Skip to main content

video_packet_from_ffmpeg

Function video_packet_from_ffmpeg 

Source
pub fn video_packet_from_ffmpeg(
    packet: &Packet,
) -> Option<VideoPacket<VideoPacketExtra, FfmpegBuffer>>
Expand description

Wraps a borrowed [ffmpeg::Packet] as a mediadecode::packet::VideoPacket. The compressed payload is shared with the source AVPacket via refcount bump (no copy). Timestamps, duration, key/corrupt flags, and the source stream index are forwarded to the produced packet.

Returns None when the source packet has no buffer attached (empty packet — typical after EOF). Caller can also fill in VideoPacketExtra::byte_pos / side_data post-construction if they need those.