Hand-apply ec3e6abf817b84d589f0782b01f5059dd3bf0953; only allow even
authorCarl Hetherington <cth@carlh.net>
Wed, 25 Mar 2015 00:22:16 +0000 (00:22 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 25 Mar 2015 00:22:16 +0000 (00:22 +0000)
DCP audio channel counts between 2 and 16 inclusive.

ChangeLog
src/lib/film.cc
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/film_editor.cc

index 86d8c071cc939a5e1d6f0e9331135c77c6396991..3a67b0aa73e7d88946b38bc9aa61b8087f3b14fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-03-25  Carl Hetherington  <cth@carlh.net>
 
+       * Hand-apply ec3e6abf817b84d589f0782b01f5059dd3bf0953; only allow
+       even DCP audio channel counts between 2 and 16 inclusive.
+
        * Hand-apply 3e3d3e46a74af7b3e6431033c7c80bd058c02cf6update;
        full/play length in the timing panel when the DCP frame rate is
        changed.
index 0b48bf7b12d34eefcd280c06add697e1b56aecd9..ed7d4cb5129698abe0e23717e1063cd1e8875a3f 100644 (file)
@@ -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");
index 5b2d18f23da12e65edd02607f21ddea67893af18..e029d3cc9c8fd200a60ca50e0b7b6eaab971f443 100644 (file)
@@ -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;
 }
index 060ec31ff972c55cd99830821c313de315fbdef7..655472264f25663687f29c9eb87afb08b0f34efe 100644 (file)
@@ -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;
index 3e6dddb9261e41b13b1494dbc7024468a99061e2..944ff357256e140e7a98efa16a3008bb02288d83 100644 (file)
@@ -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