NANCY: Add function atEnd() to AVFVideoDecoder
Added a function to check if a video has reached its end that respects the timing of the last frame. This is useful for videos that loop after the last frame ends (e.g. secondary videos in The Vampire Diaries)
This commit is contained in:
parent
f34762aef9
commit
7c534ca1c3
2 changed files with 7 additions and 0 deletions
|
@ -76,6 +76,12 @@ void AVFDecoder::addFrameTime(const uint16 timeToAdd) {
|
|||
((AVFDecoder::AVFVideoTrack *)getTrack(0))->_frameTime += timeToAdd;
|
||||
}
|
||||
|
||||
// Custom function to allow the last frame of the video to play correctly
|
||||
bool AVFDecoder::atEnd() const {
|
||||
const AVFDecoder::AVFVideoTrack *track = ((const AVFDecoder::AVFVideoTrack *)getTrack(0));
|
||||
return !track->isReversed() && track->endOfTrack() && track->getFrameTime(track->getFrameCount()) <= getTime();
|
||||
}
|
||||
|
||||
AVFDecoder::AVFVideoTrack::AVFVideoTrack(Common::SeekableReadStream *stream, uint32 chunkFileFormat) {
|
||||
assert(stream);
|
||||
_fileStream = stream;
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
bool loadStream(Common::SeekableReadStream *stream) override;
|
||||
const Graphics::Surface *decodeFrame(uint frameNr);
|
||||
void addFrameTime(const uint16 timeToAdd);
|
||||
bool atEnd() const;
|
||||
|
||||
private:
|
||||
class AVFVideoTrack : public FixedRateVideoTrack {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue