Struct rsmpeg::ffi::AVFrame[][src]

#[repr(C)]
pub struct AVFrame {
Show fields pub data: [*mut u8; 8], pub linesize: [i32; 8], pub extended_data: *mut *mut u8, pub width: i32, pub height: i32, pub nb_samples: i32, pub format: i32, pub key_frame: i32, pub pict_type: u32, pub sample_aspect_ratio: AVRational, pub pts: i64, pub pkt_pts: i64, pub pkt_dts: i64, pub coded_picture_number: i32, pub display_picture_number: i32, pub quality: i32, pub opaque: *mut c_void, pub error: [u64; 8], pub repeat_pict: i32, pub interlaced_frame: i32, pub top_field_first: i32, pub palette_has_changed: i32, pub reordered_opaque: i64, pub sample_rate: i32, pub channel_layout: u64, pub buf: [*mut AVBufferRef; 8], pub extended_buf: *mut *mut AVBufferRef, pub nb_extended_buf: i32, pub side_data: *mut *mut AVFrameSideData, pub nb_side_data: i32, pub flags: i32, pub color_range: u32, pub color_primaries: u32, pub color_trc: u32, pub colorspace: u32, pub chroma_location: u32, pub best_effort_timestamp: i64, pub pkt_pos: i64, pub pkt_duration: i64, pub metadata: *mut AVDictionary, pub decode_error_flags: i32, pub channels: i32, pub pkt_size: i32, pub qscale_table: *mut i8, pub qstride: i32, pub qscale_type: i32, pub qp_table_buf: *mut AVBufferRef, pub hw_frames_ctx: *mut AVBufferRef, pub opaque_ref: *mut AVBufferRef, pub crop_top: u32, pub crop_bottom: u32, pub crop_left: u32, pub crop_right: u32, pub private_ref: *mut AVBufferRef,
}
Expand description

This structure describes decoded (raw) audio or video data.

AVFrame must be allocated using av_frame_alloc(). Note that this only allocates the AVFrame itself, the buffers for the data must be managed through other means (see below). AVFrame must be freed with av_frame_free().

AVFrame is typically allocated once and then reused multiple times to hold different data (e.g. a single AVFrame to hold frames received from a decoder). In such a case, av_frame_unref() will free any references held by the frame and reset it to its original clean state before it is reused again.

The data described by an AVFrame is usually reference counted through the AVBuffer API. The underlying buffer references are stored in AVFrame.buf / AVFrame.extended_buf. An AVFrame is considered to be reference counted if at least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, every single data plane must be contained in one of the buffers in AVFrame.buf or AVFrame.extended_buf. There may be a single buffer for all the data, or one separate buffer for each plane, or anything in between.

sizeof(AVFrame) is not a part of the public ABI, so new fields may be added to the end with a minor bump.

Fields can be accessed through AVOptions, the name string used, matches the C structure field name for fields accessible through AVOptions. The AVClass for AVFrame can be obtained from avcodec_get_frame_class()

Fields

data: [*mut u8; 8]
Expand description

pointer to the picture/channel planes. This might be different from the first allocated byte

Some decoders access areas outside 0,0 - width,height, please see avcodec_align_dimensions2(). Some filters and swscale can read up to 16 bytes beyond the planes, if these filters are to be used, then 16 extra bytes must be allocated.

NOTE: Except for hwaccel formats, pointers not needed by the format MUST be set to NULL.

linesize: [i32; 8]
Expand description

For video, size in bytes of each picture line. For audio, size in bytes of each plane.

For audio, only linesize[0] may be set. For planar audio, each channel plane must be the same size.

For video the linesizes should be multiples of the CPUs alignment preference, this is 16 or 32 for modern desktop CPUs. Some code requires such alignment other code can be slower without correct alignment, for yet other it makes no difference.

@note The linesize may be larger than the size of usable data – there may be extra padding present for performance reasons.

extended_data: *mut *mut u8
Expand description

pointers to the data planes/channels.

For video, this should simply point to data[].

For planar audio, each channel has a separate data pointer, and linesize[0] contains the size of each channel buffer. For packed audio, there is just one data pointer, and linesize[0] contains the total size of the buffer for all channels.

Note: Both data and extended_data should always be set in a valid frame, but for planar audio with more channels that can fit in data, extended_data must be used in order to access all channels.

width: i32
Expand description

@name Video dimensions Video frames only. The coded dimensions (in pixels) of the video frame, i.e. the size of the rectangle that contains some well-defined values.

@note The part of the frame intended for display/presentation is further restricted by the @ref cropping “Cropping rectangle”. @{

height: i32
Expand description

@name Video dimensions Video frames only. The coded dimensions (in pixels) of the video frame, i.e. the size of the rectangle that contains some well-defined values.

@note The part of the frame intended for display/presentation is further restricted by the @ref cropping “Cropping rectangle”. @{

nb_samples: i32
Expand description

number of audio samples (per channel) described by this frame

format: i32
Expand description

format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames, enum AVSampleFormat for audio)

key_frame: i32
Expand description

1 -> keyframe, 0-> not

pict_type: u32
Expand description

Picture type of the frame.

sample_aspect_ratio: AVRational
Expand description

Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.

pts: i64
Expand description

Presentation timestamp in time_base units (time when frame should be shown to user).

pkt_pts: i64
Expand description

PTS copied from the AVPacket that was decoded to produce this frame. @deprecated use the pts field instead

pkt_dts: i64
Expand description

DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn’t used) This is also the Presentation time of this AVFrame calculated from only AVPacket.dts values without pts values.

