Add --no-asset-hash-check and --asset-hash-check-maximum-size (DoM #2444).
[libdcp.git] / src / verify.h
index 424b29e7ca983387800116931f391fa2b301427a..77fc28b39d671e78dd1586ddf5c5703c0bb307ff 100644 (file)
@@ -58,9 +58,6 @@ namespace dcp {
 class VerificationNote
 {
 public:
-       /* I've been unable to make mingw happy with ERROR as a symbol, so
-          I'm using a VERIFY_ prefix here.
-       */
        enum class Type {
                ERROR,
                BV21_ERROR, ///< may not always be considered an error, but violates a "shall" requirement of Bv2.1
@@ -82,6 +79,7 @@ public:
         *  - MISMATCHED: two things, which should be the same, are not.
         *  - 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 fields (e.g. file)
@@ -392,6 +390,38 @@ public:
                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 <MainMarkers> asset has an <EntryPoint> that should not be there */
+               UNEXPECTED_ENTRY_POINT,
+               /** Some <MainMarkers> asset has an <Duration> that should not be there */
+               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,
+               /** 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,
+               /** A PKL has more than one asset with the same ID
+                *  note contains the PKL ID
+                *  file contains the PKL filename
+                */
+               DUPLICATE_ASSET_ID_IN_PKL,
+               /** An ASSETMAP has more than one asset with the same ID
+                *  note contains the ASSETMAP ID
+                *  file contains the ASSETMAP filename
+                */
+               DUPLICATE_ASSET_ID_IN_ASSETMAP,
+               /** An Interop subtitle asset has no subtitles.
+                *  note contains the asset ID
+                *  file contains the asset filename
+                */
+               MISSING_SUBTITLE,
+               /** A SMPTE subtitle asset as an <IssueDate> 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.
+                *  note contains the incorrect <IssueDate>
+                */
+               INVALID_SUBTITLE_ISSUE_DATE
        };
 
        VerificationNote (Type type, Code code)
@@ -458,10 +488,21 @@ private:
 };
 
 
+struct VerificationOptions
+{
+       ///< If set, any assets larger than this number of bytes will not have their hashes checked
+       boost::optional<boost::uintmax_t> 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;
+};
+
+
 std::vector<VerificationNote> verify (
        std::vector<boost::filesystem::path> directories,
        boost::function<void (std::string, boost::optional<boost::filesystem::path>)> stage,
        boost::function<void (float)> progress,
+       VerificationOptions options = {},
        boost::optional<boost::filesystem::path> xsd_dtd_directory = boost::optional<boost::filesystem::path>()
        );