From f53e0026abf68029f2296c4b533c727450a9a082 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Tue, 5 Jan 2016 21:45:44 +0100 Subject: [PATCH] Make VideoStream::isPlaying return false when EOS has been reached Before it would return the playing status of the FrameSync, but a DeltaSync doesn't stop at the end of the video, now it returns the least of the FrameSync and the EOS condition --- src/modules/video/VideoStream.cpp | 4 ++-- src/modules/video/VideoStream.h | 4 ++-- src/modules/video/theora/VideoStream.cpp | 5 +++++ src/modules/video/theora/VideoStream.h | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/modules/video/VideoStream.cpp b/src/modules/video/VideoStream.cpp index bd7612dbd..8e976951a 100644 --- a/src/modules/video/VideoStream.cpp +++ b/src/modules/video/VideoStream.cpp @@ -52,12 +52,12 @@ void VideoStream::seek(double offset) frameSync->seek(offset); } -double VideoStream::tell() +double VideoStream::tell() const { return frameSync->tell(); } -bool VideoStream::isPlaying() +bool VideoStream::isPlaying() const { return frameSync->isPlaying(); } diff --git a/src/modules/video/VideoStream.h b/src/modules/video/VideoStream.h index 5ce57f154..dfd6cbc2c 100644 --- a/src/modules/video/VideoStream.h +++ b/src/modules/video/VideoStream.h @@ -44,8 +44,8 @@ public: virtual void play(); virtual void pause(); virtual void seek(double offset); - virtual double tell(); - virtual bool isPlaying(); + virtual double tell() const; + virtual bool isPlaying() const; class FrameSync; class DeltaSync; diff --git a/src/modules/video/theora/VideoStream.cpp b/src/modules/video/theora/VideoStream.cpp index 326360aa8..0b6e91e3f 100644 --- a/src/modules/video/theora/VideoStream.cpp +++ b/src/modules/video/theora/VideoStream.cpp @@ -120,6 +120,11 @@ size_t VideoStream::getSize() const return sizeof(Frame); } +bool VideoStream::isPlaying() const +{ + return frameSync->isPlaying() && !eos; +} + void VideoStream::readPage() { char *syncBuffer = nullptr; diff --git a/src/modules/video/theora/VideoStream.h b/src/modules/video/theora/VideoStream.h index 4e28e941f..7eb1fcc7a 100644 --- a/src/modules/video/theora/VideoStream.h +++ b/src/modules/video/theora/VideoStream.h @@ -56,6 +56,8 @@ public: const std::string &getFilename() const; void setSync(FrameSync *frameSync); + bool isPlaying() const; + void threadedFillBackBuffer(double dt); private: