X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fplayer.cc;h=10e47686283d7df200c15e7ff88193909305fc06;hb=9bf2cf3509380663e6943f6b0d22dbec6002c332;hp=116410046e5f0eaa3b5acfc9eddb8aee533d1b0b;hpb=2c5398adaea8bc56fe196144a9a233981657fba0;p=dcpomatic.git diff --git a/src/lib/player.cc b/src/lib/player.cc index 116410046..10e476862 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -74,6 +74,7 @@ using boost::shared_ptr; using boost::weak_ptr; using boost::dynamic_pointer_cast; using boost::optional; +using boost::scoped_ptr; Player::Player (shared_ptr film, shared_ptr playlist) : _film (film) @@ -357,7 +358,7 @@ Player::get_video (DCPTime time, bool accurate) /* Find subtitles for possible burn-in */ - PlayerSubtitles ps = get_subtitles (time, DCPTime::from_frames (1, _film->video_frame_rate ()), false, true); + PlayerSubtitles ps = get_subtitles (time, DCPTime::from_frames (1, _film->video_frame_rate ()), false, true, accurate); list sub_images; @@ -619,7 +620,7 @@ Player::content_subtitle_to_dcp (shared_ptr piece, ContentTime t) c * _always_burn_subtitles is true; in this case, all subtitles will be returned. */ PlayerSubtitles -Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt) +Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, bool accurate) { list > subs = overlaps (time, time + length); @@ -641,7 +642,7 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt) /* XXX: this video_frame_rate() should be the rate that the subtitle content has been prepared for */ ContentTime const to = from + ContentTime::from_frames (1, _film->video_frame_rate ()); - list image = subtitle_decoder->get_image_subtitles (ContentTimePeriod (from, to), starting); + list image = subtitle_decoder->get_image_subtitles (ContentTimePeriod (from, to), starting, accurate); for (list::iterator i = image.begin(); i != image.end(); ++i) { /* Apply content's subtitle offsets */ @@ -659,7 +660,7 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt) ps.image.push_back (i->sub); } - list text = subtitle_decoder->get_text_subtitles (ContentTimePeriod (from, to), starting); + list text = subtitle_decoder->get_text_subtitles (ContentTimePeriod (from, to), starting, accurate); BOOST_FOREACH (ContentTextSubtitle& ts, text) { BOOST_FOREACH (dcp::SubtitleString s, ts.subs) { s.set_h_position (s.h_position() + subtitle_content->subtitle_x_offset ()); @@ -752,9 +753,16 @@ Player::get_reel_assets () if (!j) { continue; } - DCPDecoder decoder (j, false); + + scoped_ptr decoder; + try { + decoder.reset (new DCPDecoder (j, false)); + } catch (...) { + return a; + } + int64_t offset = 0; - BOOST_FOREACH (shared_ptr k, decoder.reels()) { + BOOST_FOREACH (shared_ptr k, decoder->reels()) { DCPTime const from = i->position() + DCPTime::from_frames (offset, _film->video_frame_rate()); if (j->reference_video ()) { a.push_back ( @@ -775,6 +783,7 @@ Player::get_reel_assets () } if (j->reference_subtitle ()) { + DCPOMATIC_ASSERT (k->main_subtitle ()); a.push_back ( ReferencedReelAsset ( k->main_subtitle (),