diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-05-17 15:52:39 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-19 23:07:52 +0200 |
| commit | a6a6d8a7a1c4c59bac9de6fa8f4cd879ebeef55d (patch) | |
| tree | ce23c7951554df079f09259dd1a33f1c0c210151 /src | |
| parent | e9627c2ac61551e3598601805d12938479ad3dff (diff) | |
Generalise SMPTE Bv2.0 limitation to also support SMPTE A.smpte-a
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/config.cc | 15 | ||||
| -rw-r--r-- | src/lib/config.h | 12 | ||||
| -rw-r--r-- | src/lib/film.cc | 27 | ||||
| -rw-r--r-- | src/lib/film.h | 9 | ||||
| -rw-r--r-- | src/lib/film_property.h | 2 | ||||
| -rw-r--r-- | src/lib/reel_writer.cc | 4 | ||||
| -rw-r--r-- | src/lib/smpte_flavour.cc | 56 | ||||
| -rw-r--r-- | src/lib/smpte_flavour.h | 27 | ||||
| -rw-r--r-- | src/lib/writer.cc | 2 | ||||
| -rw-r--r-- | src/lib/wscript | 1 | ||||
| -rw-r--r-- | src/wx/dcp_panel.cc | 40 | ||||
| -rw-r--r-- | src/wx/full_config_dialog.cc | 12 |
12 files changed, 162 insertions, 45 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 384db5cde..9f9416819 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -205,7 +205,7 @@ Config::set_defaults () _default_kdm_duration = RoughDuration(1, RoughDuration::Unit::WEEKS); _auto_crop_threshold = 0.1; _last_release_notes_version = boost::none; - _allow_smpte_bv20 = false; + _allow_smpte_flavours = false; _isdcf_name_part_length = 14; _allowed_dcp_frame_rates.clear (); @@ -639,7 +639,12 @@ try } } - _allow_smpte_bv20 = f.optional_bool_child("AllowSMPTEBv20").get_value_or(false); + if (auto old = f.optional_bool_child("AllowSMPTEBv20")) { + _allow_smpte_flavours = *old; + } else { + _allow_smpte_flavours = f.optional_bool_child("AllowSMPTEFlavours").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")); @@ -1123,8 +1128,8 @@ Config::write_config () const _default_add_file_location == DefaultAddFileLocation::SAME_AS_LAST_TIME ? "last" : "project" ); - /* [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] AllowSMPTEFlavours 1 to allow the user to choose SMPTE A or Bv2.0 only as a standard, otherwise 0 */ + root->add_child("AllowSMPTEFlavours")->add_child_text(_allow_smpte_flavours ? "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)); @@ -1659,7 +1664,7 @@ Config::load_from_zip(boost::filesystem::path zip_file) changed(Property::SHOW_EXPERIMENTAL_AUDIO_PROCESSORS); changed(Property::AUDIO_MAPPING); changed(Property::AUTO_CROP_THRESHOLD); - changed(Property::ALLOW_SMPTE_BV20); + changed(Property::ALLOW_SMPTE_FLAVOURS); changed(Property::ISDCF_NAME_PART_LENGTH); changed(Property::OTHER); } diff --git a/src/lib/config.h b/src/lib/config.h index f3d080b0b..1c1c6e061 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -95,7 +95,7 @@ public: SHOW_EXPERIMENTAL_AUDIO_PROCESSORS, AUDIO_MAPPING, AUTO_CROP_THRESHOLD, - ALLOW_SMPTE_BV20, + ALLOW_SMPTE_FLAVOURS, ISDCF_NAME_PART_LENGTH, OTHER }; @@ -617,8 +617,8 @@ public: return _default_add_file_location; } - bool allow_smpte_bv20() const { - return _allow_smpte_bv20; + bool allow_smpte_flavours() const { + return _allow_smpte_flavours; } int isdcf_name_part_length() const { @@ -1198,8 +1198,8 @@ public: maybe_set(_default_add_file_location, location); } - void set_allow_smpte_bv20(bool allow) { - maybe_set(_allow_smpte_bv20, allow, ALLOW_SMPTE_BV20); + void set_allow_smpte_flavours(bool allow) { + maybe_set(_allow_smpte_flavours, allow, ALLOW_SMPTE_FLAVOURS); } void set_isdcf_name_part_length(int length) { @@ -1444,7 +1444,7 @@ private: boost::optional<int> _main_divider_sash_position; boost::optional<int> _main_content_divider_sash_position; DefaultAddFileLocation _default_add_file_location; - bool _allow_smpte_bv20; + bool _allow_smpte_flavours; int _isdcf_name_part_length; ExportConfig _export; diff --git a/src/lib/film.cc b/src/lib/film.cc index d9ab6e2a3..8a7e01aaf 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -167,7 +167,6 @@ Film::Film (optional<boost::filesystem::path> dir) , _three_d (false) , _sequence (true) , _interop (Config::instance()->default_interop ()) - , _limit_to_smpte_bv20(false) , _audio_processor (0) , _reel_type (ReelType::SINGLE) , _reel_length (2000000000) @@ -251,10 +250,16 @@ Film::video_identifier () const s += "_I"; } else { s += "_S"; - if (_limit_to_smpte_bv20) { + switch (_smpte_flavour) { + case dcp::SMPTEFlavour::A: + s += "_LA"; + break; + case dcp::SMPTEFlavour::BV20: s += "_L20"; - } else { + break; + case dcp::SMPTEFlavour::BV21: s += "_L21"; + break; } } @@ -403,7 +408,7 @@ Film::metadata (bool with_content_paths) const root->add_child("ThreeD")->add_child_text (_three_d ? "1" : "0"); root->add_child("Sequence")->add_child_text (_sequence ? "1" : "0"); root->add_child("Interop")->add_child_text (_interop ? "1" : "0"); - root->add_child("LimitToSMPTEBv20")->add_child_text(_limit_to_smpte_bv20 ? "1" : "0"); + root->add_child("SMPTEFlavour")->add_child_text(smpte_flavour_to_string(_smpte_flavour)); root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0"); root->add_child("Key")->add_child_text (_key.hex ()); root->add_child("ContextID")->add_child_text (_context_id); @@ -580,7 +585,13 @@ Film::read_metadata (optional<boost::filesystem::path> path) _three_d = f.bool_child ("ThreeD"); _interop = f.bool_child ("Interop"); - _limit_to_smpte_bv20 = f.optional_bool_child("LimitToSMPTEBv20").get_value_or(false); + + if (auto old = f.optional_bool_child("LimitToSMPTEBv20")) { + _smpte_flavour = dcp::SMPTEFlavour::BV20; + } else if (auto flavour = f.optional_string_child("SMPTEFlavour")) { + _smpte_flavour = string_to_smpte_flavour(*flavour); + } + _key = dcp::Key (f.string_child ("Key")); _context_id = f.optional_string_child("ContextID").get_value_or (dcp::make_uuid ()); @@ -1198,10 +1209,10 @@ Film::set_interop (bool i) void -Film::set_limit_to_smpte_bv20(bool limit) +Film::set_smpte_flavour(dcp::SMPTEFlavour flavour) { - FilmChangeSignaller ch(this, FilmProperty::LIMIT_TO_SMPTE_BV20); - _limit_to_smpte_bv20 = limit; + FilmChangeSignaller ch(this, FilmProperty::SMPTE_FLAVOUR); + _smpte_flavour = flavour; } diff --git a/src/lib/film.h b/src/lib/film.h index 43a41ad45..c3f69bd1c 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -37,6 +37,7 @@ #include "named_channel.h" #include "resolution.h" #include "signaller.h" +#include "smpte_flavour.h" #include "territory_type.h" #include "transcode_job.h" #include "types.h" @@ -275,8 +276,8 @@ public: return _interop; } - bool limit_to_smpte_bv20() const { - return _limit_to_smpte_bv20; + dcp::SMPTEFlavour smpte_flavour() const { + return _smpte_flavour; } AudioProcessor const * audio_processor () const { @@ -404,7 +405,7 @@ public: void set_isdcf_date_today (); void set_sequence (bool); void set_interop (bool); - void set_limit_to_smpte_bv20(bool); + void set_smpte_flavour(dcp::SMPTEFlavour flavour); void set_audio_processor (AudioProcessor const * processor); void set_reel_type (ReelType); void set_reel_length (int64_t); @@ -519,7 +520,7 @@ private: bool _three_d; bool _sequence; bool _interop; - bool _limit_to_smpte_bv20; + dcp::SMPTEFlavour _smpte_flavour = dcp::SMPTEFlavour::BV21; AudioProcessor const * _audio_processor; ReelType _reel_type; /** Desired reel length in bytes, if _reel_type == REELTYPE_BY_LENGTH */ diff --git a/src/lib/film_property.h b/src/lib/film_property.h index c23297965..863922674 100644 --- a/src/lib/film_property.h +++ b/src/lib/film_property.h @@ -47,7 +47,7 @@ enum class FilmProperty { THREE_D, SEQUENCE, INTEROP, - LIMIT_TO_SMPTE_BV20, + SMPTE_FLAVOUR, AUDIO_PROCESSOR, REEL_TYPE, REEL_LENGTH, diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 1b33cae85..37ef34c17 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -207,7 +207,7 @@ ReelWriter::ReelWriter ( film()->directory().get() / audio_asset_filename (_sound_asset, _reel_index, _reel_count, _content_summary), extra_active_channels, film()->contains_atmos_content() ? dcp::SoundAsset::AtmosSync::ENABLED : dcp::SoundAsset::AtmosSync::DISABLED, - film()->limit_to_smpte_bv20() ? dcp::SoundAsset::MCASubDescriptors::DISABLED : dcp::SoundAsset::MCASubDescriptors::ENABLED + film()->smpte_flavour() ); } @@ -759,7 +759,7 @@ ReelWriter::create_reel ( auto reel_picture_asset = create_reel_picture (reel, refs); duration = reel_picture_asset->actual_duration (); create_reel_sound (reel, refs); - if (!film()->interop()) { + if (!film()->interop() && film()->smpte_flavour() != dcp::SMPTEFlavour::A) { create_reel_markers(reel); } } diff --git a/src/lib/smpte_flavour.cc b/src/lib/smpte_flavour.cc new file mode 100644 index 000000000..f697af9e8 --- /dev/null +++ b/src/lib/smpte_flavour.cc @@ -0,0 +1,56 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "dcpomatic_assert.h" +#include "smpte_flavour.h" +#include <string> + + +dcp::SMPTEFlavour +string_to_smpte_flavour(std::string const& s) +{ + if (s == "a") { + return dcp::SMPTEFlavour::A; + } else if (s == "bv20") { + return dcp::SMPTEFlavour::BV20; + } else if (s == "bv21") { + return dcp::SMPTEFlavour::BV21; + } + + DCPOMATIC_ASSERT(false); +} + + +std::string +smpte_flavour_to_string(dcp::SMPTEFlavour f) +{ + switch (f) { + case dcp::SMPTEFlavour::A: + return "a"; + case dcp::SMPTEFlavour::BV20: + return "bv20"; + case dcp::SMPTEFlavour::BV21: + return "bv21"; + } + + DCPOMATIC_ASSERT(false); +} + diff --git a/src/lib/smpte_flavour.h b/src/lib/smpte_flavour.h new file mode 100644 index 000000000..94b40ae9a --- /dev/null +++ b/src/lib/smpte_flavour.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include <dcp/smpte_flavour.h> +#include <string> + + +dcp::SMPTEFlavour string_to_smpte_flavour(std::string const&); +std::string smpte_flavour_to_string(dcp::SMPTEFlavour); diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 7b9defd73..bb0f00cd6 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -712,7 +712,7 @@ Writer::finish (boost::filesystem::path output_dcp) dcp.set_creator(creator); dcp.set_annotation_text(film()->dcp_name()); - dcp.write_xml(signer, !film()->limit_to_smpte_bv20(), Config::instance()->dcp_metadata_filename_format()); + dcp.write_xml(signer, film()->smpte_flavour(), Config::instance()->dcp_metadata_filename_format()); LOG_GENERAL ( N_("Wrote %1 FULL, %2 FAKE, %3 REPEAT, %4 pushed to disk"), _full_written, _fake_written, _repeat_written, _pushed_to_disk diff --git a/src/lib/wscript b/src/lib/wscript index df06f0f9b..677c02ad3 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -175,6 +175,7 @@ sources = """ send_problem_report_job.cc server.cc shuffler.cc + smpte_flavour.cc spl.cc spl_entry.cc state.cc diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index f4ba74cde..7cd04f367 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -167,9 +167,12 @@ void DCPPanel::add_standards() { _standard->add(_("SMPTE"), N_("smpte")); - if (Config::instance()->allow_smpte_bv20() || (_film && _film->limit_to_smpte_bv20())) { + if (Config::instance()->allow_smpte_flavours() || (_film && _film->smpte_flavour() == dcp::SMPTEFlavour::BV20)) { _standard->add(_("SMPTE (Bv2.0 only)"), N_("smpte-bv20")); } + if (Config::instance()->allow_smpte_flavours() || (_film && _film->smpte_flavour() == dcp::SMPTEFlavour::A)) { + _standard->add(_("SMPTE (A only)"), N_("smpte-a")); + } _standard->add(_("Interop"), N_("interop")); _sizer->Layout(); } @@ -179,12 +182,21 @@ void DCPPanel::set_standard() { DCPOMATIC_ASSERT(_film); - DCPOMATIC_ASSERT(!_film->limit_to_smpte_bv20() || _standard->GetCount() == 3); if (_film->interop()) { checked_set(_standard, "interop"); } else { - checked_set(_standard, _film->limit_to_smpte_bv20() ? "smpte-bv20" : "smpte"); + switch (_film->smpte_flavour()) { + case dcp::SMPTEFlavour::A: + checked_set(_standard, "smpte-a"); + break; + case dcp::SMPTEFlavour::BV20: + checked_set(_standard, "smpte-bv20"); + break; + case dcp::SMPTEFlavour::BV21: + checked_set(_standard, "smpte"); + break; + } } } @@ -203,13 +215,16 @@ DCPPanel::standard_changed () if (*data == N_("interop")) { _film->set_interop(true); - _film->set_limit_to_smpte_bv20(false); + _film->set_smpte_flavour(dcp::SMPTEFlavour::BV21); } else if (*data == N_("smpte")) { _film->set_interop(false); - _film->set_limit_to_smpte_bv20(false); + _film->set_smpte_flavour(dcp::SMPTEFlavour::BV21); } else if (*data == N_("smpte-bv20")) { _film->set_interop(false); - _film->set_limit_to_smpte_bv20(true); + _film->set_smpte_flavour(dcp::SMPTEFlavour::BV20); + } else if (*data == N_("smpte-a")) { + _film->set_interop(false); + _film->set_smpte_flavour(dcp::SMPTEFlavour::A); } } @@ -476,10 +491,11 @@ DCPPanel::film_changed(FilmProperty p) case FilmProperty::INTEROP: set_standard(); setup_dcp_name (); - _markers->Enable (!_film->interop()); + setup_sensitivity(); break; - case FilmProperty::LIMIT_TO_SMPTE_BV20: + case FilmProperty::SMPTE_FLAVOUR: set_standard(); + setup_sensitivity(); break; case FilmProperty::AUDIO_PROCESSOR: if (_film->audio_processor()) { @@ -656,7 +672,7 @@ DCPPanel::set_film (shared_ptr<Film> film) film_changed(FilmProperty::REENCODE_J2K); film_changed(FilmProperty::AUDIO_LANGUAGE); film_changed(FilmProperty::AUDIO_FRAME_RATE); - film_changed(FilmProperty::LIMIT_TO_SMPTE_BV20); + film_changed(FilmProperty::SMPTE_FLAVOUR); set_general_sensitivity(static_cast<bool>(_film)); } @@ -683,7 +699,7 @@ DCPPanel::setup_sensitivity () _encrypted->Enable (_generally_sensitive); _reel_type->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio()); _reel_length->Enable (_generally_sensitive && _film && _film->reel_type() == ReelType::BY_LENGTH); - _markers->Enable (_generally_sensitive && _film && !_film->interop()); + _markers->Enable (_generally_sensitive && _film && !_film->interop() && _film->smpte_flavour() != dcp::SMPTEFlavour::A); _metadata->Enable (_generally_sensitive); _frame_rate_choice->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content()); _frame_rate_spin->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->contains_atmos_content()); @@ -781,12 +797,12 @@ DCPPanel::config_changed (Config::Property p) if (_film) { film_changed(FilmProperty::AUDIO_PROCESSOR); } - } else if (p == Config::ALLOW_SMPTE_BV20) { + } else if (p == Config::ALLOW_SMPTE_FLAVOURS) { _standard->Clear(); add_standards(); if (_film) { film_changed(FilmProperty::INTEROP); - film_changed(FilmProperty::LIMIT_TO_SMPTE_BV20); + film_changed(FilmProperty::SMPTE_FLAVOUR); } } else if (p == Config::ISDCF_NAME_PART_LENGTH) { setup_dcp_name(); diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index c1c36c4a4..8ded16226 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -1547,7 +1547,7 @@ private: checkbox(_("Allow creation of DCPs with 96kHz audio"), _allow_96khz_audio); checkbox(_("Allow mapping to all audio channels"), _use_all_audio_channels); - checkbox(_("Allow use of SMPTE Bv2.0"), _allow_smpte_bv20); + checkbox(_("Allow use of SMPTE flavours"), _allow_smpte_flavours); { add_label_to_sizer(table, _panel, _("ISDCF name part length"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); @@ -1563,7 +1563,7 @@ private: _allow_any_container->bind(&NonStandardPage::allow_any_container_changed, this); _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); + _allow_smpte_flavours->bind(&NonStandardPage::allow_smpte_flavours_changed, this); _isdcf_name_part_length->SetRange(1, 256); _isdcf_name_part_length->Bind(wxEVT_SPINCTRL, boost::bind(&NonStandardPage::isdcf_name_part_length_changed, this)); } @@ -1577,7 +1577,7 @@ private: checked_set(_allow_any_container, config->allow_any_container()); 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(_allow_smpte_flavours, config->allow_smpte_flavours()); checked_set(_isdcf_name_part_length, config->isdcf_name_part_length()); } @@ -1606,9 +1606,9 @@ private: Config::instance()->set_use_all_audio_channels(_use_all_audio_channels->GetValue()); } - void allow_smpte_bv20_changed() + void allow_smpte_flavours_changed() { - Config::instance()->set_allow_smpte_bv20(_allow_smpte_bv20->GetValue()); + Config::instance()->set_allow_smpte_flavours(_allow_smpte_flavours->GetValue()); } void isdcf_name_part_length_changed() @@ -1621,7 +1621,7 @@ private: CheckBox* _allow_any_container = nullptr; CheckBox* _allow_96khz_audio = nullptr; CheckBox* _use_all_audio_channels = nullptr; - CheckBox* _allow_smpte_bv20 = nullptr; + CheckBox* _allow_smpte_flavours = nullptr; wxSpinCtrl* _isdcf_name_part_length = nullptr; }; |
