/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
*/
enum Type {
VERIFY_ERROR,
- VERIFY_WARNING,
- VERIFY_NOTE
+ VERIFY_WARNING
};
- VerificationNote (Type type, std::string note)
+ enum Code {
+ /** An error when reading the DCP. note contains (probably technical) details. */
+ GENERAL_READ,
+ /** The hash of the CPL in the PKL does not agree with the CPL file */
+ CPL_HASH_INCORRECT,
+ /** Frame rate given in a reel for the main picture is not 24, 25, 30, 48, 50 or 60 */
+ INVALID_PICTURE_FRAME_RATE,
+ /** The hash of a main picture asset does not agree with the PKL file. file contains the picture asset filename. */
+ PICTURE_HASH_INCORRECT,
+ /** The hash of a main picture is different in the CPL and PKL */
+ PKL_CPL_PICTURE_HASHES_DISAGREE,
+ /** The hash of a main sound asset does not agree with the PKL file. file contains the sound asset filename. */
+ SOUND_HASH_INCORRECT,
+ /** The hash of a main sound is different in the CPL and PKL */
+ PKL_CPL_SOUND_HASHES_DISAGREE,
+ /** An assetmap's <Path> entry is empty */
+ EMPTY_ASSET_PATH,
+ /** 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)
+ : _type (type)
+ , _code (code)
+ {}
+
+ VerificationNote (Type type, Code code, std::string note)
+ : _type (type)
+ , _code (code)
+ , _note (note)
+ {}
+
+ VerificationNote (Type type, Code code, boost::filesystem::path file)
+ : _type (type)
+ , _code (code)
+ , _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;
}
- std::string note () const {
+ Code code () const {
+ return _code;
+ }
+
+ boost::optional<std::string> note () const {
return _note;
}
+ boost::optional<boost::filesystem::path> file () const {
+ return _file;
+ }
+
+ boost::optional<uint64_t> line () const {
+ return _line;
+ }
+
private:
Type _type;
- std::string _note;
+ 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);
+
}
#endif