Merge branch 'master' into 2.0
authorCarl Hetherington <cth@carlh.net>
Wed, 5 Mar 2014 16:20:23 +0000 (16:20 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 5 Mar 2014 16:20:23 +0000 (16:20 +0000)
ChangeLog
src/lib/film.cc
src/lib/job.cc
src/lib/util.cc
src/lib/util.h
src/lib/wscript
src/tools/dcpomatic_create.cc
src/wx/audio_mapping_view.cc
src/wx/audio_plot.cc
src/wx/audio_plot.h
wscript

index 62d76fbf57f23fb74258dd434148b3265c5c1dd2..46230393fcbc652b3838ceddc975fdbb8c286b20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-05  Carl Hetherington  <cth@carlh.net>
+
+       * Bump maximum audio channels to 12 so that we can
+       (crudely at least) get BsL/BsR.
+
 2014-03-04  Carl Hetherington  <cth@carlh.net>
 
        * Version 1.64.18 released.
index aecb389fd5e67b4a7b2cb9a01a1572196e4d7cd9..21e7383bf94fcfbfd0635c7d1c0efe3c90ee2741 100644 (file)
@@ -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");
index 01df2c570611cf90c2fa38a7aee41f142391725d..2ac8c60771b1c960850b4805ff1ca550fbb1cd3a 100644 (file)
@@ -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 */
index e8f83d4e4d45a21fc524006b7f155addb683799f..15109eee05c442f0dab35982703e20e788148f79 100644 (file)
@@ -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];
index d91a6b435d55843522d538657a544314f98bb7ca..2ae97814cf77726377a4f187c6e2e32d9c186435 100644 (file)
@@ -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"
 
index 16b5aafe4d2c7c9e684db7c80f17cb60f8d9bede..5d27cfe45317d68df9c8e27dda6ea07bb2a0d173 100644 (file)
@@ -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:
index 4f737dd5a53eafbefa0dd2d2d030fb9e6e03377e..36e04120e306732ea54bba4ce68acd16d0af5300 100644 (file)
@@ -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) {
index 0b28b12fb641201ca438c71fff61330951666f15..52303ac14b2e9b94996bbf8950f42e3bf4458abc 100644 (file)
@@ -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 ();
 }
 
index 2e8b24e367ebe15b70fc927489a4a3b0718ddfaa..124b927367da0a69773a3e2d05171e176fa186ee 100644 (file)
@@ -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 
        
index 7eedd8ffe9b869e77d7f588659b687f8d91ac03d..4a1a40aa138ad709d54bfca4cf9ac8c4600ef480 100644 (file)
@@ -23,7 +23,7 @@
 #include "lib/util.h"
 #include "lib/audio_analysis.h"
 
-class Metrics;
+struct Metrics;
 
 class AudioPlot : public wxPanel
 {
diff --git a/wscript b/wscript
index 8027ea88c086f8d93a6501737a8ce8fddedb3934..3a7920bd7989585f3508056e7073f09dd41c76e5 100644 (file)
--- a/wscript
+++ b/wscript
@@ -179,7 +179,7 @@ def configure(conf):
         conf.env.INSTALL_PREFIX = conf.options.install_prefix
 
     # Common CXXFLAGS
-    conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-D__STDC_LIMIT_MACROS', '-msse', '-mfpmath=sse', '-ffast-math', '-fno-strict-aliasing',
+    conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-D__STDC_LIMIT_MACROS', '-msse', '-ffast-math', '-fno-strict-aliasing',
                                        '-Wall', '-Wno-attributes', '-Wextra', '-D_FILE_OFFSET_BITS=64'])
 
     if conf.options.enable_debug:
@@ -197,7 +197,12 @@ def configure(conf):
 
     # Windows
     if conf.env.TARGET_WINDOWS:
-        conf.env.append_value('CXXFLAGS', ['-DDCPOMATIC_WINDOWS', '-DWIN32_LEAN_AND_MEAN', '-DBOOST_USE_WINDOWS_H', '-DUNICODE', '-DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN'])
+        conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_WINDOWS')
+        conf.env.append_value('CXXFLAGS', '-DWIN32_LEAN_AND_MEAN')
+        conf.env.append_value('CXXFLAGS', '-DBOOST_USE_WINDOWS_H')
+        conf.env.append_value('CXXFLAGS', '-DUNICODE')
+        conf.env.append_value('CXXFLAGS', '-DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN')
+        conf.env.append_value('CXXFLAGS', '-mfpmath=sse')
         wxrc = os.popen('wx-config --rescomp').read().split()[1:]
         conf.env.append_value('WINRCFLAGS', wxrc)
         if conf.options.enable_debug:
@@ -223,6 +228,7 @@ def configure(conf):
 
     # Linux
     if conf.env.TARGET_LINUX:
+        conf.env.append_value('CXXFLAGS', '-mfpmath=sse')
         conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_LINUX')
 
     if conf.env.TARGET_DEBIAN:
@@ -234,7 +240,7 @@ def configure(conf):
 
     # OSX
     if conf.env.TARGET_OSX:
-        conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_OSX')
+        conf.env.append_value('CXXFLAGS', ['-DDCPOMATIC_OSX', '-Wno-unused-function', '-Wno-unused-parameter'])
         conf.env.append_value('LINKFLAGS', '-headerpad_max_install_names')
 
     #