Add config option to allow long ISDCF name parts.
authorCarl Hetherington <cth@carlh.net>
Fri, 23 Jun 2023 22:54:28 +0000 (00:54 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 23 Jun 2023 22:54:28 +0000 (00:54 +0200)
src/lib/config.cc
src/lib/config.h
src/lib/film.cc
src/wx/dcp_panel.cc
src/wx/full_config_dialog.cc

index 6a61aae46318b8376fe3b738bee31eacc168418a..3366a2bbc018015ca119fee015aa3f0134747329 100644 (file)
@@ -199,6 +199,7 @@ Config::set_defaults ()
        _auto_crop_threshold = 0.1;
        _last_release_notes_version = boost::none;
        _allow_smpte_bv20 = false;
+       _isdcf_name_part_length = 14;
 
        _allowed_dcp_frame_rates.clear ();
        _allowed_dcp_frame_rates.push_back (24);
@@ -631,6 +632,7 @@ try
        }
 
        _allow_smpte_bv20 = f.optional_bool_child("AllowSMPTEBv20").get_value_or(false);
+       _isdcf_name_part_length = f.optional_number_child<int>("ISDCFNamePartLength").get_value_or(14);
 
        _export.read(f.optional_node_child("Export"));
 }
@@ -1115,6 +1117,8 @@ Config::write_config () const
 
        /* [XML] AllowSMPTEBv20 1 to allow the user to choose SMPTE (Bv2.0 only) as a standard, otherwise 0 */
        root->add_child("AllowSMPTEBv20")->add_child_text(_allow_smpte_bv20 ? "1" : "0");
+       /* [XML] ISDCFNamePartLength Maximum length of the "name" part of an ISDCF name, which should be 14 according to the standard */
+       root->add_child("ISDCFNamePartLength")->add_child_text(raw_convert<string>(_isdcf_name_part_length));
 
        _export.write(root->add_child("Export"));
 
index 91d779b7ad7b0bcca7b6c06c25542c9fcec408d0..0a332bcbb74abdc287153077a86601fe4d1cf00e 100644 (file)
@@ -94,6 +94,7 @@ public:
                AUDIO_MAPPING,
                AUTO_CROP_THRESHOLD,
                ALLOW_SMPTE_BV20,
+               ISDCF_NAME_PART_LENGTH,
                OTHER
        };
 
@@ -617,6 +618,10 @@ public:
                return _allow_smpte_bv20;
        }
 
+       int isdcf_name_part_length() const {
+               return _isdcf_name_part_length;
+       }
+
        /* SET (mostly) */
 
        void set_master_encoding_threads (int n) {
@@ -1194,6 +1199,10 @@ public:
                maybe_set(_allow_smpte_bv20, allow, ALLOW_SMPTE_BV20);
        }
 
