Stop assuming that the presence of FullContentTitleText means that there was CPL...
authorCarl Hetherington <cth@carlh.net>
Mon, 15 Aug 2022 14:54:40 +0000 (16:54 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Aug 2022 14:54:40 +0000 (16:54 +0200)
src/cpl.cc
src/cpl.h
src/verify.cc

index 815f9a767e9bd2069ff6bc104a1bf2adf890bd10..79726f7f8e73293c5ac0070802f27892a249a670 100644 (file)
@@ -153,6 +153,7 @@ CPL::CPL (boost::filesystem::path file)
                auto metadata = asset_list->optional_node_child("CompositionMetadataAsset");
                if (metadata) {
                        read_composition_metadata_asset (metadata);
+                       _read_composition_metadata = true;
                }
        }
 
index 439aeda0d539452b40feff167a937ff8f31d48b1..74bac5f1d6268f072a1207854a82453f5402cb6e 100644 (file)
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -328,6 +328,13 @@ public:
                return _standard;
        }
 
+       /** @return true iff this CPL was read from a file and it contained
+        *  a CompositionMetadataAsset node.
+        */
+       bool read_composition_metadata() const {
+               return _read_composition_metadata;
+       }
+
        static std::string static_pkl_type (Standard standard);
 
 protected:
@@ -373,6 +380,7 @@ private:
        /* See note for _release_territory above */
        std::vector<std::string> _additional_subtitle_languages;
        boost::optional<std::string> _sign_language_video_language;
+       bool _read_composition_metadata = false;
 
        std::vector<std::shared_ptr<Reel>> _reels;
 
index bef05a16fe2e494a8a4490ffd91093bf6f2301be..e698920c11da3f8f1f49c3e43df16190c1921ba2 100644 (file)
@@ -1534,10 +1534,7 @@ dcp::verify (
                                        notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_LENGTH});
                                }
 
-                               if (!cpl->full_content_title_text()) {
-                                       /* Since FullContentTitleText is assumed always to exist if there's a CompositionMetadataAsset we
-                                        * can use it as a proxy for CompositionMetadataAsset's existence.
-                                        */
+                               if (!cpl->read_composition_metadata()) {
                                        notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get()});
                                } else if (!cpl->version_number()) {
                                        notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_CPL_METADATA_VERSION_NUMBER, cpl->id(), cpl->file().get()});