Make verified DCPs available on the return from dcp::verify().
authorCarl Hetherington <cth@carlh.net>
Wed, 28 Dec 2022 00:25:57 +0000 (01:25 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 14 Apr 2024 20:48:35 +0000 (22:48 +0200)
src/verify.cc
src/verify.h
test/combine_test.cc
test/verify_test.cc
tools/dcpverify.cc

index ba0007db5e754e13d8af428c5601769f92bf23a4..0003e0a6e0049ed916e1d1074c21c15dc28f0d13 100644 (file)
@@ -1810,7 +1810,7 @@ verify_assetmap(Context& context, shared_ptr<const DCP> dcp)
 }
 
 
-vector<VerificationNote>
+dcp::VerifyResult
 dcp::verify (
        vector<boost::filesystem::path> directories,
        vector<dcp::DecryptedKDM> kdms,
@@ -1891,7 +1891,7 @@ dcp::verify (
                }
        }
 
-       return notes;
+       return { notes, dcps };
 }
 
 
index 2adb47d218bb23eddb78ec21928488c14d7b252e..77c5392b1a6508eb019112123a1257a39620c57d 100644 (file)
@@ -58,6 +58,9 @@
 namespace dcp {
 
 
+class DCP;
+
+
 class VerificationNote
 {
 public:
@@ -659,7 +662,14 @@ struct VerificationOptions
 };
 
 
-std::vector<VerificationNote> verify (
+struct VerifyResult
+{
+       std::vector<VerificationNote> notes;
+       std::vector<std::shared_ptr<dcp::DCP>> dcps;
+};
+
+
+VerifyResult verify(
        std::vector<boost::filesystem::path> directories,
        std::vector<dcp::DecryptedKDM> kdms,
        boost::function<void (std::string, boost::optional<boost::filesystem::path>)> stage,
index 12cbb6e2562fe87fb858e1e81457716d72006682..eb43d8a386543d7beccbbc345fc69a9deffe8eaf 100644 (file)
@@ -87,7 +87,7 @@ check_no_errors (boost::filesystem::path path)
 {
        vector<boost::filesystem::path> directories;
        directories.push_back (path);
-       auto notes = dcp::verify(directories, {}, &stage, &progress, {}, xsd_test);
+       auto notes = dcp::verify(directories, {}, &stage, &progress, {}, xsd_test).notes;
        vector<dcp::VerificationNote> filtered_notes;
        std::copy_if (notes.begin(), notes.end(), std::back_inserter(filtered_notes), [](dcp::VerificationNote const& i) {
                return i.code() != dcp::VerificationNote::Code::INVALID_STANDARD && i.code() != dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION;
@@ -475,7 +475,7 @@ BOOST_AUTO_TEST_CASE(combine_multi_reel_subtitles)
 
        check_combined({in}, out);
 
-       auto notes = dcp::verify({out}, {}, &stage, &progress, {}, xsd_test);
+       auto notes = dcp::verify({out}, {}, &stage, &progress, {}, xsd_test).notes;
        vector<dcp::VerificationNote> filtered_notes;
        std::copy_if(notes.begin(), notes.end(), std::back_inserter(filtered_notes), [](dcp::VerificationNote const& i) {
                return i.code() != dcp::VerificationNote::Code::INVALID_STANDARD && i.code() != dcp::VerificationNote::Code::MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL;
index 3c2a3780044957b0e0290e7e48c951ac1941e9bc..161201b945ef84c28bfeb998c790020571eaaeea 100644 (file)
@@ -199,7 +199,7 @@ static
 void
 check_verify_result(vector<path> dir, vector<dcp::DecryptedKDM> kdm, vector<dcp::VerificationNote> test_notes)
 {
-       auto notes = dcp::verify({dir}, kdm, &stage, &progress, {}, xsd_test);
+       auto notes = dcp::verify({dir}, kdm, &stage, &progress, {}, xsd_test).notes;
        std::sort (notes.begin(), notes.end());
        std::sort (test_notes.begin(), test_notes.end());
 
@@ -253,7 +253,7 @@ check_verify_result_after_replace (string suffix, boost::function<path (string)>
                e.replace (from, to);
        }
 
-       auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, xsd_test);
+       auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, xsd_test).notes;
 
        BOOST_REQUIRE_EQUAL (notes.size(), codes.size());
        auto i = notes.begin();
@@ -301,7 +301,7 @@ BOOST_AUTO_TEST_CASE (verify_no_error)
 {
        stages.clear ();
        auto dir = setup (1, "no_error");
-       auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, xsd_test);
+       auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, xsd_test).notes;
 
        path const cpl_file = dir / dcp_test1_cpl();
        path const pkl_file = dir / dcp_test1_pkl();
@@ -565,7 +565,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_standard)
 {
        stages.clear ();
        auto dir = setup (3, "verify_invalid_standard");
-       auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, xsd_test);
+       auto notes = dcp::verify({dir}, {}, &stage, &progress, {}, xsd_test).notes;
 
        path const cpl_file = dir / "cpl_cbfd2bc0-21cf-4a8f-95d8-9cddcbe51296.xml";
        path const pkl_file = dir / "pkl_d87a950c-bd6f-41f6-90cc-56ccd673e131.xml";
@@ -1419,7 +1419,7 @@ check_picture_size (int width, int height, int frame_rate, bool three_d)
        d->set_annotation_text("A Test DCP");
        d->write_xml();
 
-       return dcp::verify({dcp_path}, {}, &stage, &progress, {}, xsd_test);
+       return dcp::verify({dcp_path}, {}, &stage, &progress, {}, xsd_test).notes;
 }
 
 
index ebc02874e113c8e44c1991778c6b1c1ea8f025c0..1f74709773190d73ba0789b1c72c875f8ba5660e 100644 (file)
@@ -173,7 +173,7 @@ main (int argc, char* argv[])
 
        vector<boost::filesystem::path> directories;
        directories.push_back (argv[optind]);
-       auto notes = dcp::verify(directories, {}, stage, progress, verification_options);
+       auto notes = dcp::verify(directories, {}, stage, progress, verification_options).notes;
        dcp::filter_notes (notes, ignore_missing_assets);
 
        if (!quiet) {