mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-12 18:45:33 -10:00
Let .webm files serve as menu thumbnails, decoded and animated exactly like animated WebP: the still-image pipeline uploads the first displayed frame, and gfx_thumbnail_animate() then streams frames under the existing per-vsync decode budget with durations taken from the container's block timestamps. New glue module formats/webm/rwebm_video.c combines the rwebm demuxer with the rvp8/rvp9 decoders behind the two contracts image_transfer.c dispatches on: - rwebm_video_alloc/set_buf_ptr/process_image: rwebp_t-style still image (first displayed frame), honouring supports_rgba - rwebm_video_stream_open/get_info/next/rewind/close: the anim-stream contract (ABGR words, per-frame duration in ms, loop_count 0 = infinite) It picks the first video track with a compiled-in codec (VP8 via rvp8; VP9 via rvp9 when HAVE_RVP9), pre-scans block timestamps so frame durations need no lookahead decode, splits VP9 superframes, skips non-shown frames (VP8 show_frame bit / VP9 show_fb), and resets the decoder on rewind since the stream restarts at a key frame. Plumbing: IMAGE_TYPE_WEBM through image_texture_get_type and every image_transfer dispatch, NBIO_TYPE_WEBM through the image load task, the gfx_thumbnail anim gate, and .webp/.webm appended to the playlist_allow_non_png extension probe order (webp animation existed but was previously undiscoverable there). HAVE_RWEBM/HAVE_RVP9 default to yes in qb builds; console Makefiles are unchanged. Verified against libvpx via ffmpeg-encoded streams (VP8, VP9, VP9+altref superframes, odd 317x239 dims): frame counts and container durations exact, rewind byte-deterministic, final inter frame within YUV->RGB rounding (max diff 3) of ffmpeg's decode; ASan/UBSan clean over truncation and random-corruption sweeps. Multi-tile VP9 streams are rejected gracefully (documented rvp9 limitation). Decode cost in harness: ~1ms/frame at 320x240, well inside the 8ms anim budget; oversized streams degrade to a lower frame rate by design.