Skip to main content

Module vaapi

Module vaapi 

Source
Available on Linux and crate feature vaapi only.
Expand description

VAAPI: hardware decoding and encoding on Linux GPUs with a VA driver — AMD (Mesa radeonsi), Intel (iHD, i965) and others.

VaapiDecoder decodes H.264, HEVC, VP9 and AV1; VaapiEncoder encodes HEVC to MP4.

libva and libva-drm are opened at run time, not linked, so a binary built with the vaapi feature runs unchanged where there is no driver, and available says so. Struct layouts are those of libva 2.x (VA-API 1.x), checked against the C compiler’s.

VAAPI does not parse the bitstream: the caller supplies every picture’s parameters, reference frames and slice headers. So the native decoders do that part — parameter sets, reference marking and lists, output order — and hand each slice to the GPU through their accelerator hooks (H264Accel and its HEVC, VP9 and AV1 counterparts). The pictures that come back are the native decoder’s, sample for sample; only who computes them changes.

decode::Decoder uses this when it is available; VaapiDecoder is the backend on its own.

Structs§

VaapiDecoder
A hardware decoder on a VA driver, with the interface of NativeDecoder: open it from a demuxed track, push samples in decode order, take pictures by presentation time.
VaapiEncoder
A hardware HEVC encoder on a VA driver (AMD, Intel): RGBA frames in, an hvc1 MP4 out.

Enums§

VaapiRate
How a VaapiEncoder spends bits.

Functions§

available
Whether this machine has a VA driver that decodes H.264.
encode_available
Whether this machine has a VA driver that encodes HEVC.