mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
VIDEO: Fix VideoDecoder::needsUpdate to work for audio-only files
VideoDecoder::needsUpdate() only returns true if there are frames remaining to be rendered. This won't work for video files that are audio-only, so in the event of a such a file, fall back to checking endOfVideo() which includes audio tracks. Fixes audio-only DigitalVideoCastMembers in the Director engine. Fixes playback of the cupcake song in Chop Suey.
This commit is contained in:
parent
dcceb4c34b
commit
32f87b27cb
@ -96,7 +96,26 @@ bool VideoDecoder::loadFile(const Common::Path &filename) {
|
||||
}
|
||||
|
||||
bool VideoDecoder::needsUpdate() const {
|
||||
return hasFramesLeft() && getTimeToNextFrame() == 0;
|
||||
bool hasVideo = false;
|
||||
bool hasAudio = false;
|
||||
for (auto &it : _tracks) {
|
||||
switch (it->getTrackType()) {
|
||||
case Track::kTrackTypeAudio:
|
||||
hasAudio = true;
|
||||
break;
|
||||
case Track::kTrackTypeVideo:
|
||||
hasVideo = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasVideo) {
|
||||
return hasFramesLeft() && getTimeToNextFrame() == 0;
|
||||
} else if (hasAudio) {
|
||||
return !endOfVideo();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void VideoDecoder::pauseVideo(bool pause) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user