summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-18 16:40:46 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-18 16:40:46 +0100
commit4675119254338408f50685c8eb9317efd74e538b (patch)
tree3b0c31503261fc2f55c2da2b44fddefa0a3a456b /src/lib
parentdd28fe883c8aa637b9a158751516f36b9eccf1e4 (diff)
Use output channel counts from processors to decide DCI name, when appropriate (#609).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index f41371892..5ec5fbc2f 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -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;
}