summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-05-24 11:26:50 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-24 11:26:50 +0100
commit437f928f7d7209c9e4c8ea3e3b5d0e8dc43b54a8 (patch)
tree50feb1d8277cf6ad7fb8da83b36b0d5782c55326 /src/dcp.cc
parent23644a666637d3db3ccf2007a7cbbcdf4f2d29a2 (diff)
Add reporting of DCP type.
Diffstat (limited to 'src/dcp.cc')
-rw-r--r--src/dcp.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 3298cfae..11146562 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -81,6 +81,7 @@ DCP::DCP (boost::filesystem::path directory)
_directory = boost::filesystem::canonical (_directory);
}
+/** Call this instead of throwing an exception if the error can be tolerated */
template<class T> void
survivable_error (bool keep_going, dcp::DCP::ReadErrors* errors, T const & e)
{
@@ -108,7 +109,16 @@ DCP::read (bool keep_going, ReadErrors* errors, bool ignore_incorrect_picture_mx
}
cxml::Document asset_map ("AssetMap");
+
asset_map.read_file (asset_map_file);
+ if (asset_map.namespace_uri() == assetmap_interop_ns) {
+ _standard = INTEROP;
+ } else if (asset_map.namespace_uri() == assetmap_smpte_ns) {
+ _standard = SMPTE;
+ } else {
+ boost::throw_exception (XMLError ("Unrecognised Assetmap namespace " + asset_map.namespace_uri()));
+ }
+
list<shared_ptr<cxml::Node> > asset_nodes = asset_map.node_child("AssetList")->node_children ("Asset");
map<string, boost::filesystem::path> paths;
BOOST_FOREACH (shared_ptr<cxml::Node> i, asset_nodes) {
@@ -153,11 +163,23 @@ DCP::read (bool keep_going, ReadErrors* errors, bool ignore_incorrect_picture_mx
delete p;
if (root == "CompositionPlaylist") {
- _cpls.push_back (shared_ptr<CPL> (new CPL (path)));
+ shared_ptr<CPL> cpl (new CPL (path));
+ if (_standard && cpl->standard() && cpl->standard().get() != _standard.get()) {
+ survivable_error (keep_going, errors, MismatchedStandardError ());
+ }
+ _cpls.push_back (cpl);
} else if (root == "DCSubtitle") {
+ if (_standard && _standard.get() == SMPTE) {
+ survivable_error (keep_going, errors, MismatchedStandardError ());
+ }
other_assets.push_back (shared_ptr<InteropSubtitleAsset> (new InteropSubtitleAsset (path)));
}
} else if (boost::filesystem::extension (path) == ".mxf") {
+
+ /* XXX: asdcplib does not appear to support discovery of read MXFs standard
+ (Interop / SMPTE)
+ */
+
ASDCP::EssenceType_t type;
if (ASDCP::EssenceType (path.string().c_str(), type) != ASDCP::RESULT_OK) {
throw DCPReadError ("Could not find essence type");