pub struct Frame {
pub data: FrameData,
pub pts: i64,
pub pkt_dts: i64,
pub best_effort_timestamp: i64,
pub duration: i64,
pub time_base: Rational,
pub flags: FrameFlags,
pub repeat_pict: i32,
pub metadata: Metadata,
pub side_data: Vec<FrameSideData>,
}Expand description
Decoded frame, matching FFmpeg’s AVFrame concept.
Fields§
§data: FrameData§pts: i64Presentation timestamp in time_base units.
pkt_dts: i64Decompression timestamp, copied from the packet that triggered output.
best_effort_timestamp: i64Best-effort timestamp estimated by the framework.
duration: i64Duration in time_base units.
time_base: RationalTime base for pts/duration.
flags: FrameFlags§repeat_pict: i32Extra flag to indicate a picture should be decoded but displayed twice (or according to repeat_pict). Matches FFmpeg’s AVFrame.repeat_pict.
metadata: MetadataMetadata key-value pairs.
side_data: Vec<FrameSideData>Side data associated with this frame.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new_video(width: u32, height: u32, format: PixelFormat) -> Self
pub fn new_video(width: u32, height: u32, format: PixelFormat) -> Self
Create a new video frame.
Sourcepub fn new_audio(
nb_samples: u32,
format: SampleFormat,
sample_rate: u32,
channel_layout: ChannelLayout,
) -> Self
pub fn new_audio( nb_samples: u32, format: SampleFormat, sample_rate: u32, channel_layout: ChannelLayout, ) -> Self
Create a new audio frame.
Sourcepub fn video(&self) -> Option<&VideoFrameData>
pub fn video(&self) -> Option<&VideoFrameData>
Get video data, if this is a video frame.
Sourcepub fn video_mut(&mut self) -> Option<&mut VideoFrameData>
pub fn video_mut(&mut self) -> Option<&mut VideoFrameData>
Get mutable video data, if this is a video frame.
Sourcepub fn audio(&self) -> Option<&AudioFrameData>
pub fn audio(&self) -> Option<&AudioFrameData>
Get audio data, if this is an audio frame.
Sourcepub fn audio_mut(&mut self) -> Option<&mut AudioFrameData>
pub fn audio_mut(&mut self) -> Option<&mut AudioFrameData>
Get mutable audio data, if this is an audio frame.
Sourcepub fn get_side_data(
&self,
data_type: FrameSideDataType,
) -> Option<&FrameSideData>
pub fn get_side_data( &self, data_type: FrameSideDataType, ) -> Option<&FrameSideData>
Get side data of a specific type.
Sourcepub fn add_side_data(&mut self, side_data: FrameSideData)
pub fn add_side_data(&mut self, side_data: FrameSideData)
Add side data to the frame.
Does NOT replace existing data of the same type — multiple entries of
the same type are allowed, matching FFmpeg’s av_frame_new_side_data.
Use remove_side_data first if you need unique-per-type behavior.
Sourcepub fn remove_side_data(&mut self, data_type: FrameSideDataType)
pub fn remove_side_data(&mut self, data_type: FrameSideDataType)
Remove side data of a specific type.