2 Copyright (C) 2012-2021 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 "audio_dialog.h"
24 #include "focus_manager.h"
25 #include "check_box.h"
26 #include "static_text.h"
27 #include "check_box.h"
28 #include "dcpomatic_button.h"
29 #include "markers_dialog.h"
30 #include "interop_metadata_dialog.h"
31 #include "smpte_metadata_dialog.h"
32 #include "lib/ratio.h"
33 #include "lib/config.h"
34 #include "lib/dcp_content_type.h"
37 #include "lib/ffmpeg_content.h"
38 #include "lib/audio_processor.h"
39 #include "lib/video_content.h"
40 #include "lib/text_content.h"
41 #include "lib/dcp_content.h"
42 #include "lib/audio_content.h"
43 #include <dcp/locale_convert.h>
45 #include <wx/notebook.h>
46 #include <wx/gbsizer.h>
47 #include <wx/spinctrl.h>
48 #include <boost/lexical_cast.hpp>
58 using boost::lexical_cast;
59 using std::shared_ptr;
61 #if BOOST_VERSION >= 106100
62 using namespace boost::placeholders;
64 using dcp::locale_convert;
66 DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
69 , _interop_metadata_dialog (0)
70 , _smpte_metadata_dialog (0)
73 , _generally_sensitive (true)
75 _panel = new wxPanel (n);
76 _sizer = new wxBoxSizer (wxVERTICAL);
77 _panel->SetSizer (_sizer);
79 _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
80 _sizer->Add (_grid, 0, wxEXPAND | wxALL, 8);
82 _name_label = create_label (_panel, _("Name"), true);
83 _name = new wxTextCtrl (_panel, wxID_ANY);
84 FocusManager::instance()->add(_name);
86 _use_isdcf_name = new CheckBox (_panel, _("Use ISDCF name"));
87 _copy_isdcf_name_button = new Button (_panel, _("Copy as name"));
89 /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
90 http://trac.wxwidgets.org/ticket/12539
92 _dcp_name = new StaticText (
93 _panel, wxT (""), wxDefaultPosition, wxDefaultSize,
94 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
97 _dcp_content_type_label = create_label (_panel, _("Content Type"), true);
98 _dcp_content_type = new wxChoice (_panel, wxID_ANY);
100 _encrypted = new CheckBox (_panel, _("Encrypted"));
102 wxClientDC dc (_panel);
103 auto size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
106 _reels_label = create_label (_panel, _("Reels"), true);
107 _reel_type = new wxChoice (_panel, wxID_ANY);
109 _reel_length_label = create_label (_panel, _("Reel length"), true);
110 _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
111 _reel_length_gb_label = create_label (_panel, _("GB"), false);
113 _standard_label = create_label (_panel, _("Standard"), true);
114 _standard = new wxChoice (_panel, wxID_ANY);
116 _markers = new Button (_panel, _("Markers..."));
117 _metadata = new Button (_panel, _("Metadata..."));
119 _notebook = new wxNotebook (_panel, wxID_ANY);
120 _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
122 _notebook->AddPage (make_video_panel (), _("Video"), false);
123 _notebook->AddPage (make_audio_panel (), _("Audio"), false);
125 _name->Bind (wxEVT_TEXT, boost::bind (&DCPPanel::name_changed, this));
126 _use_isdcf_name->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
127 _copy_isdcf_name_button->Bind(wxEVT_BUTTON, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
128 _dcp_content_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::dcp_content_type_changed, this));
129 _encrypted->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::encrypted_toggled, this));
130 _reel_type->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::reel_type_changed, this));
131 _reel_length->Bind (wxEVT_SPINCTRL, boost::bind (&DCPPanel::reel_length_changed, this));
132 _standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this));
133 _markers->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::markers_clicked, this));
134 _metadata->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::metadata_clicked, this));
136 for (auto i: DCPContentType::all()) {
137 _dcp_content_type->Append (std_to_wx (i->pretty_name ()));
140 _reel_type->Append (_("Single reel"));
141 _reel_type->Append (_("Split by video content"));
142 /// TRANSLATORS: translate the word "Custom" here; do not include the "Reel|" prefix
143 _reel_type->Append (S_("Reel|Custom"));
145 _reel_length->SetRange (1, 64);
147 _standard->Append (_("SMPTE"));
148 _standard->Append (_("Interop"));
150 Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this, _1));
156 DCPPanel::add_to_grid ()
160 auto name_sizer = new wxBoxSizer (wxHORIZONTAL);
161 name_sizer->Add (_name_label, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
162 name_sizer->Add (_name, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
163 _grid->Add (name_sizer, wxGBPosition(r, 0), wxGBSpan(1, 2), wxRIGHT | wxEXPAND, DCPOMATIC_DIALOG_BORDER);
166 int flags = wxALIGN_CENTER_VERTICAL;
168 flags |= wxALIGN_RIGHT;
171 _grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
173 auto s = new wxBoxSizer (wxHORIZONTAL);
174 s->Add (_copy_isdcf_name_button, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
175 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
179 _grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL);
182 add_label_to_sizer (_grid, _dcp_content_type_label, true, wxGBPosition (r, 0));
183 _grid->Add (_dcp_content_type, wxGBPosition (r, 1));
186 _grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
189 add_label_to_sizer (_grid, _reels_label, true, wxGBPosition (r, 0));
190 _grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
193 add_label_to_sizer (_grid, _reel_length_label, true, wxGBPosition (r, 0));
195 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
196 s->Add (_reel_length);
197 add_label_to_sizer (s, _reel_length_gb_label, false, 0, wxLEFT | wxALIGN_CENTER_VERTICAL);
198 _grid->Add (s, wxGBPosition (r, 1));
202 add_label_to_sizer (_grid, _standard_label, true, wxGBPosition (r, 0));
203 _grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
206 auto extra = new wxBoxSizer (wxHORIZONTAL);
207 extra->Add (_markers, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
208 extra->Add (_metadata, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
209 _grid->Add (extra, wxGBPosition(r, 0), wxGBSpan(1, 2));
214 DCPPanel::name_changed ()
220 _film->set_name (string (_name->GetValue().mb_str()));
224 DCPPanel::j2k_bandwidth_changed ()
230 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
234 DCPPanel::encrypted_toggled ()
240 _film->set_encrypted (_encrypted->GetValue ());
243 /** Called when the frame rate choice widget has been changed */
245 DCPPanel::frame_rate_choice_changed ()
251 _film->set_video_frame_rate (
252 boost::lexical_cast<int>(
253 wx_to_std(_frame_rate_choice->GetString(_frame_rate_choice->GetSelection()))
259 /** Called when the frame rate spin widget has been changed */
261 DCPPanel::frame_rate_spin_changed ()
267 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
271 DCPPanel::audio_channels_changed ()
277 _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
281 DCPPanel::resolution_changed ()
287 _film->set_resolution (_resolution->GetSelection() == 0 ? Resolution::TWO_K : Resolution::FOUR_K);
291 DCPPanel::standard_changed ()
297 _film->set_interop (_standard->GetSelection() == 1);
301 DCPPanel::markers_clicked ()
303 if (_markers_dialog) {
304 _markers_dialog->Destroy ();
308 _markers_dialog = new MarkersDialog (_panel, _film, _viewer);
309 _markers_dialog->Show();
313 DCPPanel::metadata_clicked ()
315 if (_film->interop()) {
316 if (_interop_metadata_dialog) {
317 _interop_metadata_dialog->Destroy ();
318 _interop_metadata_dialog = 0;
321 _interop_metadata_dialog = new InteropMetadataDialog (_panel, _film);
322 _interop_metadata_dialog->setup ();
323 _interop_metadata_dialog->Show ();
325 if (_smpte_metadata_dialog) {
326 _smpte_metadata_dialog->Destroy ();
327 _smpte_metadata_dialog = 0;
330 _smpte_metadata_dialog = new SMPTEMetadataDialog (_panel, _film);
331 _smpte_metadata_dialog->setup ();
332 _smpte_metadata_dialog->Show ();
337 DCPPanel::film_changed (Film::Property p)
340 case Film::Property::NONE:
342 case Film::Property::CONTAINER:
345 case Film::Property::NAME:
346 checked_set (_name, _film->name());
349 case Film::Property::DCP_CONTENT_TYPE:
350 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
353 case Film::Property::ENCRYPTED:
354 checked_set (_encrypted, _film->encrypted ());
356 case Film::Property::RESOLUTION:
357 checked_set (_resolution, _film->resolution() == Resolution::TWO_K ? 0 : 1);
361 case Film::Property::J2K_BANDWIDTH:
362 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
364 case Film::Property::USE_ISDCF_NAME:
366 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
367 if (_film->use_isdcf_name()) {
368 /* We are going back to using an ISDCF name. Remove anything after a _ in the current name,
369 in case the user has clicked 'Copy as name' then re-ticked 'Use ISDCF name' (#1513).
371 string const name = _film->name ();
372 string::size_type const u = name.find("_");
373 if (u != string::npos) {
374 _film->set_name (name.substr(0, u));
380 case Film::Property::VIDEO_FRAME_RATE:
383 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
384 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
385 checked_set (_frame_rate_choice, i);
392 checked_set (_frame_rate_choice, -1);
395 checked_set (_frame_rate_spin, _film->video_frame_rate ());
397 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
401 case Film::Property::AUDIO_CHANNELS:
402 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
403 _film->set_audio_channels (minimum_allowed_audio_channels ());
405 checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
409 case Film::Property::THREE_D:
410 checked_set (_three_d, _film->three_d ());
413 case Film::Property::REENCODE_J2K:
414 checked_set (_reencode_j2k, _film->reencode_j2k());
416 case Film::Property::INTEROP:
417 checked_set (_standard, _film->interop() ? 1 : 0);
419 _markers->Enable (!_film->interop());
421 case Film::Property::AUDIO_PROCESSOR:
422 if (_film->audio_processor ()) {
423 checked_set (_audio_processor, _film->audio_processor()->id());
425 checked_set (_audio_processor, 0);
427 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
428 film_changed (Film::Property::AUDIO_CHANNELS);
430 case Film::Property::REEL_TYPE:
431 checked_set (_reel_type, static_cast<int>(_film->reel_type()));
432 _reel_length->Enable (_film->reel_type() == ReelType::BY_LENGTH);
434 case Film::Property::REEL_LENGTH:
435 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
437 case Film::Property::CONTENT:
439 setup_sensitivity ();
441 case Film::Property::CONTENT_VERSIONS:
442 case Film::Property::VERSION_NUMBER:
443 case Film::Property::RELEASE_TERRITORY:
444 case Film::Property::RATINGS:
445 case Film::Property::FACILITY:
446 case Film::Property::STUDIO:
447 case Film::Property::TEMP_VERSION:
448 case Film::Property::PRE_RELEASE:
449 case Film::Property::RED_BAND:
450 case Film::Property::TWO_D_VERSION_OF_THREE_D:
451 case Film::Property::CHAIN:
452 case Film::Property::LUMINANCE:
461 DCPPanel::film_content_changed (int property)
463 if (property == AudioContentProperty::STREAMS ||
464 property == AudioContentProperty::LANGUAGE ||
465 property == TextContentProperty::USE ||
466 property == TextContentProperty::BURN ||
467 property == TextContentProperty::LANGUAGE ||
468 property == TextContentProperty::LANGUAGE_IS_ADDITIONAL ||
469 property == VideoContentProperty::SCALE ||
470 property == VideoContentProperty::BURNT_SUBTITLE_LANGUAGE ||
471 property == DCPContentProperty::REFERENCE_VIDEO ||
472 property == DCPContentProperty::REFERENCE_AUDIO ||
473 property == DCPContentProperty::REFERENCE_TEXT) {
475 setup_sensitivity ();
481 DCPPanel::setup_container ()
484 vector<Ratio const *> ratios = Ratio::containers ();
485 vector<Ratio const *>::iterator i = ratios.begin ();
486 while (i != ratios.end() && *i != _film->container ()) {
491 if (i == ratios.end()) {
492 checked_set (_container, -1);
493 checked_set (_container_size, wxT (""));
495 checked_set (_container, n);
496 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
497 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
503 /** Called when the container widget has been changed */
505 DCPPanel::container_changed ()
511 int const n = _container->GetSelection ();
513 vector<Ratio const *> ratios = Ratio::containers ();
514 DCPOMATIC_ASSERT (n < int (ratios.size()));
515 _film->set_container (ratios[n]);
519 /** Called when the DCP content type widget has been changed */
521 DCPPanel::dcp_content_type_changed ()
527 int const n = _dcp_content_type->GetSelection ();
528 if (n != wxNOT_FOUND) {
529 _film->set_dcp_content_type (DCPContentType::from_index (n));
534 DCPPanel::set_film (shared_ptr<Film> film)
536 /* We are changing film, so destroy any dialogs for the old one */
538 _audio_dialog->Destroy ();
539 _audio_dialog = nullptr;
541 if (_markers_dialog) {
542 _markers_dialog->Destroy ();
543 _markers_dialog = nullptr;
545 if (_interop_metadata_dialog) {
546 _interop_metadata_dialog->Destroy ();
547 _interop_metadata_dialog = nullptr;
549 if (_smpte_metadata_dialog) {
550 _smpte_metadata_dialog->Destroy ();
551 _smpte_metadata_dialog = nullptr;
557 /* Really should all the film_changed below but this might be enough */
558 checked_set (_dcp_name, wxT(""));
559 set_general_sensitivity (false);
563 film_changed (Film::Property::NAME);
564 film_changed (Film::Property::USE_ISDCF_NAME);
565 film_changed (Film::Property::CONTENT);
566 film_changed (Film::Property::DCP_CONTENT_TYPE);
567 film_changed (Film::Property::CONTAINER);
568 film_changed (Film::Property::RESOLUTION);
569 film_changed (Film::Property::ENCRYPTED);
570 film_changed (Film::Property::J2K_BANDWIDTH);
571 film_changed (Film::Property::VIDEO_FRAME_RATE);
572 film_changed (Film::Property::AUDIO_CHANNELS);
573 film_changed (Film::Property::SEQUENCE);
574 film_changed (Film::Property::THREE_D);
575 film_changed (Film::Property::INTEROP);
576 film_changed (Film::Property::AUDIO_PROCESSOR);
577 film_changed (Film::Property::REEL_TYPE);
578 film_changed (Film::Property::REEL_LENGTH);
579 film_changed (Film::Property::REENCODE_J2K);
581 set_general_sensitivity(static_cast<bool>(_film));
585 DCPPanel::set_general_sensitivity (bool s)
587 _generally_sensitive = s;
588 setup_sensitivity ();
592 DCPPanel::setup_sensitivity ()
594 _name->Enable (_generally_sensitive);
595 _use_isdcf_name->Enable (_generally_sensitive);
596 _dcp_content_type->Enable (_generally_sensitive);
597 _copy_isdcf_name_button->Enable (_generally_sensitive);
598 _encrypted->Enable (_generally_sensitive);
599 _reel_type->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
600 _reel_length->Enable (_generally_sensitive && _film && _film->reel_type() == ReelType::BY_LENGTH);
601 _markers->Enable (_generally_sensitive && _film && !_film->interop());
602 _metadata->Enable (_generally_sensitive);
603 _frame_rate_choice->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content());
604 _frame_rate_spin->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content());
605 _audio_channels->Enable (_generally_sensitive && _film && !_film->references_dcp_audio() && !_film->contains_atmos_content());
606 _audio_processor->Enable (_generally_sensitive && _film && !_film->references_dcp_audio());
607 _j2k_bandwidth->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
608 _container->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
609 _best_frame_rate->Enable (
610 _generally_sensitive &&
612 _film->best_video_frame_rate () != _film->video_frame_rate() &&
613 !_film->references_dcp_video() &&
614 !_film->contains_atmos_content()
616 _resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
617 _three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
620 _generally_sensitive &&
622 !_film->references_dcp_video() &&
623 !_film->references_dcp_audio() &&
624 !_film->contains_atmos_content()
627 _reencode_j2k->Enable (_generally_sensitive && _film);
628 _show_audio->Enable (_generally_sensitive && _film);
632 DCPPanel::use_isdcf_name_toggled ()
638 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
642 DCPPanel::setup_dcp_name ()
644 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
645 _dcp_name->SetToolTip (std_to_wx (_film->dcp_name (true)));
649 DCPPanel::best_frame_rate_clicked ()
655 _film->set_video_frame_rate (_film->best_video_frame_rate ());
659 DCPPanel::three_d_changed ()
665 _film->set_three_d (_three_d->GetValue ());
669 DCPPanel::reencode_j2k_changed ()
675 _film->set_reencode_j2k (_reencode_j2k->GetValue());
679 DCPPanel::config_changed (Config::Property p)
681 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
682 setup_frame_rate_widget ();
684 if (p == Config::SHOW_EXPERIMENTAL_AUDIO_PROCESSORS) {
685 _audio_processor->Clear ();
686 add_audio_processors ();
688 film_changed (Film::Property::AUDIO_PROCESSOR);
694 DCPPanel::setup_frame_rate_widget ()
696 if (Config::instance()->allow_any_dcp_frame_rate ()) {
697 _frame_rate_choice->Hide ();
698 _frame_rate_spin->Show ();
700 _frame_rate_choice->Show ();
701 _frame_rate_spin->Hide ();
706 DCPPanel::make_video_panel ()
708 auto panel = new wxPanel (_notebook);
709 auto sizer = new wxBoxSizer (wxVERTICAL);
710 _video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
711 sizer->Add (_video_grid, 0, wxALL, 8);
712 panel->SetSizer (sizer);
714 _container_label = create_label (panel, _("Container"), true);
715 _container = new wxChoice (panel, wxID_ANY);
716 _container_size = new StaticText (panel, wxT (""));
718 _resolution_label = create_label (panel, _("Resolution"), true);
719 _resolution = new wxChoice (panel, wxID_ANY);
721 _frame_rate_label = create_label (panel, _("Frame Rate"), true);
722 _frame_rate_choice = new wxChoice (panel, wxID_ANY);
723 _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
724 setup_frame_rate_widget ();
725 _best_frame_rate = new Button (panel, _("Use best"));
727 _three_d = new CheckBox (panel, _("3D"));
729 _j2k_bandwidth_label = create_label (panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true);
730 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
731 _mbits_label = create_label (panel, _("Mbit/s"), false);
733 _reencode_j2k = new CheckBox (panel, _("Re-encode JPEG2000 data from input"));
735 _container->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::container_changed, this));
736 _frame_rate_choice->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::frame_rate_choice_changed, this));
737 _frame_rate_spin->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::frame_rate_spin_changed, this));
738 _best_frame_rate->Bind (wxEVT_BUTTON, boost::bind(&DCPPanel::best_frame_rate_clicked, this));
739 _j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
740 /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */
741 _j2k_bandwidth->Bind (wxEVT_TEXT, boost::bind(&DCPPanel::j2k_bandwidth_changed, this));
742 _resolution->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::resolution_changed, this));
743 _three_d->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::three_d_changed, this));
744 _reencode_j2k->Bind (wxEVT_CHECKBOX, boost::bind(&DCPPanel::reencode_j2k_changed, this));
746 for (auto i: Ratio::containers()) {
747 _container->Append (std_to_wx(i->container_nickname()));
750 for (auto i: Config::instance()->allowed_dcp_frame_rates()) {
751 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (i)));
754 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
755 _frame_rate_spin->SetRange (1, 480);
757 _resolution->Append (_("2K"));
758 _resolution->Append (_("4K"));
760 add_video_panel_to_grid ();
766 DCPPanel::add_video_panel_to_grid ()
770 add_label_to_sizer (_video_grid, _container_label, true, wxGBPosition (r, 0));
772 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
773 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
774 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
775 _video_grid->Add (s, wxGBPosition(r, 1));
779 add_label_to_sizer (_video_grid, _resolution_label, true, wxGBPosition (r, 0));
780 _video_grid->Add (_resolution, wxGBPosition (r, 1));
783 add_label_to_sizer (_video_grid, _frame_rate_label, true, wxGBPosition (r, 0));
785 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
786 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
787 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
788 _frame_rate_sizer->Add (_best_frame_rate, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP);
789 _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
793 _video_grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
796 add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
797 auto s = new wxBoxSizer (wxHORIZONTAL);
798 s->Add (_j2k_bandwidth, 0, wxALIGN_CENTER_VERTICAL);
799 add_label_to_sizer (s, _mbits_label, false, 0, wxLEFT | wxALIGN_CENTER_VERTICAL);
800 _video_grid->Add (s, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
802 _video_grid->Add (_reencode_j2k, wxGBPosition(r, 0), wxGBSpan(1, 2));
806 DCPPanel::minimum_allowed_audio_channels () const
809 if (_film && _film->audio_processor ()) {
810 min = _film->audio_processor()->out_channels ();
821 DCPPanel::make_audio_panel ()
823 auto panel = new wxPanel (_notebook);
824 _audio_panel_sizer = new wxBoxSizer (wxVERTICAL);
825 _audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
826 _audio_panel_sizer->Add (_audio_grid, 0, wxALL, 8);
827 panel->SetSizer (_audio_panel_sizer);
829 _channels_label = create_label (panel, _("Channels"), true);
830 _audio_channels = new wxChoice (panel, wxID_ANY);
831 setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
833 _processor_label = create_label (panel, _("Processor"), true);
834 _audio_processor = new wxChoice (panel, wxID_ANY);
835 add_audio_processors ();
837 _show_audio = new Button (panel, _("Show audio..."));
839 _audio_channels->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_channels_changed, this));
840 _audio_processor->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_processor_changed, this));
841 _show_audio->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::show_audio_clicked, this));
843 add_audio_panel_to_grid ();
849 DCPPanel::add_audio_panel_to_grid ()
853 add_label_to_sizer (_audio_grid, _channels_label, true, wxGBPosition (r, 0));
854 _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
857 add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
858 _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
861 _audio_grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
866 DCPPanel::copy_isdcf_name_button_clicked ()
868 _film->set_name (_film->isdcf_name (true));
869 _film->set_use_isdcf_name (false);
873 DCPPanel::audio_processor_changed ()
879 auto const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
880 _film->set_audio_processor (AudioProcessor::from_id (s));
884 DCPPanel::show_audio_clicked ()
891 _audio_dialog->Destroy ();
895 auto d = new AudioDialog (_panel, _film, _viewer);
900 DCPPanel::reel_type_changed ()
906 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
910 DCPPanel::reel_length_changed ()
916 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
920 DCPPanel::add_audio_processors ()
922 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
923 for (auto ap: AudioProcessor::visible()) {
924 _audio_processor->Append (std_to_wx(ap->name()), new wxStringClientData(std_to_wx(ap->id())));
926 _audio_panel_sizer->Layout();