Skip to main content

Module decode

Module decode 

Source
Expand description

Turning compressed packets into pictures.

One trait, several backends, and a runtime choice between them. The choice is the interesting part: which decoder exists depends on the platform and on what was compiled in, and the two fail differently. A build without decode-av1 and a Linux box without VA-API both produce “no decoder”, and a person needs to know which one they are looking at — so open says.

§Where the decoders come from

vtome reads two encodings, H.264 and AV1 (Encoding::is_in_scope); anything else is refused as out of scope before a backend is asked.

BackendPlatformWhat it decodes for vtome
VideoToolboxmacOS, iOSH.264, and AV1 on hardware that has it
Media FoundationWindowsH.264, AV1
MediaCodecAndroidH.264, and AV1 where the device ships it
VA-APILinuxwhatever the driver exposes
dav1danywhereAV1, in software

The platform decoders come first: they are hardware-accelerated, and the patent licence for H.264 is the operating system’s rather than ours. dav1d is the floor — it is what makes “vtome can always play AV1, which it writes” true everywhere.

§What is implemented

H.264 through VideoToolbox (Apple targets), Media Foundation (Windows), and MediaCodec (Android), each with decode-platform. For everything else open refuses honestly, naming the backend that would have taken the work, rather than returning a decoder that produces nothing. See planning/TODO.md §2.

Structs§

DecoderConfig
What a decoder needs to know before the first packet.
StubDecoder
A stub decoder for Phase 1 testing — returns empty frames.

Enums§

Backend
Which implementation decodes.
Hardware
Whether a codec may, must, or must not use dedicated hardware — for decoding and for encoding alike.

Constants§

BACKENDS
Every backend, in the order open tries them.

Traits§

Decoder
Something that turns packets into frames.

Functions§

backends_for
Which backends could decode this, here, in this build.
open
A decoder for this configuration.
open_with
open, with a say in whether the decoder runs in hardware.