coded_picture_number: i32
Expand description

picture number in bitstream order

display_picture_number: i32
Expand description

picture number in display order

quality: i32
Expand description

quality (between 1 (good) and FF_LAMBDA_MAX (bad))

opaque: *mut c_void
Expand description

for some private data of the user

error: [u64; 8]
Expand description

@deprecated unused

repeat_pict: i32
Expand description

When decoding, this signals how much the picture must be delayed. extra_delay = repeat_pict / (2*fps)

interlaced_frame: i32
Expand description

The content of the picture is interlaced.

top_field_first: i32
Expand description

If the content is interlaced, is top field displayed first.

palette_has_changed: i32
Expand description

Tell user application that palette has changed from previous frame.

reordered_opaque: i64
Expand description

reordered opaque 64 bits (generally an integer or a double precision float PTS but can be anything). The user sets AVCodecContext.reordered_opaque to represent the input at that time, the decoder reorders values as needed and sets AVFrame.reordered_opaque to exactly one of the values provided by the user through AVCodecContext.reordered_opaque

sample_rate: i32
Expand description

Sample rate of the audio data.

channel_layout: u64
Expand description

Channel layout of the audio data.

buf: [*mut AVBufferRef; 8]
Expand description

AVBuffer references backing the data for this frame. If all elements of this array are NULL, then this frame is not reference counted. This array must be filled contiguously – if buf[i] is non-NULL then buf[j] must also be non-NULL for all j < i.

There may be at most one AVBuffer per data plane, so for video this array always contains all the references. For planar audio with more than AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in this array. Then the extra AVBufferRef pointers are stored in the extended_buf array.

extended_buf: *mut *mut AVBufferRef
Expand description

For planar audio which requires more than AV_NUM_DATA_POINTERS AVBufferRef pointers, this array will hold all the references which cannot fit into AVFrame.buf.

Note that this is different from AVFrame.extended_data, which always contains all the pointers. This array only contains the extra pointers, which cannot fit into AVFrame.buf.

This array is always allocated using av_malloc() by whoever constructs the frame. It is freed in av_frame_unref().

nb_extended_buf: i32
Expand description

Number of elements in extended_buf.

side_data: *mut *mut AVFrameSideDatanb_side_data: i32flags: i32
Expand description

Frame flags, a combination of @ref lavu_frame_flags

color_range: u32
Expand description

MPEG vs JPEG YUV range.

  • encoding: Set by user
  • decoding: Set by libavcodec
color_primaries: u32color_trc: u32colorspace: u32
Expand description

YUV colorspace type.

  • encoding: Set by user
  • decoding: Set by libavcodec
chroma_location: u32best_effort_timestamp: i64
Expand description

frame timestamp estimated using various heuristics, in stream time base

  • encoding: unused
  • decoding: set by libavcodec, read by user.
pkt_pos: i64
Expand description

reordered pos from the last AVPacket that has been input into the decoder

  • encoding: unused
  • decoding: Read by user.
pkt_duration: i64
Expand description

duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown.

  • encoding: unused
  • decoding: Read by user.
metadata: *mut AVDictionary
Expand description

metadata.

  • encoding: Set by user.
  • decoding: Set by libavcodec.
decode_error_flags: i32
Expand description

decode error flags of the frame, set to a combination of FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there were errors during the decoding.

  • encoding: unused
  • decoding: set by libavcodec, read by user.
channels: i32
Expand description

number of audio channels, only used for audio.

  • encoding: unused
  • decoding: Read by user.
pkt_size: i32
Expand description

size of the corresponding packet containing the compressed frame. It is set to a negative value if unknown.

  • encoding: unused
  • decoding: set by libavcodec, read by user.
qscale_table: *mut i8
Expand description

QP table

qstride: i32
Expand description

QP store stride

qscale_type: i32qp_table_buf: *mut AVBufferRefhw_frames_ctx: *mut AVBufferRef
Expand description

For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.

opaque_ref: *mut AVBufferRef
Expand description

AVBufferRef for free use by the API user. FFmpeg will never check the contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when the frame is unreferenced. av_frame_copy_props() calls create a new reference with av_buffer_ref() for the target frame’s opaque_ref field.

This is unrelated to the opaque field, although it serves a similar purpose.

crop_top: u32
Expand description

@anchor cropping @name Cropping Video frames only. The number of pixels to discard from the the top/bottom/left/right border of the frame to obtain the sub-rectangle of the frame intended for presentation. @{

crop_bottom: u32crop_left: u32crop_right: u32private_ref: *mut AVBufferRef
Expand description

AVBufferRef for internal use by a single libav* library. Must not be used to transfer data between libraries. Has to be NULL when ownership of the frame leaves the respective library.

Code outside the FFmpeg libs should never check or change the contents of the buffer ref.

FFmpeg calls av_buffer_unref() on it when the frame is unreferenced. av_frame_copy_props() calls create a new reference with av_buffer_ref() for the target frame’s private_ref field.

Trait Implementations

impl Clone for AVFrame[src]

pub fn clone(&self) -> AVFrame[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for AVFrame[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Copy for AVFrame[src]

Auto Trait Implementations

impl RefUnwindSafe for AVFrame

impl !Send for AVFrame

impl !Sync for AVFrame

impl Unpin for AVFrame

impl UnwindSafe for AVFrame

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.