diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-04-21 23:32:42 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-04-21 23:51:38 +0200 |
| commit | 5f3a88d3ab1e9c1a13d7e61fc37a0c4cef8df9a5 (patch) | |
| tree | d9d66af89bd2c9864ad5242e5aaece551e72ce1e /src | |
| parent | f5980767b7d1d9b39186dd13f12b9d8297a87aef (diff) | |
Allow DCP content to store and serialise metadata.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_content.cc | 15 | ||||
| -rw-r--r-- | src/lib/dcp_content.h | 10 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.cc | 3 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.h | 10 |
4 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 6c2db91d3..4280ad13a 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -151,6 +151,12 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version) BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Marker")) { _markers[dcp::marker_from_string(i->string_attribute("type"))] = ContentTime(raw_convert<int64_t>(i->content())); } + + BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Rating")) { + _ratings.push_back (dcp::Rating(i)); + } + + _content_version = node->optional_string_child("ContentVersion").get_value_or(""); } void @@ -249,6 +255,8 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) for (map<dcp::Marker, dcp::Time>::const_iterator i = markers.begin(); i != markers.end(); ++i) { _markers[i->first] = ContentTime(i->second.as_editable_units(DCPTime::HZ)); } + _ratings = examiner->ratings (); + _content_version = examiner->content_version (); } if (old_texts == texts) { @@ -354,6 +362,13 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const marker->set_attribute("type", dcp::marker_to_string(i->first)); marker->add_child_text(raw_convert<string>(i->second.get())); } + + BOOST_FOREACH (dcp::Rating i, _ratings) { + xmlpp::Element* rating = node->add_child("Rating"); + i.as_xml (rating); + } + + node->add_child("ContentVersion")->add_child_text (_content_version); } DCPTime diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 8658ac5ed..6d707670f 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -158,6 +158,14 @@ public: Resolution resolution () const; + std::vector<dcp::Rating> ratings () const { + return _ratings; + } + + std::string content_version () const { + return _content_version; + } + private: friend class reels_test5; @@ -205,6 +213,8 @@ private: /** List of the lengths of the reels in this DCP */ std::list<int64_t> _reel_lengths; std::map<dcp::Marker, dcpomatic::ContentTime> _markers; + std::vector<dcp::Rating> _ratings; + std::string _content_version; }; #endif diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index a7d451eca..d04dacdd6 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -23,6 +23,7 @@ #include "exceptions.h" #include "image.h" #include "config.h" +#include "util.h" #include <dcp/dcp.h> #include <dcp/decrypted_kdm.h> #include <dcp/cpl.h> @@ -236,6 +237,8 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant) _standard = cpl->standard().get(); _three_d = !cpl->reels().empty() && cpl->reels().front()->main_picture() && dynamic_pointer_cast<dcp::StereoPictureAsset> (cpl->reels().front()->main_picture()->asset()); + _ratings = list_to_vector (cpl->ratings()); + _content_version = cpl->content_version_label_text (); _cpl = cpl->id (); } diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index c1ba54dee..21aa8d3ab 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -123,6 +123,14 @@ public: return _markers; } + std::vector<dcp::Rating> ratings () const { + return _ratings; + } + + std::string content_version () const { + return _content_version; + } + private: boost::optional<double> _video_frame_rate; boost::optional<dcp::Size> _video_size; @@ -146,4 +154,6 @@ private: std::string _cpl; std::list<int64_t> _reel_lengths; std::map<dcp::Marker, dcp::Time> _markers; + std::vector<dcp::Rating> _ratings; + std::string _content_version; }; |
