From 0a5615c17edf6d9c51d9269c824d6caf71f710e5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 17 Jan 2022 18:45:19 +0100 Subject: Use optional for ReelAsset _annotation_text. Not only is this tag optional in Interop and SMPTE, but it would appear that if it is present but empty a DCP will not play back on Sony SRX320 / LMT3000 systems (DoM bug #2124). Here we use optional<>, as seems to make sense, and also refuse to write empty tags (instead omitting the tag entirely). --- src/reel_asset.cc | 11 +++++--- src/reel_asset.h | 8 ++++-- test/reel_asset_test.cc | 4 +-- test/ref/DCP/dcp_test1/ASSETMAP.xml | 2 +- .../cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml | 3 -- .../pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml | 4 +-- test/ref/DCP/dcp_test2/ASSETMAP.xml | 2 +- .../cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml | 2 -- .../pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml | 4 +-- test/ref/DCP/dcp_test5/ASSETMAP.xml | 2 +- .../cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml | 3 -- .../pkl_5d51e8a1-b2a5-4da6-9b66-4615c3609440.xml | 4 +-- test/ref/DCP/dcp_test7/ASSETMAP | 2 +- .../cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml | 3 -- .../pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml | 4 +-- test/ref/DCP/encryption_test/ASSETMAP.xml | 2 +- .../cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml | 16 +++++------ .../pkl_8ee8f7da-8da2-4adb-ae0e-31e8f4b91900.xml | 18 ++++++------ test/ref/cpl_metadata_test1.xml | 1 - test/ref/cpl_metadata_test2.xml | 1 - test/ref/write_interop_subtitle_test3/ASSETMAP | 2 +- .../pkl_e94b8a0d-27f7-408a-af16-78d3df419a91.xml | 4 +-- test/verify_test.cc | 33 +++++++++++++--------- 23 files changed, 67 insertions(+), 68 deletions(-) diff --git a/src/reel_asset.cc b/src/reel_asset.cc index d233ee64..f9742628 100644 --- a/src/reel_asset.cc +++ b/src/reel_asset.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2021 Carl Hetherington + Copyright (C) 2014-2022 Carl Hetherington This file is part of libdcp. @@ -72,7 +72,7 @@ ReelAsset::ReelAsset (shared_ptr node) : Object (remove_urn_uuid (node->string_child ("Id"))) , _intrinsic_duration (node->number_child ("IntrinsicDuration")) , _duration (node->optional_number_child("Duration")) - , _annotation_text (node->optional_string_child ("AnnotationText").get_value_or ("")) + , _annotation_text (node->optional_string_child("AnnotationText")) , _edit_rate (Fraction (node->string_child ("EditRate"))) , _entry_point (node->optional_number_child("EntryPoint")) { @@ -93,7 +93,10 @@ ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const a->set_namespace_declaration (ns.first, ns.second); } a->add_child("Id")->add_child_text ("urn:uuid:" + _id); - a->add_child("AnnotationText")->add_child_text (_annotation_text); + /* Empty tags cause refusal to play on some Sony SRX320 / LMT3000 systems (DoM bug #2124) */ + if (_annotation_text && !_annotation_text->empty()) { + a->add_child("AnnotationText")->add_child_text(*_annotation_text); + } a->add_child("EditRate")->add_child_text (_edit_rate.as_string()); a->add_child("IntrinsicDuration")->add_child_text (raw_convert (_intrinsic_duration)); if (_entry_point) { @@ -124,7 +127,7 @@ bool ReelAsset::asset_equals (shared_ptr other, EqualityOptions opt, NoteHandler note) const { if (_annotation_text != other->_annotation_text) { - string const s = "Reel: annotation texts differ (" + _annotation_text + " vs " + other->_annotation_text + ")\n"; + string const s = "Reel: annotation texts differ (" + _annotation_text.get_value_or("") + " vs " + other->_annotation_text.get_value_or("") + ")\n"; if (!opt.reel_annotation_texts_can_differ) { note (NoteType::ERROR, s); return false; diff --git a/src/reel_asset.h b/src/reel_asset.h index ab06434e..200c49ff 100644 --- a/src/reel_asset.h +++ b/src/reel_asset.h @@ -120,7 +120,7 @@ public: /** @return , or - if is not present */ int64_t actual_duration () const; - std::string annotation_text () const { + boost::optional annotation_text () const { return _annotation_text; } @@ -128,6 +128,10 @@ public: _annotation_text = at; } + void unset_annotation_text () { + _annotation_text = boost::none; + } + bool asset_equals (std::shared_ptr, EqualityOptions, NoteHandler) const; protected: @@ -147,7 +151,7 @@ protected: boost::optional _duration; ///< The <Duration> from the reel's entry for this asset, if present private: - std::string _annotation_text; ///< The <AnnotationText> from the reel's entry for this asset + boost::optional _annotation_text; ///< The <AnnotationText> from the reel's entry for this asset Fraction _edit_rate; ///< The <EditRate> from the reel's entry for this asset boost::optional _entry_point; ///< The <EntryPoint> from the reel's entry for this asset }; diff --git a/test/reel_asset_test.cc b/test/reel_asset_test.cc index 94f9c265..9dd2f8c3 100644 --- a/test/reel_asset_test.cc +++ b/test/reel_asset_test.cc @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE (reel_picture_asset_test) dcp::ReelMonoPictureAsset pa (doc); BOOST_CHECK_EQUAL (pa.id(), "06ac1ca7-9c46-4107-8864-a6448e24b04b"); - BOOST_CHECK_EQUAL (pa.annotation_text(), "Hello world!"); + BOOST_CHECK_EQUAL (pa.annotation_text().get_value_or(""), "Hello world!"); BOOST_CHECK_EQUAL (pa.edit_rate(), dcp::Fraction(24, 1)); BOOST_CHECK_EQUAL (pa.intrinsic_duration(), 187048); BOOST_CHECK_EQUAL (pa.entry_point().get(), 42L); @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE (reel_smpte_subtitle_asset_test) dcp::ReelSMPTESubtitleAsset ps (doc); BOOST_CHECK_EQUAL (ps.id(), "8bca1489-aab1-9259-a4fd-8150abc1de12"); - BOOST_CHECK_EQUAL (ps.annotation_text(), "Goodbye world!"); + BOOST_CHECK_EQUAL (ps.annotation_text().get_value_or(""), "Goodbye world!"); BOOST_CHECK_EQUAL (ps.edit_rate(), dcp::Fraction(25, 1)); BOOST_CHECK_EQUAL (ps.intrinsic_duration(), 1870); BOOST_CHECK_EQUAL (ps.entry_point().get(), 0L); diff --git a/test/ref/DCP/dcp_test1/ASSETMAP.xml b/test/ref/DCP/dcp_test1/ASSETMAP.xml index 10083feb..ee780c7c 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 - 8762 + 8630 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 ae0f23be..01eea88d 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 @@ -18,7 +18,6 @@ urn:uuid:93182bd2-b1e8-41a3-b5c8-6e6564273bff - 24 1 24 0 @@ -36,7 +35,6 @@ urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 - 24 1 24 0 @@ -47,7 +45,6 @@ urn:uuid:8b92bcee-62fc-4a33-a51a-816e9611ce85 - 24 1 24 0 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 3f285d23..cf753574 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 - c1DRq6GaSzV2brF0YnSNed46nqk= - 8762 + 6pkiSEIBuZW7KEY73GrNNw8UjDE= + 8630 text/xml diff --git a/test/ref/DCP/dcp_test2/ASSETMAP.xml b/test/ref/DCP/dcp_test2/ASSETMAP.xml index 61cf5d21..23390415 100644 --- a/test/ref/DCP/dcp_test2/ASSETMAP.xml +++ b/test/ref/DCP/dcp_test2/ASSETMAP.xml @@ -26,7 +26,7 @@ cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml 1 0 - 1774 + 1686 diff --git a/test/ref/DCP/dcp_test2/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml b/test/ref/DCP/dcp_test2/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml index 6e5fab73..3910dcd3 100644 --- a/test/ref/DCP/dcp_test2/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml +++ b/test/ref/DCP/dcp_test2/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml @@ -18,7 +18,6 @@ urn:uuid:77e1fb48-ce0c-4d29-bf88-8c3bfec8013a - 24 1 24 0 @@ -27,7 +26,6 @@ urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 - 24 1 24 0 diff --git a/test/ref/DCP/dcp_test2/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml b/test/ref/DCP/dcp_test2/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml index a37a062a..abfd5100 100644 --- a/test/ref/DCP/dcp_test2/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml +++ b/test/ref/DCP/dcp_test2/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml @@ -9,8 +9,8 @@ urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b 81fb54df-e1bf-4647-8788-ea7ba154375b - Q9GRM2MtKZAg5FEIEkRsL28rNeQ= - 1774 + 9JCFUMDcUujOZxSqSig3u/5wIuI= + 1686 text/xml diff --git a/test/ref/DCP/dcp_test5/ASSETMAP.xml b/test/ref/DCP/dcp_test5/ASSETMAP.xml index 3f5d9076..fb9f897a 100644 --- a/test/ref/DCP/dcp_test5/ASSETMAP.xml +++ b/test/ref/DCP/dcp_test5/ASSETMAP.xml @@ -26,7 +26,7 @@ cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml 1 0 - 2156 + 2024 diff --git a/test/ref/DCP/dcp_test5/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml b/test/ref/DCP/dcp_test5/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml index a7a1441e..69558723 100644 --- a/test/ref/DCP/dcp_test5/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml +++ b/test/ref/DCP/dcp_test5/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml @@ -18,7 +18,6 @@ urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 - 24 1 24 0 @@ -29,7 +28,6 @@ urn:uuid:8b92bcee-62fc-4a33-a51a-816e9611ce85 - 24 1 24 0 @@ -38,7 +36,6 @@ urn:uuid:b68febcc-5ddf-489a-84a7-924f29fa2afd - 24 1 1489 0 diff --git a/test/ref/DCP/dcp_test5/pkl_5d51e8a1-b2a5-4da6-9b66-4615c3609440.xml b/test/ref/DCP/dcp_test5/pkl_5d51e8a1-b2a5-4da6-9b66-4615c3609440.xml index 6f7974a4..0ae84d3d 100644 --- a/test/ref/DCP/dcp_test5/pkl_5d51e8a1-b2a5-4da6-9b66-4615c3609440.xml +++ b/test/ref/DCP/dcp_test5/pkl_5d51e8a1-b2a5-4da6-9b66-4615c3609440.xml @@ -9,8 +9,8 @@ urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b 81fb54df-e1bf-4647-8788-ea7ba154375b - kvvGY8+ZNsyJyWk6i5Ha1dRpFQU= - 2156 + +a4c/A2gZJW4rVH5BZ7jbb6qXkc= + 2024 text/xml diff --git a/test/ref/DCP/dcp_test7/ASSETMAP b/test/ref/DCP/dcp_test7/ASSETMAP index f82ce56f..71873d99 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 - 2168 + 2036 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 d3589fc5..89f6851d 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 @@ -18,7 +18,6 @@ urn:uuid:93182bd2-b1e8-41a3-b5c8-6e6564273bff - 24 1 24 0 @@ -36,7 +35,6 @@ urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 - 24 1 24 0 @@ -47,7 +45,6 @@ urn:uuid:8b92bcee-62fc-4a33-a51a-816e9611ce85 - 24 1 24 0 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 a2c83a0e..6d529422 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 - LE8AZqXvZYb8W6QjVZiN7zB8Tro= - 2168 + qD31AlG29UXWwTGYch5P+zuD3xc= + 2036 text/xml;asdcpKind=CPL diff --git a/test/ref/DCP/encryption_test/ASSETMAP.xml b/test/ref/DCP/encryption_test/ASSETMAP.xml index 3c1ca16c..71fa54ac 100644 --- a/test/ref/DCP/encryption_test/ASSETMAP.xml +++ b/test/ref/DCP/encryption_test/ASSETMAP.xml @@ -26,7 +26,7 @@ cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml 1 0 - 9314 + 9226 diff --git a/test/ref/DCP/encryption_test/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml b/test/ref/DCP/encryption_test/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml index 598444b4..2866df6d 100644 --- a/test/ref/DCP/encryption_test/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml +++ b/test/ref/DCP/encryption_test/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml @@ -18,7 +18,6 @@ urn:uuid:e98d059d-645f-4343-a30f-edc61d58b8e0 - 24 1 24 0 @@ -30,7 +29,6 @@ urn:uuid:11471a77-7cd8-4de6-8c11-beaa198c015f - 24 1 24 0 @@ -59,15 +57,15 @@ - G/4l/FrHjANRjHMvx1wwtojaqXY= + 4/8QgoO0blTh31eQ8ubu1zkECYc= - tLWdo5wkG1aseboTfSONMMYLEnd89Wqcjw0Gwhw71wX/lEKEGYiCluUchInurc6J -+Lq7rgNz+SPg7XIgh1N58EHqEarwH6oFTf2ZFMtoEzmX1nXcjKR7MRYomMtCBb/V -g+LOpPuOY+36bQ/8XBYiH8t1w6ayNSLI0LGTuAfJDz+/L6wAGRSLosQgVThjz3bE -nnl9V96ufU3vMPcrq2YpT99Rb61gX3ItBKW60FiTX+NB5vBwQ1lq4vJ6qno4aviE -HEebN6byReZtqm+X6/olVvVHJBAyOG1ZKOb9Oj6I2Iw4hx0OYB70Tg7Qkx+f8zsl -HHXyc9gA+KzKStrrm390oA== + jHGd0G9X7iT26LNertFIPsKGIVUxUNEZWSDmjzYH4QwP2SAYOMh/tGXAaUQyy2vA ++qCj+OQavpBS8q1HMekyUrShRo18XY6mpS3lSADdZBY7TLExCdkLtSq7yoPVfzx+ ++iRypVIKBl6xbv9wf/ssCzpxXMbsuaL5BGbOdRlgH7FFdQN5GKbAWVYoCmPHcl+q +S2BLqXN1S9LjB4zQ606bVq2C4S7mUYqAFZ0a9w/MK1RU5kFRJfq7W2ZktvhIWrFI +K6iF4XGhwoCURfPKP9piAwrpR+5sI7LuknMLa/JHPYzkBCH63oZoNW8vHyzCBNpR +ADgG10jZGAXp+GY0BL8v2w== diff --git a/test/ref/DCP/encryption_test/pkl_8ee8f7da-8da2-4adb-ae0e-31e8f4b91900.xml b/test/ref/DCP/encryption_test/pkl_8ee8f7da-8da2-4adb-ae0e-31e8f4b91900.xml index ecacaac5..b97d6eaf 100644 --- a/test/ref/DCP/encryption_test/pkl_8ee8f7da-8da2-4adb-ae0e-31e8f4b91900.xml +++ b/test/ref/DCP/encryption_test/pkl_8ee8f7da-8da2-4adb-ae0e-31e8f4b91900.xml @@ -9,8 +9,8 @@ urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b 81fb54df-e1bf-4647-8788-ea7ba154375b - iBE1dh+gKFCi7R93mx2AoJ1eaek= - 9314 + zk4L2kXj9llDdjmxCW2d2X06VQM= + 9226 text/xml @@ -46,15 +46,15 @@ - iFEJZ3tiVaiuJMzVY/ju8qx+KV0= + xzO3cFwUX87TL4rL9jq6CLqDN6I= - GKFnAkzVuhXi391uAz5kRTmKaJKMKd3iAe1XtYsUoRfhVxtQCv/hha/W8xpVsP2J -g/duTyASL/T4vdaQsrR8K3JUwP/r/gWlN3UfcFIORHkKeJ9OOBSIdauthODZpAJw -V+ZfgTu5S8aTh4XqkWWeVDQSsBWJhgHWFM4vrPrsWxae4l3SGj2DpcXUPhLOe55+ -Xh/sVJVH8CpEcNGKNDZnaJShUI6Ige45ElUePZNsYRNLBDWDcYw+nR0DAUovEuCh -CFqB2H9FKwufxAIWqbEYSca4liHlgFYL7TuHgaDbzdjTlQ8oL3kCPGbtVX5oWiEu -ZksAYCwT9sDxSxeThmFZOQ== + VIZyD5JmV2gnPyzMEMwDaIg+NBOZzpSvBoRtPbWrYUyjxVzQfPvFzAAE+4hz8Wc7 +TIpiTZ3sYXKRQAEmA4Iu5AOJ2uijv8tnioo2FyV6JT9aGr5cNi7eeGFmN7ILU4zc +rgp99iWgTRms8T8C7zy/NtE8P2q8K4sxQvxnYmK/0kHkQPQnWpZafAd6G/fpoV0h +5W8UQTtn72OEPhm21uxp4crWRk9YlF2ayGYDBGm8YFP01w663e0r61xq6ROW2O4i +jR2dQWPM1nzrafHSJKg2TL4S/GtTsDNNuIJihzGpmEjULX2FIt83f6dogyr7K624 +XcjpahE+WHn7WR3VVZsMkw== diff --git a/test/ref/cpl_metadata_test1.xml b/test/ref/cpl_metadata_test1.xml index 58649e8d..1140c07d 100644 --- a/test/ref/cpl_metadata_test1.xml +++ b/test/ref/cpl_metadata_test1.xml @@ -18,7 +18,6 @@ urn:uuid:e98d059d-645f-4343-a30f-edc61d58b8e0 - 24 1 24 0 diff --git a/test/ref/cpl_metadata_test2.xml b/test/ref/cpl_metadata_test2.xml index 01dd52d8..d04d25af 100644 --- a/test/ref/cpl_metadata_test2.xml +++ b/test/ref/cpl_metadata_test2.xml @@ -18,7 +18,6 @@ urn:uuid:e98d059d-645f-4343-a30f-edc61d58b8e0 - 24 1 24 0 diff --git a/test/ref/write_interop_subtitle_test3/ASSETMAP b/test/ref/write_interop_subtitle_test3/ASSETMAP index 228a7e1c..7c901513 100644 --- a/test/ref/write_interop_subtitle_test3/ASSETMAP +++ b/test/ref/write_interop_subtitle_test3/ASSETMAP @@ -26,7 +26,7 @@ cpl_46c3eb45-15e5-47d6-8684-d8641e4dc516.xml 1 0 - 1105 + 1061 diff --git a/test/ref/write_interop_subtitle_test3/pkl_e94b8a0d-27f7-408a-af16-78d3df419a91.xml b/test/ref/write_interop_subtitle_test3/pkl_e94b8a0d-27f7-408a-af16-78d3df419a91.xml index 664ad626..2da8e910 100644 --- a/test/ref/write_interop_subtitle_test3/pkl_e94b8a0d-27f7-408a-af16-78d3df419a91.xml +++ b/test/ref/write_interop_subtitle_test3/pkl_e94b8a0d-27f7-408a-af16-78d3df419a91.xml @@ -9,8 +9,8 @@ urn:uuid:46c3eb45-15e5-47d6-8684-d8641e4dc516 46c3eb45-15e5-47d6-8684-d8641e4dc516 - YkdOdaGok/Vrkq62zAkfCw1l/Y4= - 1105 + 614bJ4VLsNZ6mLbdXbZXjGuoSsY= + 1061 text/xml;asdcpKind=CPL diff --git a/test/verify_test.cc b/test/verify_test.cc index dab85a23..b2e98981 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -115,6 +115,9 @@ prepare_directory (path path) } +/** Copy dcp_test{reference_number} to build/test/verify_test{verify_test_suffix} + * to make a new sacrifical test DCP. + */ static path setup (int reference_number, string verify_test_suffix) { @@ -255,6 +258,10 @@ check_verify_result (vector dir, vector test_notes) } +/* Copy dcp_test1 to build/test/verify_test{suffix} then edit a file found by the functor 'file', + * replacing from with to. Verify the resulting DCP and check that the results match the given + * list of codes. + */ static void check_verify_result_after_replace (string suffix, boost::function file, string from, string to, vector codes) @@ -379,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 'xc1DRq6GaSzV2brF0YnSNed46nqk=' is invalid Base64-encoded binary", canonical(dir / dcp_test1_pkl), 12 } }); } @@ -510,7 +517,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_pkl_id) BOOST_AUTO_TEST_CASE (verify_invalid_xml_asset_map_id) { check_verify_result_after_replace ( - "invalix_xml_asset_map_id", &asset_map, + "invalid_xml_asset_map_id", &asset_map, "urn:uuid:" + dcp_test1_asset_map_id.substr(0, 3), "urn:uuid:x" + dcp_test1_asset_map_id.substr(1, 2), { dcp::VerificationNote::Code::INVALID_XML } @@ -936,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()), 54 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("no declaration found for element 'meta:MainSoundXSampleRate'"), canonical(cpl->file().get()), 55 }, + { 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, @@ -948,7 +955,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_cpl_metadata_bad_tag) "MainSoundSampleRate,MainPictureStoredArea,MainPictureActiveArea,MainSubtitleLanguageList?," "ExtensionMetadataList?,)'"), canonical(cpl->file().get()), - 75 + 73 }, { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->id(), canonical(cpl->file().get()) }, }); @@ -2727,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(), 75 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:NameX' is not allowed for content model '(Name,PropertyList?,)'"), cpl->file().get(), 82 }, + { 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::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); } @@ -2810,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(), 79 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:ValueX' is not allowed for content model '(Name,Value)'"), cpl->file().get(), 80 }, + { 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::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); } @@ -2866,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(), 77 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:PropertyX' is not allowed for content model '(Property+)'"), cpl->file().get(), 81 }, + { 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::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); } @@ -2895,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(), 76 }, - { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_XML, string("element 'meta:PropertyListX' is not allowed for content model '(Name,PropertyList?,)'"), cpl->file().get(), 82 }, + { 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::MISMATCHED_CPL_HASHES, cpl->id(), cpl->file().get() }, }); } -- cgit v1.2.3