Reset VideoDecoder::_position on seek.
authorCarl Hetherington <cth@carlh.net>
Wed, 13 Dec 2017 22:03:56 +0000 (22:03 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 13 Dec 2017 22:03:56 +0000 (22:03 +0000)
src/lib/decoder.cc
src/lib/video_decoder.cc
src/lib/video_decoder.h

index 0d4f4babfa9db0831650529ae4ead927260dc7f3..502273de1e49f5a551110674a5d8284572dbe180 100644 (file)
@@ -52,6 +52,9 @@ Decoder::position () const
 void
 Decoder::seek (ContentTime, bool)
 {
+       if (video) {
+               video->seek ();
+       }
        if (audio) {
                audio->seek ();
        }
index dceadcd15f1d42392e7a55b5cfe97a4b7f121f24..b9ead52c8381680d2a8e97129a8d85c9d5b2f270 100644 (file)
@@ -101,3 +101,10 @@ VideoDecoder::emit (shared_ptr<const ImageProxy> image, Frame frame)
                _position = ContentTime::from_frames (frame, _content->active_video_frame_rate ());
        }
 }
+
+void
+VideoDecoder::seek ()
+{
+       _position = ContentTime();
+       _last_emitted.reset ();
+}
index 8b199bd1ddfb27836ddd07380e0387f5f44156e2..c5e2ea4cf01a2cd63e4d3f23f421aa696db8c124 100644 (file)
@@ -55,6 +55,8 @@ public:
                return _position;
        }
 
+       void seek ();
+
        void emit (boost::shared_ptr<const ImageProxy>, Frame frame);
 
        /** @return true if the emitted data was accepted, false if not */