+       void set_isdcf_name_part_length(int length) {
+               maybe_set(_isdcf_name_part_length, length, ISDCF_NAME_PART_LENGTH);
+       }
+
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
        /** Emitted if read() failed on an existing Config file.  There is nothing
@@ -1432,6 +1441,7 @@ private:
        boost::optional<int> _main_content_divider_sash_position;
        DefaultAddFileLocation _default_add_file_location;
        bool _allow_smpte_bv20;
+       int _isdcf_name_part_length;
 
        ExportConfig _export;
 
index ff0569aa502e8e1152e74efdb838c9c170e223d4..4ed1f0f8bd3079572fda3f9850bcd8378d2c8d28 100644 (file)
@@ -863,7 +863,7 @@ Film::isdcf_name (bool if_created_now) const
                }
        }
 
-       fixed_name = fixed_name.substr(0, 14);
+       fixed_name = fixed_name.substr(0, Config::instance()->isdcf_name_part_length());
 
        isdcf_name += fixed_name;
 
index 6574bcdb314397c14f388397fc218857b9200671..4da8abe36ed1bdd3c33665ad06319c3a71c54be1 100644 (file)
@@ -780,6 +780,8 @@ DCPPanel::config_changed (Config::Property p)
                        film_changed(Film::Property::INTEROP);
                        film_changed(Film::Property::LIMIT_TO_SMPTE_BV20);
                }
+       } else if (p == Config::ISDCF_NAME_PART_LENGTH) {
+               setup_dcp_name();
        }
 }
 
index ec098ad3226d4cc0e687e2bdc181c5ba95f99654..c61c75eced8660635dfd288ef95138fa8c29ec02 100644 (file)
@@ -1517,7 +1517,7 @@ private:
 
                {
                        add_label_to_sizer(table, _panel, _("Maximum JPEG2000 bandwidth"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
-                       wxBoxSizer* s = new wxBoxSizer(wxHORIZONTAL);
+                       auto s = new wxBoxSizer(wxHORIZONTAL);
                        _maximum_j2k_bandwidth = new wxSpinCtrl(_panel);
                        s->Add(_maximum_j2k_bandwidth, 1);
                        add_label_to_sizer(s, _panel, _("Mbit/s"), false, 0, wxLEFT | wxALIGN_CENTRE_VERTICAL);
@@ -1546,6 +1546,14 @@ private:
                checkbox(_("Allow mapping to all audio channels"), _use_all_audio_channels);
                checkbox(_("Allow use of SMPTE Bv2.0"), _allow_smpte_bv20);
 
+               {
+                       add_label_to_sizer(table, _panel, _("ISDCF name part length"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+                       auto s = new wxBoxSizer(wxHORIZONTAL);
+                       _isdcf_name_part_length = new wxSpinCtrl(_panel);
+                       s->Add(_isdcf_name_part_length, 1);
+                       table->Add(s, 1);
+               }
+
                _maximum_j2k_bandwidth->SetRange(1, 1000);
                _maximum_j2k_bandwidth->Bind(wxEVT_SPINCTRL, boost::bind(&NonStandardPage::maximum_j2k_bandwidth_changed, this));
                _allow_any_dcp_frame_rate->bind(&NonStandardPage::allow_any_dcp_frame_rate_changed, this);
@@ -1553,6 +1561,8 @@ private:
                _allow_96khz_audio->bind(&NonStandardPage::allow_96khz_audio_changed, this);
                _use_all_audio_channels->bind(&NonStandardPage::use_all_channels_changed, this);
                _allow_smpte_bv20->bind(&NonStandardPage::allow_smpte_bv20_changed, this);
+               _isdcf_name_part_length->SetRange(14, 256);
+               _isdcf_name_part_length->Bind(wxEVT_SPINCTRL, boost::bind(&NonStandardPage::isdcf_name_part_length_changed, this));
        }
 
        void config_changed() override
@@ -1565,6 +1575,7 @@ private:
                checked_set(_allow_96khz_audio, config->allow_96khz_audio());
                checked_set(_use_all_audio_channels, config->use_all_audio_channels());
                checked_set(_allow_smpte_bv20, config->allow_smpte_bv20());
+               checked_set(_isdcf_name_part_length, config->isdcf_name_part_length());
        }
 
        void maximum_j2k_bandwidth_changed()
@@ -1597,12 +1608,18 @@ private:
                Config::instance()->set_allow_smpte_bv20(_allow_smpte_bv20->GetValue());
        }
 
+       void isdcf_name_part_length_changed()
+       {
+               Config::instance()->set_isdcf_name_part_length(_isdcf_name_part_length->GetValue());
+       }
+
        wxSpinCtrl* _maximum_j2k_bandwidth = nullptr;
        CheckBox* _allow_any_dcp_frame_rate = nullptr;
        CheckBox* _allow_any_container = nullptr;
        CheckBox* _allow_96khz_audio = nullptr;
        CheckBox* _use_all_audio_channels = nullptr;
        CheckBox* _allow_smpte_bv20 = nullptr;
+       wxSpinCtrl* _isdcf_name_part_length = nullptr;
 };