pub const fn from_av_pixel_format(raw: i32) -> PixelFormatExpand description
Maps a raw AVFrame.format integer (i.e. the value of an
AVPixelFormat enum variant) onto mediadecode::PixelFormat.
Returns PixelFormat::None for raw integers we don’t have a
mapping for — including AV_PIX_FMT_NONE itself and the
hardware-frame markers (AV_PIX_FMT_VIDEOTOOLBOX / _VAAPI /
_CUDA / _D3D11 / …), since those never describe CPU-side pixel
data and the unified enum intentionally doesn’t carry them. Use
is_hardware_pix_fmt to identify HW frames before transferring
to a CPU format.
mediaframe 0.3 struck PixelFormat::Unknown(u32), so the raw
integer no longer rides along in the returned value; the caller’s
own raw is the place it survives. Every consumer in this crate
already treats the fall-through as “not a deliverable CPU format”
(pixdesc::to_av_pixel_format, is_supported_cpu_pix_fmt and the
geometry tables all reject it), so the rejection is unchanged.
The match never constructs an AVPixelFormat from a runtime
value; it compares the input against AVPixelFormat::AV_PIX_FMT_X as i32 constants. Sound regardless of which discriminant set the
linked FFmpeg version exposes.