diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-01-06 19:30:00 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-01-06 19:30:00 +0000 |
| commit | b8c235e96ee6ac9548263682eb6c92bf28fc29b0 (patch) | |
| tree | 1c7e8a6ce0c2fc0d8c42fcff99da3b59f56cc0d5 | |
| parent | 59f7cacd98de32c70787a4b4fb69cbddbc94016b (diff) | |
More DCP verification detail and testing.
| -rw-r--r-- | src/verify.cc | 12 | ||||
| -rw-r--r-- | test/verify_test.cc | 24 |
2 files changed, 34 insertions, 2 deletions
diff --git a/src/verify.cc b/src/verify.cc index bd61124c..2288200b 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -127,6 +127,18 @@ dcp::verify (vector<boost::filesystem::path> directories, function<void (string, BOOST_FOREACH (shared_ptr<Reel> reel, cpl->reels()) { stage ("Checking reel", optional<boost::filesystem::path>()); if (reel->main_picture()) { + /* Check reel stuff */ + Fraction const frame_rate = reel->main_picture()->frame_rate(); + if (frame_rate.denominator != 1 || + (frame_rate.numerator != 24 && + frame_rate.numerator != 25 && + frame_rate.numerator != 30 && + frame_rate.numerator != 48 && + frame_rate.numerator != 50 && + frame_rate.numerator != 60)) { + notes.push_back (VerificationNote (VerificationNote::VERIFY_ERROR, "Invalid frame rate for picture")); + } + /* Check asset */ stage ("Checking picture asset hash", reel->main_picture()->asset()->file()); Result const r = verify_asset (dcp, reel->main_picture(), progress); switch (r) { diff --git a/test/verify_test.cc b/test/verify_test.cc index 58bc5978..a7e703a2 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE (verify_test2) list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress); - BOOST_CHECK_EQUAL (notes.size(), 2); + BOOST_REQUIRE_EQUAL (notes.size(), 2); BOOST_CHECK_EQUAL (notes.front().type(), dcp::VerificationNote::VERIFY_ERROR); BOOST_CHECK_EQUAL (notes.front().note(), "Picture asset hash is incorrect."); BOOST_CHECK_EQUAL (notes.back().type(), dcp::VerificationNote::VERIFY_ERROR); @@ -178,6 +178,26 @@ BOOST_AUTO_TEST_CASE (verify_test4) list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress); - BOOST_CHECK_EQUAL (notes.size(), 1); + BOOST_REQUIRE_EQUAL (notes.size(), 1); BOOST_CHECK_EQUAL (notes.front().note(), "Bad content kind 'xfeature'"); } + +/* FrameRate */ +BOOST_AUTO_TEST_CASE (verify_test5) +{ + vector<boost::filesystem::path> directories = setup (5); + + boost::filesystem::path const cpl_file = "build/test/verify_test5/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml"; + + string cpl = dcp::file_to_string (cpl_file); + boost::algorithm::replace_all (cpl, "<FrameRate>24 1", "<FrameRate>99 1"); + FILE* f = fopen(cpl_file.string().c_str(), "w"); + fwrite(cpl.c_str(), cpl.length(), 1, f); + fclose(f); + + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress); + + BOOST_REQUIRE_EQUAL (notes.size(), 2); + BOOST_CHECK_EQUAL (notes.front().note(), "CPL hash is incorrect."); + BOOST_CHECK_EQUAL (notes.back().note(), "Invalid frame rate for picture"); +} |
