/*
- 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
#include "wx_util.h"
#include "isdcf_metadata_dialog.h"
#include "lib/ratio.h"
-#include "lib/scaler.h"
#include "lib/config.h"
#include "lib/dcp_content_type.h"
#include "lib/util.h"
#include <wx/spinctrl.h>
#include <boost/lexical_cast.hpp>
+using std::cout;
using std::list;
using std::string;
using std::vector;
grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
++r;
- add_label_to_grid_bag_sizer (grid, _panel, _("DCP Name"), true, wxGBPosition (r, 0));
- _dcp_name = new wxStaticText (_panel, wxID_ANY, wxT (""));
- grid->Add (_dcp_name, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- ++r;
-
int flags = wxALIGN_CENTER_VERTICAL;
#ifdef __WXOSX__
flags |= wxALIGN_RIGHT;
_use_isdcf_name = new wxCheckBox (_panel, wxID_ANY, _("Use ISDCF name"));
grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
- _edit_isdcf_button = new wxButton (_panel, wxID_ANY, _("Details..."));
- grid->Add (_edit_isdcf_button, wxGBPosition (r, 1), wxDefaultSpan);
- ++r;
- add_label_to_grid_bag_sizer (grid, _panel, _("Container"), true, wxGBPosition (r, 0));
- _container = new wxChoice (_panel, wxID_ANY);
- grid->Add (_container, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
+ {
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _edit_isdcf_button = new wxButton (_panel, wxID_ANY, _("Details..."));
+ s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
+ _copy_isdcf_name_button = new wxButton (_panel, wxID_ANY, _("Copy as name"));
+ s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
+ grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
+ ++r;
+ }
+
+ add_label_to_grid_bag_sizer (grid, _panel, _("DCP Name"), true, wxGBPosition (r, 0));
+ _dcp_name = new wxStaticText (_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
+ grid->Add (_dcp_name, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxEXPAND);
++r;
add_label_to_grid_bag_sizer (grid, _panel, _("Content Type"), true, wxGBPosition (r, 0));
grid->Add (_dcp_content_type, wxGBPosition (r, 1));
++r;
- {
- add_label_to_grid_bag_sizer (grid, _panel, _("Frame Rate"), true, wxGBPosition (r, 0));
- _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
- _frame_rate_choice = new wxChoice (_panel, wxID_ANY);
- _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
- _frame_rate_spin = new wxSpinCtrl (_panel, wxID_ANY);
- _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
- setup_frame_rate_widget ();
- _best_frame_rate = new wxButton (_panel, wxID_ANY, _("Use best"));
- _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
- grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
- }
- ++r;
-
- _burn_subtitles = new wxCheckBox (_panel, wxID_ANY, _("Burn subtitles into image"));
- grid->Add (_burn_subtitles, wxGBPosition (r, 0), wxGBSpan (1, 2));
- ++r;
+ _notebook = new wxNotebook (_panel, wxID_ANY);
+ _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
+ _notebook->AddPage (make_video_panel (), _("Video"), false);
+ _notebook->AddPage (make_audio_panel (), _("Audio"), false);
+
_signed = new wxCheckBox (_panel, wxID_ANY, _("Signed"));
grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
- add_label_to_grid_bag_sizer (grid, _panel, _("Audio channels"), true, wxGBPosition (r, 0));
- _audio_channels = new wxSpinCtrl (_panel, wxID_ANY);
- grid->Add (_audio_channels, wxGBPosition (r, 1));
- ++r;
-
- _three_d = new wxCheckBox (_panel, wxID_ANY, _("3D"));
- grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _panel, _("Resolution"), true, wxGBPosition (r, 0));
- _resolution = new wxChoice (_panel, wxID_ANY);
- grid->Add (_resolution, wxGBPosition (r, 1));
- ++r;
-
- {
- add_label_to_grid_bag_sizer (grid, _panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
- wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _j2k_bandwidth = new wxSpinCtrl (_panel, wxID_ANY);
- s->Add (_j2k_bandwidth, 1);
- add_label_to_sizer (s, _panel, _("Mbit/s"), false);
- grid->Add (s, wxGBPosition (r, 1));
- }
- ++r;
-
add_label_to_grid_bag_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0));
_standard = new wxChoice (_panel, wxID_ANY);
grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
++r;
- add_label_to_grid_bag_sizer (grid, _panel, _("Scaler"), true, wxGBPosition (r, 0));
- _scaler = new wxChoice (_panel, wxID_ANY);
- grid->Add (_scaler, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- ++r;
-
- _name->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DCPPanel::name_changed, this));
- _use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
- _edit_isdcf_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
- _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::container_changed, this));
- _scaler->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::scaler_changed, this));
- _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::dcp_content_type_changed, this));
- _frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::frame_rate_choice_changed, this));
- _frame_rate_spin->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::frame_rate_spin_changed, this));
- _best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::best_frame_rate_clicked, this));
- _burn_subtitles->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::burn_subtitles_toggled, this));
- _signed->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::signed_toggled, this));
- _encrypted->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::encrypted_toggled, this));
- _audio_channels->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::audio_channels_changed, this));
- _j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
- _resolution->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::resolution_changed, this));
- _three_d->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::three_d_changed, this));
- _standard->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::standard_changed, this));
-
- vector<Scaler const *> const sc = Scaler::all ();
- for (vector<Scaler const *>::const_iterator i = sc.begin(); i != sc.end(); ++i) {
- _scaler->Append (std_to_wx ((*i)->name()));
- }
-
- vector<Ratio const *> const ratio = Ratio::all ();
- for (vector<Ratio const *>::const_iterator i = ratio.begin(); i != ratio.end(); ++i) {
- _container->Append (std_to_wx ((*i)->nickname ()));
- }
+ _name->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DCPPanel::name_changed, this));
+ _use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
+ _edit_isdcf_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
+ _copy_isdcf_name_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
+ _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::dcp_content_type_changed, this));
+ _signed->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::signed_toggled, this));
+ _encrypted->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::encrypted_toggled, this));
+ _standard->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::standard_changed, this));
vector<DCPContentType const *> const ct = DCPContentType::all ();
for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
}
- list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
- for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
- _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
- }
-
- _audio_channels->SetRange (0, MAX_DCP_AUDIO_CHANNELS);
- _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
- _frame_rate_spin->SetRange (1, 480);
-
- _resolution->Append (_("2K"));
- _resolution->Append (_("4K"));
-
_standard->Append (_("SMPTE"));
_standard->Append (_("Interop"));
return;
}
- _film->set_audio_channels (_audio_channels->GetValue ());
+ _film->set_audio_channels ((_audio_channels->GetSelection () + 1) * 2);
}
void
checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
setup_dcp_name ();
break;
- case Film::SCALER:
- checked_set (_scaler, Scaler::as_index (_film->scaler ()));
- break;
case Film::BURN_SUBTITLES:
checked_set (_burn_subtitles, _film->burn_subtitles ());
break;
checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
break;
case Film::USE_ISDCF_NAME:
+ {
checked_set (_use_isdcf_name, _film->use_isdcf_name ());
setup_dcp_name ();
+ _edit_isdcf_button->Enable (_film->use_isdcf_name ());
break;
+ }
case Film::ISDCF_METADATA:
setup_dcp_name ();
break;
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:
void
DCPPanel::film_content_changed (int property)
{
- if (property == FFmpegContentProperty::AUDIO_STREAM || property == SubtitleContentProperty::USE_SUBTITLES) {
+ if (property == FFmpegContentProperty::AUDIO_STREAM ||
+ property == SubtitleContentProperty::USE_SUBTITLES ||
+ property == VideoContentProperty::VIDEO_SCALE) {
setup_dcp_name ();
}
}
int const n = _container->GetSelection ();
if (n >= 0) {
vector<Ratio const *> ratios = Ratio::all ();
- assert (n < int (ratios.size()));
+ DCPOMATIC_ASSERT (n < int (ratios.size()));
_film->set_container (ratios[n]);
}
}
film_changed (Film::DCP_CONTENT_TYPE);
film_changed (Film::CONTAINER);
film_changed (Film::RESOLUTION);
- film_changed (Film::SCALER);
film_changed (Film::SIGNED);
film_changed (Film::BURN_SUBTITLES);
film_changed (Film::ENCRYPTED);
_use_isdcf_name->Enable (s);
_edit_isdcf_button->Enable (s);
_dcp_content_type->Enable (s);
+ _copy_isdcf_name_button->Enable (s);
bool si = s;
if (_film && _film->encrypted ()) {
_container->Enable (s);
_best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
_resolution->Enable (s);
- _scaler->Enable (s);
_three_d->Enable (s);
_standard->Enable (s);
}
-/** Called when the scaler widget has been changed */
-void
-DCPPanel::scaler_changed ()
-{
- if (!_film) {
- return;
- }
-
- int const n = _scaler->GetSelection ();
- if (n >= 0) {
- _film->set_scaler (Scaler::from_index (n));
- }
-}
-
void
DCPPanel::use_isdcf_name_toggled ()
{
_frame_rate_sizer->Layout ();
}
+
+wxPanel *
+DCPPanel::make_video_panel ()
+{
+ wxPanel* panel = new wxPanel (_notebook);
+ wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ sizer->Add (grid, 0, wxALL, 8);
+ panel->SetSizer (sizer);
+
+ int r = 0;
+
+ add_label_to_grid_bag_sizer (grid, panel, _("Container"), true, wxGBPosition (r, 0));
+ _container = new wxChoice (panel, wxID_ANY);
+ grid->Add (_container, wxGBPosition (r, 1));
+ ++r;
+
+ {
+ add_label_to_grid_bag_sizer (grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0));
+ _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
+ _frame_rate_choice = new wxChoice (panel, wxID_ANY);
+ _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
+ _frame_rate_spin = new wxSpinCtrl (panel, wxID_ANY);
+ _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
+ setup_frame_rate_widget ();
+ _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best"));
+ _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
+ grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
+ }
+ ++r;
+
+ _burn_subtitles = new wxCheckBox (panel, wxID_ANY, _("Burn subtitles into image"));
+ grid->Add (_burn_subtitles, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
+ _three_d = new wxCheckBox (panel, wxID_ANY, _("3D"));
+ grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
+ add_label_to_grid_bag_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0));
+ _resolution = new wxChoice (panel, wxID_ANY);
+ grid->Add (_resolution, wxGBPosition (r, 1));
+ ++r;
+
+ {
+ add_label_to_grid_bag_sizer (grid, panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
+ wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
+ s->Add (_j2k_bandwidth, 1);
+ add_label_to_sizer (s, panel, _("Mbit/s"), false);
+ grid->Add (s, wxGBPosition (r, 1));
+ }
+ ++r;
+
+ _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::container_changed, this));
+ _frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::frame_rate_choice_changed, this));
+ _frame_rate_spin->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::frame_rate_spin_changed, this));
+ _best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::best_frame_rate_clicked, this));
+ _burn_subtitles->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::burn_subtitles_toggled, this));
+ _j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
+ /* Also listen to wxEVT_COMMAND_TEXT_UPDATED so that typing numbers directly in is always noticed */
+ _j2k_bandwidth->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
+ _resolution->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DCPPanel::resolution_changed, this));
+ _three_d->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&DCPPanel::three_d_changed, this));
+
+ vector<Ratio const *> const ratio = Ratio::all ();
+ for (vector<Ratio const *>::const_iterator i = ratio.begin(); i != ratio.end(); ++i) {
+ _container->Append (std_to_wx ((*i)->nickname ()));
+ }
+
+ list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
+ for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
+ _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
+ }
+
+ _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+ _frame_rate_spin->SetRange (1, 480);
+
+ _resolution->Append (_("2K"));
+ _resolution->Append (_("4K"));
+
+ return panel;
+}
+
+wxPanel *
+DCPPanel::make_audio_panel ()
+{
+ wxPanel* panel = new wxPanel (_notebook);
+ wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ sizer->Add (grid, 0, wxALL, 8);
+ panel->SetSizer (sizer);
+
+ int r = 0;
+ add_label_to_grid_bag_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
+ _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_CHOICE_SELECTED, boost::bind (&DCPPanel::audio_channels_changed, this));
+
+ return panel;
+}
+
+void
+DCPPanel::copy_isdcf_name_button_clicked ()
+{
+ _film->set_name (_film->isdcf_name (false));
+ _film->set_use_isdcf_name (false);
+}