Skip to main content

ffmpeg_packet_from_video_packet

Function ffmpeg_packet_from_video_packet 

Source
pub fn ffmpeg_packet_from_video_packet(
    packet: &VideoPacket<VideoPacketExtra, FfmpegBuffer>,
) -> Result<Packet, Error>
Expand description

Builds an ffmpeg::Packet from a [mediadecode::VideoPacket] parameterized by crate::extras::VideoPacketExtra and crate::FfmpegBuffer.

The compressed bytes are copied into a new packet allocation — zero-copy passthrough of the FfmpegBuffer’s underlying AVBufferRef is a future optimization (would need to wire an AVBufferRef into AVPacket.buf directly via av_packet_alloc + manual buffer set). PTS / DTS / duration / flags / stream_index are propagated.

Returns Err(ffmpeg_next::Error) on:

  • payload larger than c_int::MAX (would overflow AVPacket.size);
  • av_new_packet allocation failure (OOM).