summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-02-29 01:00:02 +0000
committerCarl Hetherington <cth@carlh.net>2016-02-29 01:00:02 +0000
commit45841f333f295200ec461607f85d64e7b1e99249 (patch)
tree21a3b246d9b677cbf57ca0ee3e7c33e8318fab59 /src/dcp.cc
parent8f7a014e6d11c107b520ac3c869b1cc7bef1bbd0 (diff)
Add workaround for (apparently) incorrectly-labelled stereo MXFs.
Diffstat (limited to 'src/dcp.cc')
-rw-r--r--src/dcp.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 2aa1d575..7ec7577f 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -87,7 +87,7 @@ survivable_error (bool keep_going, dcp::DCP::ReadErrors* errors, T const & e)
}
void
-DCP::read (bool keep_going, ReadErrors* errors)
+DCP::read (bool keep_going, ReadErrors* errors, bool ignore_incorrect_picture_mxf_type)
{
/* Read the ASSETMAP */
@@ -160,7 +160,16 @@ DCP::read (bool keep_going, ReadErrors* errors)
case ASDCP::ESS_MPEG2_VES:
throw DCPReadError ("MPEG2 video essences are not supported");
case ASDCP::ESS_JPEG_2000:
- other_assets.push_back (shared_ptr<MonoPictureAsset> (new MonoPictureAsset (path)));
+ try {
+ other_assets.push_back (shared_ptr<MonoPictureAsset> (new MonoPictureAsset (path)));
+ } catch (dcp::MXFFileError& e) {
+ if (ignore_incorrect_picture_mxf_type && e.number() == ASDCP::RESULT_SFORMAT) {
+ /* Tried to load it as mono but the error says it's stereo; try that instead */
+ other_assets.push_back (shared_ptr<StereoPictureAsset> (new StereoPictureAsset (path)));
+ } else {
+ throw;
+ }
+ }
break;
case ASDCP::ESS_PCM_24b_48k:
case ASDCP::ESS_PCM_24b_96k: