summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-16 19:40:43 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-16 19:40:43 +0100
commit20eea989f452ea1a6af0af6b5c5b504d3b19480c (patch)
tree51c922df42151747efc5f4db90bf79b53d6b4bac /src
parentd71b3fffa09263a2116b3f91981c1999b4ae873c (diff)
Modify previous commit to move restriction code into the UI.
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc15
-rw-r--r--src/lib/film.h8
-rw-r--r--src/wx/dcp_panel.cc21
-rw-r--r--src/wx/dcp_panel.h2
4 files changed, 22 insertions, 24 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 98b921029..66d651c27 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -1232,18 +1232,3 @@ 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 a1daebe78..96a79f9cf 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -223,7 +223,9 @@ public:
return _video_frame_rate;
}
- int audio_channels () const;
+ int audio_channels () const {
+ return _audio_channels;
+ }
bool three_d () const {
return _three_d;
@@ -324,9 +326,7 @@ private:
int _video_frame_rate;
/** The date that we should use in a ISDCF name */
boost::gregorian::date _isdcf_date;
- /** Number of audio channels requested for the DCP; this will be overridden
- if we are using an audio processor which outputs more channels.
- */
+ /** Number of audio channels requested for the DCP */
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.
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 0759694f8..2829d88fa 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -43,6 +43,7 @@ using std::list;
using std::string;
using std::vector;
using std::pair;
+using std::max;
using std::make_pair;
using boost::lexical_cast;
using boost::shared_ptr;
@@ -349,8 +350,12 @@ DCPPanel::film_changed (int p)
break;
}
case Film::AUDIO_CHANNELS:
- checked_set (_audio_channels, dcp::raw_convert<string> (_film->audio_channels ()));
- setup_dcp_name ();
+ if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
+ _film->set_audio_channels (minimum_allowed_audio_channels ());
+ } else {
+ checked_set (_audio_channels, dcp::raw_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
+ setup_dcp_name ();
+ }
break;
case Film::THREE_D:
checked_set (_three_d, _film->three_d ());
@@ -653,8 +658,8 @@ DCPPanel::make_video_panel ()
return panel;
}
-void
-DCPPanel::setup_audio_channels_choice ()
+int
+DCPPanel::minimum_allowed_audio_channels () const
{
int min = 2;
if (_film && _film->audio_processor ()) {
@@ -665,8 +670,14 @@ DCPPanel::setup_audio_channels_choice ()
++min;
}
+ return min;
+}
+
+void
+DCPPanel::setup_audio_channels_choice ()
+{
vector<pair<string, string> > items;
- for (int i = min; i <= 12; i += 2) {
+ for (int i = minimum_allowed_audio_channels(); i <= 12; i += 2) {
items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
}
diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h
index ab4e7f1d3..ac6792ddd 100644
--- a/src/wx/dcp_panel.h
+++ b/src/wx/dcp_panel.h
@@ -78,6 +78,8 @@ private:
void setup_dcp_name ();
void setup_audio_channels_choice ();
+ int minimum_allowed_audio_channels () const;
+
wxPanel* make_general_panel ();
wxPanel* make_video_panel ();
wxPanel* make_audio_panel ();