summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-16 17:01:32 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-16 17:01:32 +0100
commitd71b3fffa09263a2116b3f91981c1999b4ae873c (patch)
treedbfe582e07062418fc0e48ce3b31a78a5cbd8922 /src/lib
parent5dce250808e2371fdbd3e2f21511e789454b788f (diff)
Prevent selection of too few DCP channels (#611).
This makes Film::audio_channels() return a minimum of any active processor's output channel count, even if fewer DCP channels have been selected. It may have been neater code-wise to make Player cope if such a setting is made, but it would probably confuse people if we don't auto-fix it (like this commit does).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/film.cc17
-rw-r--r--src/lib/film.h8
2 files changed, 21 insertions, 4 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index d67182022..98b921029 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -72,6 +72,7 @@ using std::map;
using std::vector;
using std::setfill;
using std::min;
+using std::max;
using std::make_pair;
using std::endl;
using std::cout;
@@ -805,6 +806,7 @@ Film::set_audio_processor (AudioProcessor const * processor)
{
_audio_processor = processor;
signal_changed (AUDIO_PROCESSOR);
+ signal_changed (AUDIO_CHANNELS);
}
void
@@ -1230,3 +1232,18 @@ Film::audio_output_names () const
return vector<string> (n.begin(), n.begin() + audio_channels ());
}
+
+int
+Film::audio_channels () const
+{
+ int minimum = 0;
+ if (_audio_processor) {
+ minimum = _audio_processor->out_channels ();
+ }
+
+ if (minimum % 2 == 1) {
+ ++minimum;
+ }
+
+ return max (minimum, _audio_channels);
+}
diff --git a/src/lib/film.h b/src/lib/film.h
index f9dc0ed9c..a1daebe78 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -223,9 +223,7 @@ public:
return _video_frame_rate;
}
- int audio_channels () const {
- return _audio_channels;
- }
+ int audio_channels () const;
bool three_d () const {
return _three_d;
@@ -326,7 +324,9 @@ private:
int _video_frame_rate;
/** The date that we should use in a ISDCF name */
boost::gregorian::date _isdcf_date;
- /** Number of audio channels to put in the DCP */
+ /** Number of audio channels requested for the DCP; this will be overridden
+ if we are using an audio processor which outputs more channels.
+ */
int _audio_channels;
/** If true, the DCP will be written in 3D mode; otherwise in 2D.
This will be regardless of what content is on the playlist.