Skip to main content

CodecParser

Trait CodecParser 

Source
pub trait CodecParser {
    const CODEC: CodecId;

    // Required methods
    fn parse_config(data: &[u8]) -> Option<VideoParams>;
    fn is_random_access_point(data: &[u8]) -> bool;
    fn carries_config(data: &[u8]) -> bool;
    fn hls_codec_string(params: &VideoParams) -> String;
}
Available on crate feature codec only.
Expand description

One parser per codec. Pure, allocation-light, &[u8]-in.

The engine never calls these directly — protocol handlers do, at the ingest boundary, to classify frames (FrameType) and populate metadata. The kernel’s GOP cache, segmenter, eviction, and recorder all key on is_keyframe, so a correct is_random_access_point is all that’s needed to make a codec “work”.

Required Associated Constants§

Source

const CODEC: CodecId

The codec this parser handles.

Required Methods§

Source

fn parse_config(data: &[u8]) -> Option<VideoParams>

Parse the parameter set(s) / sequence header into VideoParams. Returns None if no usable header is present or it cannot be decoded.

Source

fn is_random_access_point(data: &[u8]) -> bool

Whether this access unit is a random-access point (IDR/CRA/KEY_FRAME) — the signal the engine anchors GOP caching and segmentation on.

Source

fn carries_config(data: &[u8]) -> bool

Whether this access unit carries decoder configuration (parameter sets / sequence header) that should be cached for late joiners.

Source

fn hls_codec_string(params: &VideoParams) -> String

The HLS CODECS attribute for these parameters (e.g. "hvc1.1.6.L93.B0", "av01.0.04M.08").

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl CodecParser for Av1

Available on crate feature codec-av1 only.
Source§

const CODEC: CodecId = CodecId::AV1

Source§

impl CodecParser for H264

Available on crate feature codec-h264 only.
Source§

const CODEC: CodecId = CodecId::H264

Source§

impl CodecParser for H265

Available on crate feature codec-h265 only.
Source§

const CODEC: CodecId = CodecId::H265

Source§

impl CodecParser for Vp9

Available on crate feature codec-vp9 only.
Source§

const CODEC: CodecId = CodecId::VP9

Source§

impl CodecParser for Vvc

Available on crate feature codec-vvc only.
Source§

const CODEC: CodecId = CodecId::VVC