X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.cc;h=23fe65cf4c8fcfd9448975d1b050edc7f787c8cb;hb=2cdf3d9f461b12d0925cc54368105bbd177bbbb3;hp=08e138fe602d4bef681dc0836852d42083f5f9f3;hpb=7c730205e50014347bd96ab9735346d0b5922798;p=dcpomatic.git diff --git a/src/lib/player.cc b/src/lib/player.cc index 08e138fe6..23fe65cf4 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 Carl Hetherington + Copyright (C) 2013-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -93,6 +93,7 @@ Player::Player (shared_ptr film, shared_ptr playlist , _ignore_text (false) , _always_burn_open_subtitles (false) , _fast (false) + , _tolerant (film->tolerant()) , _play_referenced (false) , _audio_merger (_film->audio_frame_rate()) , _shuffler (0) @@ -138,6 +139,7 @@ have_audio (shared_ptr piece) void Player::setup_pieces_unlocked () { + list > old_pieces = _pieces; _pieces.clear (); delete _shuffler; @@ -155,7 +157,15 @@ Player::setup_pieces_unlocked () continue; } - shared_ptr decoder = decoder_factory (_film, i, _fast); + shared_ptr old_decoder; + BOOST_FOREACH (shared_ptr j, old_pieces) { + if (j->content == i) { + old_decoder = j->decoder; + break; + } + } + + shared_ptr decoder = decoder_factory (_film, i, _fast, _tolerant, old_decoder); FrameRateChange frc (_film, i); if (!decoder) { @@ -494,7 +504,7 @@ Player::get_reel_assets () scoped_ptr decoder; try { - decoder.reset (new DCPDecoder (_film, j, false)); + decoder.reset (new DCPDecoder (_film, j, false, false, shared_ptr())); } catch (...) { return a; } @@ -1045,8 +1055,12 @@ Player::seek (DCPTime time, bool accurate) BOOST_FOREACH (shared_ptr i, _pieces) { if (time < i->content->position()) { - /* Before; seek to the start of the content */ - i->decoder->seek (dcp_to_content_time (i, i->content->position()), accurate); + /* Before; seek to the start of the content. Even if this request is for an inaccurate seek + we must seek this (following) content accurately, otherwise when we come to the end of the current + content we may not start right at the beginning of the next, causing a gap (if the next content has + been trimmed to a point between keyframes, or something). + */ + i->decoder->seek (dcp_to_content_time (i, i->content->position()), true); i->done = false; } else if (i->content->position() <= time && time < i->content->end(_film)) { /* During; seek to position */