Fix to allow re-writing of SMPTE subtitles.
[libdcp.git] / src / verify.h
index 1403797c709e09a2fa9500063876bd39ce671b35..c30718ebba9a34570f61c4e82abed1b1b6ef8add 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
@@ -51,6 +51,7 @@ public:
        */
        enum Type {
                VERIFY_ERROR,
+               VERIFY_BV21_ERROR, ///< may not always be considered an error, but violates a "shall" requirement of Bv2.1
                VERIFY_WARNING
        };
 
@@ -71,12 +72,42 @@ public:
                PKL_CPL_SOUND_HASHES_DISAGREE,
                /** An assetmap's <Path> entry is empty */
                EMPTY_ASSET_PATH,
-               /** An file mentioned in an assetmap cannot be found */
+               /** A file mentioned in an asset map cannot be found */
                MISSING_ASSET,
                /** The DCP contains both SMPTE and Interop-standard components */
                MISMATCHED_STANDARD,
-               /** A urn:uuid ID is badly formed */
-               BAD_URN_UUID,
+               /** Some XML fails to validate against the XSD/DTD */
+               XML_VALIDATION_ERROR,
+               /** No ASSETMAP{.xml} was found */
+               MISSING_ASSETMAP,
+               /** An asset's IntrinsicDuration is less than 1 second */
+               INTRINSIC_DURATION_TOO_SMALL,
+               /** An asset's Duration is less than 1 second */
+               DURATION_TOO_SMALL,
+               /** The JPEG2000 data in at least one picture frame is larger than the equivalent of 250Mbit/s */
+               PICTURE_FRAME_TOO_LARGE_IN_BYTES,
+               /** The JPEG2000 data in at least one picture frame is larger than the equivalent of 230Mbit/s */
+               PICTURE_FRAME_NEARLY_TOO_LARGE_IN_BYTES,
+               /** An asset that the CPL requires is not in this DCP; the DCP may be a VF */
+               EXTERNAL_ASSET,
+               /** DCP is Interop, not SMPTE [Bv2.1_6.1] */
+               NOT_SMPTE,
+               /** A language or territory does not conform to RFC 5646 [Bv2.1_6.2.1] */
+               BAD_LANGUAGE,
+               /** A picture asset does not have one of the required Bv2.1 sizes (in pixels) [Bv2.1_7.1] */
+               PICTURE_ASSET_INVALID_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] */
+               PICTURE_ASSET_INVALID_FRAME_RATE_FOR_2K,
+               /** A picture asset is 4K but is not at 24fps as required by Bv2.1 [Bv2.1_7.1] */
+               PICTURE_ASSET_INVALID_FRAME_RATE_FOR_4K,
+               /** A picture asset is 4K but is 3D which is not allowed by Bv2.1 [Bv2.1_7.1] */
+               PICTURE_ASSET_4K_3D,
+               /** A closed caption's XML file is larger than 256KB [Bv2.1_7.2.1] */
+               CLOSED_CAPTION_XML_TOO_LARGE_IN_BYTES,
+               /** Any timed text asset's total files is larger than 115MB [Bv2.1_7.2.1] */
+               TIMED_TEXT_ASSET_TOO_LARGE_IN_BYTES,
+               /** The total size of all a timed text asset's fonts is larger than 10MB [Bv2.1_7.2.1] */
+               TIMED_TEXT_FONTS_TOO_LARGE_IN_BYTES,
        };
 
        VerificationNote (Type type, Code code)
@@ -96,6 +127,21 @@ public:
                , _file (file)
        {}
 
+       VerificationNote (Type type, Code code, std::string note, boost::filesystem::path file)
+               : _type (type)
+               , _code (code)
+               , _note (note)
+               , _file (file)
+       {}
+
+       VerificationNote (Type type, Code code, std::string note, boost::filesystem::path file, uint64_t line)
+               : _type (type)
+               , _code (code)
+               , _note (note)
+               , _file (file)
+               , _line (line)
+       {}
+
        Type type () const {
                return _type;
        }
@@ -112,17 +158,26 @@ public:
                return _file;
        }
 
+       boost::optional<uint64_t> line () const {
+               return _line;
+       }
+
 private:
        Type _type;
        Code _code;
+       /** Further information about the error, if applicable */
        boost::optional<std::string> _note;
+       /** Path of file containing the error, if applicable */
        boost::optional<boost::filesystem::path> _file;
+       /** Error line number within _file, if applicable */
+       uint64_t _line;
 };
 
 std::list<VerificationNote> verify (
        std::vector<boost::filesystem::path> directories,
        boost::function<void (std::string, boost::optional<boost::filesystem::path>)> stage,
-       boost::function<void (float)> progress
+       boost::function<void (float)> progress,
+       boost::filesystem::path xsd_dtd_directory
        );
 
 std::string note_to_string (dcp::VerificationNote note);