diff options
Diffstat (limited to 'src/verify.h')
| -rw-r--r-- | src/verify.h | 57 |
1 files changed, 49 insertions, 8 deletions
diff --git a/src/verify.h b/src/verify.h index 218d2ceb..16323261 100644 --- a/src/verify.h +++ b/src/verify.h @@ -58,19 +58,21 @@ namespace dcp { -class SubtitleAsset; +class DCP; +class TextAsset; class VerificationNote { public: enum class Type { + OK, ERROR, BV21_ERROR, ///< may not always be considered an error, but violates a "shall" requirement of Bv2.1 WARNING }; - /** Codes for errors or warnings from verifying DCPs. + /** Codes for successful checks, errors or warnings from verifying DCPs. * * The names should (in general) answer the question "what is wrong?" with an answer that begins "There is a ..." * e.g. "There is a INCORRECT_CPL_HASH" @@ -101,6 +103,7 @@ public: * note contains (probably technical) details */ FAILED_READ, + MATCHING_CPL_HASHES, /** The hash of the CPL in the PKL does not agree with the CPL file * note contains CPL ID * file contains CPL filename @@ -112,6 +115,7 @@ public: * note contains the invalid frame rate as "<numerator>/<denominator>" */ INVALID_PICTURE_FRAME_RATE, + CORRECT_PICTURE_HASH, /** The hash of a main picture asset does not agree with the PKL file * file contains the picture asset filename * calculated_hash contains the current hash of the picture MXF @@ -156,6 +160,7 @@ public: * note contains asset ID */ INVALID_DURATION, + VALID_PICTURE_FRAME_SIZES_IN_BYTES, /** The JPEG2000 data in at least one picture frame is larger than the equivalent of 250Mbit/s * file contains the picture asset filename */ @@ -178,6 +183,7 @@ public: * note contains the invalid language */ INVALID_LANGUAGE, + VALID_RELEASE_TERRITORY, /** A picture asset does not have one of the required Bv2.1 sizes (in pixels) [Bv2.1_7.1] * note contains the incorrect size as "<width>x<height>" * file contains the asset filename @@ -250,6 +256,11 @@ public: * file contains the asset filename */ INVALID_SOUND_FRAME_RATE, + /** The audio bit depth must be 24 + * note contains the invalid bit depth + * file contains the asset filename + */ + INVALID_SOUND_BIT_DEPTH, /** The CPL has no _<AnnotationText>_ tag [Bv2.1_8.1] * note contains the CPL ID * file contains the CPL filename @@ -260,6 +271,7 @@ public: * file contains the CPL filename */ MISMATCHED_CPL_ANNOTATION_TEXT, + VALID_CPL_ANNOTATION_TEXT, /** At least one asset in a reel does not have the same duration as the others */ MISMATCHED_ASSET_DURATION, /** If one reel has a _MainSubtitle_, all must have them */ @@ -337,6 +349,11 @@ public: * file contains the PKL filename */ MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL, + MATCHING_PKL_ANNOTATION_TEXT_WITH_CPL, + /** All content is encrypted */ + ALL_ENCRYPTED, + /** No content is encrypted */ + NONE_ENCRYPTED, /** Some, but not all content, is encrypted */ PARTIALLY_ENCRYPTED, /** General error during JPEG2000 codestream verification @@ -409,11 +426,13 @@ public: UNEXPECTED_DURATION, /** A <ContentKind> has been specified with either no scope or the SMPTE 429-7 scope, but which is not one of those allowed */ INVALID_CONTENT_KIND, + VALID_CONTENT_KIND, /** Either the width or height of a <MainPictureActiveArea> in a CPL is either not an even number, or bigger than the corresponding asset dimension. * note contains details of what is wrong * file contains the CPL filename */ INVALID_MAIN_PICTURE_ACTIVE_AREA, + VALID_MAIN_PICTURE_ACTIVE_AREA, /** A PKL has more than one asset with the same ID * note contains the PKL ID * file contains the PKL filename @@ -478,13 +497,13 @@ public: * file contains the CPL filename */ EMPTY_CONTENT_VERSION_LABEL_TEXT, + VALID_CONTENT_VERSION_LABEL_TEXT, /** The CPL namespace is not valid. * note contains the invalid namespace * file contains the CPL filename */ INVALID_CPL_NAMESPACE, /** A SMPTE CPL does not contain a _<ContentVersion>_ tag - * note contains the CPL ID * file contains the CPL filename */ MISSING_CPL_CONTENT_VERSION, @@ -550,6 +569,7 @@ private: ID, OTHER_ID, FRAME_RATE, + CPL_ID, CALCULATED_HASH, REFERENCE_HASH }; @@ -649,6 +669,15 @@ public: return data<std::string>(Data::REFERENCE_HASH); } + VerificationNote& set_cpl_id(std::string id) { + _data[Data::CPL_ID] = id; + return *this; + } + + boost::optional<std::string> cpl_id() const { + return data<std::string>(Data::CPL_ID); + } + private: Type _type; Code _code; @@ -666,18 +695,30 @@ struct VerificationOptions }; -std::vector<VerificationNote> verify ( +struct VerificationResult +{ + std::vector<VerificationNote> notes; + std::vector<std::shared_ptr<dcp::DCP>> dcps; +}; + + +VerificationResult verify( std::vector<boost::filesystem::path> directories, std::vector<dcp::DecryptedKDM> kdms, - boost::function<void (std::string, boost::optional<boost::filesystem::path>)> stage, - boost::function<void (float)> progress, + std::function<void (std::string, boost::optional<boost::filesystem::path>)> stage, + std::function<void (float)> progress, VerificationOptions options = {}, boost::optional<boost::filesystem::path> xsd_dtd_directory = boost::optional<boost::filesystem::path>() ); -std::string note_to_string (dcp::VerificationNote note); +std::string note_to_string( + dcp::VerificationNote note, + std::function<std::string (std::string)> process_string = [](std::string s) { return s; }, + std::function<std::string (std::string)> process_filename = [](std::string s) { return s; } + ); bool operator== (dcp::VerificationNote const& a, dcp::VerificationNote const& b); +bool operator!=(dcp::VerificationNote const& a, dcp::VerificationNote const& b); bool operator< (dcp::VerificationNote const& a, dcp::VerificationNote const& b); std::ostream& operator<<(std::ostream& s, dcp::VerificationNote const& note); @@ -692,7 +733,7 @@ struct LinesCharactersResult extern void verify_text_lines_and_characters( - std::shared_ptr<const dcp::SubtitleAsset> asset, + std::shared_ptr<const dcp::TextAsset> asset, int warning_length, int error_length, dcp::LinesCharactersResult* result |
