From 2c1faeb15715794525f48110c2b8a9df96b387c1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 15 Mar 2021 01:36:51 +0100 Subject: Fix various bugs in subtitle/ccap verification. Check that subtitles don't overlap reel boundaries, and fix a few tests that trip this check. Fix confusion when calculating subtitle timings during verification where the picture asset frame rate was being used rather than the subtitle asset's edit rate. Do the subtitle timing verification for Interop as well as SMPTE subtitles. Take tags into account when checking subtitles, even though Bv2.1 says they should be set to 0. Rename Time::as_editable_units to Time::as_editable_units_ceil and add a _floor variant, then use that to round down when checking reel boundary overlaps. --- test/verify_test.cc | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/verify_test.cc b/test/verify_test.cc index 43121941..80e985e5 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -202,6 +202,7 @@ void check_verify_result (vector dir, vector test_notes) { auto notes = dcp::verify ({dir}, &stage, &progress, xsd_test); + dump_notes (notes); BOOST_REQUIRE_EQUAL (notes.size(), test_notes.size()); for (auto i = 0U; i < notes.size(); ++i) { BOOST_REQUIRE_EQUAL (notes[i], test_notes[i]); @@ -677,7 +678,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_smpte_subtitles) prepare_directory (dir); copy_file ("test/data/subs.mxf", dir / "subs.mxf"); auto asset = make_shared(dir / "subs.mxf"); - auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 16 * 24, 0); + auto reel_asset = make_shared(asset, dcp::Fraction(25, 1), 300 * 24, 0); auto cpl = write_dcp_with_single_asset (dir, reel_asset); check_verify_result ({dir}, {{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get() }}); @@ -692,7 +693,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_smpte_subtitles) prepare_directory (dir); copy_file ("test/data/broken_smpte.mxf", dir / "subs.mxf"); auto asset = make_shared(dir / "subs.mxf"); - auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 16 * 24, 0); + auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 300 * 24, 0); auto cpl = write_dcp_with_single_asset (dir, reel_asset); check_verify_result ( @@ -890,7 +891,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language1) auto asset = make_shared(dir / "subs.mxf"); asset->_language = "wrong-andbad"; asset->write (dir / "subs.mxf"); - auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 16 * 24, 0); + auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 300 * 24, 0); reel_asset->_language = "badlang"; auto cpl = write_dcp_with_single_asset (dir, reel_asset); @@ -913,7 +914,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language2) auto asset = make_shared(dir / "subs.mxf"); asset->_language = "wrong-andbad"; asset->write (dir / "subs.mxf"); - auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 16 * 24, 0); + auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 300 * 24, 0); reel_asset->_language = "badlang"; auto cpl = write_dcp_with_single_asset (dir, reel_asset); @@ -1168,7 +1169,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_xml_size_in_bytes) } asset->set_language (dcp::LanguageTag("de-DE")); asset->write (dir / "subs.mxf"); - auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 16 * 24, 0); + auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 2049 * 24, 0); auto cpl = write_dcp_with_single_asset (dir, reel_asset); check_verify_result ( @@ -1637,6 +1638,29 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_duration) } +BOOST_AUTO_TEST_CASE (verify_subtitle_overlapping_reel_boundary) +{ + auto const dir = path("build/test/verify_subtitle_overlapping_reel_boundary"); + prepare_directory (dir); + auto asset = make_shared(); + asset->set_start_time (dcp::Time()); + add_test_subtitle (asset, 0, 4 * 24); + asset->set_language (dcp::LanguageTag("de-DE")); + asset->write (dir / "subs.mxf"); + + auto reel_asset = make_shared(asset, dcp::Fraction(24, 1), 3 * 24, 0); + auto cpl = write_dcp_with_single_asset (dir, reel_asset); + check_verify_result ( + {dir}, + { + { dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME }, + { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::SUBTITLE_OVERLAPS_REEL_BOUNDARY }, + { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get() } + }); + +} + + BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_count1) { auto const dir = path ("build/test/invalid_subtitle_line_count1"); -- cgit v1.2.3