Expand description
Media decoding: a small trait layer over two backends.
mf— Windows Media Foundation (native software decode, no external deps, instant seeks). Primary.ffpipe— ffmpeg.exe / ffprobe.exe child processes. Universal fallback, images, probing, export. Everything produces top-down RGBA8 frames and interleaved stereo f32 audio at SAMPLE_RATE.
Modules§
- ffpipe
- ffmpeg.exe / ffprobe.exe child-process backend. Universal fallback decoder, image loader, prober, and the process launcher used by export.
- mf
- Windows Media Foundation backend (IMFSourceReader). Native software decode, no external deps, instant seeks.
- proxy
- Proxy media: background all-intra low-res transcodes of imported video, played instead of the
originals in the preview. Every proxy frame is a keyframe (
-g 1), so seeks, reverse scrubs and clip-boundary cold opens decode without reference chains — the reason big NLEs feel instant. Proxies live in the cache dir, named by a hash of (source path, mtime, height): a re-exported source gets a fresh proxy automatically and stale files are just never referenced again. Export and full-quality one-shot renders never see proxies (their DecoderPools carry no map). - thumbs
- Thumbnail cache for timeline filmstrips and library previews. Non-blocking:
get/texturereturn immediately; misses are queued to ONE worker thread (newest request first, so scrubbing/zooming stays responsive) that owns a DecoderPool (backend from settings) and decodesh-pixel-tall RGBA thumbnails (aspect kept; images ignoret; Sequence clips are not handled here — the timeline draws a label). Results are kept in an LRU bounded by both entry count (≤512) and decoded bytes (≤48 MB) and uploaded lazily as egui textures (texture) so panels can paint them directly.ctx.request_repaint()when a thumbnail lands. Key = (path, t rounded to 0.5 s buckets, h rounded up to 16 px);clear()forgets everything (e.g. after save-over-original). - waveform
- Audio waveform peaks per (file, audio stream): computed once on a background thread (decoding the
whole stream through an AudioSource), cached in memory and on disk under Settings::cache_dir()
(key = hash of path + file size + mtime + stream).
PEAKS_PER_SECbuckets of mono (min, max). - ytdlp
- URL import: download media from a link with
yt-dlp.exe, the same child-process patternffpipe.rsuses for ffmpeg. Entirely optional —exe()returns None when yt-dlp is not installed and the Library then hides its “Import URL…” button.
Structs§
- Decoder
Pool - Lazily opened decoders, one per (path) / (path, audio stream). Failed opens are remembered (None) so a missing file doesn’t re-spawn work every frame.
- Frame
- Top-down RGBA8 image.
rgba.len() == width*height*4.
Enums§
Constants§
- CHANNELS
- POOL_
AUDIOS 🔒 - POOL_
VIDEOS 🔒 - Live decoders kept per pool (LRU past this). Failed opens (None) are cheap and never counted.
- SAMPLE_
RATE
Traits§
Functions§
- ext
- Lower-case file extension (“” when none).
- is_
image_ path - open_
audio - open_
video - probe
- Probe a media file into an Asset (id = 0). ffprobe gives the richest stream metadata, so it is preferred when present; Media Foundation otherwise.