summaryrefslogtreecommitdiff
path: root/src/lib/dcp_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-10-30 13:16:52 +0000
committerCarl Hetherington <cth@carlh.net>2015-10-30 13:16:52 +0000
commit0fa016885370f0cf5b240deb48766894d8404e83 (patch)
treecd249fe152d3fd3dde57900136d00bc80b30139b /src/lib/dcp_content.cc
parent637a2a90d3e11306959a989ff511e0af103b2ad0 (diff)
Make it possible to do more stuff when there is missing DCP content in a project.
Diffstat (limited to 'src/lib/dcp_content.cc')
-rw-r--r--src/lib/dcp_content.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 747216f3c..c072dfa3d 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -42,6 +42,7 @@ using std::distance;
using std::pair;
using std::list;
using boost::shared_ptr;
+using boost::scoped_ptr;
using boost::optional;
int const DCPContentProperty::CAN_BE_PLAYED = 600;
@@ -255,12 +256,20 @@ list<DCPTimePeriod>
DCPContent::reels () const
{
list<DCPTimePeriod> p;
- DCPDecoder decoder (shared_from_this(), false);
+ scoped_ptr<DCPDecoder> decoder;
+ try {
+ decoder.reset (new DCPDecoder (shared_from_this(), false));
+ } catch (...) {
+ /* Could not load the DCP; guess reels */
+ list<DCPTimePeriod> p;
+ p.push_back (DCPTimePeriod (position(), end()));
+ return p;
+ }
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
DCPTime from = position ();
- BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder.reels()) {
+ BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder->reels()) {
DCPTime const to = from + DCPTime::from_frames (i->main_picture()->duration(), film->video_frame_rate());
p.push_back (DCPTimePeriod (from, to));
from = to;