From 498806d76160a6b1fa0af58e7734c0f553abf12b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 11 Apr 2021 22:24:44 +0200 Subject: [PATCH] Specify CPL standard on construction. Then choose which standard DCP should use based on the CPL(s). --- examples/make_dcp.cc | 4 +- src/combine.cc | 2 +- src/cpl.cc | 15 ++++---- src/cpl.h | 8 ++-- src/dcp.cc | 20 ++++++++-- src/dcp.h | 1 - test/combine_test.cc | 33 ++++++++--------- test/cpl_metadata_test.cc | 14 +++---- test/cpl_ratings_test.cc | 4 +- test/dcp_font_test.cc | 8 ++-- test/dcp_test.cc | 73 ++++++++++++++++++++++++++++++++----- test/encryption_test.cc | 4 +- test/kdm_test.cc | 2 +- test/markers_test.cc | 4 +- test/mca_test.cc | 8 ++-- test/round_trip_test.cc | 2 +- test/test.cc | 8 ++-- test/test.h | 2 +- test/verify_test.cc | 61 ++++++++----------------------- test/write_subtitle_test.cc | 4 +- tools/dcprecover.cc | 2 +- 21 files changed, 157 insertions(+), 122 deletions(-) diff --git a/examples/make_dcp.cc b/examples/make_dcp.cc index dbd95a52..bbe29545 100644 --- a/examples/make_dcp.cc +++ b/examples/make_dcp.cc @@ -101,13 +101,13 @@ main () reel->add(std::make_shared(sound_asset, 0)); /* Make a CPL with this reel */ - auto cpl = std::make_shared("My film", dcp::ContentKind::FEATURE); + auto cpl = std::make_shared("My film", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl->add(reel); /* Write the DCP */ dcp::DCP dcp ("DCP"); dcp.add (cpl); - dcp.write_xml (dcp::Standard::SMPTE); + dcp.write_xml (); return 0; } diff --git a/src/combine.cc b/src/combine.cc index da893cb7..e974c407 100644 --- a/src/combine.cc +++ b/src/combine.cc @@ -173,5 +173,5 @@ dcp::combine ( } } - output_dcp.write_xml (*standard, issuer, creator, issue_date, annotation_text, signer); + output_dcp.write_xml (issuer, creator, issue_date, annotation_text, signer); } diff --git a/src/cpl.cc b/src/cpl.cc index 3b549757..3867c238 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -80,7 +80,7 @@ static string const smpte_395_ns = "http://www.smpte-ra.org/reg/395/2014/13/1/aa static string const smpte_335_ns = "http://www.smpte-ra.org/reg/335/2012"; -CPL::CPL (string annotation_text, ContentKind content_kind) +CPL::CPL (string annotation_text, ContentKind content_kind, Standard standard) /* default _content_title_text to annotation_text */ : _issuer ("libdcp" LIBDCP_VERSION) , _creator ("libdcp" LIBDCP_VERSION) @@ -88,6 +88,7 @@ CPL::CPL (string annotation_text, ContentKind content_kind) , _annotation_text (annotation_text) , _content_title_text (annotation_text) , _content_kind (content_kind) + , _standard (standard) { ContentVersion cv; cv.label_text = cv.id + LocalTime().as_string(); @@ -139,7 +140,7 @@ CPL::CPL (boost::filesystem::path file) } for (auto i: f.node_child("ReelList")->node_children("Reel")) { - _reels.push_back (make_shared(i, *_standard)); + _reels.push_back (make_shared(i, _standard)); } auto reel_list = f.node_child ("ReelList"); @@ -170,11 +171,11 @@ CPL::add (std::shared_ptr reel) void -CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr signer) const +CPL::write_xml (boost::filesystem::path file, shared_ptr signer) const { xmlpp::Document doc; xmlpp::Element* root; - if (standard == Standard::INTEROP) { + if (_standard == Standard::INTEROP) { root = doc.create_root_node ("CompositionPlaylist", cpl_interop_ns); } else { root = doc.create_root_node ("CompositionPlaylist", cpl_smpte_ns); @@ -209,8 +210,8 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptrwrite_to_cpl (reel_list, standard); - if (first && standard == Standard::SMPTE) { + auto asset_list = i->write_to_cpl (reel_list, _standard); + if (first && _standard == Standard::SMPTE) { maybe_write_composition_metadata_asset (asset_list); first = false; } @@ -219,7 +220,7 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptrsign (root, standard); + signer->sign (root, _standard); } doc.write_to_file_formatted (file.string(), "UTF-8"); diff --git a/src/cpl.h b/src/cpl.h index 84dbd9ff..03e35a4e 100644 --- a/src/cpl.h +++ b/src/cpl.h @@ -73,7 +73,7 @@ class DecryptedKDM; class CPL : public Asset { public: - CPL (std::string annotation_text, ContentKind content_kind); + CPL (std::string annotation_text, ContentKind content_kind, Standard standard); /** Construct a CPL object from a XML file */ explicit CPL (boost::filesystem::path file); @@ -117,12 +117,10 @@ public: /** Write an CompositonPlaylist XML file * * @param file Filename to write - * @param standard INTEROP or SMPTE * @param signer Signer to sign the CPL, or 0 to add no signature */ void write_xml ( boost::filesystem::path file, - Standard standard, std::shared_ptr ) const; @@ -306,7 +304,7 @@ public: void set_additional_subtitle_languages (std::vector const& lang); - boost::optional standard () const { + Standard standard () const { return _standard; } @@ -354,7 +352,7 @@ private: std::vector> _reels; /** Standard of CPL that was read in */ - boost::optional _standard; + Standard _standard; }; diff --git a/src/dcp.cc b/src/dcp.cc index 20ff82f8..bcf487e1 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -67,6 +67,7 @@ #include #include #include +#include using std::string; @@ -229,7 +230,7 @@ DCP::read (vector* notes, bool ignore_incorrect_picture_m if (root == "CompositionPlaylist") { auto cpl = make_shared(path); - if (_standard && cpl->standard() && cpl->standard().get() != _standard.get() && notes) { + if (_standard && cpl->standard() != _standard.get() && notes) { notes->push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::MISMATCHED_STANDARD}); } _cpls.push_back (cpl); @@ -469,7 +470,6 @@ DCP::write_assetmap ( void DCP::write_xml ( - Standard standard, string issuer, string creator, string issue_date, @@ -478,10 +478,24 @@ DCP::write_xml ( NameFormat name_format ) { + if (_cpls.empty()) { + throw MiscError ("Cannot write DCP with no CPLs."); + } + + auto standard = std::accumulate ( + std::next(_cpls.begin()), _cpls.end(), _cpls[0]->standard(), + [](Standard s, shared_ptr c) { + if (s != c->standard()) { + throw MiscError ("Cannot make DCP with mixed Interop and SMPTE CPLs."); + } + return s; + } + ); + for (auto i: cpls()) { NameFormat::Map values; values['t'] = "cpl"; - i->write_xml (_directory / (name_format.get(values, "_" + i->id() + ".xml")), standard, signer); + i->write_xml (_directory / (name_format.get(values, "_" + i->id() + ".xml")), signer); } shared_ptr pkl; diff --git a/src/dcp.h b/src/dcp.h index 403eea9e..6e50c48e 100644 --- a/src/dcp.h +++ b/src/dcp.h @@ -151,7 +151,6 @@ public: * @param name_format Name format to use for the CPL and PKL filenames */ void write_xml ( - Standard standard, std::string issuer = String::compose("libdcp %1", dcp::version), std::string creator = String::compose("libdcp %1", dcp::version), std::string issue_date = LocalTime().as_string(), diff --git a/test/combine_test.cc b/test/combine_test.cc index 99795592..280137c3 100644 --- a/test/combine_test.cc +++ b/test/combine_test.cc @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_same_asset_filenames_test) boost::filesystem::path const out = "build/test/combine_two_dcps_with_same_asset_filenames_test"; shared_ptr second = make_simple ("build/test/combine_input2"); - second->write_xml (dcp::Standard::SMPTE); + second->write_xml (); remove_all (out); vector inputs; @@ -196,10 +196,9 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_interop_subs_test) boost::filesystem::path const out = "build/test/combine_two_dcps_with_interop_subs_test"; auto first = make_simple_with_interop_subs ("build/test/combine_input1"); - first->write_xml (dcp::Standard::INTEROP); + first->write_xml (); auto second = make_simple_with_interop_subs ("build/test/combine_input2"); - second->write_xml (dcp::Standard::INTEROP); remove_all (out); vector inputs; @@ -219,10 +218,10 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_smpte_subs_test) boost::filesystem::path const out = "build/test/combine_two_dcps_with_smpte_subs_test"; shared_ptr first = make_simple_with_smpte_subs ("build/test/combine_input1"); - first->write_xml (dcp::Standard::SMPTE); + first->write_xml (); shared_ptr second = make_simple_with_smpte_subs ("build/test/combine_input2"); - second->write_xml (dcp::Standard::SMPTE); + second->write_xml (); remove_all (out); vector inputs; @@ -242,10 +241,10 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_interop_ccaps_test) boost::filesystem::path const out = "build/test/combine_two_dcps_with_interop_ccaps_test"; shared_ptr first = make_simple_with_interop_ccaps ("build/test/combine_input1"); - first->write_xml (dcp::Standard::INTEROP); + first->write_xml (); shared_ptr second = make_simple_with_interop_ccaps ("build/test/combine_input2"); - second->write_xml (dcp::Standard::INTEROP); + second->write_xml (); remove_all (out); vector inputs; @@ -265,10 +264,10 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_smpte_ccaps_test) boost::filesystem::path const out = "build/test/combine_two_dcps_with_interop_ccaps_test"; shared_ptr first = make_simple_with_smpte_ccaps ("build/test/combine_input1"); - first->write_xml (dcp::Standard::SMPTE); + first->write_xml (); shared_ptr second = make_simple_with_smpte_ccaps ("build/test/combine_input2"); - second->write_xml (dcp::Standard::SMPTE); + second->write_xml (); remove_all (out); vector inputs; @@ -288,10 +287,10 @@ BOOST_AUTO_TEST_CASE (combine_two_multi_reel_dcps) boost::filesystem::path const out = "build/test/combine_two_multi_reel_dcps"; shared_ptr first = make_simple ("build/test/combine_input1", 4); - first->write_xml (dcp::Standard::SMPTE); + first->write_xml (); shared_ptr second = make_simple ("build/test/combine_input2", 4); - second->write_xml (dcp::Standard::SMPTE); + second->write_xml (); remove_all (out); vector inputs; @@ -310,7 +309,7 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_shared_asset) boost::filesystem::path const out = "build/test/combine_two_dcps_with_shared_asset"; shared_ptr first = make_simple ("build/test/combine_input1", 1); - first->write_xml (dcp::Standard::SMPTE); + first->write_xml (); remove_all ("build/test/combine_input2"); shared_ptr second(new dcp::DCP("build/test/combine_input2")); @@ -319,7 +318,7 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_shared_asset) mxf_meta.company_name = "OpenDCP"; mxf_meta.product_version = "0.0.25"; - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->set_content_version ( dcp::ContentVersion("urn:uuid:75ac29aa-42ac-1234-ecae-49251abefd11","content-version-label-text") ); @@ -335,7 +334,7 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_shared_asset) reel->add (simple_markers()); cpl->add (reel); second->add (cpl); - second->write_xml (dcp::Standard::SMPTE); + second->write_xml (); remove_all (out); vector inputs; @@ -355,7 +354,7 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_duplicated_asset) boost::filesystem::path const out = "build/test/combine_two_dcps_with_duplicated_asset"; auto first = make_simple ("build/test/combine_input1", 1); - first->write_xml (dcp::Standard::SMPTE); + first->write_xml (); remove_all ("build/test/combine_input2"); auto second = make_shared("build/test/combine_input2"); @@ -364,7 +363,7 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_duplicated_asset) mxf_meta.company_name = "OpenDCP"; mxf_meta.product_version = "0.0.25"; - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->set_content_version ( dcp::ContentVersion("urn:uuid:75ac29aa-42ac-1234-ecae-49251abefd11","content-version-label-text") ); @@ -384,7 +383,7 @@ BOOST_AUTO_TEST_CASE (combine_two_dcps_with_duplicated_asset) reel->add (simple_markers()); cpl->add (reel); second->add (cpl); - second->write_xml (dcp::Standard::SMPTE); + second->write_xml (); remove_all (out); vector inputs; diff --git a/test/cpl_metadata_test.cc b/test/cpl_metadata_test.cc index 2c88d6a8..a0dc15a8 100644 --- a/test/cpl_metadata_test.cc +++ b/test/cpl_metadata_test.cc @@ -53,7 +53,7 @@ using std::vector; BOOST_AUTO_TEST_CASE (cpl_metadata_bad_values_test) { - dcp::CPL cpl("", dcp::ContentKind::FEATURE); + dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); BOOST_CHECK_THROW (cpl.set_version_number(-1), dcp::BadSettingError); vector cv; @@ -252,7 +252,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test1) { RNGFixer fix; - dcp::CPL cpl("", dcp::ContentKind::FEATURE); + dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl.set_issue_date ("2020-08-28T13:35:06+02:00"); vector cv; @@ -310,7 +310,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test1) lt.push_back(dcp::LanguageTag("fr-ZA")); cpl.set_additional_subtitle_languages (lt); - cpl.write_xml ("build/test/cpl_metadata_write_test1.xml", dcp::Standard::SMPTE, shared_ptr()); + cpl.write_xml ("build/test/cpl_metadata_write_test1.xml", shared_ptr()); check_xml ( dcp::file_to_string("test/ref/cpl_metadata_test1.xml"), dcp::file_to_string("build/test/cpl_metadata_write_test1.xml"), @@ -323,7 +323,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test1) BOOST_AUTO_TEST_CASE (cpl_metadata_roundtrip_test_1) { dcp::CPL cpl ("test/ref/cpl_metadata_test1.xml"); - cpl.write_xml ("build/test/cpl_metadata_roundtrip_test1.xml", dcp::Standard::SMPTE, shared_ptr()); + cpl.write_xml ("build/test/cpl_metadata_roundtrip_test1.xml", shared_ptr()); vector ignore; ignore.push_back ("Id"); check_xml ( @@ -339,7 +339,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test2) { RNGFixer fix; - dcp::CPL cpl("", dcp::ContentKind::FEATURE); + dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl.set_issue_date ("2020-08-28T13:35:06+02:00"); cpl.set_content_version (dcp::ContentVersion("id", "version")); cpl.set_issuer ("libdcp1.6.4devel"); @@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_write_test2) reel->add (black_picture_asset("build/test/cpl_metadata_write_test1")); cpl.add (reel); - cpl.write_xml ("build/test/cpl_metadata_write_test2.xml", dcp::Standard::SMPTE, shared_ptr()); + cpl.write_xml ("build/test/cpl_metadata_write_test2.xml", shared_ptr()); check_xml ( dcp::file_to_string("test/ref/cpl_metadata_test2.xml"), dcp::file_to_string("build/test/cpl_metadata_write_test2.xml"), @@ -414,9 +414,9 @@ BOOST_AUTO_TEST_CASE (cpl_metadata_read_test2) BOOST_AUTO_TEST_CASE (cpl_metadata_roundtrip_test_2) { dcp::CPL cpl ("test/ref/cpl_metadata_test2.xml"); - cpl.write_xml ("build/test/cpl_metadata_roundtrip_test2.xml", dcp::Standard::SMPTE, shared_ptr()); vector ignore; ignore.push_back ("Id"); + cpl.write_xml ("build/test/cpl_metadata_roundtrip_test2.xml", shared_ptr()); check_xml ( dcp::file_to_string("test/ref/cpl_metadata_test2.xml"), dcp::file_to_string("build/test/cpl_metadata_roundtrip_test2.xml"), diff --git a/test/cpl_ratings_test.cc b/test/cpl_ratings_test.cc index 0135e6e0..17500a13 100644 --- a/test/cpl_ratings_test.cc +++ b/test/cpl_ratings_test.cc @@ -42,7 +42,7 @@ using std::shared_ptr; BOOST_AUTO_TEST_CASE (cpl_ratings) { - dcp::CPL cpl ("annotation", dcp::ContentKind::FEATURE); + dcp::CPL cpl ("annotation", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); vector ratings; ratings.push_back (dcp::Rating("http://www.mpaa.org/2003-ratings", "PG-13")); @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE (cpl_ratings) shared_ptr reel(new dcp::Reel()); cpl.add (reel); - cpl.write_xml ("build/test/cpl_ratings.xml", dcp::Standard::SMPTE, {}); + cpl.write_xml ("build/test/cpl_ratings.xml", {}); vector ignore; ignore.push_back ("Id"); diff --git a/test/dcp_font_test.cc b/test/dcp_font_test.cc index 2ac68273..047e0266 100644 --- a/test/dcp_font_test.cc +++ b/test/dcp_font_test.cc @@ -66,11 +66,11 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test) auto reel = make_shared(); reel->add (make_shared(subs, dcp::Fraction (24, 1), 24, 0)); - auto cpl = make_shared("", dcp::ContentKind::TRAILER); + auto cpl = make_shared("", dcp::ContentKind::TRAILER, dcp::Standard::INTEROP); cpl->add (reel); dcp.add (cpl); - dcp.write_xml (dcp::Standard::INTEROP); + dcp.write_xml (); dcp::DCP dcp2 (directory); dcp2.read (); @@ -103,11 +103,11 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test) auto reel = make_shared(); reel->add (make_shared(subs, dcp::Fraction (24, 1), 24, 0)); - auto cpl = make_shared("", dcp::ContentKind::TRAILER); + auto cpl = make_shared("", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel); dcp.add (cpl); - dcp.write_xml (dcp::Standard::SMPTE); + dcp.write_xml (); dcp::DCP dcp2 (directory); dcp2.read (); diff --git a/test/dcp_test.cc b/test/dcp_test.cc index fb3a605c..95afc0dd 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE (dcp_test1) RNGFixer fixer; make_simple("build/test/DCP/dcp_test1")->write_xml( - dcp::Standard::SMPTE, "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "A Test DCP" + "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "A Test DCP" ); /* build/test/DCP/dcp_test1 is checked against test/ref/DCP/dcp_test1 by run/tests */ @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (dcp_test2) boost::filesystem::remove_all ("build/test/DCP/dcp_test2"); boost::filesystem::create_directories ("build/test/DCP/dcp_test2"); dcp::DCP d ("build/test/DCP/dcp_test2"); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::FEATURE); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl->set_content_version ( dcp::ContentVersion("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00", "81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00") ); @@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE (dcp_test2) d.add (cpl); - d.write_xml (dcp::Standard::SMPTE, "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp"); + d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp"); /* build/test/DCP/dcp_test2 is checked against test/ref/DCP/dcp_test2 by run/tests */ } @@ -227,11 +227,11 @@ test_rewriting_sound(string name, bool modify) reel->add(make_shared(sound, 0)); reel->add(simple_markers()); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel); B.add (cpl); - B.write_xml (dcp::Standard::SMPTE); + B.write_xml (); dcp::EqualityOptions eq; eq.reel_hashes_can_differ = true; @@ -270,7 +270,7 @@ BOOST_AUTO_TEST_CASE (dcp_test5) boost::filesystem::remove_all ("build/test/DCP/dcp_test5"); boost::filesystem::create_directories ("build/test/DCP/dcp_test5"); dcp::DCP d ("build/test/DCP/dcp_test5"); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::FEATURE); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl->set_content_version ( dcp::ContentVersion("urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00", "81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00") ); @@ -323,7 +323,7 @@ BOOST_AUTO_TEST_CASE (dcp_test5) d.add (cpl); - d.write_xml (dcp::Standard::SMPTE, "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp"); + d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp"); /* build/test/DCP/dcp_test5 is checked against test/ref/DCP/dcp_test5 by run/tests */ } @@ -347,8 +347,8 @@ BOOST_AUTO_TEST_CASE (dcp_test7) { RNGFixer fix; - make_simple("build/test/DCP/dcp_test7")->write_xml( - dcp::Standard::INTEROP, "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp" + make_simple("build/test/DCP/dcp_test7", 1, 24, dcp::Standard::INTEROP)->write_xml( + "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp" ); /* build/test/DCP/dcp_test7 is checked against test/ref/DCP/dcp_test7 by run/tests */ @@ -370,3 +370,58 @@ BOOST_AUTO_TEST_CASE (dcp_things_in_assetmap_not_in_pkl) dcp::DCP dcp ("test/data/extra_assetmap"); BOOST_CHECK_NO_THROW (dcp.read()); } + + +/** Test that writing the XML for a DCP with no CPLs throws */ +BOOST_AUTO_TEST_CASE (dcp_with_no_cpls) +{ + dcp::DCP dcp ("build/test/dcp_with_no_cpls"); + BOOST_REQUIRE_THROW (dcp.write_xml(), dcp::MiscError); +} + + +/** Test that writing the XML for a DCP with Interop CPLs makes a SMPTE assetmap */ +BOOST_AUTO_TEST_CASE (dcp_with_interop_cpls) +{ + boost::filesystem::path path = "build/test/dcp_with_interop_cpls"; + boost::filesystem::remove_all (path); + dcp::DCP dcp (path); + auto cpl1 = make_shared("", dcp::ContentKind::FEATURE, dcp::Standard::INTEROP); + cpl1->add(make_shared()); + dcp.add(cpl1); + auto cpl2 = make_shared("", dcp::ContentKind::FEATURE, dcp::Standard::INTEROP); + cpl2->add(make_shared()); + dcp.add(cpl2); + dcp.write_xml (); + BOOST_REQUIRE (boost::filesystem::exists(path / "ASSETMAP")); + BOOST_REQUIRE (!boost::filesystem::exists(path / "ASSETMAP.xml")); +} + + +/** Test that writing the XML for a DCP with SMPTE CPLs makes a SMPTE assetmap */ +BOOST_AUTO_TEST_CASE (dcp_with_smpte_cpls) +{ + boost::filesystem::path path = "build/test/dcp_with_smpte_cpls"; + boost::filesystem::remove_all (path); + dcp::DCP dcp (path); + auto cpl1 = make_shared("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); + cpl1->add(make_shared()); + dcp.add(cpl1); + auto cpl2 = make_shared("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); + cpl2->add(make_shared()); + dcp.add(cpl2); + dcp.write_xml (); + BOOST_REQUIRE (!boost::filesystem::exists(path / "ASSETMAP")); + BOOST_REQUIRE (boost::filesystem::exists(path / "ASSETMAP.xml")); +} + + +/** Test that writing the XML for a DCP with mixed-standard CPLs throws */ +BOOST_AUTO_TEST_CASE (dcp_with_mixed_cpls) +{ + dcp::DCP dcp ("build/test/dcp_with_mixed_cpls"); + dcp.add(make_shared("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE)); + dcp.add(make_shared("", dcp::ContentKind::FEATURE, dcp::Standard::INTEROP)); + dcp.add(make_shared("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE)); + BOOST_REQUIRE_THROW (dcp.write_xml(), dcp::MiscError); +} diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 5294f1ac..89c3da81 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (encryption_test) signer->add (dcp::Certificate (dcp::file_to_string ("test/ref/crypt/leaf.signed.pem"))); signer->set_key (dcp::file_to_string ("test/ref/crypt/leaf.key")); - shared_ptr cpl (new dcp::CPL ("A Test DCP", dcp::ContentKind::FEATURE)); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); dcp::Key key; @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE (encryption_test) d.add (cpl); - d.write_xml (dcp::Standard::SMPTE, "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp", signer); + d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "Created by libdcp", signer); dcp::DecryptedKDM kdm ( cpl, diff --git a/test/kdm_test.cc b/test/kdm_test.cc index 506f6c43..ce589a8c 100644 --- a/test/kdm_test.cc +++ b/test/kdm_test.cc @@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE (validity_period_test1) writer->write (frame.data(), frame.size()); auto reel = make_shared(); reel->add(make_shared(asset, 0)); - auto cpl = make_shared("test", dcp::ContentKind::FEATURE); + auto cpl = make_shared("test", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl->add(reel); /* This certificate_chain is valid from 26/12/2012 to 24/12/2022 */ diff --git a/test/markers_test.cc b/test/markers_test.cc index 217900c0..59d523c6 100644 --- a/test/markers_test.cc +++ b/test/markers_test.cc @@ -45,7 +45,7 @@ using std::make_shared; BOOST_AUTO_TEST_CASE (markers_write_test) { - dcp::CPL cpl("Markers test", dcp::ContentKind::TEST); + dcp::CPL cpl("Markers test", dcp::ContentKind::TEST, dcp::Standard::SMPTE); auto asset = make_shared(dcp::Fraction(24, 1), 432000, 0); asset->set (dcp::Marker::FFOC, dcp::Time(1, 1, 9, 16, 24)); @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE (markers_write_test) cpl.add (reel); - cpl.write_xml ("build/test/markers_test.xml", dcp::Standard::SMPTE, {}); + cpl.write_xml ("build/test/markers_test.xml", {}); } static void diff --git a/test/mca_test.cc b/test/mca_test.cc index d9708ea9..45fa03ae 100644 --- a/test/mca_test.cc +++ b/test/mca_test.cc @@ -62,13 +62,13 @@ BOOST_AUTO_TEST_CASE (parse_mca_descriptors_from_mxf_test) reel->add (black_picture_asset(dcp::String::compose("build/test/parse_mca_descriptors_from_mxf_test%1", i), 24)); reel->add (reel_sound_asset); - dcp::CPL cpl("", dcp::ContentKind::FEATURE); + dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl.add (reel); cpl.set_main_sound_configuration("51/L,R,C,LFE,Ls,Rs"); cpl.set_main_sound_sample_rate(48000); cpl.set_main_picture_stored_area(dcp::Size(1998, 1080)); cpl.set_main_picture_active_area(dcp::Size(1998, 1080)); - cpl.write_xml (dcp::String::compose("build/test/parse_mca_descriptors_from_mxf_test%1/cpl.xml", i), dcp::Standard::SMPTE, shared_ptr()); + cpl.write_xml (dcp::String::compose("build/test/parse_mca_descriptors_from_mxf_test%1/cpl.xml", i), shared_ptr()); cxml::Document ref("CompositionPlaylist", private_test / dcp::String::compose("51_sound_with_mca_%1.cpl", i)); cxml::Document check("CompositionPlaylist", dcp::String::compose("build/test/parse_mca_descriptors_from_mxf_test%1/cpl.xml", i)); @@ -115,13 +115,13 @@ BOOST_AUTO_TEST_CASE (write_mca_descriptors_to_mxf_test) reel->add (black_picture_asset("build/test/write_mca_descriptors_to_mxf_test", 24)); reel->add (reel_sound_asset); - dcp::CPL cpl("", dcp::ContentKind::FEATURE); + dcp::CPL cpl("", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl.add (reel); cpl.set_main_sound_configuration("51/L,R,C,LFE,Ls,Rs"); cpl.set_main_sound_sample_rate(48000); cpl.set_main_picture_stored_area(dcp::Size(1998, 1080)); cpl.set_main_picture_active_area(dcp::Size(1998, 1080)); - cpl.write_xml ("build/test/write_mca_descriptors_to_mxf_test/cpl.xml", dcp::Standard::SMPTE, shared_ptr()); + cpl.write_xml ("build/test/write_mca_descriptors_to_mxf_test/cpl.xml", shared_ptr()); cxml::Document ref("CompositionPlaylist", private_test / "51_sound_with_mca_1.cpl"); cxml::Document check("CompositionPlaylist", "build/test/write_mca_descriptors_to_mxf_test/cpl.xml"); diff --git a/test/round_trip_test.cc b/test/round_trip_test.cc index a9037114..313f6069 100644 --- a/test/round_trip_test.cc +++ b/test/round_trip_test.cc @@ -79,9 +79,9 @@ BOOST_AUTO_TEST_CASE (round_trip_test) asset_A->set_key (key); - shared_ptr cpl (new dcp::CPL ("A Test DCP", dcp::ContentKind::FEATURE)); shared_ptr reel (new dcp::Reel ()); reel->add (shared_ptr (new dcp::ReelMonoPictureAsset (asset_A, 0))); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); cpl->add (reel); dcp::LocalTime start; diff --git a/test/test.cc b/test/test.cc index c48ecffe..c46e63c9 100644 --- a/test/test.cc +++ b/test/test.cc @@ -321,7 +321,7 @@ simple_sound (boost::filesystem::path path, string suffix, dcp::MXFMetadata mxf_ shared_ptr -make_simple (boost::filesystem::path path, int reels, int frames) +make_simple (boost::filesystem::path path, int reels, int frames, dcp::Standard standard) { /* Some known metadata */ dcp::MXFMetadata mxf_meta; @@ -332,7 +332,7 @@ make_simple (boost::filesystem::path path, int reels, int frames) boost::filesystem::remove_all (path); boost::filesystem::create_directories (path); auto d = make_shared(path); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, standard); cpl->set_annotation_text ("A Test DCP"); cpl->set_issuer ("OpenDCP 0.0.25"); cpl->set_creator ("OpenDCP 0.0.25"); @@ -414,7 +414,7 @@ simple_markers (int frames) shared_ptr make_simple_with_interop_subs (boost::filesystem::path path) { - shared_ptr dcp = make_simple (path); + auto dcp = make_simple (path, 1, 24, dcp::Standard::INTEROP); shared_ptr subs(new dcp::InteropSubtitleAsset()); subs->add (simple_subtitle()); @@ -453,7 +453,7 @@ make_simple_with_smpte_subs (boost::filesystem::path path) shared_ptr make_simple_with_interop_ccaps (boost::filesystem::path path) { - shared_ptr dcp = make_simple (path); + auto dcp = make_simple (path, 1, 24, dcp::Standard::INTEROP); shared_ptr subs(new dcp::InteropSubtitleAsset()); subs->add (simple_subtitle()); diff --git a/test/test.h b/test/test.h index 57be5d11..8733c7c3 100644 --- a/test/test.h +++ b/test/test.h @@ -47,7 +47,7 @@ extern std::shared_ptr simple_picture (boost::filesystem: extern std::shared_ptr simple_sound (boost::filesystem::path path, std::string suffix, dcp::MXFMetadata mxf_meta, std::string language, int frames = 24, int sample_rate = 48000); extern std::shared_ptr simple_subtitle (); extern std::shared_ptr simple_markers (int frames = 24); -extern std::shared_ptr make_simple (boost::filesystem::path path, int reels = 1, int frames = 24); +extern std::shared_ptr make_simple (boost::filesystem::path path, int reels = 1, int frames = 24, dcp::Standard = dcp::Standard::SMPTE); extern std::shared_ptr make_simple_with_interop_subs (boost::filesystem::path path); extern std::shared_ptr make_simple_with_smpte_subs (boost::filesystem::path path); extern std::shared_ptr make_simple_with_interop_ccaps (boost::filesystem::path path); diff --git a/test/verify_test.cc b/test/verify_test.cc index 78e264a7..bfa52b0a 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -122,12 +122,11 @@ write_dcp_with_single_asset (path dir, shared_ptr reel_asset, dc reel->add (reel_asset); reel->add (simple_markers()); - auto cpl = make_shared("hello", dcp::ContentKind::TRAILER); + auto cpl = make_shared("hello", dcp::ContentKind::TRAILER, standard); cpl->add (reel); auto dcp = make_shared(dir); dcp->add (cpl); dcp->write_xml ( - standard, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -770,7 +769,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_cpl_metadata) reel->add (make_shared(simple_picture(dir, "", 16 * 24), 0)); reel->add (simple_markers(16 * 24)); - auto cpl = make_shared("hello", dcp::ContentKind::TRAILER); + auto cpl = make_shared("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel); cpl->set_main_sound_configuration ("L,C,R,Lfe,-,-"); cpl->set_main_sound_sample_rate (48000); @@ -781,7 +780,6 @@ BOOST_AUTO_TEST_CASE (verify_valid_cpl_metadata) dcp::DCP dcp (dir); dcp.add (cpl); dcp.write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -813,7 +811,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_bad_tag) auto reel = make_shared(); reel->add (black_picture_asset(dir)); - auto cpl = make_shared("hello", dcp::ContentKind::TRAILER); + auto cpl = make_shared("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel); cpl->set_main_sound_configuration ("L,C,R,Lfe,-,-"); cpl->set_main_sound_sample_rate (48000); @@ -826,7 +824,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_bad_tag) dcp::DCP dcp (dir); dcp.add (cpl); dcp.write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -868,7 +865,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_missing_tag) auto reel = make_shared(); reel->add (black_picture_asset(dir)); - auto cpl = make_shared("hello", dcp::ContentKind::TRAILER); + auto cpl = make_shared("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel); cpl->set_main_sound_configuration ("L,C,R,Lfe,-,-"); cpl->set_main_sound_sample_rate (48000); @@ -878,7 +875,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_missing_tag) dcp::DCP dcp (dir); dcp.add (cpl); dcp.write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -959,7 +955,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language3) reel->add (reel_sound); reel->add (simple_markers()); - auto cpl = make_shared("hello", dcp::ContentKind::TRAILER); + auto cpl = make_shared("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel); cpl->_additional_subtitle_languages.push_back("this-is-wrong"); cpl->_additional_subtitle_languages.push_back("andso-is-this"); @@ -972,7 +968,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language3) auto dcp = make_shared(dir); dcp->add (cpl); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1016,7 +1011,7 @@ check_picture_size (int width, int height, int frame_rate, bool three_d) picture_writer->finalize (); auto d = make_shared(dcp_path); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->set_annotation_text ("A Test DCP"); cpl->set_issue_date ("2012-07-17T04:45:18+00:00"); cpl->set_main_sound_configuration ("L,C,R,Lfe,-,-"); @@ -1039,7 +1034,6 @@ check_picture_size (int width, int height, int frame_rate, bool three_d) d->add (cpl); d->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1285,7 +1279,6 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_language) auto reel_subs = make_shared(subs, dcp::Fraction(24, 1), 106, 0); dcp->cpls().front()->reels().front()->add(reel_subs); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1327,7 +1320,6 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages) } dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1370,7 +1362,6 @@ BOOST_AUTO_TEST_CASE (verify_multiple_closed_caption_languages_allowed) } dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1423,7 +1414,6 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_start_time) auto reel_subs = make_shared(subs, dcp::Fraction(24, 1), 106, 0); dcp->cpls().front()->reels().front()->add(reel_subs); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1477,7 +1467,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_start_time) auto reel_subs = make_shared(subs, dcp::Fraction(24, 1), 106, 0); dcp->cpls().front()->reels().front()->add(reel_subs); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1583,13 +1572,12 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel) markers2->set (dcp::Marker::LFOC, dcp::Time(4 * 24 - 1, 24, 24)); reel2->add (markers2); - auto cpl = make_shared("hello", dcp::ContentKind::TRAILER); + auto cpl = make_shared("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel1); cpl->add (reel2); auto dcp = make_shared(dir); dcp->add (cpl); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1879,12 +1867,11 @@ BOOST_AUTO_TEST_CASE (verify_invalid_sound_frame_rate) auto reel_sound = make_shared(sound, 0); reel->add (reel_sound); reel->add (simple_markers()); - auto cpl = make_shared("hello", dcp::ContentKind::TRAILER); + auto cpl = make_shared("hello", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); cpl->add (reel); auto dcp = make_shared(dir); dcp->add (cpl); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1905,7 +1892,6 @@ BOOST_AUTO_TEST_CASE (verify_missing_cpl_annotation_text) path const dir("build/test/verify_missing_cpl_annotation_text"); auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1936,7 +1922,6 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_cpl_annotation_text) path const dir("build/test/verify_mismatched_cpl_annotation_text"); auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -1966,7 +1951,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_asset_duration) path const dir("build/test/verify_mismatched_asset_duration"); prepare_directory (dir); shared_ptr dcp (new dcp::DCP(dir)); - shared_ptr cpl (new dcp::CPL("A Test DCP", dcp::ContentKind::TRAILER)); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); shared_ptr mp = simple_picture (dir, "", 24); shared_ptr ms = simple_sound (dir, "", dcp::MXFMetadata(), "en-US", 25); @@ -1981,7 +1966,6 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_asset_duration) dcp->add (cpl); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2004,7 +1988,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a { prepare_directory (dir); auto dcp = make_shared(dir); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); auto constexpr reel_length = 192; @@ -2047,7 +2031,6 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a dcp->add (cpl); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2092,7 +2075,7 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1, { prepare_directory (dir); auto dcp = make_shared(dir); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); auto constexpr reel_length = 192; @@ -2134,7 +2117,6 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1, dcp->add (cpl); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2178,7 +2160,7 @@ verify_text_entry_point_check (path dir, dcp::VerificationNote::Code code, boost { prepare_directory (dir); auto dcp = make_shared(dir); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); auto constexpr reel_length = 192; @@ -2203,7 +2185,6 @@ verify_text_entry_point_check (path dir, dcp::VerificationNote::Code code, boost dcp->add (cpl); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2262,7 +2243,6 @@ BOOST_AUTO_TEST_CASE (verify_missing_hash) path const dir("build/test/verify_missing_hash"); auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2303,7 +2283,6 @@ verify_markers_test ( } dcp->cpls()[0]->reels()[0]->add(markers_asset); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2405,7 +2384,6 @@ BOOST_AUTO_TEST_CASE (verify_missing_cpl_metadata_version_number) auto cpl = dcp->cpls()[0]; cpl->unset_version_number(); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2421,7 +2399,6 @@ BOOST_AUTO_TEST_CASE (verify_missing_extension_metadata1) path dir = "build/test/verify_missing_extension_metadata1"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2449,7 +2426,6 @@ BOOST_AUTO_TEST_CASE (verify_missing_extension_metadata2) path dir = "build/test/verify_missing_extension_metadata2"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2477,7 +2453,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata3) path dir = "build/test/verify_invalid_xml_cpl_extension_metadata3"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2507,7 +2482,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_extension_metadata1) path dir = "build/test/verify_invalid_extension_metadata1"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2535,7 +2509,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_extension_metadata2) path dir = "build/test/verify_invalid_extension_metadata2"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2563,7 +2536,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata6) path dir = "build/test/verify_invalid_xml_cpl_extension_metadata6"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2593,7 +2565,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata7) path dir = "build/test/verify_invalid_xml_cpl_extension_metadata7"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2621,7 +2592,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata8) path dir = "build/test/verify_invalid_xml_cpl_extension_metadata8"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2651,7 +2621,6 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata9) path dir = "build/test/verify_invalid_xml_cpl_extension_metadata9"; auto dcp = make_simple (dir); dcp->write_xml ( - dcp::Standard::SMPTE, dcp::String::compose("libdcp %1", dcp::version), dcp::String::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), @@ -2767,7 +2736,7 @@ BOOST_AUTO_TEST_CASE (verify_partially_encrypted) signer->add (dcp::Certificate(dcp::file_to_string("test/ref/crypt/leaf.signed.pem"))); signer->set_key (dcp::file_to_string("test/ref/crypt/leaf.key")); - auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER); + auto cpl = make_shared("A Test DCP", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE); dcp::Key key; @@ -2807,7 +2776,7 @@ BOOST_AUTO_TEST_CASE (verify_partially_encrypted) d.add (cpl); - d.write_xml (dcp::Standard::SMPTE, "OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "A Test DCP", signer); + d.write_xml ("OpenDCP 0.0.25", "OpenDCP 0.0.25", "2012-07-17T04:45:18+00:00", "A Test DCP", signer); check_verify_result ( {dir}, @@ -2844,7 +2813,7 @@ BOOST_AUTO_TEST_CASE (verify_jpeg2000_codestream_libdcp) boost::filesystem::path dir = "build/test/verify_jpeg2000_codestream_libdcp"; prepare_directory (dir); auto dcp = make_simple (dir); - dcp->write_xml (dcp::Standard::SMPTE); + dcp->write_xml (); vector notes; dcp::MonoPictureAsset picture (find_file(dir, "video")); auto reader = picture.start_read (); diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc index f7c9ae25..04374dea 100644 --- a/test/write_subtitle_test.cc +++ b/test/write_subtitle_test.cc @@ -368,7 +368,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) string const creator = "libdcp"; string const annotation_text = "Created by libdcp"; - auto cpl = make_shared("My film", dcp::ContentKind::FEATURE); + auto cpl = make_shared("My film", dcp::ContentKind::FEATURE, dcp::Standard::INTEROP); cpl->add (reel); cpl->set_issuer (issuer); cpl->set_creator (creator); @@ -381,7 +381,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) dcp::DCP dcp ("build/test/write_interop_subtitle_test3"); dcp.add (cpl); - dcp.write_xml (dcp::Standard::INTEROP, issuer, creator, issue_date, annotation_text); + dcp.write_xml (issuer, creator, issue_date, annotation_text); check_xml ( dcp::file_to_string("test/ref/write_interop_subtitle_test3/subs.xml"), diff --git a/tools/dcprecover.cc b/tools/dcprecover.cc index f9e08087..f78b246c 100644 --- a/tools/dcprecover.cc +++ b/tools/dcprecover.cc @@ -155,7 +155,7 @@ main (int argc, char* argv[]) dcp::DCP fixed (*output); fixed.add (cpl); fixed.resolve_refs (assets); - fixed.write_xml (dcp::Standard::INTEROP); + fixed.write_xml (); cout << "Fixed XML files written to " << output->string() << "\n"; } -- 2.30.2