From: Carl Hetherington Date: Sun, 27 Sep 2020 19:18:51 +0000 (+0200) Subject: Fixes for new libdcp with multiple content versions. X-Git-Tag: v2.15.104~74 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=c78e9f0d5e802e1bb020694870357ef271217628 Fixes for new libdcp with multiple content versions. --- diff --git a/src/lib/copy_dcp_details_to_film.cc b/src/lib/copy_dcp_details_to_film.cc index d73ee8792..c33b0974b 100644 --- a/src/lib/copy_dcp_details_to_film.cc +++ b/src/lib/copy_dcp_details_to_film.cc @@ -70,10 +70,6 @@ copy_dcp_details_to_film (shared_ptr dcp, shared_ptr fil } film->set_ratings (dcp->ratings()); - - vector cv; - cv.push_back (dcp->content_version()); - film->set_content_versions (cv); + film->set_content_versions (dcp->content_versions()); } - diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 00ffb390c..0bef73f77 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -158,7 +158,9 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version) _ratings.push_back (dcp::Rating(i)); } - _content_version = node->optional_string_child("ContentVersion").get_value_or(""); + BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("ContentVersion")) { + _content_versions.push_back (i->content()); + } } void @@ -274,7 +276,7 @@ DCPContent::examine (shared_ptr film, shared_ptr job) _markers[i->first] = ContentTime(i->second.as_editable_units(DCPTime::HZ)); } _ratings = examiner->ratings (); - _content_version = examiner->content_version (); + _content_versions = examiner->content_versions (); } if (old_texts == texts) { @@ -390,7 +392,9 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const i.as_xml (rating); } - node->add_child("ContentVersion")->add_child_text (_content_version); + BOOST_FOREACH (string i, _content_versions) { + node->add_child("ContentVersion")->add_child_text(i); + } } DCPTime diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 6d707670f..e8532ff57 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -162,8 +162,8 @@ public: return _ratings; } - std::string content_version () const { - return _content_version; + std::vector content_versions () const { + return _content_versions; } private: @@ -214,7 +214,7 @@ private: std::list _reel_lengths; std::map _markers; std::vector _ratings; - std::string _content_version; + std::vector _content_versions; }; #endif diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 65cfb884e..27eb74a5d 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -260,7 +260,9 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) _three_d = !cpl->reels().empty() && cpl->reels().front()->main_picture() && dynamic_pointer_cast (cpl->reels().front()->main_picture()->asset()); _ratings = cpl->ratings(); - _content_version = cpl->content_version().label_text; + BOOST_FOREACH (dcp::ContentVersion i, cpl->content_versions()) { + _content_versions.push_back (i.label_text); + } _cpl = cpl->id (); } diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index cb68aa523..232d7f0d8 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -134,8 +134,8 @@ public: return _ratings; } - std::string content_version () const { - return _content_version; + std::vector content_versions () const { + return _content_versions; } bool has_atmos () const { @@ -176,7 +176,7 @@ private: std::list _reel_lengths; std::map _markers; std::vector _ratings; - std::string _content_version; + std::vector _content_versions; bool _has_atmos; Frame _atmos_length; dcp::Fraction _atmos_edit_rate; diff --git a/test/import_dcp_test.cc b/test/import_dcp_test.cc index 07116c1e2..ad6fc88ca 100644 --- a/test/import_dcp_test.cc +++ b/test/import_dcp_test.cc @@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE (import_dcp_metadata_test) film2->write_metadata (); BOOST_CHECK (imported->ratings() == ratings); - BOOST_CHECK_EQUAL (imported->content_version(), "Fred"); + BOOST_CHECK (imported->content_versions() == cv); /* Load that film and check that the metadata has been loaded */ shared_ptr film3(new Film(boost::filesystem::path("build/test/import_dcp_metadata_test2"))); @@ -195,6 +195,6 @@ BOOST_AUTO_TEST_CASE (import_dcp_metadata_test) BOOST_REQUIRE (reloaded); BOOST_CHECK (reloaded->ratings() == ratings); - BOOST_CHECK_EQUAL (reloaded->content_version(), "Fred"); + BOOST_CHECK (reloaded->content_versions() == cv); }