summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-10-29 22:19:24 +0100
committerCarl Hetherington <cth@carlh.net>2025-10-29 22:19:24 +0100
commitbcc9e32cd3c886fbe02f1b2573bd19ca9ec340dc (patch)
treed4eb3f4ebd7e7b0793c1812301777d7d96692953 /src
parentc070eecb967ed17116866d79f705860a8321630b (diff)
Don't report channels as mapped when they are not included in the film's channel count.
So e.g. if you map the 7.1 surrounds but have a 6-channel film it should consider those channels un-mapped.
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc16
-rw-r--r--src/lib/film.h5
2 files changed, 17 insertions, 4 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index c6a6f3cce..8dc55c590 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -797,11 +797,18 @@ list<int>
Film::mapped_audio_channels() const
{
list<int> mapped;
+ auto const highest_channel = audio_channels() - 1;
+
+ auto maybe_add = [&mapped, highest_channel](int channel) {
+ if (channel <= highest_channel) {
+ mapped.push_back(channel);
+ }
+ };
if (audio_processor()) {
/* Assume all a processor's declared output channels are mapped */
for (int i = 0; i < audio_processor()->out_channels(); ++i) {
- mapped.push_back(i);
+ maybe_add(i);
}
/* Check to see if channels that the processor passes through are mapped */
@@ -810,7 +817,7 @@ Film::mapped_audio_channels() const
if (i->audio) {
for (auto c: i->audio->mapping().mapped_output_channels()) {
if (std::find(pass.begin(), pass.end(), dcp::Channel(c)) != pass.end()) {
- mapped.push_back(c);
+ maybe_add(c);
}
}
}
@@ -819,8 +826,9 @@ Film::mapped_audio_channels() const
} else {
for (auto i: content()) {
if (i->audio) {
- auto c = i->audio->mapping().mapped_output_channels();
- copy(c.begin(), c.end(), back_inserter(mapped));
+ for (auto c: i->audio->mapping().mapped_output_channels()) {
+ maybe_add(c);
+ }
}
}
diff --git a/src/lib/film.h b/src/lib/film.h
index 8574c700f..6d04da9bf 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -173,6 +173,11 @@ public:
}
std::vector<dcpomatic::DCPTimePeriod> reels() const;
+
+ /** @return List of channel indicies that are mapped to the DCP. This takes the
+ * value of audio_channels() into account, so even if a channel above audio_channels()
+ * is mapped it will not be returned here.
+ */
std::list<int> mapped_audio_channels() const;
boost::optional<dcp::LanguageTag> audio_language() const {