summaryrefslogtreecommitdiff
path: root/src/verify_internal.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-11-29 00:42:13 +0100
committerCarl Hetherington <cth@carlh.net>2024-12-08 21:29:37 +0100
commitd0255af1234de0f90017930b2ceb7e75ec14ca95 (patch)
treec12bf1413fef31ada2ec131994ee550376215c78 /src/verify_internal.h
parent3896921f82140b43e32e68f5e509e57b927733fb (diff)
Extract more stuff to verify_internal.h
Diffstat (limited to 'src/verify_internal.h')
-rw-r--r--src/verify_internal.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/verify_internal.h b/src/verify_internal.h
index 3dfc4fb5..97c0e90f 100644
--- a/src/verify_internal.h
+++ b/src/verify_internal.h
@@ -44,7 +44,12 @@
#define LIBDCP_VERIFY_INTERNAL_H
+#include "cpl.h"
+#include "verify.h"
+#include <boost/filesystem.hpp>
+#include <boost/optional.hpp>
#include <memory>
+#include <vector>
namespace dcp {
@@ -67,6 +72,80 @@ extern void verify_text_lines_and_characters(
);
+class Context
+{
+public:
+ Context(
+ std::vector<VerificationNote>& notes_,
+ boost::filesystem::path xsd_dtd_directory_,
+ std::function<void (std::string, boost::optional<boost::filesystem::path>)> stage_,
+ std::function<void (float)> progress_,
+ VerificationOptions options_
+ )
+ : notes(notes_)
+ , xsd_dtd_directory(xsd_dtd_directory_)
+ , stage(stage_)
+ , progress(progress_)
+ , options(options_)
+ {}
+
+ Context(Context const&) = delete;
+ Context& operator=(Context const&) = delete;
+
+ template<typename... Args>
+ void ok(dcp::VerificationNote::Code code, Args... args)
+ {
+ add_note({dcp::VerificationNote::Type::OK, code, std::forward<Args>(args)...});
+ }
+
+ template<typename... Args>
+ void warning(dcp::VerificationNote::Code code, Args... args)
+ {
+ add_note({dcp::VerificationNote::Type::WARNING, code, std::forward<Args>(args)...});
+ }
+
+ template<typename... Args>
+ void bv21_error(dcp::VerificationNote::Code code, Args... args)
+ {
+ add_note({dcp::VerificationNote::Type::BV21_ERROR, code, std::forward<Args>(args)...});
+ }
+
+ template<typename... Args>
+ void error(dcp::VerificationNote::Code code, Args... args)
+ {
+ add_note({dcp::VerificationNote::Type::ERROR, code, std::forward<Args>(args)...});
+ }
+
+ void add_note(dcp::VerificationNote note)
+ {
+ if (cpl) {
+ note.set_cpl_id(cpl->id());
+ }
+ notes.push_back(std::move(note));
+ }
+
+ void add_note_if_not_existing(dcp::VerificationNote note)
+ {
+ if (find(notes.begin(), notes.end(), note) == notes.end()) {
+ add_note(note);
+ }
+ }
+
+ std::vector<VerificationNote>& notes;
+ std::shared_ptr<const DCP> dcp;
+ std::shared_ptr<const CPL> cpl;
+ boost::filesystem::path xsd_dtd_directory;
+ std::function<void (std::string, boost::optional<boost::filesystem::path>)> stage;
+ std::function<void (float)> progress;
+ VerificationOptions options;
+
+ boost::optional<std::string> subtitle_language;
+ boost::optional<int> audio_channels;
+};
+
+
+extern void verify_extension_metadata(dcp::Context& context);
+
}