summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-05 16:20:23 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-05 16:20:23 +0000
commit79ce26d031d109177ba4b0f637fa2960345a37a3 (patch)
tree987dbb3419f779fbd8192795898f3f93d0291efe /src
parenta79d78d8bb6d51f6662f1f63b9f8fd19e1a0c5f1 (diff)
parenta476ad31d447b8436326ba1bf448471f321a3ca9 (diff)
Merge branch 'master' into 2.0
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc3
-rw-r--r--src/lib/job.cc25
-rw-r--r--src/lib/util.cc10
-rw-r--r--src/lib/util.h2
-rw-r--r--src/lib/wscript3
-rw-r--r--src/tools/dcpomatic_create.cc43
-rw-r--r--src/wx/audio_mapping_view.cc24
-rw-r--r--src/wx/audio_plot.cc6
-rw-r--r--src/wx/audio_plot.h2
9 files changed, 94 insertions, 24 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index aecb389fd..21e7383bf 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -397,6 +397,9 @@ Film::read_metadata ()
f.read_file (file ("metadata.xml"));
_state_version = f.number_child<int> ("Version");
+ if (_state_version > current_state_version) {
+ throw StringError (_("This film was created with a newer version of DCP-o-matic, and it cannot be loaded into this version. Sorry!"));
+ }
_name = f.string_child ("Name");
_use_dci_name = f.bool_child ("UseDCIName");
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 01df2c570..2ac8c6077 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -186,22 +186,33 @@ Job::paused () const
void
Job::set_state (State s)
{
- bool finished = false;
+ bool const finished = (s == FINISHED_OK || s == FINISHED_ERROR || s == FINISHED_CANCELLED);
+ /* Do this first, so that we handle things that should happen on finish before the
+ * job is actually marked as such. This is important for callers that do:
+ *
+ * while (JobManager::work_to_do ()) {
+ * ui_signaller->ui_idle ();
+ * }
+ *
+ * as otherwise this loop can finish before the Finished handler has been executed
+ * (job finishes, calls set_state(), this sets the state and sets a pending signal
+ * for Finished, but this is never called as a ui_idle() never happens as work_to_do()
+ * is now false).
+ */
+ if (finished && ui_signaller) {
+ ui_signaller->emit (boost::bind (boost::ref (Finished)));
+ }
+
{
boost::mutex::scoped_lock lm (_state_mutex);
_state = s;
- if (_state == FINISHED_OK || _state == FINISHED_ERROR || _state == FINISHED_CANCELLED) {
+ if (finished) {
_ran_for = elapsed_time ();
- finished = true;
_sub_name.clear ();
}
}
-
- if (finished && ui_signaller) {
- ui_signaller->emit (boost::bind (boost::ref (Finished)));
- }
}
/** @return DCPTime (in seconds) that this sub-job has been running */
diff --git a/src/lib/util.cc b/src/lib/util.cc
index e8f83d4e4..15109eee0 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -756,7 +756,7 @@ ensure_ui_thread ()
string
audio_channel_name (int c)
{
- assert (MAX_AUDIO_CHANNELS == 8);
+ assert (MAX_AUDIO_CHANNELS == 12);
/* TRANSLATORS: these are the names of audio channels; Lfe (sub) is the low-frequency
enhancement channel (sub-woofer). HI is the hearing-impaired audio track and
@@ -769,8 +769,12 @@ audio_channel_name (int c)
_("Lfe (sub)"),
_("Left surround"),
_("Right surround"),
- _("HI"),
- _("VI")
+ _("Hearing impaired"),
+ _("Visually impaired"),
+ _("Left centre"),
+ _("Right centre"),
+ _("Left rear surround"),
+ _("Right rear surround"),
};
return channels[c];
diff --git a/src/lib/util.h b/src/lib/util.h
index d91a6b435..2ae97814c 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -50,7 +50,7 @@ extern "C" {
#undef check
/** The maximum number of audio channels that we can cope with */
-#define MAX_AUDIO_CHANNELS 8
+#define MAX_AUDIO_CHANNELS 12
#define DCPOMATIC_HELLO "Boys, you gotta learn not to talk to nuns that way"
diff --git a/src/lib/wscript b/src/lib/wscript
index 16b5aafe4..5d27cfe45 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -87,6 +87,9 @@ def build(bld):
CURL ZIP QUICKMAIL PANGOMM CAIROMM
"""
+ if bld.env.TARGET_OSX:
+ obj.framework = ['IOKit', 'Foundation']
+
obj.source = sources + ' version.cc'
if bld.env.TARGET_WINDOWS:
diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc
index 4f737dd5a..36e04120e 100644
--- a/src/tools/dcpomatic_create.cc
+++ b/src/tools/dcpomatic_create.cc
@@ -32,6 +32,7 @@
#include "lib/job.h"
#include "lib/dcp_content_type.h"
#include "lib/ratio.h"
+#include "lib/image_content.h"
using std::string;
using std::cout;
@@ -52,11 +53,21 @@ help (string n)
<< " -h, --help show this help\n"
<< " -n, --name <name> film name\n"
<< " -c, --dcp-content-type <type> FTR, SHR, TLR, TST, XSN, RTG, TSR, POL, PSA or ADV\n"
- << " --container-ratio 119, 133, 137, 138, 166, 178, 185 or 239\n"
- << " --content-ratio 119, 133, 137, 138, 166, 178, 185 or 239\n"
+ << " --container-ratio <ratio> 119, 133, 137, 138, 166, 178, 185 or 239\n"
+ << " --content-ratio <ratio> 119, 133, 137, 138, 166, 178, 185 or 239\n"
+ << " -s, --still-length <n> number of seconds that still content should last\n"
<< " -o, --output <dir> output directory\n";
}
+class SimpleUISignaller : public UISignaller
+{
+public:
+ /* Do nothing in this method so that UI events happen in our thread
+ when we call UISignaller::ui_idle().
+ */
+ void wake_ui () {}
+};
+
int
main (int argc, char* argv[])
{
@@ -66,6 +77,7 @@ main (int argc, char* argv[])
DCPContentType const * dcp_content_type = DCPContentType::from_dci_name ("TST");
Ratio const * container_ratio = 0;
Ratio const * content_ratio = 0;
+ int still_length = 10;
boost::filesystem::path output;
int option_index = 0;
@@ -77,11 +89,12 @@ main (int argc, char* argv[])
{ "dcp-content-type", required_argument, 0, 'c'},
{ "container-ratio", required_argument, 0, 'A'},
{ "content-ratio", required_argument, 0, 'B'},
+ { "still-length", required_argument, 0, 's'},
{ "output", required_argument, 0, 'o'},
{ 0, 0, 0, 0}
};
- int c = getopt_long (argc, argv, "vhn:c:A:B:o:", long_options, &option_index);
+ int c = getopt_long (argc, argv, "vhn:c:A:B:s:o:", long_options, &option_index);
if (c == -1) {
break;
}
@@ -120,6 +133,9 @@ main (int argc, char* argv[])
exit (EXIT_FAILURE);
}
break;
+ case 's':
+ still_length = atoi (optarg);
+ break;
case 'o':
output = optarg;
break;
@@ -132,8 +148,7 @@ main (int argc, char* argv[])
}
if (!content_ratio) {
- cerr << "Missing required option --content-ratio.\n";
- help (argv[0]);
+ cerr << argv[0] << ": missing required option --content-ratio.\n";
exit (EXIT_FAILURE);
}
@@ -141,7 +156,12 @@ main (int argc, char* argv[])
container_ratio = content_ratio;
}
- ui_signaller = new UISignaller ();
+ if (optind == argc) {
+ cerr << argv[0] << ": no content specified.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ ui_signaller = new SimpleUISignaller ();
try {
shared_ptr<Film> film (new Film (output, false));
@@ -150,6 +170,7 @@ main (int argc, char* argv[])
}
film->set_container (container_ratio);
+ film->set_dcp_content_type (dcp_content_type);
for (int i = optind; i < argc; ++i) {
shared_ptr<Content> c = content_factory (film, argv[i]);
@@ -164,7 +185,15 @@ main (int argc, char* argv[])
while (jm->work_to_do ()) {
ui_signaller->ui_idle ();
}
-
+
+ ContentList content = film->content ();
+ for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
+ shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (*i);
+ if (ic) {
+ ic->set_video_length (still_length * 24);
+ }
+ }
+
if (jm->errors ()) {
list<shared_ptr<Job> > jobs = jm->get ();
for (list<shared_ptr<Job> >::iterator i = jobs.begin(); i != jobs.end(); ++i) {
diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc
index 0b28b12fb..52303ac14 100644
--- a/src/wx/audio_mapping_view.cc
+++ b/src/wx/audio_mapping_view.cc
@@ -34,7 +34,7 @@ using std::max;
using boost::shared_ptr;
using boost::lexical_cast;
-#define INDICATOR_SIZE 20
+#define INDICATOR_SIZE 16
enum {
ID_off = 1,
@@ -270,9 +270,9 @@ AudioMappingView::set_column_labels ()
{
int const c = _grid->GetNumberCols ();
- _grid->SetColLabelValue (0, _("Content channel"));
+ _grid->SetColLabelValue (0, _("Content"));
-#if MAX_AUDIO_CHANNELS != 8
+#if MAX_AUDIO_CHANNELS != 12
#warning AudioMappingView::set_column_labels() is expecting the wrong MAX_AUDIO_CHANNELS
#endif
@@ -307,7 +307,23 @@ AudioMappingView::set_column_labels ()
if (c > 7) {
_grid->SetColLabelValue (8, _("VI"));
}
-
+
+ if (c > 8) {
+ _grid->SetColLabelValue (9, _("Lc"));
+ }
+
+ if (c > 9) {
+ _grid->SetColLabelValue (10, _("Rc"));
+ }
+
+ if (c > 10) {
+ _grid->SetColLabelValue (11, _("BsL"));
+ }
+
+ if (c > 11) {
+ _grid->SetColLabelValue (12, _("BsR"));
+ }
+
_grid->AutoSize ();
}
diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc
index 2e8b24e36..124b92736 100644
--- a/src/wx/audio_plot.cc
+++ b/src/wx/audio_plot.cc
@@ -62,8 +62,12 @@ AudioPlot::AudioPlot (wxWindow* parent)
_colours.push_back (wxColour ( 0, 139, 0));
_colours.push_back (wxColour ( 0, 0, 139));
_colours.push_back (wxColour (255, 255, 0));
+ _colours.push_back (wxColour ( 0, 255, 255));
+ _colours.push_back (wxColour (255, 0, 255));
+ _colours.push_back (wxColour (255, 0, 139));
+ _colours.push_back (wxColour (139, 0, 255));
-#if MAX_AUDIO_CHANNELS != 8
+#if MAX_AUDIO_CHANNELS != 12
#warning AudioPlot::AudioPlot is expecting the wrong MAX_AUDIO_CHANNELS
#endif
diff --git a/src/wx/audio_plot.h b/src/wx/audio_plot.h
index 7eedd8ffe..4a1a40aa1 100644
--- a/src/wx/audio_plot.h
+++ b/src/wx/audio_plot.h
@@ -23,7 +23,7 @@
#include "lib/util.h"
#include "lib/audio_analysis.h"
-class Metrics;
+struct Metrics;
class AudioPlot : public wxPanel
{