diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-03-25 00:22:16 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-03-25 00:22:16 +0000 |
| commit | b6e388dc3ea1ab37711f50bbc28a93f48de98db3 (patch) | |
| tree | 85f151006aa1fc151d39b89671b155bc97077531 /src | |
| parent | 5f6d9c16df8e0b49160353354dccbcbdd1e57e9d (diff) | |
Hand-apply ec3e6abf817b84d589f0782b01f5059dd3bf0953; only allow even
DCP audio channel counts between 2 and 16 inclusive.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/film.cc | 8 | ||||
| -rw-r--r-- | src/wx/dcp_panel.cc | 13 | ||||
| -rw-r--r-- | src/wx/dcp_panel.h | 2 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 2 |
4 files changed, 17 insertions, 8 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 0b48bf7b1..ed7d4cb51 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -437,6 +437,14 @@ Film::read_metadata () _signed = f.optional_bool_child("Signed").get_value_or (true); _encrypted = f.bool_child ("Encrypted"); _audio_channels = f.number_child<int> ("AudioChannels"); + /* We used to allow odd numbers (and zero) channels, but it's just not worth + the pain. + */ + if (_audio_channels == 0) { + _audio_channels = 2; + } else if ((_audio_channels % 2) == 1) { + _audio_channels++; + } _sequence_video = f.bool_child ("SequenceVideo"); _three_d = f.bool_child ("ThreeD"); _interop = f.bool_child ("Interop"); diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 5b2d18f23..e029d3cc9 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -208,7 +208,7 @@ DCPPanel::audio_channels_changed () return; } - _film->set_audio_channels (_audio_channels->GetValue ()); + _film->set_audio_channels ((_audio_channels->GetSelection () + 1) * 2); } void @@ -304,7 +304,7 @@ DCPPanel::film_changed (int p) break; } case Film::AUDIO_CHANNELS: - checked_set (_audio_channels, _film->audio_channels ()); + checked_set (_audio_channels, (_film->audio_channels () / 2) - 1); setup_dcp_name (); break; case Film::THREE_D: @@ -626,13 +626,14 @@ DCPPanel::make_audio_panel () int r = 0; add_label_to_grid_bag_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0)); - _audio_channels = new wxSpinCtrl (panel, wxID_ANY); + _audio_channels = new wxChoice (panel, wxID_ANY); + for (int i = 2; i <= 16; i += 2) { + _audio_channels->Append (wxString::Format ("%d", i)); + } grid->Add (_audio_channels, wxGBPosition (r, 1)); ++r; - _audio_channels->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::audio_channels_changed, this)); - - _audio_channels->SetRange (0, MAX_DCP_AUDIO_CHANNELS); + _audio_channels->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_channels_changed, this)); return panel; } diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index 060ec31ff..655472264 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -95,7 +95,7 @@ private: wxChoice* _frame_rate_choice; wxSpinCtrl* _frame_rate_spin; wxSizer* _frame_rate_sizer; - wxSpinCtrl* _audio_channels; + wxChoice* _audio_channels; wxButton* _best_frame_rate; wxCheckBox* _three_d; wxChoice* _resolution; diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 3e6dddb92..944ff3572 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |
