Hand-apply 97dde0e6d77b874742161703944d60524023664e from master.
authorCarl Hetherington <cth@carlh.net>
Sun, 12 Apr 2015 16:20:10 +0000 (17:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 Apr 2015 16:20:10 +0000 (17:20 +0100)
ChangeLog
TO_PORT
src/lib/film.cc

index 46ccc91226b1acd65308a3da198e7f786562f975..a528dd82798038073ce7c48337d6cb3d1a581cac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-12  Carl Hetherington  <cth@carlh.net>
+
+       * Hand-apply 24ae3a8f0a68529b50c34079e643caf6b9327523 from master;
+       use the number of mapped audio channels for the DCP name, not the
+       number of DCP channels (#479).
+
 2015-03-25  Carl Hetherington  <cth@carlh.net>
 
        * Remove scaler settings and just uses SWS_BICUBIC all round.
diff --git a/TO_PORT b/TO_PORT
index 479c0a059195a08a1f8bff269beb5c7fac265f42..e58362d868a72ca5648825469fb3c28437c78260 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1,4 +1,3 @@
-24ae3a8f0a68529b50c34079e643caf6b9327523
 83f1ea8eacb4d56860ccdb9db5acdf12c6e71dfb
 c0e0b90d987af2586323d4a67bd67330256da51d
 69866d9ba972d21375081c313ac245535ac55be9
index e5904ca1e988d3b6da451d62e1bda96154511abe..3aed4d9657ff088b6464ca5ede71e78abf2d2bf0 100644 (file)
@@ -581,11 +581,12 @@ Film::isdcf_name (bool if_created_now) const
                d << "_" << container()->isdcf_name();
        }
 
+       ContentList cl = content ();
+       
        /* XXX: this uses the first bit of content only */
 
        /* The standard says we don't do this for trailers, for some strange reason */
        if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
-               ContentList cl = content ();
                Ratio const * content_ratio = 0;
                for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
                        shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i);
@@ -621,25 +622,34 @@ Film::isdcf_name (bool if_created_now) const
                }
        }
 
-       switch (audio_channels ()) {
-       case 1:
-               d << "_10";
-               break;
-       case 2:
-               d << "_20";
-               break;
-       case 3:
-               d << "_30";
-               break;
-       case 4:
-               d << "_40";
-               break;
-       case 5:
-               d << "_50";
-               break;
-       case 6:
-               d << "_51";
-               break;
+       /* Find all mapped channels */
+
+       list<dcp::Channel> mapped;
+       for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) {
+               shared_ptr<const AudioContent> ac = dynamic_pointer_cast<const AudioContent> (*i);
+               if (ac) {
+                       list<dcp::Channel> c = ac->audio_mapping().mapped_dcp_channels ();
+                       copy (c.begin(), c.end(), back_inserter (mapped));
+               }
+       }
+
+       mapped.sort ();
+       mapped.unique ();
+       
+       /* Count them */
+                       
+       int non_lfe = 0;
+       int lfe = 0;
+       for (list<dcp::Channel>::const_iterator i = mapped.begin(); i != mapped.end(); ++i) {
+               if ((*i) == dcp::LFE) {
+                       ++lfe;
+               } else {
+                       ++non_lfe;
+               }
+       }
+
+       if (non_lfe) {
+               d << "_" << non_lfe << lfe;
        }
 
        /* XXX: HI/VI */
@@ -1014,7 +1024,11 @@ Film::playlist_content_changed (boost::weak_ptr<Content> c, int p)
 {
        if (p == VideoContentProperty::VIDEO_FRAME_RATE) {
                set_video_frame_rate (_playlist->best_dcp_frame_rate ());
-       } 
+       } else if (
+               p == AudioContentProperty::AUDIO_MAPPING ||
+               p == AudioContentProperty::AUDIO_CHANNELS) {
+               signal_changed (NAME);
+       }
 
        if (ui_signaller) {
                ui_signaller->emit (boost::bind (boost::ref (ContentChanged), c, p));
@@ -1025,6 +1039,7 @@ void
 Film::playlist_changed ()
 {
        signal_changed (CONTENT);
+       signal_changed (NAME);
 }      
 
 int