2 Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "dcp_panel.h"
22 #include "key_dialog.h"
23 #include "isdcf_metadata_dialog.h"
24 #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/dcp_content.h"
34 #include "lib/cross.h"
36 #include <dcp/raw_convert.h>
38 #include <wx/notebook.h>
39 #include <wx/gbsizer.h>
40 #include <wx/spinctrl.h>
41 #include <boost/lexical_cast.hpp>
42 #include <boost/foreach.hpp>
52 using boost::lexical_cast;
53 using boost::shared_ptr;
54 using boost::dynamic_pointer_cast;
56 DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
59 , _generally_sensitive (true)
61 _panel = new wxPanel (n);
62 _sizer = new wxBoxSizer (wxVERTICAL);
63 _panel->SetSizer (_sizer);
65 wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
66 _sizer->Add (grid, 0, wxEXPAND | wxALL, 8);
70 add_label_to_sizer (grid, _panel, _("Name"), true, wxGBPosition (r, 0), wxGBSpan (1, 2));
71 _name = new wxTextCtrl (_panel, wxID_ANY);
72 grid->Add (_name, wxGBPosition(r, 2), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
75 int flags = wxALIGN_CENTER_VERTICAL;
77 flags |= wxALIGN_RIGHT;
80 _use_isdcf_name = new wxCheckBox (_panel, wxID_ANY, _("Use ISDCF name"));
81 grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
84 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
85 _edit_isdcf_button = new wxButton (_panel, wxID_ANY, _("Details..."));
86 s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
87 _copy_isdcf_name_button = new wxButton (_panel, wxID_ANY, _("Copy as name"));
88 s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
89 grid->Add (s, wxGBPosition (r, 2), wxDefaultSpan, wxEXPAND);
93 /* wxST_ELLIPSIZE_MIDDLE works around a bug in GTK2 and/or wxWidgets, see
94 http://trac.wxwidgets.org/ticket/12539
96 _dcp_name = new wxStaticText (
97 _panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize,
98 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
101 grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 3), wxALIGN_CENTER_VERTICAL | wxEXPAND);
104 add_label_to_sizer (grid, _panel, _("Content Type"), true, wxGBPosition (r, 0));
105 _dcp_content_type = new wxChoice (_panel, wxID_ANY);
106 grid->Add (_dcp_content_type, wxGBPosition (r, 2));
109 _notebook = new wxNotebook (_panel, wxID_ANY);
110 _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
112 _notebook->AddPage (make_video_panel (), _("Video"), false);
113 _notebook->AddPage (make_audio_panel (), _("Audio"), false);
115 _signed = new wxCheckBox (_panel, wxID_ANY, _("Signed"));
116 grid->Add (_signed, wxGBPosition (r, 0));
119 _encrypted = new wxCheckBox (_panel, wxID_ANY, _("Encrypted"));
120 grid->Add (_encrypted, wxGBPosition (r, 0));
123 wxClientDC dc (_panel);
124 wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
128 add_label_to_sizer (grid, _panel, _("Key"), true, wxGBPosition (r, 0));
129 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
130 _key = new wxStaticText (_panel, wxID_ANY, "", wxDefaultPosition, size);
131 s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
132 _edit_key = new wxButton (_panel, wxID_ANY, _("Edit..."));
134 grid->Add (s, wxGBPosition (r, 2));
138 add_label_to_sizer (grid, _panel, _("Reels"), true, wxGBPosition (r, 0));
139 _reel_type = new wxChoice (_panel, wxID_ANY);
140 grid->Add (_reel_type, wxGBPosition (r, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
143 add_label_to_sizer (grid, _panel, _("Reel length"), true, wxGBPosition (r, 0));
146 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
147 _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
148 s->Add (_reel_length);
149 add_label_to_sizer (s, _panel, _("GB"), false);
150 grid->Add (s, wxGBPosition (r, 2));
154 add_label_to_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0));
155 _standard_warning = new Warning (_panel);
156 grid->Add (_standard_warning->get(), wxGBPosition (r, 1));
157 _standard = new wxChoice (_panel, wxID_ANY);
158 grid->Add (_standard, wxGBPosition (r, 2), 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 _reel_type->Append (_("Reel|Custom"));
187 _reel_length->SetRange (1, 64);
189 _standard->Append (_("SMPTE"));
190 _standard->Append (_("Interop"));
192 Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this));
198 DCPPanel::edit_key_clicked ()
200 KeyDialog* d = new KeyDialog (_panel, _film->key ());
201 if (d->ShowModal () == wxID_OK) {
202 _film->set_key (d->key ());
208 DCPPanel::name_changed ()
214 _film->set_name (string (_name->GetValue().mb_str()));
218 DCPPanel::j2k_bandwidth_changed ()
224 _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
228 DCPPanel::signed_toggled ()
234 _film->set_signed (_signed->GetValue ());
238 DCPPanel::encrypted_toggled ()
244 _film->set_encrypted (_encrypted->GetValue ());
247 /** Called when the frame rate choice widget has been changed */
249 DCPPanel::frame_rate_choice_changed ()
255 _film->set_video_frame_rate (
256 boost::lexical_cast<int> (
257 wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
262 /** Called when the frame rate spin widget has been changed */
264 DCPPanel::frame_rate_spin_changed ()
270 _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
274 DCPPanel::audio_channels_changed ()
280 _film->set_audio_channels (dcp::raw_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
284 DCPPanel::resolution_changed ()
290 _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
294 DCPPanel::standard_changed ()
300 _film->set_interop (_standard->GetSelection() == 1);
304 DCPPanel::upload_after_make_dcp_changed ()
310 _film->set_upload_after_make_dcp (_upload_after_make_dcp->GetValue ());
314 DCPPanel::film_changed (int p)
319 case Film::CONTAINER:
323 checked_set (_name, _film->name());
326 case Film::DCP_CONTENT_TYPE:
327 checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
331 checked_set (_signed, _film->is_signed ());
333 case Film::ENCRYPTED:
334 checked_set (_encrypted, _film->encrypted ());
335 if (_film->encrypted ()) {
336 _film->set_signed (true);
337 _signed->Enable (false);
338 _key->Enable (_generally_sensitive);
339 _edit_key->Enable (_generally_sensitive);
341 _signed->Enable (_generally_sensitive);
342 _key->Enable (false);
343 _edit_key->Enable (false);
347 checked_set (_key, _film->key().hex().substr (0, 8) + "...");
349 case Film::RESOLUTION:
350 checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
354 case Film::J2K_BANDWIDTH:
355 checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
357 case Film::USE_ISDCF_NAME:
359 checked_set (_use_isdcf_name, _film->use_isdcf_name ());
361 _edit_isdcf_button->Enable (_film->use_isdcf_name ());
364 case Film::ISDCF_METADATA:
367 case Film::VIDEO_FRAME_RATE:
370 for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
371 if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
372 checked_set (_frame_rate_choice, i);
379 checked_set (_frame_rate_choice, -1);
382 checked_set (_frame_rate_spin, _film->video_frame_rate ());
384 _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
387 case Film::AUDIO_CHANNELS:
388 if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
389 _film->set_audio_channels (minimum_allowed_audio_channels ());
391 checked_set (_audio_channels, dcp::raw_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
396 checked_set (_three_d, _film->three_d ());
400 checked_set (_standard, _film->interop() ? 1 : 0);
403 case Film::AUDIO_PROCESSOR:
404 if (_film->audio_processor ()) {
405 checked_set (_audio_processor, _film->audio_processor()->id());
407 checked_set (_audio_processor, 0);
409 setup_audio_channels_choice ();
410 film_changed (Film::AUDIO_CHANNELS);
412 case Film::REEL_TYPE:
413 checked_set (_reel_type, _film->reel_type ());
414 _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
416 case Film::REEL_LENGTH:
417 checked_set (_reel_length, _film->reel_length() / 1000000000LL);
419 case Film::UPLOAD_AFTER_MAKE_DCP:
420 checked_set (_upload_after_make_dcp, _film->upload_after_make_dcp ());
433 DCPPanel::film_content_changed (int property)
435 if (property == AudioContentProperty::AUDIO_STREAMS ||
436 property == SubtitleContentProperty::USE_SUBTITLES ||
437 property == SubtitleContentProperty::BURN_SUBTITLES ||
438 property == VideoContentProperty::VIDEO_SCALE ||
439 property == DCPContentProperty::REFERENCE_VIDEO ||
440 property == DCPContentProperty::REFERENCE_AUDIO ||
441 property == DCPContentProperty::REFERENCE_SUBTITLE) {
450 DCPPanel::setup_container ()
453 vector<Ratio const *> ratios = Ratio::all ();
454 vector<Ratio const *>::iterator i = ratios.begin ();
455 while (i != ratios.end() && *i != _film->container ()) {
460 if (i == ratios.end()) {
461 checked_set (_container, -1);
462 checked_set (_container_size, wxT (""));
464 checked_set (_container, n);
465 dcp::Size const size = fit_ratio_within (_film->container()->ratio(), _film->full_frame ());
466 checked_set (_container_size, wxString::Format ("%dx%d", size.width, size.height));
472 /** Called when the container widget has been changed */
474 DCPPanel::container_changed ()
480 int const n = _container->GetSelection ();
482 vector<Ratio const *> ratios = Ratio::all ();
483 DCPOMATIC_ASSERT (n < int (ratios.size()));
484 _film->set_container (ratios[n]);
488 /** Called when the DCP content type widget has been changed */
490 DCPPanel::dcp_content_type_changed ()
496 int const n = _dcp_content_type->GetSelection ();
497 if (n != wxNOT_FOUND) {
498 _film->set_dcp_content_type (DCPContentType::from_index (n));
503 DCPPanel::set_film (shared_ptr<Film> film)
507 film_changed (Film::NAME);
508 film_changed (Film::USE_ISDCF_NAME);
509 film_changed (Film::CONTENT);
510 film_changed (Film::DCP_CONTENT_TYPE);
511 film_changed (Film::CONTAINER);
512 film_changed (Film::RESOLUTION);
513 film_changed (Film::SIGNED);
514 film_changed (Film::ENCRYPTED);
515 film_changed (Film::KEY);
516 film_changed (Film::J2K_BANDWIDTH);
517 film_changed (Film::ISDCF_METADATA);
518 film_changed (Film::VIDEO_FRAME_RATE);
519 film_changed (Film::AUDIO_CHANNELS);
520 film_changed (Film::SEQUENCE);
521 film_changed (Film::THREE_D);
522 film_changed (Film::INTEROP);
523 film_changed (Film::AUDIO_PROCESSOR);
524 film_changed (Film::REEL_TYPE);
525 film_changed (Film::REEL_LENGTH);
526 film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
530 DCPPanel::set_general_sensitivity (bool s)
533 _use_isdcf_name->Enable (s);
534 _edit_isdcf_button->Enable (s);
535 _dcp_content_type->Enable (s);
536 _copy_isdcf_name_button->Enable (s);
539 if (_film && _film->encrypted ()) {
542 _signed->Enable (si);
544 _encrypted->Enable (s);
545 _key->Enable (s && _film && _film->encrypted ());
546 _edit_key->Enable (s && _film && _film->encrypted ());
547 _reel_type->Enable (s);
548 _reel_length->Enable (s && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
549 _upload_after_make_dcp->Enable (s);
550 _frame_rate_choice->Enable (s);
551 _frame_rate_spin->Enable (s);
552 _audio_channels->Enable (s);
553 _audio_processor->Enable (s);
554 _j2k_bandwidth->Enable (s);
555 _container->Enable (s);
556 _best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
557 _resolution->Enable (s);
558 _three_d->Enable (s);
559 _standard->Enable (s);
563 DCPPanel::use_isdcf_name_toggled ()
569 _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
573 DCPPanel::edit_isdcf_button_clicked ()
579 ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
581 _film->set_isdcf_metadata (d->isdcf_metadata ());
586 DCPPanel::setup_dcp_name ()
588 _dcp_name->SetLabel (std_to_wx (_film->dcp_name (true)));
592 DCPPanel::best_frame_rate_clicked ()
598 _film->set_video_frame_rate (_film->best_video_frame_rate ());
602 DCPPanel::three_d_changed ()
608 _film->set_three_d (_three_d->GetValue ());
612 DCPPanel::config_changed ()
614 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
615 setup_frame_rate_widget ();
619 DCPPanel::setup_frame_rate_widget ()
621 if (Config::instance()->allow_any_dcp_frame_rate ()) {
622 _frame_rate_choice->Hide ();
623 _frame_rate_spin->Show ();
625 _frame_rate_choice->Show ();
626 _frame_rate_spin->Hide ();
629 _frame_rate_sizer->Layout ();
630 _video_grid->Layout ();
634 DCPPanel::make_video_panel ()
636 wxPanel* panel = new wxPanel (_notebook);
637 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
638 _video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
639 sizer->Add (_video_grid, 0, wxALL, 8);
640 panel->SetSizer (sizer);
644 add_label_to_sizer (_video_grid, panel, _("Container"), true, wxGBPosition (r, 0));
645 _container_warning = new Warning (panel);
646 _video_grid->Add (_container_warning->get(), wxGBPosition (r, 1));
648 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
649 _container = new wxChoice (panel, wxID_ANY);
650 s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
651 _container_size = new wxStaticText (panel, wxID_ANY, wxT (""));
652 s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
653 _video_grid->Add (s, wxGBPosition (r, 2), wxDefaultSpan, wxEXPAND);
657 add_label_to_sizer (_video_grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0));
658 _frame_rate_warning = new Warning (panel);
659 _video_grid->Add (_frame_rate_warning->get(), wxGBPosition (r, 1));
661 _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
662 _frame_rate_choice = new wxChoice (panel, wxID_ANY);
663 _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
664 _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
665 _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
666 setup_frame_rate_widget ();
667 _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best"));
668 _frame_rate_sizer->Add (_best_frame_rate, 0, wxALIGN_CENTER_VERTICAL);
669 _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 2));
673 _three_d = new wxCheckBox (panel, wxID_ANY, _("3D"));
674 _video_grid->Add (_three_d, wxGBPosition (r, 0));
675 _three_d_warning = new Warning (panel);
676 _video_grid->Add (_three_d_warning->get(), wxGBPosition (r, 1));
679 add_label_to_sizer (_video_grid, panel, _("Resolution"), true, wxGBPosition (r, 0), wxGBSpan (1, 2));
680 _resolution = new wxChoice (panel, wxID_ANY);
681 _video_grid->Add (_resolution, wxGBPosition (r, 2));
685 add_label_to_sizer (_video_grid, panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
686 _j2k_bandwidth_warning = new Warning (panel);
687 _video_grid->Add (_j2k_bandwidth_warning->get(), wxGBPosition (r, 1));
688 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
689 _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
690 s->Add (_j2k_bandwidth, 1);
691 add_label_to_sizer (s, panel, _("Mbit/s"), false);
692 _video_grid->Add (s, wxGBPosition (r, 2));
696 _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::container_changed, this));
697 _frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::frame_rate_choice_changed, this));
698 _frame_rate_spin->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::frame_rate_spin_changed, this));
699 _best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::best_frame_rate_clicked, this));
700 _j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
701 /* Also listen to wxEVT_COMMAND_TEXT_UPDATED so that typing numbers directly in is always noticed */
702 _j2k_bandwidth->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
703 _resolution->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::resolution_changed, this));
704 _three_d->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::three_d_changed, this));
706 vector<Ratio const *> const ratio = Ratio::all ();
707 for (vector<Ratio const *>::const_iterator i = ratio.begin(); i != ratio.end(); ++i) {
708 _container->Append (std_to_wx ((*i)->nickname ()));
711 list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
712 for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
713 _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
716 _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
717 _frame_rate_spin->SetRange (1, 480);
719 _resolution->Append (_("2K"));
720 _resolution->Append (_("4K"));
726 DCPPanel::minimum_allowed_audio_channels () const
729 if (_film && _film->audio_processor ()) {
730 min = _film->audio_processor()->out_channels ();
741 DCPPanel::setup_audio_channels_choice ()
743 vector<pair<string, string> > items;
744 for (int i = minimum_allowed_audio_channels(); i <= 16; i += 2) {
745 items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
748 checked_set (_audio_channels, items);
752 DCPPanel::make_audio_panel ()
754 wxPanel* panel = new wxPanel (_notebook);
755 wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
756 wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
757 sizer->Add (grid, 0, wxALL, 8);
758 panel->SetSizer (sizer);
762 add_label_to_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
763 _audio_channels = new wxChoice (panel, wxID_ANY);
764 setup_audio_channels_choice ();
765 _audio_channels_warning = new Warning (panel);
766 grid->Add (_audio_channels_warning->get(), wxGBPosition (r, 1));
767 grid->Add (_audio_channels, wxGBPosition (r, 2));
770 add_label_to_sizer (grid, panel, _("Processor"), true, wxGBPosition (r, 0), wxGBSpan (1, 2));
771 _audio_processor = new wxChoice (panel, wxID_ANY);
772 _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
773 BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
774 _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
776 grid->Add (_audio_processor, wxGBPosition (r, 2));
779 _show_audio = new wxButton (panel, wxID_ANY, _("Show audio..."));
780 grid->Add (_show_audio, wxGBPosition (r, 0), wxGBSpan (1, 2));
783 _audio_channels->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_channels_changed, this));
784 _audio_processor->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_processor_changed, this));
785 _show_audio->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::show_audio_clicked, this));
791 DCPPanel::copy_isdcf_name_button_clicked ()
793 _film->set_name (_film->isdcf_name (false));
794 _film->set_use_isdcf_name (false);
798 DCPPanel::audio_processor_changed ()
804 string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
805 _film->set_audio_processor (AudioProcessor::from_id (s));
809 DCPPanel::show_audio_clicked ()
816 _audio_dialog->Destroy ();
820 AudioDialog* d = new AudioDialog (_panel, _film);
825 DCPPanel::reel_type_changed ()
831 _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
835 DCPPanel::reel_length_changed ()
841 _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
845 DCPPanel::setup_warnings ()
848 _container_warning->disable ();
852 ContentList content = _film->content ();
854 int flat_or_narrower = 0;
856 BOOST_FOREACH (shared_ptr<const Content> i, content) {
857 shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
859 Ratio const * r = vc->scale().ratio ();
860 if (r && r->id() == "239") {
862 } else if (r && r->id() != "239" && r->id() != "full-frame") {
868 _container_warning->disable ();
869 _frame_rate_warning->disable ();
870 _j2k_bandwidth_warning->disable ();
871 _three_d_warning->disable ();
872 _audio_channels_warning->disable ();
873 _standard_warning->disable ();
875 if (scope && !flat_or_narrower && _film->container()->id() == "185") {
876 _container_warning->enable (_("All of your content is in Scope (2.39:1) but your DCP's container is Flat (1.85:1). This will letter-box your content inside a Flat (1.85:1) frame. You may prefer to set the container to Scope (2.39:1)."));
879 if (!scope && flat_or_narrower && _film->container()->id() == "239") {
880 _container_warning->enable (_("All of your content is at 1.85:1 or narrower but your DCP's container is Scope (2.39:1). This will pillar-box your content inside a Flat (1.85:1) frame. You may prefer to set the container to Flat."));
883 if (_film->video_frame_rate() != 24 && _film->video_frame_rate() != 48) {
884 _frame_rate_warning->enable (wxString::Format (_("Your DCP frame rate (%d fps) may cause problems in a few (mostly older) projectors. If possible, use 24 or 48 frames per second."), _film->video_frame_rate()));
887 if (_film->j2k_bandwidth() >= 245000000) {
888 _j2k_bandwidth_warning->enable (_("A few projectors have problems playing back very high bit-rate DCPs. It is a good idea to drop the JPEG2000 bandwidth down to about 200Mbit/s; this is unlikely to have any visible effect on the image."));
892 BOOST_FOREACH (shared_ptr<const Content> i, content) {
893 shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
894 if (vc && vc->video_frame_type() != VIDEO_FRAME_TYPE_2D) {
899 if (three_d > 0 && !_film->three_d()) {
900 _three_d_warning->enable (_("You are using 3D content but your DCP is set to 2D. Set the DCP to 3D if you want to play it back on a 3D system (e.g. Real-D, MasterImage etc.)"));
903 if (_film->audio_channels() < 6) {
904 _audio_channels_warning->enable (_("Your DCP has fewer than 6 audio channels. This may cause problems on some projectors."));
907 if (_film->interop() && _film->video_frame_rate() != 24 && _film->video_frame_rate() != 48) {
908 _standard_warning->enable (_("You are set up for an Interop DCP at a frame rate which is not officially supported. You are advised to make a SMPTE DCP instead."));
911 _video_grid->Layout ();