Expand description
Boundary conversions between FFmpeg’s bindgen integers and the
unified mediadecode vocabulary.
Centralised so the rest of the crate never compares raw
AVPixelFormat integers against literals or transmutes back into
the bindgen enum (UB hazard when the value isn’t in the enum’s
discriminant set).
Functions§
- audio_
packet_ from_ ffmpeg - Wraps a borrowed [
ffmpeg::Packet] as amediadecode::packet::AudioPacket. Same shape asvideo_packet_from_ffmpeg— refcounted payload, forwarded metadata. - empty_
audio_ frame - Constructs an empty
mediadecode::frame::AudioFramesuitable as the destination argument tomediadecode::decoder::AudioStreamDecoder::receive_frame. Same behaviour asempty_video_frame— eight 1-byte plane placeholders,plane_count = 0. - empty_
subtitle_ frame - Constructs an empty
mediadecode::frame::SubtitleFramesuitable as the destination argument tomediadecode::decoder::SubtitleDecoder::receive_frame. The payload is an emptyTextplaceholder; the decoder overwrites it on success. - empty_
video_ frame - Constructs an empty
mediadecode::frame::VideoFramesuitable as the destination argument tomediadecode::decoder::VideoStreamDecoder::receive_frame. The decoder overwrites the frame on success; this just provides a well-formed slot. - ffmpeg_
packet_ from_ audio_ packet - Builds an
ffmpeg::Packetfrom a [mediadecode::AudioPacket]. Same shape asffmpeg_packet_from_video_packet— bytes are copied; pts/dts/duration/flags/stream_index are forwarded. Same failure modes. - ffmpeg_
packet_ from_ subtitle_ packet - Builds an
ffmpeg::Packetfrom a [mediadecode::SubtitlePacket]. Bytes copied; pts/duration/flags/stream_index forwarded. Subtitle packets have nodtsin the mediadecode model. Same failure modes asffmpeg_packet_from_video_packet. - ffmpeg_
packet_ from_ video_ packet - Builds an
ffmpeg::Packetfrom a [mediadecode::VideoPacket] parameterized bycrate::extras::VideoPacketExtraandcrate::FfmpegBuffer. - from_
av_ pixel_ format - Maps a raw
AVFrame.formatinteger (i.e. the value of anAVPixelFormatenum variant) ontomediadecode::PixelFormat. - is_
hardware_ pix_ fmt - Returns
truewhenrawis one of FFmpeg’s hardware-frame markers (AV_PIX_FMT_VIDEOTOOLBOX/_VAAPI/_CUDA/_D3D11/_DRM_PRIME/_MEDIACODEC/_VULKAN). Used by the HW probe to identify GPU-resident frames before triggeringav_hwframe_transfer_data. - subtitle_
packet_ from_ ffmpeg - Wraps a borrowed [
ffmpeg::Packet] as amediadecode::packet::SubtitlePacket. Subtitle packets have nodtsin the mediadecode model; everything else mirrorsvideo_packet_from_ffmpeg. - try_
empty_ audio_ frame - Fallible counterpart to
empty_audio_frame. ReturnsNoneif any of the eight placeholder allocations fails. - try_
empty_ subtitle_ frame - Fallible counterpart to
empty_subtitle_frame. ReturnsNoneif the placeholder allocation fails. - try_
empty_ video_ frame - Fallible counterpart to
empty_video_frame. ReturnsNoneif any of the four placeholder allocations fails. - video_
packet_ from_ ffmpeg - Wraps a borrowed [
ffmpeg::Packet] as amediadecode::packet::VideoPacket. The compressed payload is shared with the sourceAVPacketvia refcount bump (no copy). Timestamps, duration, key/corrupt flags, and the source stream index are forwarded to the produced packet.