/* Copyright (C) 2018-2021 Carl Hetherington This file is part of libdcp. libdcp is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. libdcp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with libdcp. If not, see . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ /** @file src/verify.h * @brief dcp::verify() method and associated code */ #ifndef LIBDCP_VERIFY_H #define LIBDCP_VERIFY_H #include "decrypted_kdm.h" #include #include #include #include #include #include #include #include /* windows.h defines this but we want to use it */ #undef ERROR namespace dcp { 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 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" * "There is a MISSING_ASSET" * * In general the pattern should be . * Some s are: * * - MISMATCHED: two things, which should be the same, are not (opposite MATCHING) * - INCORRECT: something, which could have any value, is wrong (opposite CORRECT) * - INVALID: something, which should only be one of a set of values, is not in the set, or some preformatted * quantity (e.g. XML) is in the wrong format (opposite VALID) * - EMPTY: something, which should have a value, has no value. * - MISSING: something, which should be present, is not. * - UNEXPECTED: something, which is present, should not be. * - FAILED: some part of the verification failed in some serious way. * * Comments should clarify meaning and also say which of the optional _data items * are filled in when this code is used. It's not necessary to list which * _location items are filled. */ // If you change the next line, also look in doc/manual/verifier.py in DCP-o-matic // as it looks for it when compiling the manual. Also, in this enum: // [...] will be taken as a reference to a section of Bv2.1 // _foo_ means foo should be written as a piece of code enum class Code { /** A general error when reading the DCP * error contains (probably technical) details */ FAILED_READ, /** The hash of a CPL in the PKL agrees with the CPL file */ MATCHING_CPL_HASHES, /** The hash of the CPL in the PKL does not agree with the CPL file * calculated_hash contains current hash of the CPL * reference_hash contains the hash written in the PKL */ MISMATCHED_CPL_HASHES, /** The frame rate given in a reel for the main picture is not 24, 25, 30, 48, 50 or 60 * frame_rate contains the frame rate */ INVALID_PICTURE_FRAME_RATE, /** The hash of a main picture asset agrees with the PKL file */ CORRECT_PICTURE_HASH, /** The hash of a main picture asset does not agree with the PKL file * calculated_hash contains the current hash of the picture MXF * reference_hash contains the hash from the PKL */ INCORRECT_PICTURE_HASH, /** The hash of a main picture is different in the CPL and PKL */ MISMATCHED_PICTURE_HASHES, /** The hash of a main sound asset does not agree with the PKL file * calculated_hash contains the current hash of the picture MXF * reference_hash contains the hash from the PKL */ INCORRECT_SOUND_HASH, /** The hash of a main sound is different in the CPL and PKL */ MISMATCHED_SOUND_HASHES, /** An assetmap's __ entry is empty */ EMPTY_ASSET_PATH, /** A file mentioned in an asset map cannot be found * file contains the filename that is missing */ MISSING_ASSET, /** The DCP contains both SMPTE and Interop-standard components */ MISMATCHED_STANDARD, /** Some XML fails to validate against its XSD/DTD * error contains the (probably technical) details */ INVALID_XML, /** No _ASSETMAP_ or _ASSETMAP.xml_ was found */ MISSING_ASSETMAP, /** An asset's _IntrinsicDuration_ is less than 1 second */ INVALID_INTRINSIC_DURATION, /** An asset's _Duration_ is less than 1 second */ INVALID_DURATION, /** The JPEG2000 data in all picture frames of an asset is smaller than the maximum size */ VALID_PICTURE_FRAME_SIZES_IN_BYTES, /** The JPEG2000 data in at least one picture frame is larger than the equivalent of 250Mbit/s */ INVALID_PICTURE_FRAME_SIZE_IN_BYTES, /** The JPEG2000 data in at least one picture frame is larger than the equivalent of 230Mbit/s */ NEARLY_INVALID_PICTURE_FRAME_SIZE_IN_BYTES, /** An asset that the CPL requires is not in this DCP; the DCP may be a VF */ EXTERNAL_ASSET, /** A stereoscopic asset has an MXF which is marked as being monoscopic */ THREED_ASSET_MARKED_AS_TWOD, /** DCP is Interop, not SMPTE [Bv2.1_6.1] */ INVALID_STANDARD, /** A language or territory does not conform to RFC 5646 [Bv2.1_6.2.1] * language contains the invalid language */ INVALID_LANGUAGE, /** A CPL has a valid release territory */ VALID_RELEASE_TERRITORY, /** A JPEG2000 picture asset does not have one of the required Bv2.1 sizes (in pixels) [Bv2.1_7.1] * size_in_pixels contains the incorrect size */ INVALID_JPEG2000_PICTURE_SIZE_IN_PIXELS, /** A MPEG2 picture asset does not have the required size of 1920x1080 * size_in_pixels contains the incorrect size */ INVALID_MPEG2_PICTURE_SIZE_IN_PIXELS, /** A picture asset is 2K but is not at 24, 25 or 48 fps as required by Bv2.1 [Bv2.1_7.1] * frame_rate contains the invalid frame rate */ INVALID_PICTURE_FRAME_RATE_FOR_2K, /** A picture asset is 4K but is not at 24fps as required by Bv2.1 [Bv2.1_7.1] * frame_rate contains the invalid frame rate */ INVALID_PICTURE_FRAME_RATE_FOR_4K, /** A picture asset is 4K but is 3D which is not allowed by Bv2.1 [Bv2.1_7.1] */ INVALID_PICTURE_ASSET_RESOLUTION_FOR_3D, /** A closed caption's XML file is larger than 256KB [Bv2.1_7.2.1] * size_in_bytes contains the invalid size in bytes */ INVALID_CLOSED_CAPTION_XML_SIZE_IN_BYTES, /** Any timed text asset's total files is larger than 115MB [Bv2.1_7.2.1] * size_in_bytes contains the invalid size in bytes */ INVALID_TIMED_TEXT_SIZE_IN_BYTES, /** The total size of all a timed text asset's fonts is larger than 10MB [Bv2.1_7.2.1] * size_in_bytes contains the invalid size in bytes */ INVALID_TIMED_TEXT_FONT_SIZE_IN_BYTES, /** Some SMPTE subtitle XML has no __ tag [Bv2.1_7.2.2] */ MISSING_SUBTITLE_LANGUAGE, /** Not all subtitle assets specify the same __ tag [Bv2.1_7.2.2] */ MISMATCHED_SUBTITLE_LANGUAGES, /** Some SMPTE subtitle XML has no __ tag [Bv2.1_7.2.3] */ MISSING_SUBTITLE_START_TIME, /** Some SMPTE subtitle XML has a non-zero __ tag [Bv2.1_7.2.3] */ INVALID_SUBTITLE_START_TIME, /** The first subtitle or closed caption happens before 4s into the first reel [Bv2.1_7.2.4] */ INVALID_SUBTITLE_FIRST_TEXT_TIME, /** At least one subtitle has a zero or negative duration */ INVALID_SUBTITLE_DURATION, /** At least one subtitle is less than the minimum of 15 frames suggested by [Bv2.1_7.2.5] */ INVALID_SUBTITLE_DURATION_BV21, /** At least one pair of subtitles are separated by less than the the minimum of 2 frames suggested by [Bv2.1_7.2.5] */ INVALID_SUBTITLE_SPACING, /** A subtitle lasts for longer than the reel which contains it */ SUBTITLE_OVERLAPS_REEL_BOUNDARY, /** There are more than 3 subtitle lines in at least one place [Bv2.1_7.2.7] */ INVALID_SUBTITLE_LINE_COUNT, /** There are more than 52 characters in at least one subtitle line [Bv2.1_7.2.7] */ NEARLY_INVALID_SUBTITLE_LINE_LENGTH, /** There are more than 79 characters in at least one subtitle line [Bv2.1_7.2.7] */ INVALID_SUBTITLE_LINE_LENGTH, /** There are more than 3 closed caption lines in at least one place [Bv2.1_7.2.6] */ INVALID_CLOSED_CAPTION_LINE_COUNT, /** There are more than 32 characters in at least one closed caption line [Bv2.1_7.2.6] */ INVALID_CLOSED_CAPTION_LINE_LENGTH, /** The audio sampling rate must be 48kHz [Bv2.1_7.3] * frame_rate contains the invalid frame rate */ INVALID_SOUND_FRAME_RATE, /** The audio bit depth must be 24 * bit_depth contains the invalid bit depth */ INVALID_SOUND_BIT_DEPTH, /** The CPL has no __ tag [Bv2.1_8.1] */ MISSING_CPL_ANNOTATION_TEXT, /** The __ is not the same as the __ [Bv2.1_8.1] */ MISMATCHED_CPL_ANNOTATION_TEXT, /** A CPL has an annotation text which matches the __ */ 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 */ MISSING_MAIN_SUBTITLE_FROM_SOME_REELS, /** If one reel has at least one _ClosedCaption_, all reels must have the same number of _ClosedCaptions_ */ MISMATCHED_CLOSED_CAPTION_ASSET_COUNTS, /** MainSubtitle in reels must have __ [Bv2.1_8.3.2] */ MISSING_SUBTITLE_ENTRY_POINT, /** MainSubtitle __ must be zero [Bv2.1_8.3.2] */ INCORRECT_SUBTITLE_ENTRY_POINT, /** Closed caption in reels must have __ [Bv2.1_8.3.2] */ MISSING_CLOSED_CAPTION_ENTRY_POINT, /** Closed caption _MainSubtitle_ __ must be zero [Bv2.1_8.3.2] */ INCORRECT_CLOSED_CAPTION_ENTRY_POINT, /** __ must be present for assets in CPLs */ MISSING_HASH, /** If _ContentKind_ is Feature there must be a FFEC marker */ MISSING_FFEC_IN_FEATURE, /** If _ContentKind_ is Feature there must be a FFMC marker */ MISSING_FFMC_IN_FEATURE, /** There should be a FFOC marker */ MISSING_FFOC, /** There should be a LFOC marker */ MISSING_LFOC, /** The FFOC marker should be 1 * marker_position contains the incorrect value. */ INCORRECT_FFOC, /** The LFOC marker should be the last frame in the reel * marker_position contains the incorrect value */ INCORRECT_LFOC, /** There must be a __ */ MISSING_CPL_METADATA, /** CPL metadata should contain __ of 1, at least */ MISSING_CPL_METADATA_VERSION_NUMBER, /** There must be an __ in __ [Bv2.1_8.6.3] */ MISSING_EXTENSION_METADATA, /** __ does not have the correct form [Bv2.1_8.6.3] * error contains details of what's wrong */ INVALID_EXTENSION_METADATA, /** A CPL containing encrypted content is not signed [Bv2.1_8.7] */ UNSIGNED_CPL_WITH_ENCRYPTED_CONTENT, /** A PKL containing encrypted content is not signed [Bv2.1_8.7] */ UNSIGNED_PKL_WITH_ENCRYPTED_CONTENT, /** If a PKL has one CPL its __ must be the same as the PKL's __ */ MISMATCHED_PKL_ANNOTATION_TEXT_WITH_CPL, /** A PKL __ matches a 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 * error contains details */ INVALID_JPEG2000_CODESTREAM, /** Invalid number of guard bits in a 2K JPEG2000 stream (should be 1) [Bv2.1_10.2.1] * guard_bits contains the number of guard bits */ INVALID_JPEG2000_GUARD_BITS_FOR_2K, /** Invalid number of guard bits in a 4K JPEG2000 stream (should be 2) [Bv2.1_10.2.1] * guard_bits contains the number of guard bits */ INVALID_JPEG2000_GUARD_BITS_FOR_4K, /** JPEG2000 tile size is not the same as the image size [Bv2.1_10.2.1] */ INVALID_JPEG2000_TILE_SIZE, /** JPEG2000 code block width is not 32 [Bv2.1_10.2.1] * code_block_size contains the code block width */ INVALID_JPEG2000_CODE_BLOCK_WIDTH, /** JPEG2000 code block height is not 32 [Bv2.1_10.2.1] * code_block_size contains the code block height */ INVALID_JPEG2000_CODE_BLOCK_HEIGHT, /** There must be no POC markers in a 2K codestream [Bv2.1_10.2.1] * poc_markers_count contains the number of POC markers found */ INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_2K, /** There must be exactly one POC marker in a 4K codestream [Bv2.1_10.2.1] * poc_markers_count contains the number of POC markers found */ INCORRECT_JPEG2000_POC_MARKER_COUNT_FOR_4K, /** A POC marker has incorrect content [Bv2.1_10.2.1] * error contains details */ INCORRECT_JPEG2000_POC_MARKER, /** A POC marker was found outside the main head [Bv2.1_10.2.1] */ INVALID_JPEG2000_POC_MARKER_LOCATION, /** Invalid number of tile parts for 2K JPEG2000 stream (should be 3) [Bv2.1_10.2.1] * tile_parts contains the number of tile parts */ INVALID_JPEG2000_TILE_PARTS_FOR_2K, /** Invalid number of tile parts for 4K JPEG2000 stream (should be 6) [Bv2.1_10.2.1] * tile_parts contains the number of tile parts */ INVALID_JPEG2000_TILE_PARTS_FOR_4K, /** Invalid Rsiz (capabilities) value in 2K JPEG2000 stream. * jpeg2000_capabilities contains the invalid value */ INVALID_JPEG2000_RSIZ_FOR_2K, /** Invalid Rsiz (capabilities) value in 4K JPEG2000 stream * jpeg2000_capabilities contains the invalid value */ INVALID_JPEG2000_RSIZ_FOR_4K, /** No TLM marker was found [Bv2.1_10.2.1] */ MISSING_JPEG2000_TLM_MARKER, /** The MXF _ResourceID_ of a timed text resource was not the same as that of the contained XML essence [Bv2.1_10.4.3] */ MISMATCHED_TIMED_TEXT_RESOURCE_ID, /** The AssetID of a timed text MXF is the same as its _ResourceID_ or that of the contained XML essence [Bv2.1_10.4.2] */ INCORRECT_TIMED_TEXT_ASSET_ID, /** The ContainerDuration of a timed text MXF is not the same as the _Duration_ in its reel [Bv2.1_10.4.3] * reel_duration contains the reel duration * asset_duration contains the MXF duration */ MISMATCHED_TIMED_TEXT_DURATION, /** Something could not be verified because content is encrypted and no key is available */ MISSED_CHECK_OF_ENCRYPTED, /** Some timed-text XML has an empty __ node */ EMPTY_TEXT, /** Some closed captions do not have the same vertical alignment within a __ node */ MISMATCHED_CLOSED_CAPTION_VALIGN, /** Some closed captions are not listed in the XML in the order of their vertical position */ INCORRECT_CLOSED_CAPTION_ORDERING, /** Some asset has an __ that should not be there */ UNEXPECTED_ENTRY_POINT, /** Some asset has an __ that should not be there */ UNEXPECTED_DURATION, /** A __ has been specified with either: * - no scope, or * - the SMPTE 429-7 scope, but with an invalid kind * content_kind contains the invalid */ INVALID_CONTENT_KIND, /** A valid __ was seen. * content_kind contains the valid */ VALID_CONTENT_KIND, /** Either the width or height of a __ in a CPL is either not an even number, or bigger than the corresponding asset dimension. * error contains details of what is wrong */ INVALID_MAIN_PICTURE_ACTIVE_AREA, /** A valid __ was seen. * size_in_pixels contains the size. */ VALID_MAIN_PICTURE_ACTIVE_AREA, /** A PKL has more than one asset with the same ID * pkl_id contains the PKL ID */ DUPLICATE_ASSET_ID_IN_PKL, /** An ASSETMAP has more than one asset with the same ID */ DUPLICATE_ASSET_ID_IN_ASSETMAP, /** An Interop subtitle asset has no subtitles */ MISSING_SUBTITLE, /** A SMPTE subtitle asset as an __ which is not of the form yyyy-mm-ddThh:mm:ss * I can find no reference in a standard to this being required, but the Deluxe delivery * specifications require it and their QC will fail DCPs that don't have it. * issue_date contains the incorrect */ INVALID_SUBTITLE_ISSUE_DATE, /** The sound assets in the CPL do not have the same audio channel count */ MISMATCHED_SOUND_CHANNEL_COUNTS, /** The CPL contains a __ tag which does not describe the number of * channels in the audio assets, or which is in some way badly formatted. * error contains details of what is wrong */ INVALID_MAIN_SOUND_CONFIGURATION, /** An interop subtitle file has a __ node which refers to a font file that is not found. * load_font_id contains the ID */ MISSING_FONT, /** A tile part in a JPEG2000 frame is too big. * size contains the size that is too big */ INVALID_JPEG2000_TILE_PART_SIZE, /** A subtitle XML root node has more than one namespace (xmlns) declaration. */ INCORRECT_SUBTITLE_NAMESPACE_COUNT, /** A subtitle or closed caption file has a __ tag which refers to a font that is not * first introduced with a . * load_font_id contains the ID of the tag. */ MISSING_LOAD_FONT_FOR_FONT, /** A SMPTE subtitle asset has at least one __ element but no */ MISSING_LOAD_FONT, /** An ID in an asset map does not match the ID obtained from reading the actual file. * mismatched_asset_id_from_asset_map contains the ID from the asset map. * mismatched_asset_id_from_file contains the ID from the file. */ MISMATCHED_ASSET_MAP_ID, /** The inside a __ is empty */ EMPTY_CONTENT_VERSION_LABEL_TEXT, /** A inside a __ is valid */ VALID_CONTENT_VERSION_LABEL_TEXT, /** The CPL namespace is not valid. * namespace contains the invalid namespace */ INVALID_CPL_NAMESPACE, /** A SMPTE CPL does not contain a __ tag * file contains the CPL filename */ MISSING_CPL_CONTENT_VERSION, /** The PKL namespace is not valid. * namespace contains the invalid namespace */ INVALID_PKL_NAMESPACE, }; VerificationNote(Code code) : _code(code) {} VerificationNote(Code code, boost::filesystem::path file) : _code (code) { _location[Location::FILE] = file; } VerificationNote(Code code, boost::filesystem::path file, int64_t line) : _code (code) { _location[Location::FILE] = file; _location[Location::LINE] = line; } Type type() const; Code code() const { return _code; } enum class Location { FILE, ///< path of file containing the error LINE, ///< error line number within the FILE FRAME, COMPONENT, ASSET_ID, CPL_ID, PKL_ID, REEL_INDEX, ///< reel index, counting from 0 }; std::vector locations() const; std::string location_as_string(Location key) const; private: enum class Data { SIZE, LOAD_FONT_ID, MISMATCHED_ASSET_ID_FROM_ASSET_MAP, MISMATCHED_ASSET_ID_FROM_FILE, FRAME_RATE, ASSET_MAP_ID, CALCULATED_HASH, REFERENCE_HASH, XML_NAMESPACE, CONTENT_VERSION, ERROR, LANGUAGE, CONTENT_KIND, CPL_ANNOTATION_TEXT, GUARD_BITS, ISSUE_DATE, RELEASE_TERRITORY, SIZE_IN_PIXELS, SIZE_IN_BYTES, BIT_DEPTH, MARKER_POSITION, CODE_BLOCK_SIZE, POC_MARKERS, TILE_PARTS, REEL_DURATION, ASSET_DURATION, JPEG2000_CAPABILITIES, }; template boost::optional data(Data key) const { auto iter = _data.find(key); if (iter == _data.end()) { return {}; } return boost::any_cast(iter->second); } template boost::optional location(Location key) const { auto iter = _location.find(key); if (iter == _location.end()) { return {}; } return boost::any_cast(iter->second); } public: boost::optional data_as_string(std::string const& key) const; boost::optional file () const { return location(Location::FILE); } VerificationNote& set_line(int64_t line) { _location[Location::LINE] = line; return *this; } boost::optional line () const { return location(Location::LINE); } VerificationNote& set_frame(int frame) { _location[Location::FRAME] = frame; return *this; } boost::optional frame() const { return location(Location::FRAME); } VerificationNote& set_component(int component) { _location[Location::COMPONENT] = component; return *this; } boost::optional component() const { return location(Location::COMPONENT); } VerificationNote& set_size(int size) { _data[Data::SIZE] = size; return *this; } boost::optional size() const { return data(Data::SIZE); } VerificationNote& set_load_font_id(std::string id) { _data[Data::LOAD_FONT_ID] = id; return *this; } boost::optional load_font_id() const { return data(Data::LOAD_FONT_ID); } VerificationNote& set_asset_id(std::string id) { _location[Location::ASSET_ID] = id; return *this; } boost::optional asset_id() const { return location(Location::ASSET_ID); } VerificationNote& set_mismatched_asset_id_from_asset_map(std::string asset_id) { _data[Data::MISMATCHED_ASSET_ID_FROM_ASSET_MAP] = asset_id; return *this; } boost::optional mismatched_asset_id_from_asset_map() const { return data(Data::MISMATCHED_ASSET_ID_FROM_ASSET_MAP); } VerificationNote& set_mismatched_asset_id_from_file(std::string asset_id) { _data[Data::MISMATCHED_ASSET_ID_FROM_FILE] = asset_id; return *this; } boost::optional mismatched_asset_id_from_file() const { return data(Data::MISMATCHED_ASSET_ID_FROM_FILE); } VerificationNote& set_frame_rate(dcp::Fraction frame_rate) { _data[Data::FRAME_RATE] = frame_rate; return *this; } boost::optional frame_rate() const { return data(Data::FRAME_RATE); } VerificationNote& set_calculated_hash(std::string hash) { _data[Data::CALCULATED_HASH] = hash; return *this; } boost::optional calculated_hash() const { return data(Data::CALCULATED_HASH); } VerificationNote& set_reference_hash(std::string hash) { _data[Data::REFERENCE_HASH] = hash; return *this; } boost::optional reference_hash() const { return data(Data::REFERENCE_HASH); } VerificationNote& set_cpl_id(std::string id) { _location[Location::CPL_ID] = id; return *this; } boost::optional cpl_id() const { return location(Location::CPL_ID); } VerificationNote& set_pkl_id(std::string id) { _location[Location::PKL_ID] = id; return *this; } boost::optional pkl_id() const { return location(Location::PKL_ID); } VerificationNote& set_asset_map_id(std::string id) { _data[Data::ASSET_MAP_ID] = id; return *this; } boost::optional asset_map_id() const { return data(Data::ASSET_MAP_ID); } VerificationNote& set_reel_index(int index) { _location[Location::REEL_INDEX] = index; return *this; } boost::optional reel_index() const { return location(Location::REEL_INDEX); } VerificationNote& set_xml_namespace(std::string ns) { _data[Data::XML_NAMESPACE] = ns; return *this; } boost::optional xml_namespace() const { return data(Data::XML_NAMESPACE); } VerificationNote& set_content_version(std::string version) { _data[Data::CONTENT_VERSION] = version; return *this; } boost::optional content_version() const { return data(Data::CONTENT_VERSION); } VerificationNote& set_error(std::string error) { _data[Data::ERROR] = error; return *this; } boost::optional error() const { return data(Data::ERROR); } VerificationNote& set_language(std::string language) { _data[Data::LANGUAGE] = language; return *this; } boost::optional language() const { return data(Data::LANGUAGE); } VerificationNote& set_content_kind(std::string content_kind) { _data[Data::CONTENT_KIND] = content_kind; return *this; } boost::optional content_kind() const { return data(Data::CONTENT_KIND); } VerificationNote& set_cpl_annotation_text(std::string cpl_annotation_text) { _data[Data::CPL_ANNOTATION_TEXT] = cpl_annotation_text; return *this; } boost::optional cpl_annotation_text() const { return data(Data::CPL_ANNOTATION_TEXT); } VerificationNote& set_guard_bits(int guard_bits) { _data[Data::GUARD_BITS] = guard_bits; return *this; } boost::optional guard_bits() const { return data(Data::GUARD_BITS); } VerificationNote& set_issue_date(std::string issue_date) { _data[Data::ISSUE_DATE] = issue_date; return *this; } boost::optional issue_date() const { return data(Data::ISSUE_DATE); } VerificationNote& set_release_territory(std::string release_territory) { _data[Data::RELEASE_TERRITORY] = release_territory; return *this; } boost::optional release_territory() const { return data(Data::RELEASE_TERRITORY); } VerificationNote& set_size_in_pixels(dcp::Size size_in_pixels) { _data[Data::SIZE_IN_PIXELS] = size_in_pixels; return *this; } boost::optional size_in_pixels() const { return data(Data::SIZE_IN_PIXELS); } VerificationNote& set_size_in_bytes(int64_t size_in_bytes) { _data[Data::SIZE_IN_BYTES] = size_in_bytes; return *this; } boost::optional size_in_bytes() const { return data(Data::SIZE_IN_BYTES); } VerificationNote& set_bit_depth(int bit_depth) { _data[Data::BIT_DEPTH] = bit_depth; return *this; } boost::optional bit_depth() const { return data(Data::BIT_DEPTH); } VerificationNote& set_marker_position(int64_t marker_position) { _data[Data::MARKER_POSITION] = marker_position; return *this; } boost::optional marker_position() const { return data(Data::MARKER_POSITION); } VerificationNote& set_code_block_size(int code_block_size) { _data[Data::CODE_BLOCK_SIZE] = code_block_size; return *this; } boost::optional code_block_size() const { return data(Data::CODE_BLOCK_SIZE); } VerificationNote& set_poc_markers(int poc_markers) { _data[Data::POC_MARKERS] = poc_markers; return *this; } boost::optional poc_markers() const { return data(Data::POC_MARKERS); } VerificationNote& set_tile_parts(int tile_parts) { _data[Data::TILE_PARTS] = tile_parts; return *this; } boost::optional tile_parts() const { return data(Data::TILE_PARTS); } VerificationNote& set_reel_duration(int64_t reel_duration) { _data[Data::REEL_DURATION] = reel_duration; return *this; } boost::optional reel_duration() const { return data(Data::REEL_DURATION); } VerificationNote& set_asset_duration(int64_t asset_duration) { _data[Data::ASSET_DURATION] = asset_duration; return *this; } boost::optional asset_duration() const { return data(Data::ASSET_DURATION); } VerificationNote& set_jpeg2000_capabilities(int jpeg2000_capabilities) { _data[Data::JPEG2000_CAPABILITIES] = jpeg2000_capabilities; return *this; } boost::optional jpeg2000_capabilities() const { return data(Data::JPEG2000_CAPABILITIES); } private: Code _code; std::map _data; std::map _location; }; struct VerificationOptions { ///< If set, any assets larger than this number of bytes will not have their hashes checked boost::optional maximum_asset_size_for_hash_check; ///< true to check asset hashes (except those which match maximum_asset_size_for_hash_check) ///< false to check no asset hashes. bool check_asset_hashes = true; ///< true to do some time-consuming detailed picture checks (e.g. J2K bitstream) bool check_picture_details = true; }; struct VerificationResult { std::vector notes; std::vector> dcps; }; VerificationResult verify( std::vector directories, std::vector kdms, std::function)> stage, std::function progress, VerificationOptions options = {}, boost::optional xsd_dtd_directory = boost::optional() ); std::string note_to_string( dcp::VerificationNote note, std::function process_string = [](std::string s) { return s; }, std::function 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); std::ostream& operator<<(std::ostream& s, dcp::VerificationNote const& note); std::string substitute(std::string text, dcp::VerificationNote const& note); std::string location_name(dcp::VerificationNote::Location location); } #endif