Bv2.1 8.3.2: text tracks must have <EntryPoint> and it must be zero.
authorCarl Hetherington <cth@carlh.net>
Fri, 15 Jan 2021 21:04:42 +0000 (22:04 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 17 Jan 2021 19:13:23 +0000 (20:13 +0100)
src/verify.cc
src/verify.h
test/verify_test.cc

index f8ab3d446560358a3fa46c2418106dba5f3284a4..01d2e786ff0fa78fc8ea103fe42f277a1b75d257 100644 (file)
@@ -633,6 +633,12 @@ verify_main_subtitle_reel (shared_ptr<const ReelSubtitleAsset> reel_asset, vecto
        if (reel_asset->language()) {
                verify_language_tag (*reel_asset->language(), notes);
        }
+
+       if (!reel_asset->entry_point()) {
+               notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::MISSING_SUBTITLE_ENTRY_POINT });
+       } else if (reel_asset->entry_point().get()) {
+               notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::SUBTITLE_ENTRY_POINT_NON_ZERO });
+       }
 }
 
 
@@ -643,6 +649,12 @@ verify_closed_caption_reel (shared_ptr<const ReelClosedCaptionAsset> reel_asset,
        if (reel_asset->language()) {
                verify_language_tag (*reel_asset->language(), notes);
        }
+
+       if (!reel_asset->entry_point()) {
+               notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::MISSING_CLOSED_CAPTION_ENTRY_POINT });
+       } else if (reel_asset->entry_point().get()) {
+               notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::CLOSED_CAPTION_ENTRY_POINT_NON_ZERO });
+       }
 }
 
 
@@ -1284,6 +1296,14 @@ dcp::note_to_string (dcp::VerificationNote note)
                return "At least one reel contains a subtitle asset, but some reel(s) do not";
        case dcp::VerificationNote::CLOSED_CAPTION_ASSET_COUNTS_DIFFER:
                return "At least one reel has closed captions, but reels have different numbers of closed caption assets.";
+       case dcp::VerificationNote::MISSING_SUBTITLE_ENTRY_POINT:
+               return "Subtitle assets must have an <EntryPoint> tag.";
+       case dcp::VerificationNote::SUBTITLE_ENTRY_POINT_NON_ZERO:
+               return "Subtitle assets must have an <EntryPoint> of 0.";
+       case dcp::VerificationNote::MISSING_CLOSED_CAPTION_ENTRY_POINT:
+               return "Closed caption assets must have an <EntryPoint> tag.";
+       case dcp::VerificationNote::CLOSED_CAPTION_ENTRY_POINT_NON_ZERO:
+               return "Closed caption assets must have an <EntryPoint> of 0.";
        }
 
        return "";
index 64232a43e2486114f95a5e65112cf5f9352066a7..917d5e53b46320abe1c003ebc5b4c2346a16c800 100644 (file)
@@ -143,6 +143,14 @@ public:
                MAIN_SUBTITLE_NOT_IN_ALL_REELS,
                /** If one reel has at least one ClosedCaption, all reels must have the same number of ClosedCaptions */
                CLOSED_CAPTION_ASSET_COUNTS_DIFFER,
+               /** MainSubtitle in reels must have <EntryPoint> Bv2.1_8.3.2 */
+               MISSING_SUBTITLE_ENTRY_POINT,
+               /** MainSubtitle <EntryPoint> must be zero Bv2.1_8.3.2 */
+               SUBTITLE_ENTRY_POINT_NON_ZERO,
+               /** Closed caption in reels must have <EntryPoint> Bv2.1_8.3.2 */
+               MISSING_CLOSED_CAPTION_ENTRY_POINT,
+               /** Closed caption MainSubtitle <EntryPoint> must be zero Bv2.1_8.3.2 */
+               CLOSED_CAPTION_ENTRY_POINT_NON_ZERO,
        };
 
        VerificationNote (Type type, Code code)
index 246b44620b451007892ab209492a7aabe019251c..3164793305b411e131ee1e60b026629d7f84ce0b 100644 (file)
@@ -1834,3 +1834,71 @@ BOOST_AUTO_TEST_CASE (verify_closed_captions_must_be_in_all_reels)
        }
 }
 
+
+template <class T>
+void
+verify_text_entry_point_check (boost::filesystem::path dir, dcp::VerificationNote::Code code, boost::function<void (shared_ptr<T>)> adjust)
+{
+       boost::filesystem::remove_all (dir);
+       boost::filesystem::create_directories (dir);
+       auto dcp = make_shared<dcp::DCP>(dir);
+       auto cpl = make_shared<dcp::CPL>("A Test DCP", dcp::FEATURE);
+
+       auto subs = make_shared<dcp::SMPTESubtitleAsset>();
+       subs->set_language (dcp::LanguageTag("de-DE"));
+       subs->set_start_time (dcp::Time());
+       subs->add (simple_subtitle());
+       subs->write (dir / "subs.mxf");
+       auto reel_text = make_shared<T>(subs, dcp::Fraction(24, 1), 240, 0);
+       adjust (reel_text);
+
+       auto reel = make_shared<dcp::Reel>(
+               make_shared<dcp::ReelMonoPictureAsset>(simple_picture(dir, "", 240), 0),
+               make_shared<dcp::ReelSoundAsset>(simple_sound(dir, "", dcp::MXFMetadata(), "en-US", 240), 0)
+               );
+
+       reel->add (reel_text);
+
+       cpl->add (reel);
+
+       dcp->add (cpl);
+       dcp->write_xml (dcp::SMPTE);
+
+       check_verify_result ({dir}, {{ dcp::VerificationNote::VERIFY_BV21_ERROR, code }});
+}
+
+
+BOOST_AUTO_TEST_CASE (verify_text_entry_point)
+{
+       verify_text_entry_point_check<dcp::ReelSubtitleAsset> (
+               "build/test/verify_subtitle_entry_point_must_be_present",
+               dcp::VerificationNote::MISSING_SUBTITLE_ENTRY_POINT,
+               [](shared_ptr<dcp::ReelSubtitleAsset> asset) {
+                       asset->unset_entry_point ();
+                       }
+               );
+
+       verify_text_entry_point_check<dcp::ReelSubtitleAsset> (
+               "build/test/verify_subtitle_entry_point_must_be_zero",
+               dcp::VerificationNote::SUBTITLE_ENTRY_POINT_NON_ZERO,
+               [](shared_ptr<dcp::ReelSubtitleAsset> asset) {
+                       asset->set_entry_point (4);
+                       }
+               );
+
+       verify_text_entry_point_check<dcp::ReelClosedCaptionAsset> (
+               "build/test/verify_closed_caption_entry_point_must_be_present",
+               dcp::VerificationNote::MISSING_CLOSED_CAPTION_ENTRY_POINT,
+               [](shared_ptr<dcp::ReelClosedCaptionAsset> asset) {
+                       asset->unset_entry_point ();
+                       }
+               );
+
+       verify_text_entry_point_check<dcp::ReelClosedCaptionAsset> (
+               "build/test/verify_closed_caption_entry_point_must_be_zero",
+               dcp::VerificationNote::CLOSED_CAPTION_ENTRY_POINT_NON_ZERO,
+               [](shared_ptr<dcp::ReelClosedCaptionAsset> asset) {
+                       asset->set_entry_point (9);
+                       }
+               );
+}