Skip to main content

Module channel_layout

Module channel_layout 

Source
Expand description

Conversions from FFmpeg’s ffmpeg_next::ChannelLayout / ffmpeg_next::ffi::AVChannelOrder to the channel-layout vocabulary mediaframe owns (ChannelLayout, ChannelOrder, ChannelSpec, ChannelLayoutDescription).

These live as free functions (not From trait impls) because of Rust’s orphan rule: this crate owns neither From nor mediaframe::audio::*, so we can’t write the impl here. Calling mediadecode_ffmpeg::channel_layout_description_from_ffmpeg(layout) is the ergonomic boundary instead.

FFmpeg’s own type is imported as AvChannelLayout so the name ChannelLayout can stay with the vocabulary these functions produce.

Functions§

channel_layout_description_from_ffmpeg
Builds a fully-populated ChannelLayoutDescription from an FFmpeg AvChannelLayout.
channel_layout_description_from_raw_ptr
Pointer variant of channel_layout_description_from_ffmpeg. Safe-API callers that already hold a &AvChannelLayout should prefer that function; the pointer form exists so the convert path (which never forms &AVFrame) can pass addr_of!((*av_frame).ch_layout) straight through without materializing a typed reference.
channel_layout_from_ffmpeg
Maps an FFmpeg AvChannelLayout to the named ChannelLayout vocabulary.
channel_order_from_ffmpeg
Maps FFmpeg’s AVChannelOrder to the ChannelOrder tag.
channel_order_from_raw
Variant of channel_order_from_ffmpeg that takes the raw integer directly. Use this when the caller has just read AVChannelLayout.order from FFmpeg memory and doesn’t want to risk constructing an invalid bindgen enum value first.