diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-12-06 10:47:04 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-12-22 01:21:00 +0100 |
| commit | 30dfa051113792305f9704d5a76ffaf57c21063d (patch) | |
| tree | 4a4055b40bfb64ebf5b7509ef81a104db4a52e46 /src/verify.cc | |
| parent | 9cb23adda9ebe6a76992b68db78ccb638348dac1 (diff) | |
Use VerificationNote for non-fatal errors in DCP::read.
Diffstat (limited to 'src/verify.cc')
| -rw-r--r-- | src/verify.cc | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/verify.cc b/src/verify.cc index 809e9e11..279de556 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -105,19 +105,14 @@ dcp::verify (vector<boost::filesystem::path> directories, function<void (string, BOOST_FOREACH (shared_ptr<DCP> dcp, dcps) { stage ("Checking DCP", dcp->directory()); - DCP::ReadErrors errors; try { - dcp->read (true, &errors); + dcp->read (¬es); } catch (DCPReadError& e) { notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::GENERAL_READ, string(e.what()))); } catch (XMLError& e) { notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::GENERAL_READ, string(e.what()))); } - BOOST_FOREACH (shared_ptr<DCPReadError> i, errors) { - notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::GENERAL_READ, string(i->what()))); - } - BOOST_FOREACH (shared_ptr<CPL> cpl, dcp->cpls()) { stage ("Checking CPL", cpl->file()); @@ -188,3 +183,33 @@ dcp::verify (vector<boost::filesystem::path> directories, function<void (string, return notes; } + +string +dcp::note_to_string (dcp::VerificationNote note) +{ + switch (note.code()) { + case dcp::VerificationNote::GENERAL_READ: + return *note.note(); + case dcp::VerificationNote::CPL_HASH_INCORRECT: + return "The hash of the CPL in the PKL does not agree with the CPL file"; + case dcp::VerificationNote::INVALID_PICTURE_FRAME_RATE: + return "The picture in a reel has an invalid frame rate"; + case dcp::VerificationNote::PICTURE_HASH_INCORRECT: + return dcp::String::compose("The hash of the picture asset %1 does not agree with the PKL file", note.file()->filename()); + case dcp::VerificationNote::PKL_CPL_PICTURE_HASHES_DISAGREE: + return "The PKL and CPL hashes disagree for a picture asset."; + case dcp::VerificationNote::SOUND_HASH_INCORRECT: + return dcp::String::compose("The hash of the sound asset %1 does not agree with the PKL file", note.file()->filename()); + case dcp::VerificationNote::PKL_CPL_SOUND_HASHES_DISAGREE: + return "The PKL and CPL hashes disagree for a sound asset."; + case dcp::VerificationNote::EMPTY_ASSET_PATH: + return "The asset map contains an empty asset path."; + case dcp::VerificationNote::MISSING_ASSET: + return "The file for an asset in the asset map cannot be found."; + case dcp::VerificationNote::MISMATCHED_STANDARD: + return "The DCP contains both SMPTE and Interop parts."; + } + + return ""; +} + |
