Skip to main content

Frame

Struct Frame 

Source
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: i64

Presentation timestamp in time_base units.

§pkt_dts: i64

Decompression timestamp, copied from the packet that triggered output.

§best_effort_timestamp: i64

Best-effort timestamp estimated by the framework.

§duration: i64

Duration in time_base units.

§time_base: Rational

Time base for pts/duration.

§flags: FrameFlags§repeat_pict: i32

Extra flag to indicate a picture should be decoded but displayed twice (or according to repeat_pict). Matches FFmpeg’s AVFrame.repeat_pict.

§metadata: Metadata

Metadata key-value pairs.

§side_data: Vec<FrameSideData>

Side data associated with this frame.

Implementations§

Source§

impl Frame

Source

pub fn new_video(width: u32, height: u32, format: PixelFormat) -> Self

Create a new video frame.

Source

pub fn new_audio( nb_samples: u32, format: SampleFormat, sample_rate: u32, channel_layout: ChannelLayout, ) -> Self

Create a new audio frame.

Source

pub fn is_video(&self) -> bool

Returns true if this is a video frame.

Source

pub fn is_audio(&self) -> bool

Returns true if this is an audio frame.

Source

pub fn video(&self) -> Option<&VideoFrameData>

Get video data, if this is a video frame.

Source

pub fn video_mut(&mut self) -> Option<&mut VideoFrameData>

Get mutable video data, if this is a video frame.

Source

pub fn audio(&self) -> Option<&AudioFrameData>

Get audio data, if this is an audio frame.

Source

pub fn audio_mut(&mut self) -> Option<&mut AudioFrameData>

Get mutable audio data, if this is an audio frame.

Source

pub fn get_side_data( &self, data_type: FrameSideDataType, ) -> Option<&FrameSideData>

Get side data of a specific type.

Source

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.

Source

pub fn remove_side_data(&mut self, data_type: FrameSideDataType)

Remove side data of a specific type.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more