diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-04 20:55:08 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-04-04 20:55:08 +0200 |
| commit | 0aabb6497979e2df9731f8753645149d85c02bc8 (patch) | |
| tree | 93b536f42f019b516e2ddd7eaf5c8291d08580cd /src/lib | |
| parent | 8e1b0dfe3103867a749ff51156e3ed6547f298a0 (diff) | |
| parent | 1c1cf56ec8982690afa5d9463d3bb76bc9c4081d (diff) | |
Remove the ISDCF metadata dialogue box (#1929).
We obtain its information from elsewhere: mostly the Interop/SMPTE
metadata dialogue box.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 14 | ||||
| -rw-r--r-- | src/lib/config.h | 11 | ||||
| -rw-r--r-- | src/lib/film.cc | 126 | ||||
| -rw-r--r-- | src/lib/film.h | 44 | ||||
| -rw-r--r-- | src/lib/isdcf_metadata.cc | 83 | ||||
| -rw-r--r-- | src/lib/isdcf_metadata.h | 68 | ||||
| -rw-r--r-- | src/lib/util.cc | 9 | ||||
| -rw-r--r-- | src/lib/util.h | 1 | ||||
| -rw-r--r-- | src/lib/wscript | 1 |
9 files changed, 134 insertions, 223 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 0dcc84117..6ec3b0588 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -309,12 +309,6 @@ try _dcp_product_version = f.optional_string_child("DCPProductVersion").get_value_or(""); _dcp_j2k_comment = f.optional_string_child("DCPJ2KComment").get_value_or(""); - if (version && version.get() >= 2) { - _default_isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata")); - } else { - _default_isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata")); - } - _default_still_length = f.optional_number_child<int>("DefaultStillLength").get_value_or (10); _default_j2k_bandwidth = f.optional_number_child<int>("DefaultJ2KBandwidth").get_value_or (200000000); _default_audio_delay = f.optional_number_child<int>("DefaultAudioDelay").get_value_or (0); @@ -688,14 +682,6 @@ Config::write_config () const /* [XML] UploadAfterMakeDCP 1 to upload to a TMS after making a DCP, 0 for no upload. */ root->add_child("UploadAfterMakeDCP")->add_child_text (_upload_after_make_dcp ? "1" : "0"); - /* [XML] ISDCFMetadata Default ISDCF metadata to use for new films; child tags are <code><ContentVersion></code>, - <code><AudioLanguage></code>, <code><SubtitleLanguage></code>, <code><Territory></code>, - <code><Rating></code>, <code><Studio></code>, <code><Facility></code>, <code><TempVersion></code>, - <code><PreRelease></code>, <code><RedBand></code>, <code><Chain></code>, <code><TwoDVersionOFThreeD></code>, - <code><MasteredLuminance></code>. - */ - _default_isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata")); - /* [XML] DefaultStillLength Default length (in seconds) for still images in new films. */ root->add_child("DefaultStillLength")->add_child_text (raw_convert<string> (_default_still_length)); /* [XML] DefaultJ2KBandwidth Default bitrate (in bits per second) for JPEG2000 data in new films. */ diff --git a/src/lib/config.h b/src/lib/config.h index 0a48a00e1..eb8f88da9 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -25,7 +25,6 @@ #ifndef DCPOMATIC_CONFIG_H #define DCPOMATIC_CONFIG_H -#include "isdcf_metadata.h" #include "types.h" #include "state.h" #include "edid.h" @@ -166,10 +165,6 @@ public: return _show_experimental_audio_processors; } - ISDCFMetadata default_isdcf_metadata () const { - return _default_isdcf_metadata; - } - boost::optional<std::string> language () const { return _language; } @@ -636,10 +631,6 @@ public: maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS); } - void set_default_isdcf_metadata (ISDCFMetadata d) { - maybe_set (_default_isdcf_metadata, d); - } - void set_language (std::string l) { if (_language && _language.get() == l) { return; @@ -1174,8 +1165,6 @@ private: bool _allow_any_container; /** Offer the upmixers in the audio processor settings */ bool _show_experimental_audio_processors; - /** Default ISDCF metadata for newly-created Films */ - ISDCFMetadata _default_isdcf_metadata; boost::optional<std::string> _language; /** Default length of still image content (seconds) */ int _default_still_length; diff --git a/src/lib/film.cc b/src/lib/film.cc index 7dd0ff6f1..a9ac82b5a 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -155,7 +155,6 @@ Film::Film (optional<boost::filesystem::path> dir) , _encrypted (false) , _context_id (dcp::make_uuid ()) , _j2k_bandwidth (Config::instance()->default_j2k_bandwidth ()) - , _isdcf_metadata (Config::instance()->default_isdcf_metadata ()) , _video_frame_rate (24) , _audio_channels (Config::instance()->default_dcp_audio_channels ()) , _three_d (false) @@ -446,7 +445,6 @@ Film::metadata (bool with_content_paths) const root->add_child("Resolution")->add_child_text (resolution_to_string (_resolution)); root->add_child("J2KBandwidth")->add_child_text (raw_convert<string> (_j2k_bandwidth)); - _isdcf_metadata.as_xml (root->add_child ("ISDCFMetadata")); root->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate)); root->add_child("ISDCFDate")->add_child_text (boost::gregorian::to_iso_string (_isdcf_date)); root->add_child("AudioChannels")->add_child_text (raw_convert<string> (_audio_channels)); @@ -490,6 +488,13 @@ Film::metadata (bool with_content_paths) const if (_facility) { root->add_child("Facility")->add_child_text(*_facility); } + if (_studio) { + root->add_child("Studio")->add_child_text(*_studio); + } + root->add_child("TempVersion")->add_child_text(_temp_version ? "1" : "0"); + root->add_child("PreRelease")->add_child_text(_pre_release ? "1" : "0"); + root->add_child("RedBand")->add_child_text(_red_band ? "1" : "0"); + root->add_child("TwoDVersionOfThreeD")->add_child_text(_two_d_version_of_three_d ? "1" : "0"); if (_luminance) { root->add_child("LuminanceValue")->add_child_text(raw_convert<string>(_luminance->value())); root->add_child("LuminanceUnit")->add_child_text(dcp::Luminance::unit_to_string(_luminance->unit())); @@ -565,11 +570,9 @@ Film::read_metadata (optional<boost::filesystem::path> path) _name = f.string_child ("Name"); if (_state_version >= 9) { _use_isdcf_name = f.bool_child ("UseISDCFName"); - _isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata")); _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("ISDCFDate")); } else { _use_isdcf_name = f.bool_child ("UseDCIName"); - _isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata")); _isdcf_date = boost::gregorian::from_undelimited_string (f.string_child ("DCIDate")); } @@ -666,6 +669,11 @@ Film::read_metadata (optional<boost::filesystem::path> path) _chain = f.optional_string_child("Chain"); _distributor = f.optional_string_child("Distributor"); _facility = f.optional_string_child("Facility"); + _studio = f.optional_string_child("Studio"); + _temp_version = f.optional_bool_child("TempVersion").get_value_or(false); + _pre_release = f.optional_bool_child("PreRelease").get_value_or(false); + _red_band = f.optional_bool_child("RedBand").get_value_or(false); + _two_d_version_of_three_d = f.optional_bool_child("TwoDVersionOfThreeD").get_value_or(false); auto value = f.optional_number_child<float>("LuminanceValue"); auto unit = f.optional_string_child("LuminanceUnit"); @@ -846,37 +854,49 @@ Film::isdcf_name (bool if_created_now) const if (dcp_content_type()) { d += "_" + dcp_content_type()->isdcf_name(); - d += "-" + raw_convert<string>(isdcf_metadata().content_version); + string version = "1"; + if (_interop) { + if (!_content_versions.empty()) { + auto cv = _content_versions[0]; + if (!cv.empty() && std::all_of(cv.begin(), cv.end(), isdigit)) { + version = cv; + } + } + } else { + version = dcp::raw_convert<string>(_version_number); + } + d += "-" + version; } - auto const dm = isdcf_metadata (); - - if (dm.temp_version) { + if (_temp_version) { d += "-Temp"; } - if (dm.pre_release) { + if (_pre_release) { d += "-Pre"; } - if (dm.red_band) { + if (_red_band) { d += "-RedBand"; } - if (!dm.chain.empty ()) { - d += "-" + dm.chain; + if (_chain && !_chain->empty()) { + d += "-" + *_chain; } if (three_d ()) { d += "-3D"; } - if (dm.two_d_version_of_three_d) { + if (_two_d_version_of_three_d) { d += "-2D"; } - if (!dm.mastered_luminance.empty ()) { - d += "-" + dm.mastered_luminance; + if (_luminance) { + auto fl = _luminance->value_in_foot_lamberts(); + char buffer[64]; + snprintf (buffer, sizeof(buffer), "%.1f", fl); + d += String::compose("-%1fl", buffer); } if (video_frame_rate() != 24) { @@ -908,9 +928,8 @@ Film::isdcf_name (bool if_created_now) const auto audio_langs = audio_languages(); auto audio_language = (audio_langs.empty() || !audio_langs.front().language()) ? "XX" : audio_langs.front().language()->subtag(); - transform (audio_language.begin(), audio_language.end(), audio_language.begin(), ::toupper); - d += "_" + audio_language; + d += "_" + to_upper (audio_language); /* I'm not clear on the precise details of the convention for CCAP labelling; for now I'm just appending -CCAP if we have any closed captions. @@ -934,7 +953,7 @@ Film::isdcf_name (bool if_created_now) const if (burnt_in) { transform (lang.begin(), lang.end(), lang.begin(), ::tolower); } else { - transform (lang.begin(), lang.end(), lang.begin(), ::toupper); + lang = to_upper (lang); } d += "-" + lang; @@ -946,12 +965,13 @@ Film::isdcf_name (bool if_created_now) const d += "-XX"; } - if (!dm.territory.empty ()) { - d += "_" + dm.territory; - if (dm.rating.empty ()) { + if (_release_territory) { + auto territory = _release_territory->subtag(); + d += "_" + to_upper (territory); + if (_ratings.empty ()) { d += "-NR"; } else { - d += "-" + dm.rating; + d += "-" + _ratings[0].label; } } @@ -975,8 +995,8 @@ Film::isdcf_name (bool if_created_now) const d += "_" + resolution_to_string (_resolution); - if (!dm.studio.empty ()) { - d += "_" + dm.studio; + if (_studio && _studio->length() >= 2) { + d += "_" + to_upper (_studio->substr(0, 4)); } if (if_created_now) { @@ -985,8 +1005,8 @@ Film::isdcf_name (bool if_created_now) const d += "_" + boost::gregorian::to_iso_string (_isdcf_date); } - if (!dm.facility.empty ()) { - d += "_" + dm.facility; + if (_facility && _facility->length() >= 3) { + d += "_" + to_upper(_facility->substr(0, 3)); } if (_interop) { @@ -1106,13 +1126,6 @@ Film::set_j2k_bandwidth (int b) _j2k_bandwidth = b; } -void -Film::set_isdcf_metadata (ISDCFMetadata m) -{ - FilmChangeSignaller ch (this, Property::ISDCF_METADATA); - _isdcf_metadata = m; -} - /** @param f New frame rate. * @param user_explicit true if this comes from a direct user instruction, false if it is from * DCP-o-matic being helpful. @@ -1140,9 +1153,8 @@ Film::set_three_d (bool t) FilmChangeSignaller ch (this, Property::THREE_D); _three_d = t; - if (_three_d && _isdcf_metadata.two_d_version_of_three_d) { - FilmChangeSignaller ch (this, Property::ISDCF_METADATA); - _isdcf_metadata.two_d_version_of_three_d = false; + if (_three_d && _two_d_version_of_three_d) { + set_two_d_version_of_three_d (false); } } @@ -1867,7 +1879,6 @@ Film::use_template (string name) _audio_processor = _template_film->_audio_processor; _reel_type = _template_film->_reel_type; _reel_length = _template_film->_reel_length; - _isdcf_metadata = _template_film->_isdcf_metadata; } pair<double, double> @@ -2050,6 +2061,14 @@ Film::set_facility (optional<string> f) } +void +Film::set_studio (optional<string> s) +{ + FilmChangeSignaller ch (this, Property::STUDIO); + _studio = s; +} + + optional<DCPTime> Film::marker (dcp::Marker type) const { @@ -2107,3 +2126,36 @@ Film::add_ffoc_lfoc (Markers& markers) const markers[dcp::Marker::LFOC] = length() - DCPTime::from_frames(1, video_frame_rate()); } } + + +void +Film::set_temp_version (bool t) +{ + FilmChangeSignaller ch (this, Property::TEMP_VERSION); + _temp_version = t; +} + + +void +Film::set_pre_release (bool p) +{ + FilmChangeSignaller ch (this, Property::PRE_RELEASE); + _pre_release = p; +} + + +void +Film::set_red_band (bool r) +{ + FilmChangeSignaller ch (this, Property::RED_BAND); + _red_band = r; +} + + +void +Film::set_two_d_version_of_three_d (bool t) +{ + FilmChangeSignaller ch (this, Property::TWO_D_VERSION_OF_THREE_D); + _two_d_version_of_three_d = t; +} + diff --git a/src/lib/film.h b/src/lib/film.h index 6b50bba5e..5fc56acfb 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -29,7 +29,6 @@ #include "change_signaller.h" #include "dcp_text_track.h" #include "frame_rate_change.h" -#include "isdcf_metadata.h" #include "signaller.h" #include "types.h" #include "util.h" @@ -217,7 +216,6 @@ public: RESOLUTION, ENCRYPTED, J2K_BANDWIDTH, - ISDCF_METADATA, VIDEO_FRAME_RATE, AUDIO_CHANNELS, /** The setting of _three_d has changed */ @@ -239,6 +237,11 @@ public: CHAIN, DISTRIBUTOR, FACILITY, + STUDIO, + TEMP_VERSION, + PRE_RELEASE, + RED_BAND, + TWO_D_VERSION_OF_THREE_D, LUMINANCE, }; @@ -281,10 +284,6 @@ public: return _j2k_bandwidth; } - ISDCFMetadata isdcf_metadata () const { - return _isdcf_metadata; - } - /** @return The frame rate of the DCP */ int video_frame_rate () const { return _video_frame_rate; @@ -373,6 +372,26 @@ public: return _facility; } + boost::optional<std::string> studio () const { + return _studio; + } + + bool temp_version () const { + return _temp_version; + } + + bool pre_release () const { + return _pre_release; + } + + bool red_band () const { + return _red_band; + } + + bool two_d_version_of_three_d () const { + return _two_d_version_of_three_d; + } + boost::optional<dcp::Luminance> luminance () const { return _luminance; } @@ -393,7 +412,6 @@ public: void set_resolution (Resolution, bool user_explicit = true); void set_encrypted (bool); void set_j2k_bandwidth (int); - void set_isdcf_metadata (ISDCFMetadata); void set_video_frame_rate (int rate, bool user_explicit = false); void set_audio_channels (int); void set_three_d (bool); @@ -416,6 +434,11 @@ public: void set_status (dcp::Status s); void set_chain (boost::optional<std::string> c = boost::none); void set_facility (boost::optional<std::string> f = boost::none); + void set_studio (boost::optional<std::string> s = boost::none); + void set_temp_version (bool t); + void set_pre_release (bool p); + void set_red_band (bool r); + void set_two_d_version_of_three_d (bool t); void set_distributor (boost::optional<std::string> d = boost::none); void set_luminance (boost::optional<dcp::Luminance> l = boost::none); @@ -488,8 +511,6 @@ private: std::string _context_id; /** bandwidth for J2K files in bits per second */ int _j2k_bandwidth; - /** ISDCF naming stuff */ - ISDCFMetadata _isdcf_metadata; /** Frames per second to run our DCP at */ int _video_frame_rate; /** The date that we should use in a ISDCF name */ @@ -522,6 +543,11 @@ private: boost::optional<std::string> _chain; boost::optional<std::string> _distributor; boost::optional<std::string> _facility; + boost::optional<std::string> _studio; + bool _temp_version = false; + bool _pre_release = false; + bool _red_band = false; + bool _two_d_version_of_three_d = false; boost::optional<dcp::Luminance> _luminance; int _state_version; diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc deleted file mode 100644 index 6adbd0f3c..000000000 --- a/src/lib/isdcf_metadata.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2012-2019 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 "isdcf_metadata.h" -#include "warnings.h" -#include <dcp/raw_convert.h> -#include <libcxml/cxml.h> -DCPOMATIC_DISABLE_WARNINGS -#include <libxml++/libxml++.h> -DCPOMATIC_ENABLE_WARNINGS -#include <iostream> - -#include "i18n.h" - -using std::string; -using std::shared_ptr; -using dcp::raw_convert; - -ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node) - : content_version (node->number_child<int> ("ContentVersion")) - , territory (node->string_child ("Territory")) - , rating (node->string_child ("Rating")) - , studio (node->string_child ("Studio")) - , facility (node->string_child ("Facility")) - /* This stuff was added later */ - , temp_version (node->optional_bool_child ("TempVersion").get_value_or (false)) - , pre_release (node->optional_bool_child ("PreRelease").get_value_or (false)) - , red_band (node->optional_bool_child ("RedBand").get_value_or (false)) - , chain (node->optional_string_child ("Chain").get_value_or ("")) - , two_d_version_of_three_d (node->optional_bool_child ("TwoDVersionOfThreeD").get_value_or (false)) - , mastered_luminance (node->optional_string_child ("MasteredLuminance").get_value_or ("")) -{ - -} - -void -ISDCFMetadata::as_xml (xmlpp::Node* root) const -{ - root->add_child("ContentVersion")->add_child_text (raw_convert<string> (content_version)); - root->add_child("Territory")->add_child_text (territory); - root->add_child("Rating")->add_child_text (rating); - root->add_child("Studio")->add_child_text (studio); - root->add_child("Facility")->add_child_text (facility); - root->add_child("TempVersion")->add_child_text (temp_version ? "1" : "0"); - root->add_child("PreRelease")->add_child_text (pre_release ? "1" : "0"); - root->add_child("RedBand")->add_child_text (red_band ? "1" : "0"); - root->add_child("Chain")->add_child_text (chain); - root->add_child("TwoDVersionOfThreeD")->add_child_text (two_d_version_of_three_d ? "1" : "0"); - root->add_child("MasteredLuminance")->add_child_text (mastered_luminance); -} - -bool -operator== (ISDCFMetadata const & a, ISDCFMetadata const & b) -{ - return a.content_version == b.content_version && - a.territory == b.territory && - a.rating == b.rating && - a.studio == b.studio && - a.facility == b.facility && - a.temp_version == b.temp_version && - a.pre_release == b.pre_release && - a.red_band == b.red_band && - a.chain == b.chain && - a.two_d_version_of_three_d == b.two_d_version_of_three_d && - a.mastered_luminance == b.mastered_luminance; -} diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h deleted file mode 100644 index fd021b8dc..000000000 --- a/src/lib/isdcf_metadata.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2012-2019 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/>. - -*/ - -#ifndef DCPOMATIC_ISDCF_METADATA_H -#define DCPOMATIC_ISDCF_METADATA_H - -#include <libcxml/cxml.h> -#include <string> - -namespace xmlpp { - class Node; -} - -class ISDCFMetadata -{ -public: - ISDCFMetadata () - : content_version (1) - , temp_version (false) - , pre_release (false) - , red_band (false) - , two_d_version_of_three_d (false) - {} - - explicit ISDCFMetadata (cxml::ConstNodePtr); - - void as_xml (xmlpp::Node *) const; - void read_old_metadata (std::string, std::string); - - int content_version; - std::string territory; - std::string rating; - std::string studio; - std::string facility; - /** true if this is a temporary version (without final picture or sound) */ - bool temp_version; - /** true if this is a pre-release version (final picture and sound, but without accessibility features) */ - bool pre_release; - /** true if this has adult content */ - bool red_band; - /** specific theatre chain or event */ - std::string chain; - /** true if this is a 2D version of content that also exists in 3D */ - bool two_d_version_of_three_d; - /** mastered luminance if there are multiple versions distributed (e.g. 35, 4fl, 6fl etc.) */ - std::string mastered_luminance; -}; - -bool operator== (ISDCFMetadata const & a, ISDCFMetadata const & b); - -#endif diff --git a/src/lib/util.cc b/src/lib/util.cc index 24ea42b8f..d3511e8c7 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1167,3 +1167,12 @@ default_font_file () return liberation_normal; } + + +string +to_upper (string s) +{ + transform (s.begin(), s.end(), s.begin(), ::toupper); + return s; +} + diff --git a/src/lib/util.h b/src/lib/util.h index ceb30701c..7f8106f3c 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -122,6 +122,7 @@ extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container); extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm); extern boost::filesystem::path default_font_file (); +extern std::string to_upper (std::string s); template <class T> std::list<T> diff --git a/src/lib/wscript b/src/lib/wscript index 1b45152a4..7cbd85a4c 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -121,7 +121,6 @@ sources = """ image_examiner.cc image_filename_sorter.cc image_proxy.cc - isdcf_metadata.cc j2k_image_proxy.cc job.cc job_manager.cc |
