Add advanced configuration option to allow any container ratio,
authorCarl Hetherington <cth@carlh.net>
Fri, 20 Jul 2018 14:20:56 +0000 (15:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 20 Jul 2018 14:20:56 +0000 (15:20 +0100)
specifically because the GDC SX-2001 will only play 25fps DCPs
with a 16:9 ratio (not Flat).

https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4470

ChangeLog
src/lib/config.cc
src/lib/config.h
src/lib/ratio.cc
src/wx/full_config_dialog.cc

index d13db7ca4d9136b80bd697f25b588375bbd9c8f6..58269eed37c986e895be8ec60d066594c00b84ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2018-07-20  Carl Hetherington  <cth@carlh.net>
 
+       * Advanced configuration option to allow any container ratio.
+
        * Support closed-caption creation (#725).
 
 2018-07-19  Carl Hetherington  <cth@carlh.net>
index 56ab16db7e0e72636cdbb8a343e6414bb317dd4b..7e2cdabf649970355fccdf0c81160f6aa692244b 100644 (file)
@@ -94,6 +94,7 @@ Config::set_defaults ()
        _tms_password = "";
        _cinema_sound_processor = CinemaSoundProcessor::from_id (N_("dolby_cp750"));
        _allow_any_dcp_frame_rate = false;
+       _allow_any_container = false;
        _language = optional<string> ();
        _default_still_length = 10;
        _default_container = Ratio::from_id ("185");
@@ -343,6 +344,7 @@ try
 
        _maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
        _allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate").get_value_or (false);
+       _allow_any_container = f.optional_bool_child ("AllowAnyContainer").get_value_or (false);
 
        _log_types = f.optional_number_child<int> ("LogTypes").get_value_or (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR);
        _analyse_ebur128 = f.optional_bool_child("AnalyseEBUR128").get_value_or (true);
@@ -677,6 +679,8 @@ Config::write_config () const
        root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert<string> (_maximum_j2k_bandwidth));
        /* [XML] AllowAnyDCPFrameRate 1 to allow users to specify any frame rate when creating DCPs, 0 to limit the GUI to standard rates */
        root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0");
+       /* [XML] AllowAnyContainer 1 to allow users to user any container ratio for their DCP, 0 to limit the GUI to standard containers */
+       root->add_child("AllowAnyContainer")->add_child_text (_allow_any_container ? "1" : "0");
        /* [XML] LogTypes Types of logging to write; a bitfield where 1 is general notes, 2 warnings, 4 errors, 8 debug information related
           to encoding, 16 debug information related to encoding, 32 debug information for timing purposes, 64 debug information related
           to sending email.
index 4c24e816bb80ed315c529bd897a1055f246ebb6c..dbe6a9c212b1042ab0e65ab4fd22d2b617b2f8a8 100644 (file)
@@ -148,6 +148,10 @@ public:
                return _allow_any_dcp_frame_rate;
        }
 
+       bool allow_any_container () const {
+               return _allow_any_container;
+       }
+
        ISDCFMetadata default_isdcf_metadata () const {
                return _default_isdcf_metadata;
        }
@@ -488,6 +492,10 @@ public:
                maybe_set (_allow_any_dcp_frame_rate, a);
        }
 
+       void set_allow_any_container (bool a) {
+               maybe_set (_allow_any_container, a);
+       }
+
        void set_default_isdcf_metadata (ISDCFMetadata d) {
                maybe_set (_default_isdcf_metadata, d);
        }
@@ -857,6 +865,11 @@ private:
        std::list<int> _allowed_dcp_frame_rates;
        /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
        bool _allow_any_dcp_frame_rate;
+       /** Allow any container ratio, not just the standard ones.  GDC SX-2001 will not play Flat
+           DCPs at 25fps but will play 16:9, so this is very useful for some users.
+           https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
+       */
+       bool _allow_any_container;
        /** Default ISDCF metadata for newly-created Films */
        ISDCFMetadata _default_isdcf_metadata;
        boost::optional<std::string> _language;
index eae12b061ca0dd04e9692d3cd85eb5e28dd00dd5..8a86ced59088ab3cbb50ba5fbeefe3768da353e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -20,6 +20,7 @@
 
 #include "ratio.h"
 #include "util.h"
+#include "config.h"
 #include <dcp/types.h>
 #include <cfloat>
 
@@ -102,6 +103,10 @@ Ratio::nearest_from_ratio (float r)
 vector<Ratio const *>
 Ratio::containers ()
 {
+       if (Config::instance()->allow_any_container()) {
+               return _ratios;
+       }
+
        vector<Ratio const *> r;
        r.push_back (Ratio::from_id ("185"));
        r.push_back (Ratio::from_id ("239"));
@@ -112,6 +117,12 @@ Ratio::containers ()
 string
 Ratio::container_nickname () const
 {
-       DCPOMATIC_ASSERT (_container_nickname);
+       if (!_container_nickname) {
+               /* Fall back to the image nickname; this just for when non-standard container
+                  ratios are enabled.
+               */
+               return _image_nickname;
+       }
+
        return *_container_nickname;
 }
index 1ea07404aa989108cdd40207f37553ead8a5f045..52397361830036d394fb30e0e95f81d51605a982 100644 (file)
@@ -1155,6 +1155,7 @@ public:
                : StockPage (Kind_Advanced, panel_size, border)
                , _maximum_j2k_bandwidth (0)
                , _allow_any_dcp_frame_rate (0)
+               , _allow_any_container (0)
                , _only_servers_encode (0)
                , _log_general (0)
                , _log_warning (0)
@@ -1196,6 +1197,17 @@ private:
                table->Add (_allow_any_dcp_frame_rate, 1, wxEXPAND | wxALL);
                table->AddSpacer (0);
 
+               _allow_any_container = new wxCheckBox (_panel, wxID_ANY, _("Allow non-standard container ratios"));
+               table->Add (_allow_any_container, 1, wxEXPAND | wxALL);
+               table->AddSpacer (0);
+
+               wxStaticText* restart = add_label_to_sizer (table, _panel, _("(restart DCP-o-matic to see all ratios)"), false);
+               wxFont font = restart->GetFont();
+               font.SetStyle (wxFONTSTYLE_ITALIC);
+               font.SetPointSize (font.GetPointSize() - 1);
+               restart->SetFont (font);
+               table->AddSpacer (0);
+
                _only_servers_encode = new wxCheckBox (_panel, wxID_ANY, _("Only servers encode"));
                table->Add (_only_servers_encode, 1, wxEXPAND | wxALL);
                table->AddSpacer (0);
@@ -1268,6 +1280,7 @@ private:
                _maximum_j2k_bandwidth->SetRange (1, 1000);
                _maximum_j2k_bandwidth->Bind (wxEVT_SPINCTRL, boost::bind (&AdvancedPage::maximum_j2k_bandwidth_changed, this));
                _allow_any_dcp_frame_rate->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_dcp_frame_rate_changed, this));
