This workaround solves audio/video sync issues that used to appear frequently in many animations, e.g. when Adibou kicks the ball in the garden.
Those animations easily get out of sync when the timing is done by hotspots::evaluate, which sometimes does not call animate() as often as needed for good sync (mouse events processing, in particular, can delay the call).
The original game seems to use also some kind of frame skipping to address this problem.
Subtitle text is only rendered while necessary.
Overlay management is done in the class instead of expecting engine to
handle it.
Overlay is not cleared when there is alpha support. This avoids useless
memory operations while the overlay being transparent, game screen is
rendered below it.
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.
Remove unused integer _frameDelay:
Fixes COVERITY: 1476344
Initialize Non-static class members on PacoDecoder:
Fixes COVERITY: 1476353
Resource leak in object No destructor on PacoAudioTrack:
Fixes COVERITY: 1476360
Fix memory leak in handleFrame. Delete copied data in fdata.
Fixes an error when playing a QuickTime video that has a mediaTime set
on its first edit. This was caused by mediaTime changes in:
ef184a6cef98a1756c0669a03fa9b6fa2386b6e7
Those changes buffered frames during initialization so that the keyframe
and other frames don't play instead of the intended start frame that
mediaTime specifies. My mistake was that decoding isn't allowed during
VideoDecoder::loadStream(); VideoDecoder::setDitheringPalette() requires
that no frames have been decoded yet, and at least Director and Mohawk
call that.
Now the initial mediaTime buffering is delayed until the first decode.
Fixes bug #13479 where certain Myst videos error.
Fixes the opening movie in the Director game Chop Suey.
The amount of lines to skip is in `len`. This wasn't taken into account
when decoding the endcurrentline opcode.
Thanks to Kostya for resolving the issue.