diff --git a/Engine/media/video/flic_player.cpp b/Engine/media/video/flic_player.cpp index bc7ce172ad5..a9d78a1312a 100644 --- a/Engine/media/video/flic_player.cpp +++ b/Engine/media/video/flic_player.cpp @@ -29,7 +29,7 @@ FlicPlayer::~FlicPlayer() } HError FlicPlayer::OpenImpl(std::unique_ptr data_stream, - const String &/*name*/, int& /*flags*/, int /*target_depth*/) + const String &/*name*/, int& flags, int /*target_depth*/) { data_stream->Seek(8); const int fliwidth = data_stream->ReadInt16(); @@ -52,6 +52,11 @@ HError FlicPlayer::OpenImpl(std::unique_ptr data_stream, _frameTime = fli_speed; _frameCount = fli_frame_count; _durationMs = fli_frame_count * fli_speed; + // FLIC must accumulate frame image and not be dropping frames, + // because its frames contain diff since the last frame; + // skipping will cause visual garbage. + flags &= ~kVideo_DropFrames; + flags |= kVideo_AccumFrame; return HError::None(); } diff --git a/Engine/media/video/videoplayer.cpp b/Engine/media/video/videoplayer.cpp index 312804ebb8c..5de48c9e49d 100644 --- a/Engine/media/video/videoplayer.cpp +++ b/Engine/media/video/videoplayer.cpp @@ -72,7 +72,8 @@ void VideoPlayer::SetTargetFrame(const Size &target_sz) _targetSize = target_sz.IsNull() ? _frameSize : target_sz; // Create helper bitmaps in case of stretching or color depth conversion - if ((_targetSize != _frameSize) || (_targetDepth != _frameDepth)) + if ((_targetSize != _frameSize) || (_targetDepth != _frameDepth) + || ((_flags & kVideo_AccumFrame) != 0)) { _vframeBuf.reset(new Bitmap(_frameSize.Width, _frameSize.Height, _frameDepth)); } @@ -334,7 +335,8 @@ void VideoPlayer::BufferVideo() } // Try to retrieve one video frame from decoder - const bool must_conv = (_targetSize != _frameSize || _targetDepth != _frameDepth); + const bool must_conv = (_targetSize != _frameSize || _targetDepth != _frameDepth + || ((_flags & kVideo_AccumFrame) != 0)); Bitmap *usebuf = must_conv ? _vframeBuf.get() : target_frame.get(); if (!NextVideoFrame(usebuf)) { // failed to get frame, so move prepared target frame into the pool for now diff --git a/Engine/media/video/videoplayer.h b/Engine/media/video/videoplayer.h index 7ea11ce57f5..0d5bd244c1b 100644 --- a/Engine/media/video/videoplayer.h +++ b/Engine/media/video/videoplayer.h @@ -54,6 +54,9 @@ enum VideoFlags kVideo_LegacyFrameSize= 0x0008, // Allow to drop late video frames in autoplay mode kVideo_DropFrames = 0x0010, + // Must accumulate decoded frames, when format's frames + // do not have a full image, but diff from the previous frame + kVideo_AccumFrame = 0x0020, }; // Parent video player class, provides basic playback logic,