pub fn video_packet_from_ffmpeg_in(
packet: Packet,
time_base: Timebase,
limits: PacketLimits,
) -> Result<Option<VideoPacket<VideoPacketExtra, FfmpegBuffer>>, PacketBufferError>Expand description
[video_packet_from_ffmpeg_as] on the view lane, with the
stream’s timebase stamped onto every timestamp.
Takes the packet by value, and that is the safety property, not
a style choice. The program below is the alias this signature
forbids — it was accepted when the parameter was a reference, and
data_mut handed out a &mut [u8] over bytes the returned carrier
was still lending as &[u8]:
ⓘ
use ffmpeg_next::packet::Mut;
use mediadecode::Timebase;
use mediadecode_ffmpeg::{PacketLimits, video_packet_from_ffmpeg_in};
let mut packet = ffmpeg_next::Packet::copy(&[0u8; 64]);
let viewed = video_packet_from_ffmpeg_in(packet, Timebase::default(), PacketLimits::default());
// The source is gone, so this cannot be written.
let _aliased = packet.data_mut();A caller who wants to keep the packet wants the owned lane, which
copies and may therefore borrow:
owned_video_packet_from_ffmpeg_in.