diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-09-23 23:42:58 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-09-23 23:42:58 +0200 |
| commit | 152266f6e65451a03521eb04b6a406b6e309e17a (patch) | |
| tree | 0ebf358010ba72fdec87e8c64bdceea5a05b2925 /src | |
| parent | adae04e0984d294aa9a95394bfed584ce7e93469 (diff) | |
Allow but give an error when seeing a strange PKL namespace.v1.8.110
DoM bug #2868 reports that Resolve made a DCP with the PKL namespace
http://www.smpte-ra.org/schemas/2067-2/2016/PKL
This seems wrong (google suggests that this is the namespace for IMF
PKLs) but let's accept it and log an error instead of throwing an
exception.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dcp.cc | 2 | ||||
| -rw-r--r-- | src/pkl.cc | 18 | ||||
| -rw-r--r-- | src/pkl.h | 5 | ||||
| -rw-r--r-- | src/verify.cc | 2 | ||||
| -rw-r--r-- | src/verify.h | 7 |
5 files changed, 30 insertions, 4 deletions
@@ -158,7 +158,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m } for (auto i: pkl_paths) { - _pkls.push_back(make_shared<PKL>(i)); + _pkls.push_back(make_shared<PKL>(i, notes)); } /* Now we have: @@ -44,6 +44,7 @@ #include "raw_convert.h" #include "util.h" #include "warnings.h" +#include "verify.h" LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> LIBDCP_ENABLE_WARNINGS @@ -53,15 +54,18 @@ LIBDCP_ENABLE_WARNINGS using std::string; using std::shared_ptr; using std::make_shared; +using std::vector; using boost::optional; using namespace dcp; static string const pkl_interop_ns = "http://www.digicine.com/PROTO-ASDCP-PKL-20040311#"; static string const pkl_smpte_ns = "http://www.smpte-ra.org/schemas/429-8/2007/PKL"; +/* I don't know why Resolve are using this namespace but apparently they are */ +static string const pkl_resolve_smpte_ns = "http://www.smpte-ra.org/schemas/2067-2/2016/PKL"; -PKL::PKL (boost::filesystem::path file) +PKL::PKL(boost::filesystem::path file, vector<dcp::VerificationNote>* notes) : _file (file) { cxml::Document pkl ("PackingList"); @@ -71,6 +75,18 @@ PKL::PKL (boost::filesystem::path file) _standard = Standard::INTEROP; } else if (pkl.namespace_uri() == pkl_smpte_ns) { _standard = Standard::SMPTE; + } else if (pkl.namespace_uri() == pkl_resolve_smpte_ns) { + _standard = Standard::SMPTE; + if (notes) { + notes->push_back( + dcp::VerificationNote( + dcp::VerificationNote::Type::ERROR, + dcp::VerificationNote::Code::INVALID_PKL_NAMESPACE, + pkl.namespace_uri(), + file + ) + ); + } } else { boost::throw_exception(XMLError("Unrecognised packing list namespace " + pkl.namespace_uri())); } @@ -52,6 +52,9 @@ namespace dcp { +class VerificationNote; + + class PKL : public Object, public AssetList { public: @@ -59,7 +62,7 @@ public: : AssetList(standard, annotation_text, issue_date, issuer, creator) {} - explicit PKL (boost::filesystem::path file); + explicit PKL(boost::filesystem::path file, std::vector<dcp::VerificationNote>* notes = nullptr); boost::optional<std::string> hash (std::string id) const; boost::optional<std::string> type (std::string id) const; diff --git a/src/verify.cc b/src/verify.cc index ec8925f2..e5d2511d 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -2183,6 +2183,8 @@ dcp::note_to_string (VerificationNote note) return String::compose("The namespace %1 in CPL %2 is invalid", note.note().get(), note.file()->filename()); case VerificationNote::Code::MISSING_CPL_CONTENT_VERSION: return String::compose("The CPL %1 has no <ContentVersion> tag", note.note().get()); + case VerificationNote::Code::INVALID_PKL_NAMESPACE: + return String::compose("The namespace %1 in PKL %2 is invalid", note.note().get(), note.file()->filename()); } return ""; diff --git a/src/verify.h b/src/verify.h index 204d83b0..218d2ceb 100644 --- a/src/verify.h +++ b/src/verify.h @@ -487,7 +487,12 @@ public: * note contains the CPL ID * file contains the CPL filename */ - MISSING_CPL_CONTENT_VERSION + MISSING_CPL_CONTENT_VERSION, + /** The PKL namespace is not valid. + * note contains the invalid namespace + * file contains the PKL filename + */ + INVALID_PKL_NAMESPACE }; VerificationNote (Type type, Code code) |
