From: Carl Hetherington Date: Wed, 28 Jun 2017 15:17:39 +0000 (+0100) Subject: Offer only flat/scope/full-frame as container choices and differentiate X-Git-Tag: v2.11.12~24 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=29377b18a8cef724c8e2de2316a66ceae89a2e9a Offer only flat/scope/full-frame as container choices and differentiate the names from the UI for content ratios. --- diff --git a/src/lib/ratio.cc b/src/lib/ratio.cc index 82602d2f2..60384892d 100644 --- a/src/lib/ratio.cc +++ b/src/lib/ratio.cc @@ -27,22 +27,23 @@ using std::string; using std::vector; +using boost::optional; vector Ratio::_ratios; void Ratio::setup_ratios () { - _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "119")); - _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "133")); - _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("Academy"), "137")); - _ratios.push_back (new Ratio (float(1544) / 1080, "143", _("IMAX"), "143")); - _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "166")); - _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "178")); - _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("Flat"), "F")); - _ratios.push_back (new Ratio (float(2048) / 872, "235", _("2.35"), "S")); - _ratios.push_back (new Ratio (float(2048) / 858, "239", _("Scope"), "S")); - _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("Full frame"), "C")); + _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), optional(), "119")); + _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("1.33 (4:3)"), optional(), "133")); + _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.38 (Academy)"), optional(), "137")); + _ratios.push_back (new Ratio (float(1544) / 1080, "143", _("1.43 (IMAX)"), optional(), "143")); + _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), optional(), "166")); + _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("1.78 (16:9 or HD)"), optional(), "178")); + _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("1.85 (Flat)"), string(_("DCI Flat")), "F")); + _ratios.push_back (new Ratio (float(2048) / 872, "235", _("2.35"), optional(), "S")); + _ratios.push_back (new Ratio (float(2048) / 858, "239", _("2.39 (Scope)"), string(_("DCI Scope")), "S")); + _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("1.90 (Full frame)"), string(_("Full frame")), "C")); } Ratio const * @@ -97,3 +98,20 @@ Ratio::nearest_from_ratio (float r) return nearest; } + +vector +Ratio::containers () +{ + vector r; + r.push_back (Ratio::from_id ("185")); + r.push_back (Ratio::from_id ("239")); + r.push_back (Ratio::from_id ("full-frame")); + return r; +} + +string +Ratio::container_nickname () const +{ + DCPOMATIC_ASSERT (_container_nickname); + return *_container_nickname; +} diff --git a/src/lib/ratio.h b/src/lib/ratio.h index 9e9d58a40..42f29458a 100644 --- a/src/lib/ratio.h +++ b/src/lib/ratio.h @@ -28,10 +28,11 @@ class Ratio : public boost::noncopyable { public: - Ratio (float ratio, std::string id, std::string n, std::string d) + Ratio (float ratio, std::string id, std::string in, boost::optional cn, std::string d) : _ratio (ratio) , _id (id) - , _nickname (n) + , _image_nickname (in) + , _container_nickname (cn) , _isdcf_name (d) {} @@ -39,10 +40,12 @@ public: return _id; } - std::string nickname () const { - return _nickname; + std::string image_nickname () const { + return _image_nickname; } + std::string container_nickname () const; + std::string isdcf_name () const { return _isdcf_name; } @@ -55,16 +58,21 @@ public: static Ratio const * from_id (std::string i); static Ratio const * from_ratio (float r); static Ratio const * nearest_from_ratio (float r); + static std::vector all () { return _ratios; } + static std::vector containers (); + private: float _ratio; /** id for use in metadata */ std::string _id; - /** nickname (e.g. Flat, Scope) */ - std::string _nickname; + /** nickname when used to describe an image ratio (e.g. Flat, Scope) */ + std::string _image_nickname; + /** nickname when used to describe a container ratio */ + boost::optional _container_nickname; std::string _isdcf_name; static std::vector _ratios; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 8ccb921d0..30a463089 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -434,7 +434,7 @@ VideoContent::processing_description () const if (scaled != container_size) { d += String::compose ( _("\nPadded with black to fit container %1 (%2x%3)"), - film->container()->nickname (), + film->container()->container_nickname (), container_size.width, container_size.height ); diff --git a/src/lib/video_content_scale.cc b/src/lib/video_content_scale.cc index c86ba6ef8..636f0e807 100644 --- a/src/lib/video_content_scale.cc +++ b/src/lib/video_content_scale.cc @@ -95,7 +95,7 @@ string VideoContentScale::name () const { if (_ratio) { - return _ratio->nickname (); + return _ratio->image_nickname (); } if (_scale) { diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 5e8f8fc9f..b5123ad74 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -554,7 +554,7 @@ Writer::write_cover_sheet () string text = Config::instance()->cover_sheet (); boost::algorithm::replace_all (text, "$CPL_NAME", _film->name()); boost::algorithm::replace_all (text, "$TYPE", _film->dcp_content_type()->pretty_name()); - boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->nickname()); + boost::algorithm::replace_all (text, "$CONTAINER", _film->container()->container_nickname()); boost::algorithm::replace_all (text, "$AUDIO_LANGUAGE", _film->isdcf_metadata().audio_language); boost::algorithm::replace_all (text, "$SUBTITLE_LANGUAGE", _film->isdcf_metadata().subtitle_language); diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index cfd8b3eae..9572c7973 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -73,7 +73,7 @@ static void print_dump (shared_ptr film) { cout << film->dcp_name (true) << "\n" - << film->container()->nickname() << " at " << ((film->resolution() == RESOLUTION_2K) ? "2K" : "4K") << "\n" + << film->container()->container_nickname() << " at " << ((film->resolution() == RESOLUTION_2K) ? "2K" : "4K") << "\n" << (film->j2k_bandwidth() / 1000000) << "Mbit/s" << "\n" << "Output " << film->video_frame_rate() << "fps " << (film->three_d() ? "3D" : "2D") << " " << (film->audio_frame_rate() / 1000) << "kHz\n" << (film->interop() ? "Inter-Op" : "SMPTE") << " " << (film->encrypted() ? "encrypted" : "unencrypted") << "\n"; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 03dae5281..8dd6cab68 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -577,24 +577,22 @@ private: _isdcf_metadata_button->Bind (wxEVT_BUTTON, boost::bind (&DefaultsPage::edit_isdcf_metadata_clicked, this)); - vector ratios = Ratio::all (); - for (size_t i = 0; i < ratios.size(); ++i) { - _container->Append (std_to_wx (ratios[i]->nickname ())); + BOOST_FOREACH (Ratio const * i, Ratio::containers()) { + _container->Append (std_to_wx(i->container_nickname())); } _container->Bind (wxEVT_CHOICE, boost::bind (&DefaultsPage::container_changed, this)); _scale_to->Append (_("Guess from content")); - for (size_t i = 0; i < ratios.size(); ++i) { - _scale_to->Append (std_to_wx (ratios[i]->nickname ())); + BOOST_FOREACH (Ratio const * i, Ratio::all()) { + _scale_to->Append (std_to_wx(i->image_nickname())); } _scale_to->Bind (wxEVT_CHOICE, boost::bind (&DefaultsPage::scale_to_changed, this)); - vector const ct = DCPContentType::all (); - for (size_t i = 0; i < ct.size(); ++i) { - _dcp_content_type->Append (std_to_wx (ct[i]->pretty_name ())); + BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) { + _dcp_content_type->Append (std_to_wx (i->pretty_name ())); } setup_audio_channels_choice (_dcp_audio_channels, 2); diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 2888bfb66..91ffe365f 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -175,9 +175,8 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr film) _standard->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::standard_changed, this)); _upload_after_make_dcp->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::upload_after_make_dcp_changed, this)); - vector const ct = DCPContentType::all (); - for (vector::const_iterator i = ct.begin(); i != ct.end(); ++i) { - _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); + BOOST_FOREACH (DCPContentType const * i, DCPContentType::all()) { + _dcp_content_type->Append (std_to_wx (i->pretty_name ())); } _reel_type->Append (_("Single reel")); @@ -445,7 +444,7 @@ void DCPPanel::setup_container () { int n = 0; - vector ratios = Ratio::all (); + vector ratios = Ratio::containers (); vector::iterator i = ratios.begin (); while (i != ratios.end() && *i != _film->container ()) { ++i; @@ -474,7 +473,7 @@ DCPPanel::container_changed () int const n = _container->GetSelection (); if (n >= 0) { - vector ratios = Ratio::all (); + vector ratios = Ratio::containers (); DCPOMATIC_ASSERT (n < int (ratios.size())); _film->set_container (ratios[n]); } @@ -653,6 +652,11 @@ DCPPanel::make_video_panel () ++r; } + add_label_to_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0)); + _resolution = new wxChoice (panel, wxID_ANY); + grid->Add (_resolution, wxGBPosition (r, 1)); + ++r; + add_label_to_sizer (grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0)); { _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL); @@ -671,11 +675,6 @@ DCPPanel::make_video_panel () grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2)); ++r; - add_label_to_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0)); - _resolution = new wxChoice (panel, wxID_ANY); - grid->Add (_resolution, wxGBPosition (r, 1)); - ++r; - { add_label_to_sizer (grid, panel, _("JPEG2000 bandwidth\nfor newly-encoded data"), true, wxGBPosition (r, 0)); wxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -696,14 +695,12 @@ DCPPanel::make_video_panel () _resolution->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::resolution_changed, this)); _three_d->Bind (wxEVT_CHECKBOX, boost::bind (&DCPPanel::three_d_changed, this)); - vector const ratio = Ratio::all (); - for (vector::const_iterator i = ratio.begin(); i != ratio.end(); ++i) { - _container->Append (std_to_wx ((*i)->nickname ())); + BOOST_FOREACH (Ratio const * i, Ratio::containers()) { + _container->Append (std_to_wx(i->container_nickname())); } - list const dfr = Config::instance()->allowed_dcp_frame_rates (); - for (list::const_iterator i = dfr.begin(); i != dfr.end(); ++i) { - _frame_rate_choice->Append (std_to_wx (boost::lexical_cast (*i))); + BOOST_FOREACH (int i, Config::instance()->allowed_dcp_frame_rates()) { + _frame_rate_choice->Append (std_to_wx (boost::lexical_cast (i))); } _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000); diff --git a/src/wx/dcp_panel.h b/src/wx/dcp_panel.h index 9209d3f9b..f2e0455c9 100644 --- a/src/wx/dcp_panel.h +++ b/src/wx/dcp_panel.h @@ -33,8 +33,8 @@ class wxSpinCtrl; class wxSizer; class AudioDialog; - class Film; +class Ratio; class DCPPanel : public boost::noncopyable {