summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-05 10:19:34 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-05 10:19:34 +0100
commit7673eebbd4595326b419f269544c43ed68bb5cf2 (patch)
tree6fb61dad3d9a9645a814b662abaad80610ee41fb /src/lib
parent275f2d20a3d2760e6136baf35d57080f852a8760 (diff)
Don't seek a piece if the seek is outside its boundary.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc15
1 files changed, 12 insertions, 3 deletions
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<Piece> 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) {