From: Carl Hetherington Date: Wed, 23 Mar 2022 23:41:32 +0000 (+0100) Subject: Remove and from tags. X-Git-Tag: v1.8.13~1 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=bc6ef3ae7644c256e2339366e5aa14c4fa4bbee4;p=libdcp.git Remove and from tags. They should not be there: "EntryPoint" ... "This element shall only be present when the Asset refers to an external resource such as a Track File". Fixes DoM bug #2215. --- diff --git a/src/reel_asset.cc b/src/reel_asset.cc index f9742628..6b6bdc0b 100644 --- a/src/reel_asset.cc +++ b/src/reel_asset.cc @@ -49,22 +49,25 @@ LIBDCP_DISABLE_WARNINGS LIBDCP_ENABLE_WARNINGS -using std::pair; -using std::string; using std::make_pair; +using std::pair; using std::shared_ptr; +using std::string; using boost::optional; using namespace dcp; -ReelAsset::ReelAsset (string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) +ReelAsset::ReelAsset (string id, Fraction edit_rate, int64_t intrinsic_duration, optional entry_point) : Object (id) , _intrinsic_duration (intrinsic_duration) - , _duration (intrinsic_duration - entry_point) , _edit_rate (edit_rate) , _entry_point (entry_point) { - DCP_ASSERT (_entry_point <= _intrinsic_duration); + if (_entry_point) { + _duration = intrinsic_duration - *_entry_point; + } + + DCP_ASSERT (!_entry_point || *_entry_point <= _intrinsic_duration); } diff --git a/src/reel_asset.h b/src/reel_asset.h index 200c49ff..6de7f1be 100644 --- a/src/reel_asset.h +++ b/src/reel_asset.h @@ -79,7 +79,7 @@ public: * @param intrinsic_duration Intrinsic duration of this asset * @param entry_point Entry point to use in that asset */ - ReelAsset (std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelAsset (std::string id, Fraction edit_rate, int64_t intrinsic_duration, boost::optional entry_point); explicit ReelAsset (std::shared_ptr); diff --git a/src/reel_markers_asset.cc b/src/reel_markers_asset.cc index 0dd3cf29..5a079071 100644 --- a/src/reel_markers_asset.cc +++ b/src/reel_markers_asset.cc @@ -54,8 +54,8 @@ using std::shared_ptr; using namespace dcp; -ReelMarkersAsset::ReelMarkersAsset (Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) - : ReelAsset (make_uuid(), edit_rate, intrinsic_duration, entry_point) +ReelMarkersAsset::ReelMarkersAsset (Fraction edit_rate, int64_t intrinsic_duration) + : ReelAsset (make_uuid(), edit_rate, intrinsic_duration, {}) { } diff --git a/src/reel_markers_asset.h b/src/reel_markers_asset.h index e3fbb962..df87dcce 100644 --- a/src/reel_markers_asset.h +++ b/src/reel_markers_asset.h @@ -48,7 +48,7 @@ namespace dcp { class ReelMarkersAsset : public ReelAsset { public: - ReelMarkersAsset (Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelMarkersAsset (Fraction edit_rate, int64_t intrinsic_duration); explicit ReelMarkersAsset (std::shared_ptr); xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override; diff --git a/test/markers_test.cc b/test/markers_test.cc index 3f2ea8ab..c8293946 100644 --- a/test/markers_test.cc +++ b/test/markers_test.cc @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE (markers_write_test) { dcp::CPL cpl("Markers test", dcp::ContentKind::TEST, dcp::Standard::SMPTE); - auto asset = make_shared(dcp::Fraction(24, 1), 432000, 0); + auto asset = make_shared(dcp::Fraction(24, 1), 432000); asset->set (dcp::Marker::FFOC, dcp::Time(1, 1, 9, 16, 24)); asset->set (dcp::Marker::LFOC, dcp::Time(2, 5, 3, 0, 24)); asset->set (dcp::Marker::FFTC, dcp::Time(0, 6, 4, 2, 24)); @@ -101,6 +101,6 @@ BOOST_AUTO_TEST_CASE (markers_read_test, * boost::unit_test::depends_on("markers BOOST_CHECK (markers->equals(markers, dcp::EqualityOptions(), [](dcp::NoteType, string) {})); - auto markers2 = make_shared(dcp::Fraction(24, 1), 432000, 0); + auto markers2 = make_shared(dcp::Fraction(24, 1), 432000); BOOST_CHECK (!markers->equals(markers2, dcp::EqualityOptions(), [](dcp::NoteType, string) {})); } diff --git a/test/ref/DCP/dcp_test1/ASSETMAP.xml b/test/ref/DCP/dcp_test1/ASSETMAP.xml index ee780c7c..962afeb3 100644 --- a/test/ref/DCP/dcp_test1/ASSETMAP.xml +++ b/test/ref/DCP/dcp_test1/ASSETMAP.xml @@ -26,7 +26,7 @@ cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml 1 0 - 8630 + 8559 diff --git a/test/ref/DCP/dcp_test1/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml b/test/ref/DCP/dcp_test1/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml index 01eea88d..6c1b2ad7 100644 --- a/test/ref/DCP/dcp_test1/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml +++ b/test/ref/DCP/dcp_test1/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml @@ -20,8 +20,6 @@ urn:uuid:93182bd2-b1e8-41a3-b5c8-6e6564273bff 24 1 24 - 0 - 24 diff --git a/test/ref/DCP/dcp_test1/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml b/test/ref/DCP/dcp_test1/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml index cf753574..588c7d48 100644 --- a/test/ref/DCP/dcp_test1/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml +++ b/test/ref/DCP/dcp_test1/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml @@ -9,8 +9,8 @@ urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b 81fb54df-e1bf-4647-8788-ea7ba154375b - 6pkiSEIBuZW7KEY73GrNNw8UjDE= - 8630 + znqYbl53W9ZQtrU2E1FQ6dwdM2M= + 8559 text/xml diff --git a/test/ref/DCP/dcp_test7/ASSETMAP b/test/ref/DCP/dcp_test7/ASSETMAP index 71873d99..0e40e455 100644 --- a/test/ref/DCP/dcp_test7/ASSETMAP +++ b/test/ref/DCP/dcp_test7/ASSETMAP @@ -26,7 +26,7 @@ cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml 1 0 - 2036 + 1965 diff --git a/test/ref/DCP/dcp_test7/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml b/test/ref/DCP/dcp_test7/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml index 89f6851d..58e5897c 100644 --- a/test/ref/DCP/dcp_test7/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml +++ b/test/ref/DCP/dcp_test7/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml @@ -20,8 +20,6 @@ urn:uuid:93182bd2-b1e8-41a3-b5c8-6e6564273bff 24 1 24 - 0 - 24 diff --git a/test/ref/DCP/dcp_test7/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml b/test/ref/DCP/dcp_test7/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml index 6d529422..c8190a2f 100644 --- a/test/ref/DCP/dcp_test7/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml +++ b/test/ref/DCP/dcp_test7/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml @@ -9,8 +9,8 @@ urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b 81fb54df-e1bf-4647-8788-ea7ba154375b - qD31AlG29UXWwTGYch5P+zuD3xc= - 2036 + V/3WP9Ff60ZtDhisE5onL9wo2tY= + 1965 text/xml;asdcpKind=CPL diff --git a/test/test.cc b/test/test.cc index a6472540..1b0b9b10 100644 --- a/test/test.cc +++ b/test/test.cc @@ -371,7 +371,7 @@ make_simple (boost::filesystem::path path, int reels, int frames, dcp::Standard shared_ptr(new dcp::ReelSoundAsset(ms, 0)) ); - auto markers = make_shared(dcp::Fraction(24, 1), frames, 0); + auto markers = make_shared(dcp::Fraction(24, 1), frames); if (i == 0) { markers->set (dcp::Marker::FFOC, dcp::Time(0, 0, 0, 1, 24)); } @@ -419,7 +419,7 @@ simple_subtitle () shared_ptr simple_markers (int frames) { - auto markers = make_shared(dcp::Fraction(24, 1), frames, 0); + auto markers = make_shared(dcp::Fraction(24, 1), frames); markers->set (dcp::Marker::FFOC, dcp::Time(1, 24, 24)); markers->set (dcp::Marker::LFOC, dcp::Time(frames - 1, 24, 24)); return markers; diff --git a/test/verify_test.cc b/test/verify_test.cc index 6a3dacc4..8126c318 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -386,9 +386,9 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_picture_sound_hashes) { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, dcp_test1_cpl_id, canonical(dir / dcp_test1_cpl) }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_PICTURE_HASHES, canonical(dir / "video.mxf") }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_SOUND_HASHES, canonical(dir / "audio.mxf") }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, "value 'x6pkiSEIBuZW7KEY73GrNNw8UjDE=' is invalid Base64-encoded binary", canonical(dir / dcp_test1_pkl), 12 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, "value 'xLq7ot/GobgrqUYdlbR8FCD5APqs=' is invalid Base64-encoded binary", canonical(dir / dcp_test1_pkl), 26 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, "value 'xgVKhC9IkWyzQbgzpFcJ1bpqbtwk=' is invalid Base64-encoded binary", canonical(dir / dcp_test1_pkl), 19 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, "value 'xznqYbl53W9ZQtrU2E1FQ6dwdM2M=' is invalid Base64-encoded binary", canonical(dir / dcp_test1_pkl), 12 }, }); } @@ -943,8 +943,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_bad_tag) check_verify_result ( { dir }, { - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:MainSoundXConfiguration'"), canonical(cpl->file().get()), 52 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:MainSoundXSampleRate'"), canonical(cpl->file().get()), 53 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:MainSoundXConfiguration'"), canonical(cpl->file().get()), 50 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:MainSoundXSampleRate'"), canonical(cpl->file().get()), 51 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, @@ -955,7 +955,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_bad_tag) "MainSoundSampleRate,MainPictureStoredArea,MainPictureActiveArea,MainSubtitleLanguageList?," "ExtensionMetadataList?,)'"), canonical(cpl->file().get()), - 73 + 71 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->id(), canonical(cpl->file().get()) }, }); @@ -1700,7 +1700,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel) auto reel_asset1 = make_shared(asset1, dcp::Fraction(24, 1), 5 * 24, 0); auto reel1 = make_shared(); reel1->add (reel_asset1); - auto markers1 = make_shared(dcp::Fraction(24, 1), 5 * 24, 0); + auto markers1 = make_shared(dcp::Fraction(24, 1), 5 * 24); markers1->set (dcp::Marker::FFOC, dcp::Time(1, 24, 24)); reel1->add (markers1); @@ -1713,7 +1713,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel) auto reel_asset2 = make_shared(asset2, dcp::Fraction(24, 1), 4 * 24, 0); auto reel2 = make_shared(); reel2->add (reel_asset2); - auto markers2 = make_shared(dcp::Fraction(24, 1), 4 * 24, 0); + auto markers2 = make_shared(dcp::Fraction(24, 1), 4 * 24); markers2->set (dcp::Marker::LFOC, dcp::Time(4 * 24 - 1, 24, 24)); reel2->add (markers2); @@ -2268,7 +2268,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a reel1->add (make_shared(subs, dcp::Fraction(24, 1), reel_length, 0)); } - auto markers1 = make_shared(dcp::Fraction(24, 1), reel_length, 0); + auto markers1 = make_shared(dcp::Fraction(24, 1), reel_length); markers1->set (dcp::Marker::FFOC, dcp::Time(1, 24, 24)); reel1->add (markers1); @@ -2283,7 +2283,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a reel2->add (make_shared(subs, dcp::Fraction(24, 1), reel_length, 0)); } - auto markers2 = make_shared(dcp::Fraction(24, 1), reel_length, 0); + auto markers2 = make_shared(dcp::Fraction(24, 1), reel_length); markers2->set (dcp::Marker::LFOC, dcp::Time(reel_length - 1, 24, 24)); reel2->add (markers2); @@ -2354,7 +2354,7 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1, reel1->add (make_shared(subs, dcp::Fraction(24, 1), reel_length, 0)); } - auto markers1 = make_shared(dcp::Fraction(24, 1), reel_length, 0); + auto markers1 = make_shared(dcp::Fraction(24, 1), reel_length); markers1->set (dcp::Marker::FFOC, dcp::Time(1, 24, 24)); reel1->add (markers1); @@ -2369,7 +2369,7 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1, reel2->add (make_shared(subs, dcp::Fraction(24, 1), reel_length, 0)); } - auto markers2 = make_shared(dcp::Fraction(24, 1), reel_length, 0); + auto markers2 = make_shared(dcp::Fraction(24, 1), reel_length); markers2->set (dcp::Marker::LFOC, dcp::Time(reel_length - 1, 24, 24)); reel2->add (markers2); @@ -2540,7 +2540,7 @@ verify_markers_test ( { auto dcp = make_simple (dir); dcp->cpls()[0]->set_content_kind (dcp::ContentKind::FEATURE); - auto markers_asset = make_shared(dcp::Fraction(24, 1), 24, 0); + auto markers_asset = make_shared(dcp::Fraction(24, 1), 24); for (auto const& i: markers) { markers_asset->set (i.first, i.second); } @@ -2734,8 +2734,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata3) check_verify_result ( {dir}, { - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:NameX'"), cpl->file().get(), 72 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:NameX' is not allowed for content model '(Name,PropertyList?,)'"), cpl->file().get(), 79 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:NameX'"), cpl->file().get(), 70 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:NameX' is not allowed for content model '(Name,PropertyList?,)'"), cpl->file().get(), 77 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); } @@ -2817,8 +2817,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata6) check_verify_result ( {dir}, { - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:ValueX'"), cpl->file().get(), 76 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:ValueX' is not allowed for content model '(Name,Value)'"), cpl->file().get(), 77 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:ValueX'"), cpl->file().get(), 74 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:ValueX' is not allowed for content model '(Name,Value)'"), cpl->file().get(), 75 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); } @@ -2873,8 +2873,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata8) check_verify_result ( {dir}, { - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:PropertyX'"), cpl->file().get(), 74 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:PropertyX' is not allowed for content model '(Property+)'"), cpl->file().get(), 78 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:PropertyX'"), cpl->file().get(), 72 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:PropertyX' is not allowed for content model '(Property+)'"), cpl->file().get(), 76 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); } @@ -2902,8 +2902,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata9) check_verify_result ( {dir}, { - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:PropertyListX'"), cpl->file().get(), 73 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:PropertyListX' is not allowed for content model '(Name,PropertyList?,)'"), cpl->file().get(), 79 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:PropertyListX'"), cpl->file().get(), 71 }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:PropertyListX' is not allowed for content model '(Name,PropertyList?,)'"), cpl->file().get(), 77 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); }