Remove <EntryPoint> and <Duration> from <ReelMarkerAsset> tags.
authorCarl Hetherington <cth@carlh.net>
Wed, 23 Mar 2022 23:41:32 +0000 (00:41 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 20 Apr 2022 18:04:03 +0000 (20:04 +0200)
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.

13 files changed:
src/reel_asset.cc
src/reel_asset.h
src/reel_markers_asset.cc
src/reel_markers_asset.h
test/markers_test.cc
test/ref/DCP/dcp_test1/ASSETMAP.xml
test/ref/DCP/dcp_test1/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml
test/ref/DCP/dcp_test1/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml
test/ref/DCP/dcp_test7/ASSETMAP
test/ref/DCP/dcp_test7/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml
test/ref/DCP/dcp_test7/pkl_6af1e0c1-c441-47f8-a502-3efd46b1fa4f.xml
test/test.cc
test/verify_test.cc

index f9742628843446ee28668ac2c68e1b7bcf38ae87..6b6bdc0bf5380f3a7f9d475800181ee07c3ea2c2 100644 (file)
@@ -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<int64_t> 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);
 }
 
 
index 200c49ffdaad096b6435db9b466b3c2b45b2e4dd..6de7f1bec54fd4206a24325547ad4515d548f35e 100644 (file)
@@ -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<int64_t> entry_point);
 
        explicit ReelAsset (std::shared_ptr<const cxml::Node>);
 
index 0dd3cf29a23f5caded0bf05294925593031f6f32..5a07907116f52b6a4dcb30879b2df1693339bace 100644 (file)
@@ -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, {})
 {
 
 }
index e3fbb96222a9320e08dfa92b22f0c120f0e4b67c..df87dcce9a7367a59a9020c108042af62654f562 100644 (file)
@@ -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<const cxml::Node>);
 
        xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
index 3f2ea8abb2e0dd7d4ae255812e007337922e799b..c8293946ae0d182c937375da76780d6589f169df 100644 (file)
@@ -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::ReelMarkersAsset>(dcp::Fraction(24, 1), 432000, 0);
+       auto asset = make_shared<dcp::ReelMarkersAsset>(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::ReelMarkersAsset>(dcp::Fraction(24, 1), 432000, 0);
+       auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), 432000);
        BOOST_CHECK (!markers->equals(markers2, dcp::EqualityOptions(), [](dcp::NoteType, string) {}));
 }
index ee780c7c121c3fd0be8286773c41e7b6d097abf5..962afeb3fd3c2397dc2b24ce55740dab25975571 100644 (file)
@@ -26,7 +26,7 @@
           <Path>cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml</Path>
           <VolumeIndex>1</VolumeIndex>
           <Offset>0</Offset>
-          <Length>8630</Length>
+          <Length>8559</Length>
         </Chunk>
       </ChunkList>
     </Asset>
index 01eea88d3fcb85c33b648295d10aae23db999b8c..6c1b2ad786fb4b758b87792f4acdf7edc7e92277 100644 (file)
@@ -20,8 +20,6 @@
           <Id>urn:uuid:93182bd2-b1e8-41a3-b5c8-6e6564273bff</Id>
           <EditRate>24 1</EditRate>
           <IntrinsicDuration>24</IntrinsicDuration>
-          <EntryPoint>0</EntryPoint>
-          <Duration>24</Duration>
           <MarkerList>
             <Marker>
               <Label>FFOC</Label>
index cf75357430eea2caa2ae877751e6aee1863b71be..588c7d486f6763849ef0a5e89b5d892f62f59797 100644 (file)
@@ -9,8 +9,8 @@
     <Asset>
       <Id>urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b</Id>
       <AnnotationText>81fb54df-e1bf-4647-8788-ea7ba154375b</AnnotationText>
-      <Hash>6pkiSEIBuZW7KEY73GrNNw8UjDE=</Hash>
-      <Size>8630</Size>
+      <Hash>znqYbl53W9ZQtrU2E1FQ6dwdM2M=</Hash>
+      <Size>8559</Size>
       <Type>text/xml</Type>
     </Asset>
     <Asset>
