X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.cc;h=ecf37b57662b6b89c198a15f3035626ba3b5dce7;hb=1c996bf18ee3731e3533c82dae98e5abaa336a32;hp=6c3d959fa4488b360352e440babc91ce25b3556d;hpb=6708d52b5c2ff9ccb6ee99f3b793d791bb95f26b;p=dcpomatic.git diff --git a/src/lib/player.cc b/src/lib/player.cc index 6c3d959fa..ecf37b576 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) @@ -218,7 +219,10 @@ Player::playlist_content_changed (weak_ptr w, int property, bool freque property == ContentProperty::TRIM_END || property == ContentProperty::PATH || property == VideoContentProperty::VIDEO_FRAME_TYPE || - property == DCPContentProperty::CAN_BE_PLAYED + property == DCPContentProperty::CAN_BE_PLAYED || + property == SubRipContentProperty::SUBTITLE_COLOUR || + property == SubRipContentProperty::SUBTITLE_OUTLINE || + property == SubRipContentProperty::SUBTITLE_OUTLINE_COLOUR ) { _have_valid_pieces = false; @@ -357,7 +361,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; @@ -380,7 +384,7 @@ Player::get_video (DCPTime time, bool accurate) list > ov = overlaps ( time, - time + DCPTime::from_frames (1, _film->video_frame_rate ()) - DCPTime::delta() + time + DCPTime::from_frames (1, _film->video_frame_rate ()) ); list > pvf; @@ -619,7 +623,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 +645,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 +663,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 +756,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 +786,7 @@ Player::get_reel_assets () } if (j->reference_subtitle ()) { + DCPOMATIC_ASSERT (k->main_subtitle ()); a.push_back ( ReferencedReelAsset ( k->main_subtitle (),