From 7673eebbd4595326b419f269544c43ed68bb5cf2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 5 May 2017 10:19:34 +0100 Subject: Don't seek a piece if the seek is outside its boundary. --- src/lib/player.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/player.cc b/src/lib/player.cc index 7ede96a0d..3de26ec90 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -913,9 +913,18 @@ Player::seek (DCPTime time, bool accurate) _active_subtitles.clear (); BOOST_FOREACH (shared_ptr i, _pieces) { - i->done = false; - DCPTime const t = min(max(time, i->content->position()), i->content->end()); - i->decoder->seek (dcp_to_content_time (i, t), accurate); + if (time < i->content->position()) { + /* Before; seek to 0 */ + i->decoder->seek (ContentTime(), accurate); + i->done = false; + } else if (i->content->position() <= time && time < i->content->end()) { + /* During; seek to position */ + i->decoder->seek (dcp_to_content_time (i, time), accurate); + i->done = false; + } else { + /* After; this piece is done */ + i->done = true; + } } if (accurate) { -- cgit v1.2.3