2 Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "dcp_panel.h"
23 #include "key_dialog.h"
24 #include "isdcf_metadata_dialog.h"
25 #include "audio_dialog.h"
26 #include "lib/ratio.h"
27 #include "lib/config.h"
28 #include "lib/dcp_content_type.h"
31 #include "lib/ffmpeg_content.h"
32 #include "lib/audio_processor.h"
33 #include "lib/video_content.h"
34 #include "lib/subtitle_content.h"
35 #include "lib/dcp_content.h"
36 #include "lib/audio_content.h"
37 #include <dcp/locale_convert.h>
40 #include <wx/notebook.h>
41 #include <wx/gbsizer.h>
42 #include <wx/spinctrl.h>
43 #include <boost/lexical_cast.hpp>
44 #include <boost/foreach.hpp>
54 using boost::lexical_cast;
55 using boost::shared_ptr;
56 using dcp::locale_convert;
58 DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
61 , _generally_sensitive (true)
63 _panel = new wxPanel (n);
64 _sizer = new wxBoxSizer (wxVERTICAL);
65 _panel->SetSizer (_sizer);
67 wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
68 _sizer->Add (grid, 0, wxEXPAND | wxALL, 8);
72 add_label_to_sizer (grid, _panel, _("Name"), true, wxGBPosition (r, 0));
73 _name = new wxTextCtrl (_panel, wxID_ANY);
74 grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
77 int flags = wxALIGN_CENTER_VERTICAL;
79 flags |= wxALIGN_RIGHT;
82 _use_isdcf_name = new wxCheckBox (_panel, wxID_ANY, _("Use ISDCF name"));
83 grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
86 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
87 _edit_isdcf_button = new wxButton (_panel, wxID_ANY, _("Details..."));
88 s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
89 _copy_isdcf_name_button = new wxButton (_panel, wxID_ANY, _("Copy as name"));
90 s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
91 grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
95 /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
96 http://trac.wxwidgets.org/ticket/12539
98 _dcp_name = new wxStaticText (
99 _panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize,
100 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
103 grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
106 add_label_to_sizer (grid, _panel, _("Content Type"), true, wxGBPosition (r, 0));
107 _dcp_content_type = new wxChoice (_panel, wxID_ANY);
108 grid->Add (_dcp_content_type, wxGBPosition (r, 1));
111 _notebook = new wxNotebook (_panel, wxID_ANY);
112 _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
114 _notebook->AddPage (make_video_panel (), _("Video"), false);
115 _notebook->AddPage (make_audio_panel (), _("Audio"), false);
117 _signed = new wxCheckBox (_panel, wxID_ANY, _("Signed"));
118 grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
121 _encrypted = new wxCheckBox (_panel, wxID_ANY, _("Encrypted"));
122 grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
125 wxClientDC dc (_panel);
126 wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
130 add_label_to_sizer (grid, _panel, _("Key"), true, wxGBPosition (r, 0));
131 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
132 _key = new wxStaticText (_panel, wxID_ANY, "", wxDefaultPosition, size);
133 s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
134 _edit_key = new wxButton (_panel, wxID_ANY, _("Edit..."));
136 grid->Add (s, wxGBPosition (r, 1));
140 add_label_to_sizer (grid, _panel, _("Reels"), true, wxGBPosition (r, 0));
141 _reel_type = new wxChoice (_panel, wxID_ANY);
142 grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
145 add_label_to_sizer (grid, _panel, _("Reel length"), true, wxGBPosition (r, 0));
148 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
149 _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
150 s->Add (_reel_length);
151 add_label_to_sizer (s, _panel, _("GB"), false);
152 grid->Add (s, wxGBPosition (r, 1));
156 add_label_to_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0));
157 _standard = new wxChoice (_panel, wxID_ANY);
158 grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
161 _upload_after_make_dcp = new wxCheckBox (_panel, wxID_ANY, _("Upload DCP to TMS after it is made"));
162 grid->Add (_upload_after_make_dcp, wxGBPosition (r, 0), wxGBSpan (1, 2));
165 _name->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DCPPanel::name_changed, this));
166 _use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
167 _edit_isdcf_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
168 _copy_isdcf_name_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
169 _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::dcp_content_type_changed, this));
170 _signed->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::signed_toggled, this));
171 _encrypted->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::encrypted_toggled, this));
172 _edit_key->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::edit_key_clicked, this));
173 _reel_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::reel_type_changed, this));
174 _reel_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::reel_length_changed, this));
175 _standard->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::standard_changed, this));
176 _upload_after_make_dcp->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this));
178 vector<DCPContentType const *> const ct = DCPContentType::all ();
179 for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
180 _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
183 _reel_type->Append (_("Single reel"));
184 _reel_type->Append (_("Split by video content"));
185 /// TRANSLATORS: translate the word "Custom" here; do not include the "Reel|" prefix
186 _reel_type->Append (S_("Reel|Custom"));
188 _reel_length->SetRange (1, 64);
190 _standard->Append (_("SMPTE"));
191 _standard->Append (_("Interop"));
193 Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this));
197 DCPPanel::edit_key_clicked ()
199 KeyDialog* d = new KeyDialog (_panel, _film->key ());
200 if (d->ShowModal () == wxID_OK) {
201 _film->set_key (d->key ());
207 DCPPanel::name_changed ()
213 _film->set_name (string (_name->GetValue().mb_str()));
217 DCPPanel::j2k_bandwidth_changed ()
223 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
227 DCPPanel::signed_toggled ()
233 _film->set_signed (_signed->GetValue ());
237 DCPPanel::encrypted_toggled ()
243 _film->set_encrypted (_encrypted->GetValue ());
246 /** Called when the frame rate choice widget has been changed */
248 DCPPanel::frame_rate_choice_changed ()
254 _film->set_video_frame_rate (
255 boost::lexical_cast<int> (
256 wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
261 /** Called when the frame rate spin widget has been changed */
263 DCPPanel::frame_rate_spin_changed ()
269 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
273 DCPPanel::audio_channels_changed ()
279 _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
283 DCPPanel::resolution_changed ()
289 _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
293 DCPPanel::standard_changed ()
299 _film->set_interop (_standard->GetSelection() == 1);
303 DCPPanel::upload_after_make_dcp_changed ()
309 _film->set_upload_after_make_dcp (_upload_after_make_dcp->GetValue ());
313 DCPPanel::film_changed (int p)
318 case Film::CONTAINER:
322 checked_set (_name, _film->name());
325 case Film::DCP_CONTENT_TYPE:
326 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
330 checked_set (_signed, _film->is_signed ());
332 case Film::ENCRYPTED:
333 checked_set (_encrypted, _film->encrypted ());
334 if (_film->encrypted ()) {
335 _film->set_signed (true);
336 _signed->Enable (false);
337 _key->Enable (_generally_sensitive);
338 _edit_key->Enable (_generally_sensitive);
340 _signed->Enable (_generally_sensitive);
341 _key->Enable (false);
342 _edit_key->Enable (false);
346 checked_set (_key, _film->key().hex().substr (0, 8) + "...");
348 case Film::RESOLUTION:
349 checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
353 case Film::J2K_BANDWIDTH:
354 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
356 case Film::USE_ISDCF_NAME:
358 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
360 _edit_isdcf_button->Enable (_film->use_isdcf_name ());
363 case Film::ISDCF_METADATA:
366 case Film::VIDEO_FRAME_RATE:
369 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
370 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
371 checked_set (_frame_rate_choice, i);
378 checked_set (_frame_rate_choice, -1);
381 checked_set (_frame_rate_spin, _film->video_frame_rate ());
383 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
386 case Film::AUDIO_CHANNELS:
387 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
388 _film->set_audio_channels (minimum_allowed_audio_channels ());
390 checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
395 checked_set (_three_d, _film->three_d ());
399 checked_set (_standard, _film->interop() ? 1 : 0);
402 case Film::AUDIO_PROCESSOR:
403 if (_film->audio_processor ()) {
404 checked_set (_audio_processor, _film->audio_processor()->id());
406 checked_set (_audio_processor, 0);
408 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
409 film_changed (Film::AUDIO_CHANNELS);
411 case Film::REEL_TYPE:
412 checked_set (_reel_type, _film->reel_type ());
413 _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
415 case Film::REEL_LENGTH:
416 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
418 case Film::UPLOAD_AFTER_MAKE_DCP:
419 checked_set (_upload_after_make_dcp, _film->upload_after_make_dcp ());
430 DCPPanel::film_content_changed (int property)
432 if (property == AudioContentProperty::STREAMS ||
433 property == SubtitleContentProperty::USE ||
434 property == SubtitleContentProperty::BURN ||
435 property == VideoContentProperty::SCALE ||
436 property == DCPContentProperty::REFERENCE_VIDEO ||
437 property == DCPContentProperty::REFERENCE_AUDIO ||
438 property == DCPContentProperty::REFERENCE_SUBTITLE) {
445 DCPPanel::setup_container ()
448 vector<Ratio const *> ratios = Ratio::all ();
449 vector<Ratio const *>::iterator i = ratios.begin ();
450 while (i != ratios.end() && *i != _film->container ()) {
455 if (i == ratios.end()) {
456 checked_set (_container, -1);
457 checked_set (_container_size, wxT (""));
459 checked_set (_container, n);
460 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
461 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
467 /** Called when the container widget has been changed */
469 DCPPanel::container_changed ()
475 int const n = _container->GetSelection ();
477 vector<Ratio const *> ratios = Ratio::all ();
478 DCPOMATIC_ASSERT (n < int (ratios.size()));
479 _film->set_container (ratios[n]);
483 /** Called when the DCP content type widget has been changed */
485 DCPPanel::dcp_content_type_changed ()
491 int const n = _dcp_content_type->GetSelection ();
492 if (n != wxNOT_FOUND) {
493 _film->set_dcp_content_type (DCPContentType::from_index (n));
498 DCPPanel::set_film (shared_ptr<Film> film)
500 /* We are changing film, so destroy any audio dialog for the old one */
502 _audio_dialog->Destroy ();
508 film_changed (Film::NAME);
509 film_changed (Film::USE_ISDCF_NAME);
510 film_changed (Film::CONTENT);
511 film_changed (Film::DCP_CONTENT_TYPE);
512 film_changed (Film::CONTAINER);
513 film_changed (Film::RESOLUTION);
514 film_changed (Film::SIGNED);
515 film_changed (Film::ENCRYPTED);
516 film_changed (Film::KEY);
517 film_changed (Film::J2K_BANDWIDTH);
518 film_changed (Film::ISDCF_METADATA);
519 film_changed (Film::VIDEO_FRAME_RATE);
520 film_changed (Film::AUDIO_CHANNELS);
521 film_changed (Film::SEQUENCE);
522 film_changed (Film::THREE_D);
523 film_changed (Film::INTEROP);
524 film_changed (Film::AUDIO_PROCESSOR);
525 film_changed (Film::REEL_TYPE);
526 film_changed (Film::REEL_LENGTH);
527 film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
531 DCPPanel::set_general_sensitivity (bool s)
534 _use_isdcf_name->Enable (s);
535 _edit_isdcf_button->Enable (s);
536 _dcp_content_type->Enable (s);
537 _copy_isdcf_name_button->Enable (s);
540 if (_film && _film->encrypted ()) {
543 _signed->Enable (si);
545 _encrypted->Enable (s);
546 _key->Enable (s && _film && _film->encrypted ());
547 _edit_key->Enable (s && _film && _film->encrypted ());
548 _reel_type->Enable (s);
549 _reel_length->Enable (s && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
550 _upload_after_make_dcp->Enable (s);
551 _frame_rate_choice->Enable (s);
552 _frame_rate_spin->Enable (s);
553 _audio_channels->Enable (s);
554 _audio_processor->Enable (s);
555 _j2k_bandwidth->Enable (s);
556 _container->Enable (s);
557 _best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
558 _resolution->Enable (s);
559 _three_d->Enable (s);
560 _standard->Enable (s);
564 DCPPanel::use_isdcf_name_toggled ()
570 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
574 DCPPanel::edit_isdcf_button_clicked ()
580 ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
582 _film->set_isdcf_metadata (d->isdcf_metadata ());
587 DCPPanel::setup_dcp_name ()
589 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
590 _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
594 DCPPanel::best_frame_rate_clicked ()
600 _film->set_video_frame_rate (_film->best_video_frame_rate ());
604 DCPPanel::three_d_changed ()
610 _film->set_three_d (_three_d->GetValue ());
614 DCPPanel::config_changed ()
616 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
617 setup_frame_rate_widget ();
621 DCPPanel::setup_frame_rate_widget ()
623 if (Config::instance()->allow_any_dcp_frame_rate ()) {
624 _frame_rate_choice->Hide ();
625 _frame_rate_spin->Show ();
627 _frame_rate_choice->Show ();
628 _frame_rate_spin->Hide ();
631 _frame_rate_sizer->Layout ();
635 DCPPanel::make_video_panel ()
637 wxPanel* panel = new wxPanel (_notebook);
638 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
639 wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
640 sizer->Add (grid, 0, wxALL, 8);
641 panel->SetSizer (sizer);
645 add_label_to_sizer (grid, panel, _("Container"), true, wxGBPosition (r, 0));
647 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
648 _container = new wxChoice (panel, wxID_ANY);
649 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
650 _container_size = new wxStaticText (panel, wxID_ANY, wxT (""));
651 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
652 grid->Add (s, wxGBPosition (r,1 ), wxDefaultSpan, wxEXPAND);
656 add_label_to_sizer (grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0));
658 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
659 _frame_rate_choice = new wxChoice (panel, wxID_ANY);
660 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
661 _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
662 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
663 setup_frame_rate_widget ();
664 _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best"));
665 _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
666 grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
670 _three_d = new wxCheckBox (panel, wxID_ANY, _("3D"));
671 grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
674 add_label_to_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0));
675 _resolution = new wxChoice (panel, wxID_ANY);
676 grid->Add (_resolution, wxGBPosition (r, 1));
680 add_label_to_sizer (grid, panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
681 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
682 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
683 s->Add (_j2k_bandwidth, 1);
684 add_label_to_sizer (s, panel, _("Mbit/s"), false);
685 grid->Add (s, wxGBPosition (r, 1));
689 _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::container_changed, this));
690 _frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::frame_rate_choice_changed, this));
691 _frame_rate_spin->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::frame_rate_spin_changed, this));
692 _best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::best_frame_rate_clicked, this));
693 _j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
694 /* Also listen to wxEVT_COMMAND_TEXT_UPDATED so that typing numbers directly in is always noticed */
695 _j2k_bandwidth->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
696 _resolution->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::resolution_changed, this));
697 _three_d->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::three_d_changed, this));
699 vector<Ratio const *> const ratio = Ratio::all ();
700 for (vector<Ratio const *>::const_iterator i = ratio.begin(); i != ratio.end(); ++i) {
701 _container->Append (std_to_wx ((*i)->nickname ()));
704 list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
705 for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
706 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
709 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
710 _frame_rate_spin->SetRange (1, 480);
712 _resolution->Append (_("2K"));
713 _resolution->Append (_("4K"));
719 DCPPanel::minimum_allowed_audio_channels () const
722 if (_film && _film->audio_processor ()) {
723 min = _film->audio_processor()->out_channels ();
734 DCPPanel::make_audio_panel ()
736 wxPanel* panel = new wxPanel (_notebook);
737 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
738 wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
739 sizer->Add (grid, 0, wxALL, 8);
740 panel->SetSizer (sizer);
744 add_label_to_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
745 _audio_channels = new wxChoice (panel, wxID_ANY);
746 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
747 grid->Add (_audio_channels, wxGBPosition (r, 1));
750 add_label_to_sizer (grid, panel, _("Processor"), true, wxGBPosition (r, 0));
751 _audio_processor = new wxChoice (panel, wxID_ANY);
752 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
753 BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
754 _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
756 grid->Add (_audio_processor, wxGBPosition (r, 1));
759 _show_audio = new wxButton (panel, wxID_ANY, _("Show audio..."));
760 grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
763 _audio_channels->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_channels_changed, this));
764 _audio_processor->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_processor_changed, this));
765 _show_audio->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::show_audio_clicked, this));
771 DCPPanel::copy_isdcf_name_button_clicked ()
773 _film->set_name (_film->isdcf_name (true));
774 _film->set_use_isdcf_name (false);
778 DCPPanel::audio_processor_changed ()
784 string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
785 _film->set_audio_processor (AudioProcessor::from_id (s));
789 DCPPanel::show_audio_clicked ()
796 _audio_dialog->Destroy ();
800 AudioDialog* d = new AudioDialog (_panel, _film);
805 DCPPanel::reel_type_changed ()
811 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
815 DCPPanel::reel_length_changed ()
821 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);