From: Carl Hetherington Date: Wed, 13 Dec 2017 22:03:56 +0000 (+0000) Subject: Reset VideoDecoder::_position on seek. X-Git-Tag: v2.11.29~3 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=3c634dda1e88fe04b0f468f39bd13ea41a80989b;hp=fb771f2613cd3e7f43bf613d592d6937a1017f2d;p=dcpomatic.git Reset VideoDecoder::_position on seek. --- diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 0d4f4babf..502273de1 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -52,6 +52,9 @@ Decoder::position () const void Decoder::seek (ContentTime, bool) { + if (video) { + video->seek (); + } if (audio) { audio->seek (); } diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index dceadcd15..b9ead52c8 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -101,3 +101,10 @@ VideoDecoder::emit (shared_ptr image, Frame frame) _position = ContentTime::from_frames (frame, _content->active_video_frame_rate ()); } } + +void +VideoDecoder::seek () +{ + _position = ContentTime(); + _last_emitted.reset (); +} diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h index 8b199bd1d..c5e2ea4cf 100644 --- a/src/lib/video_decoder.h +++ b/src/lib/video_decoder.h @@ -55,6 +55,8 @@ public: return _position; } + void seek (); + void emit (boost::shared_ptr, Frame frame); /** @return true if the emitted data was accepted, false if not */