summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc17
-rw-r--r--src/lib/film.h8
-rw-r--r--src/wx/dcp_panel.cc33
-rw-r--r--src/wx/dcp_panel.h1
4 files changed, 50 insertions, 9 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.
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 24c678c57..0759694f8 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -30,6 +30,7 @@
#include "lib/ffmpeg_content.h"
#include "lib/audio_processor.h"
#include <dcp/key.h>
+#include <dcp/raw_convert.h>
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/gbsizer.h>
@@ -41,6 +42,8 @@ using std::cout;
using std::list;
using std::string;
using std::vector;
+using std::pair;
+using std::make_pair;
using boost::lexical_cast;
using boost::shared_ptr;
@@ -245,7 +248,7 @@ DCPPanel::audio_channels_changed ()
return;
}
- _film->set_audio_channels ((_audio_channels->GetSelection () + 1) * 2);
+ _film->set_audio_channels (dcp::raw_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
}
void
@@ -346,7 +349,7 @@ DCPPanel::film_changed (int p)
break;
}
case Film::AUDIO_CHANNELS:
- checked_set (_audio_channels, (_film->audio_channels () / 2) - 1);
+ checked_set (_audio_channels, dcp::raw_convert<string> (_film->audio_channels ()));
setup_dcp_name ();
break;
case Film::THREE_D:
@@ -363,6 +366,8 @@ DCPPanel::film_changed (int p)
} else {
checked_set (_audio_processor, 0);
}
+ setup_audio_channels_choice ();
+ film_changed (Film::AUDIO_CHANNELS);
break;
default:
break;
@@ -648,6 +653,26 @@ DCPPanel::make_video_panel ()
return panel;
}
+void
+DCPPanel::setup_audio_channels_choice ()
+{
+ int min = 2;
+ if (_film && _film->audio_processor ()) {
+ min = _film->audio_processor()->out_channels ();
+ }
+
+ if (min % 2 == 1) {
+ ++min;
+ }
+
+ vector<pair<string, string> > items;
+ for (int i = min; i <= 12; i += 2) {
+ items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
+ }
+
+ checked_set (_audio_channels, items);
+}
+
wxPanel *
DCPPanel::make_audio_panel ()
{
@@ -661,9 +686,7 @@ DCPPanel::make_audio_panel ()
add_label_to_grid_bag_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
_audio_channels = new wxChoice (panel, wxID_ANY);
- for (int i = 2; i <= 12; i += 2) {
- _audio_channels->Append (wxString::Format ("%d", i));
- }
+ setup_audio_channels_choice ();
grid->Add (_audio_channels, wxGBPosition (r, 1));
++r;
diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h
index 3179ad73a..ab4e7f1d3 100644
--- a/src/wx/dcp_panel.h
+++ b/src/wx/dcp_panel.h
@@ -76,6 +76,7 @@ private:
void setup_frame_rate_widget ();
void setup_container ();
void setup_dcp_name ();
+ void setup_audio_channels_choice ();
wxPanel* make_general_panel ();
wxPanel* make_video_panel ();