From 437f928f7d7209c9e4c8ea3e3b5d0e8dc43b54a8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 24 May 2016 11:26:50 +0100 Subject: Add reporting of DCP type. --- src/dcp.cc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/dcp.cc') 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 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 > asset_nodes = asset_map.node_child("AssetList")->node_children ("Asset"); map paths; BOOST_FOREACH (shared_ptr 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 (new CPL (path))); + shared_ptr 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 (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"); -- cgit v1.2.3