summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-14 12:40:01 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-16 22:49:26 +0200
commit3f6667d8597d40832f444d6909327b817f23785c (patch)
tree7b563992c4d266248917b3c0b936af0387189afb /src
parentb45e627212869e3ae4428e5a0fc3aec27f9aeb69 (diff)
Ignore parameters in PKL type strings when checking them.
Cherry-picked from 1ffc787c6318815592e8d81c4878488eb6183ca4 in master.
Diffstat (limited to 'src')
-rw-r--r--src/dcp.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 2011f04e..00468d53 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -108,6 +108,15 @@ survivable_error (bool keep_going, dcp::DCP::ReadErrors* errors, T const & e)
}
}
+
+static
+string
+remove_parameters (string const& n)
+{
+ return n.substr(0, n.find(";"));
+}
+
+
void
DCP::read (bool keep_going, ReadErrors* errors, bool ignore_incorrect_picture_mxf_type)
{
@@ -218,7 +227,12 @@ DCP::read (bool keep_going, ReadErrors* errors, bool ignore_incorrect_picture_mx
continue;
}
- if (*pkl_type == CPL::static_pkl_type(*_standard) || *pkl_type == InteropSubtitleAsset::static_pkl_type(*_standard)) {
+ /* Remove any optional parameters (after ;) */
+ pkl_type = pkl_type->substr(0, pkl_type->find(";"));
+
+ if (
+ pkl_type == remove_parameters(CPL::static_pkl_type(*_standard)) ||
+ pkl_type == remove_parameters(InteropSubtitleAsset::static_pkl_type(*_standard))) {
xmlpp::DomParser* p = new xmlpp::DomParser;
try {
p->parse_file (path.string());
@@ -243,14 +257,14 @@ DCP::read (bool keep_going, ReadErrors* errors, bool ignore_incorrect_picture_mx
other_assets.push_back (shared_ptr<InteropSubtitleAsset> (new InteropSubtitleAsset (path)));
}
} else if (
- *pkl_type == PictureAsset::static_pkl_type(*_standard) ||
- *pkl_type == SoundAsset::static_pkl_type(*_standard) ||
- *pkl_type == AtmosAsset::static_pkl_type(*_standard) ||
- *pkl_type == SMPTESubtitleAsset::static_pkl_type(*_standard)
+ *pkl_type == remove_parameters(PictureAsset::static_pkl_type(*_standard)) ||
+ *pkl_type == remove_parameters(SoundAsset::static_pkl_type(*_standard)) ||
+ *pkl_type == remove_parameters(AtmosAsset::static_pkl_type(*_standard)) ||
+ *pkl_type == remove_parameters(SMPTESubtitleAsset::static_pkl_type(*_standard))
) {
other_assets.push_back (asset_factory(path, ignore_incorrect_picture_mxf_type));
- } else if (*pkl_type == FontAsset::static_pkl_type(*_standard)) {
+ } else if (*pkl_type == remove_parameters(FontAsset::static_pkl_type(*_standard))) {
other_assets.push_back (shared_ptr<FontAsset> (new FontAsset (i->first, path)));
} else if (*pkl_type == "image/png") {
/* It's an Interop PNG subtitle; let it go */