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/lib | |
| parent | e9627c2ac61551e3598601805d12938479ad3dff (diff) | |
Generalise SMPTE Bv2.0 limitation to also support SMPTE A.smpte-a
Diffstat (limited to 'src/lib')
| -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 |
10 files changed, 128 insertions, 27 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 |
