From fea967ca635b04ca70f3f44d2e02f551fc9d6684 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 3 Mar 2020 22:02:03 +0100 Subject: Fix interop verification and add some tests for it. --- src/verify.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/verify.cc') diff --git a/src/verify.cc b/src/verify.cc index ca53a4c1..10e91320 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -196,6 +196,10 @@ public: add("http://www.w3.org/2001/XMLSchema.dtd", "XMLSchema.dtd"); add("http://www.w3.org/2001/03/xml.xsd", "xml.xsd"); add("http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd", "xmldsig-core-schema.xsd"); + add("http://www.digicine.com/schemas/437-Y/2007/Main-Stereo-Picture-CPL.xsd", "Main-Stereo-Picture-CPL.xsd"); + add("http://www.digicine.com/PROTO-ASDCP-CPL-20040511.xsd", "PROTO-ASDCP-CPL-20040511.xsd"); + add("http://www.digicine.com/PROTO-ASDCP-PKL-20040311.xsd", "PROTO-ASDCP-PKL-20040311.xsd"); + add("http://www.digicine.com/PROTO-ASDCP-AM-20040311.xsd", "PROTO-ASDCP-AM-20040311.xsd"); } InputSource* resolveEntity(XMLCh const *, XMLCh const * system_id) @@ -245,7 +249,10 @@ validate_xml (boost::filesystem::path xml_file, boost::filesystem::path xsd_dtd_ schema["http://www.smpte-ra.org/schemas/429-7/2006/CPL"] = "SMPTE-429-7-2006-CPL.xsd"; schema["http://www.smpte-ra.org/schemas/429-8/2006/PKL"] = "SMPTE-429-8-2006-PKL.xsd"; schema["http://www.smpte-ra.org/schemas/429-9/2007/AM"] = "SMPTE-429-9-2007-AM.xsd"; - schema["http://www.w3.org/2001/03/xml.xsd"] = "xml.xsd"; + schema["http://www.digicine.com/schemas/437-Y/2007/Main-Stereo-Picture-CPL.xsd"] = "Main-Stereo-Picture-CPL.xsd"; + schema["http://www.digicine.com/PROTO-ASDCP-CPL-20040511#"] = "PROTO-ASDCP-CPL-20040511.xsd"; + schema["http://www.digicine.com/PROTO-ASDCP-PKL-20040311#"] = "PROTO-ASDCP-PKL-20040311.xsd"; + schema["http://www.digicine.com/PROTO-ASDCP-AM-20040311#"] = "PROTO-ASDCP-AM-20040311.xsd"; string locations; for (map::const_iterator i = schema.begin(); i != schema.end(); ++i) { -- cgit v1.2.3 From 82d3db851257dbd460cff1c7eed2640a39b8ebfe Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 8 Mar 2020 22:47:33 +0100 Subject: Add verification checks too see if reel assets' Duration or IntrinsicDuration are too small. --- src/verify.cc | 16 +++++++++++++++- src/verify.h | 6 +++++- test/verify_test.cc | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) (limited to 'src/verify.cc') diff --git a/src/verify.cc b/src/verify.cc index 10e91320..a8c5001c 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018-2019 Carl Hetherington + Copyright (C) 2018-2020 Carl Hetherington This file is part of libdcp. @@ -371,6 +371,16 @@ dcp::verify ( BOOST_FOREACH (shared_ptr reel, cpl->reels()) { stage ("Checking reel", optional()); + + BOOST_FOREACH (shared_ptr i, reel->assets()) { + if (i->duration() && (i->duration().get() * i->edit_rate().denominator / i->edit_rate().numerator) < 1) { + notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::DURATION_TOO_SMALL, i->id())); + } + if ((i->intrinsic_duration() * i->edit_rate().denominator / i->edit_rate().numerator) < 1) { + notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::INTRINSIC_DURATION_TOO_SMALL, i->id())); + } + } + if (reel->main_picture()) { /* Check reel stuff */ Fraction const frame_rate = reel->main_picture()->frame_rate(); @@ -472,6 +482,10 @@ dcp::note_to_string (dcp::VerificationNote note) return "The DCP contains both SMPTE and Interop parts."; case dcp::VerificationNote::XML_VALIDATION_ERROR: return String::compose("An XML file is badly formed: %1 (%2:%3)", note.note().get(), note.file()->filename(), note.line().get()); + case dcp::VerificationNote::INTRINSIC_DURATION_TOO_SMALL: + return String::compose("The intrinsic duration of an asset is less than 1 second long: %1", note.note().get()); + case dcp::VerificationNote::DURATION_TOO_SMALL: + return String::compose("The duration of an asset is less than 1 second long: %1", note.note().get()); } return ""; diff --git a/src/verify.h b/src/verify.h index ab9e9aac..c56cfb9d 100644 --- a/src/verify.h +++ b/src/verify.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2020 Carl Hetherington This file is part of libdcp. @@ -77,6 +77,10 @@ public: MISMATCHED_STANDARD, /** Some XML fails to validate against the XSD/DTD */ XML_VALIDATION_ERROR, + /** An asset's IntrinsicDuration is less than 1 second */ + INTRINSIC_DURATION_TOO_SMALL, + /** An asset's Duration is less than 1 second */ + DURATION_TOO_SMALL }; VerificationNote (Type type, Code code) diff --git a/test/verify_test.cc b/test/verify_test.cc index b5069023..2ff66f69 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -471,3 +471,25 @@ BOOST_AUTO_TEST_CASE (verify_test13) next_verify_test_number++; } + +/* DCP with a short asset */ +BOOST_AUTO_TEST_CASE (verify_test14) +{ + vector directories = setup (8, next_verify_test_number); + list notes = dcp::verify (directories, &stage, &progress, "xsd"); + + dump_notes (notes); + + BOOST_REQUIRE_EQUAL (notes.size(), 4); + list::const_iterator i = notes.begin (); + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::DURATION_TOO_SMALL); + ++i; + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::INTRINSIC_DURATION_TOO_SMALL); + ++i; + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::DURATION_TOO_SMALL); + ++i; + BOOST_CHECK_EQUAL (i->code(), dcp::VerificationNote::INTRINSIC_DURATION_TOO_SMALL); + ++i; + next_verify_test_number++; +} + -- cgit v1.2.3