index 71873d992c4a2436982ebdf07606b14a20daf619..0e40e455fcf46b13c6c74ef679d7e3a89a67ac59 100644 (file)
@@ -26,7 +26,7 @@
           <Path>cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml</Path>
           <VolumeIndex>1</VolumeIndex>
           <Offset>0</Offset>
-          <Length>2036</Length>
+          <Length>1965</Length>
         </Chunk>
       </ChunkList>
     </Asset>
index 89f6851d6fa855d93027a17f9ab36fa82a3289df..58e5897c783dd4036d6d8b80a0c6b69f7664202b 100644 (file)
@@ -20,8 +20,6 @@
           <Id>urn:uuid:93182bd2-b1e8-41a3-b5c8-6e6564273bff</Id>
           <EditRate>24 1</EditRate>
           <IntrinsicDuration>24</IntrinsicDuration>
-          <EntryPoint>0</EntryPoint>
-          <Duration>24</Duration>
           <MarkerList>
             <Marker>
               <Label>FFOC</Label>
index 6d529422b7a3fa8b09697d827d3c859bf40caca7..c8190a2fcb4662a3b52a3fe74bf02ed3bd1d5c00 100644 (file)
@@ -9,8 +9,8 @@
     <Asset>
       <Id>urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b</Id>
       <AnnotationText>81fb54df-e1bf-4647-8788-ea7ba154375b</AnnotationText>
-      <Hash>qD31AlG29UXWwTGYch5P+zuD3xc=</Hash>
-      <Size>2036</Size>
+      <Hash>V/3WP9Ff60ZtDhisE5onL9wo2tY=</Hash>
+      <Size>1965</Size>
       <Type>text/xml;asdcpKind=CPL</Type>
     </Asset>
     <Asset>
index a64725401ed030a16a6eae9920ef29ba7ca07f9e..1b0b9b106b52d484486bb739c6b218fbb6bb31b8 100644 (file)
@@ -371,7 +371,7 @@ make_simple (boost::filesystem::path path, int reels, int frames, dcp::Standard
                        shared_ptr<dcp::ReelSoundAsset>(new dcp::ReelSoundAsset(ms, 0))
                        );
 
-               auto markers = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), frames, 0);
+               auto markers = make_shared<dcp::ReelMarkersAsset>(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<dcp::ReelMarkersAsset>
 simple_markers (int frames)
 {
-       auto markers = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), frames, 0);
+       auto markers = make_shared<dcp::ReelMarkersAsset>(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;
index 6a3dacc43fac2ce46c0bb42d6e39f711576da092..8126c3180e6f181a0dee22531892a724caaec48f 100644 (file)
@@ -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<dcp::ReelSMPTESubtitleAsset>(asset1, dcp::Fraction(24, 1), 5 * 24, 0);
        auto reel1 = make_shared<dcp::Reel>();
        reel1->add (reel_asset1);
-       auto markers1 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), 5 * 24, 0);
+       auto markers1 = make_shared<dcp::ReelMarkersAsset>(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<dcp::ReelSMPTESubtitleAsset>(asset2, dcp::Fraction(24, 1), 4 * 24, 0);
        auto reel2 = make_shared<dcp::Reel>();
        reel2->add (reel_asset2);
-       auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), 4 * 24, 0);
+       auto markers2 = make_shared<dcp::ReelMarkersAsset>(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<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
        }
 
-       auto markers1 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length, 0);
+       auto markers1 = make_shared<dcp::ReelMarkersAsset>(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<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
        }
 
-       auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length, 0);
+       auto markers2 = make_shared<dcp::ReelMarkersAsset>(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<dcp::ReelSMPTEClosedCaptionAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
        }
 
-       auto markers1 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length, 0);
+       auto markers1 = make_shared<dcp::ReelMarkersAsset>(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<dcp::ReelSMPTEClosedCaptionAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
        }
 
-       auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length, 0);
+       auto markers2 = make_shared<dcp::ReelMarkersAsset>(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::ReelMarkersAsset>(dcp::Fraction(24, 1), 24, 0);
+       auto markers_asset = make_shared<dcp::ReelMarkersAsset>(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() },
                });
 }