Skip to main content

av_frame_to_video_frame

Function av_frame_to_video_frame 

Source
pub unsafe fn av_frame_to_video_frame(
    av_frame: *const AVFrame,
    time_base: Timebase,
) -> Result<VideoFrame<PixelFormat, VideoFrameExtra, FfmpegBuffer>, ConvertError>
Expand description

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.

time_base is the source stream’s time base, used to label pts/duration as mediatime Timestamps.

§Safety

av_frame must be a live *const AVFrame for the duration of this call. The frame’s buf[] references are not consumed; the produced VideoFrame holds its own refcounts on each underlying buffer.