diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-10 17:14:17 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-10 17:14:17 +0100 |
| commit | f0cc79a6c34b8198155f6e519d4464385ea30049 (patch) | |
| tree | 7509eb1f3ff30187905d55bb8c48a765a9ee209f /src/lib | |
| parent | e7bc3bd16456c17bc6fe1d7981040b14e820505e (diff) | |
Support ISDCF naming convention version 9.
Reported-by: Elia Orselli
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 75 | ||||
| -rw-r--r-- | src/lib/film.h | 3 | ||||
| -rw-r--r-- | src/lib/isdcf_metadata.cc | 14 | ||||
| -rw-r--r-- | src/lib/isdcf_metadata.h | 16 | ||||
| -rw-r--r-- | src/lib/ratio.cc | 12 |
5 files changed, 106 insertions, 14 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index fb3026039..fd3e78c35 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -490,14 +490,20 @@ Film::isdcf_name (bool if_created_now) const { stringstream d; - string fixed_name = to_upper_copy (name()); - for (size_t i = 0; i < fixed_name.length(); ++i) { - if (fixed_name[i] == ' ') { - fixed_name[i] = '-'; + string raw_name = name (); + string fixed_name; + bool cap_next = true; + for (size_t i = 0; i < raw_name.length(); ++i) { + if (raw_name[i] == ' ') { + cap_next = true; + } else if (cap_next) { + fixed_name += toupper (raw_name[i]); + cap_next = false; + } else { + fixed_name += tolower (raw_name[i]); } } - /* Spec is that the name part should be maximum 14 characters, as I understand it */ if (fixed_name.length() > 14) { fixed_name = fixed_name.substr (0, 14); } @@ -509,19 +515,60 @@ Film::isdcf_name (bool if_created_now) const d << "-" << isdcf_metadata().content_version; } + ISDCFMetadata const dm = isdcf_metadata (); + + if (dm.temp_version) { + d << "-Temp"; + } + + if (dm.pre_release) { + d << "-Pre"; + } + + if (dm.red_band) { + d << "-RedBand"; + } + + if (!dm.chain.empty ()) { + d << "-" << dm.chain; + } + if (three_d ()) { d << "-3D"; } + if (dm.two_d_version_of_three_d) { + d << "-2D"; + } + + if (!dm.mastered_luminance.empty ()) { + d << "-" << dm.mastered_luminance; + } + if (video_frame_rate() != 24) { d << "-" << video_frame_rate(); } - + if (container()) { d << "_" << container()->isdcf_name(); } - ISDCFMetadata const dm = isdcf_metadata (); + /* XXX: this only works for content which has been scaled to a given ratio, + and uses the first bit of content only. + */ + + ContentList cl = content (); + Ratio const * content_ratio = 0; + for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) { + shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (*i); + if (vc && (content_ratio == 0 || vc->scale().ratio() != content_ratio)) { + content_ratio = vc->scale().ratio(); + } + } + + if (content_ratio && content_ratio != container()) { + d << "-" << content_ratio->isdcf_name(); + } if (!dm.audio_language.empty ()) { d << "_" << dm.audio_language; @@ -560,8 +607,10 @@ Film::isdcf_name (bool if_created_now) const break; } - d << "_" << resolution_to_string (_resolution); + /* XXX: HI/VI */ + d << "_" << resolution_to_string (_resolution); + if (!dm.studio.empty ()) { d << "_" << dm.studio; } @@ -576,6 +625,16 @@ Film::isdcf_name (bool if_created_now) const d << "_" << dm.facility; } + if (_interop) { + d << "_IOP"; + } else { + d << "_SMPTE"; + } + + if (three_d ()) { + d << "-3D"; + } + if (!dm.package_type.empty ()) { d << "_" << dm.package_type; } diff --git a/src/lib/film.h b/src/lib/film.h index f77309862..96ea930cc 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -46,6 +46,7 @@ class Playlist; class AudioContent; class Scaler; class Screen; +class isdcf_name_test; /** @class Film * @@ -282,6 +283,8 @@ public: private: + friend class ::isdcf_name_test; + void signal_changed (Property); std::string video_identifier () const; void playlist_changed (); diff --git a/src/lib/isdcf_metadata.cc b/src/lib/isdcf_metadata.cc index ae99280ca..dfba50a9a 100644 --- a/src/lib/isdcf_metadata.cc +++ b/src/lib/isdcf_metadata.cc @@ -38,6 +38,14 @@ ISDCFMetadata::ISDCFMetadata (shared_ptr<const cxml::Node> node) studio = node->string_child ("Studio"); facility = node->string_child ("Facility"); package_type = node->string_child ("PackageType"); + + /* 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 @@ -51,6 +59,12 @@ ISDCFMetadata::as_xml (xmlpp::Node* root) const root->add_child("Studio")->add_child_text (studio); root->add_child("Facility")->add_child_text (facility); root->add_child("PackageType")->add_child_text (package_type); + 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); } void diff --git a/src/lib/isdcf_metadata.h b/src/lib/isdcf_metadata.h index cd63ba2ee..0fb7e7baa 100644 --- a/src/lib/isdcf_metadata.h +++ b/src/lib/isdcf_metadata.h @@ -32,6 +32,10 @@ class ISDCFMetadata public: ISDCFMetadata () : content_version (1) + , temp_version (false) + , pre_release (false) + , red_band (false) + , two_d_version_of_three_d (false) {} ISDCFMetadata (boost::shared_ptr<const cxml::Node>); @@ -47,6 +51,18 @@ public: std::string studio; std::string facility; std::string package_type; + /** 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; }; #endif diff --git a/src/lib/ratio.cc b/src/lib/ratio.cc index a47b2101e..52577d3bb 100644 --- a/src/lib/ratio.cc +++ b/src/lib/ratio.cc @@ -32,12 +32,12 @@ vector<Ratio const *> Ratio::_ratios; void Ratio::setup_ratios () { - _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "F")); - _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "F")); - _ratios.push_back (new Ratio (float(1480) / 1080, "137", _("Academy"), "F")); - _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.375"), "F")); - _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "F")); - _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "F")); + _ratios.push_back (new Ratio (float(1290) / 1080, "119", _("1.19"), "119")); + _ratios.push_back (new Ratio (float(1440) / 1080, "133", _("4:3"), "133")); + _ratios.push_back (new Ratio (float(1480) / 1080, "137", _("Academy"), "137")); + _ratios.push_back (new Ratio (float(1485) / 1080, "138", _("1.375"), "137")); + _ratios.push_back (new Ratio (float(1800) / 1080, "166", _("1.66"), "166")); + _ratios.push_back (new Ratio (float(1920) / 1080, "178", _("16:9"), "178")); _ratios.push_back (new Ratio (float(1998) / 1080, "185", _("Flat"), "F")); _ratios.push_back (new Ratio (float(2048) / 858, "239", _("Scope"), "S")); _ratios.push_back (new Ratio (float(2048) / 1080, "full-frame", _("Full frame"), "C")); |
