summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-09-23 23:42:58 +0200
committerCarl Hetherington <cth@carlh.net>2024-09-23 23:42:58 +0200
commit152266f6e65451a03521eb04b6a406b6e309e17a (patch)
tree0ebf358010ba72fdec87e8c64bdceea5a05b2925 /src
parentadae04e0984d294aa9a95394bfed584ce7e93469 (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.cc2
-rw-r--r--src/pkl.cc18
-rw-r--r--src/pkl.h5
-rw-r--r--src/verify.cc2
-rw-r--r--src/verify.h7
5 files changed, 30 insertions, 4 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index eb21b47d..af15081b 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -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:
diff --git a/src/pkl.cc b/src/pkl.cc
index 57eda9da..1684ea5f 100644
--- a/src/pkl.cc
+++ b/src/pkl.cc
@@ -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()));
}
diff --git a/src/pkl.h b/src/pkl.h
index d0a11188..e514095b 100644
--- a/src/pkl.h
+++ b/src/pkl.h
@@ -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)