+               _allow_any_container->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_container_changed, this));
                _only_servers_encode->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::only_servers_encode_changed, this));
                _frames_in_memory_multiplier->Bind (wxEVT_SPINCTRL, boost::bind(&AdvancedPage::frames_in_memory_multiplier_changed, this));
                _dcp_metadata_filename_format->Changed.connect (boost::bind (&AdvancedPage::dcp_metadata_filename_format_changed, this));
@@ -1290,6 +1303,7 @@ private:
 
                checked_set (_maximum_j2k_bandwidth, config->maximum_j2k_bandwidth() / 1000000);
                checked_set (_allow_any_dcp_frame_rate, config->allow_any_dcp_frame_rate ());
+               checked_set (_allow_any_container, config->allow_any_container ());
                checked_set (_only_servers_encode, config->only_servers_encode ());
                checked_set (_log_general, config->log_types() & LogEntry::TYPE_GENERAL);
                checked_set (_log_warning, config->log_types() & LogEntry::TYPE_WARNING);
@@ -1319,6 +1333,11 @@ private:
                Config::instance()->set_allow_any_dcp_frame_rate (_allow_any_dcp_frame_rate->GetValue ());
        }
 
+       void allow_any_container_changed ()
+       {
+               Config::instance()->set_allow_any_container (_allow_any_container->GetValue ());
+       }
+
        void only_servers_encode_changed ()
        {
                Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue ());
@@ -1371,6 +1390,7 @@ private:
        wxSpinCtrl* _maximum_j2k_bandwidth;
        wxSpinCtrl* _frames_in_memory_multiplier;
        wxCheckBox* _allow_any_dcp_frame_rate;
+       wxCheckBox* _allow_any_container;
        wxCheckBox* _only_servers_encode;
        NameFormatEditor* _dcp_metadata_filename_format;
        NameFormatEditor* _dcp_asset_filename_format;