pub unsafe fn channel_layout_description_from_raw_ptr(
ptr: *const AVChannelLayout,
) -> Result<ChannelLayoutDescription, ChannelLayoutFault>Expand description
Pointer variant of channel_layout_description_from_ffmpeg, and
the only road that reads a custom channel map.
The safe form refuses a CUSTOM order outright, because nothing it
is handed can establish the map’s extent; this one requires that
extent of its caller instead, and is therefore unsafe. The pointer
shape also lets the convert path pass
addr_of!((*av_frame).ch_layout) straight through without
materializing a typed reference.
§Safety
ptrmust be a live, aligned*const AVChannelLayoutfor the duration of this call.- If
(*ptr).orderisAV_CHANNEL_ORDER_CUSTOMandu.mapis non-null,u.mapmust point at a live, aligned, initialised array of exactlynb_channelsAVChannelCustomentries — the invariantav_channel_layout_copyand every libavcodec road that fills a layout maintain, and the one this function’s own walk and FFmpeg’s helpers both index against. A shorter array, a dangling pointer, or a negative-but-nonzero count is undefined behaviour, and no check inside can recover it.
What the function does check, because those are content faults
rather than extent ones: a null u.map beside a positive count, a
non-positive count, and a sixteen-byte name with no NUL inside it
(which av_channel_layout_describe would hand to %s). Each is
refused as ChannelLayoutFault::MalformedCustomMap before any
FFmpeg helper sees the layout.
order is read raw and folded before anything else, and no
&AVChannelLayout is formed until it is known to be a discriminant
this build names.