Skip to main content

Module convert

Module convert 

Source
Expand description

Conversion helpers from FFmpeg AVFrame / AVPacket to the mediadecode types parameterized by crate::Ffmpeg and crate::FfmpegBuffer.

The video-frame conversion is zero-copy: each plane is exposed as an FfmpegBuffer view into the underlying AVBufferRef, so the FFmpeg-allocated pixel memory is shared between the source frame and the produced VideoFrame. Cloning the resulting VideoFrame bumps refcounts; dropping releases them.

Enums§

ConvertError
Errors from av_frame_to_video_frame.

Functions§

audio_frame_from
Safe wrapper around av_frame_to_audio_frame taking a borrowed ffmpeg::frame::Audio.
av_frame_to_audio_frame
Converts an FFmpeg audio AVFrame into a mediadecode::AudioFrame.
av_frame_to_video_frame
Converts an FFmpeg AVFrame (CPU-side, post-av_hwframe_transfer_data or from a software decoder) into a mediadecode::VideoFrame parameterized by crate::Ffmpeg / crate::FfmpegBuffer.
av_subtitle_to_subtitle_frame
Converts an FFmpeg AVSubtitle into a mediadecode::SubtitleFrame.
subtitle_frame_from
Safe wrapper around av_subtitle_to_subtitle_frame taking a borrowed ffmpeg::Subtitle.
video_frame_from
Safe wrapper around av_frame_to_video_frame taking a borrowed ffmpeg::Frame. Recommended entry point for most callers — equivalent to passing frame.as_ptr() to the unsafe variant, but the FFmpeg side keeps the frame alive for the duration of the call so the safety contract is satisfied internally.