Use output channel counts from processors to decide DCI name, when appropriate (...
authorCarl Hetherington <cth@carlh.net>
Thu, 18 Jun 2015 15:40:46 +0000 (16:40 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 18 Jun 2015 15:40:46 +0000 (16:40 +0100)
ChangeLog
src/lib/film.cc

index 6f34df2f824a82af9d19e340fdea000ece3b47de..3d7a6c3caab0cbac9f81f8467c87c6627cc14dfd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-18  c.hetherington  <cth@carlh.net>
+
+       * Fix audio channel counts in DCP names when
+       processors are in use (#609).
+
 2015-06-18  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.1.4 released.
index f41371892963b1d22df478be6d2a1f15786d2d99..5ec5fbc2f280a1b8e17d9e952b7c82bd33c54318 100644 (file)
@@ -616,35 +616,47 @@ Film::isdcf_name (bool if_created_now) const
 
        /* Find all mapped channels */
 
-       list<int> 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<int> c = ac->audio_mapping().mapped_output_channels ();
-                       copy (c.begin(), c.end(), back_inserter (mapped));
-               }
-       }
-
-       mapped.sort ();
-       mapped.unique ();
-       
-       /* Count them */
-                       
        int non_lfe = 0;
        int lfe = 0;
-       for (list<int>::const_iterator i = mapped.begin(); i != mapped.end(); ++i) {
-               if (*i >= audio_channels()) {
-                       /* This channel is mapped but is not included in the DCP */
-                       continue;
+
+       if (audio_processor ()) {
+               /* Processors are mapped 1:1 to DCP outputs so we can guess the number of LFE/
+                  non-LFE from the channel counts.
+               */
+               non_lfe = audio_processor()->out_channels ();
+               if (non_lfe >= 4) {
+                       --non_lfe;
+                       ++lfe;
+               }
+       } else {
+               list<int> 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<int> c = ac->audio_mapping().mapped_output_channels ();
+                               copy (c.begin(), c.end(), back_inserter (mapped));
+                       }
                }
                
-               if (static_cast<dcp::Channel> (*i) == dcp::LFE) {
-                       ++lfe;
-               } else {
-                       ++non_lfe;
+               mapped.sort ();
+               mapped.unique ();
+               
+               /* Count them */
+               
+               for (list<int>::const_iterator i = mapped.begin(); i != mapped.end(); ++i) {
+                       if (*i >= audio_channels()) {
+                               /* This channel is mapped but is not included in the DCP */
+                               continue;
+                       }
+                       
+                       if (static_cast<dcp::Channel> (*i) == dcp::LFE) {
+                               ++lfe;
+                       } else {
+                               ++non_lfe;
+                       }
                }
        }
-
+       
        if (non_lfe) {
                d << "_" << non_lfe << lfe;
        }