Check that JPEG2000 frames aren't too big (i.e. too
[libdcp.git] / src / verify.h
index 9018ed4630c77c72c5c757e64c10da7b4ea24101..4bd91f55b01fd290af19276bfc606ff7e0b3f405 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.
 
@@ -71,12 +71,22 @@ 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 */
+               /** An file mentioned in an asset map cannot be found */
                MISSING_ASSET,
                /** The DCP contains both SMPTE and Interop-standard components */
                MISMATCHED_STANDARD,
                /** 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,
+               /** The JPEG2000 data in at least one picture frame is larger than the equivalent of 230Mbit/s */
+               PICTURE_FRAME_NEARLY_TOO_LARGE,
        };
 
        VerificationNote (Type type, Code code)
@@ -96,6 +106,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,11 +137,19 @@ 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 (