This structure describes decoded (raw) audio or video data. More...
|uint8_t *||data [AV_NUM_DATA_POINTERS]|
|pointer to the picture/channel planes. More...|
|For video, size in bytes of each picture line. More...|
|pointers to the data planes/channels. More...|
|number of audio samples (per channel) described by this frame More...|
|format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames, enum AVSampleFormat for audio) More...|
|1 -> keyframe, 0-> not More...|
|Picture type of the frame. More...|
|Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. More...|
|Presentation timestamp in time_base units (time when frame should be shown to user). More...|
|PTS copied from the AVPacket that was decoded to produce this frame. More...|
|DTS copied from the AVPacket that triggered returning this frame. More...|
|picture number in bitstream order More...|
|picture number in display order More...|
|quality (between 1 (good) and FF_LAMBDA_MAX (bad)) More...|
|for some private data of the user More...|
|attribute_deprecated uint64_t||error [AV_NUM_DATA_POINTERS]|
|When decoding, this signals how much the picture must be delayed. More...|
|The content of the picture is interlaced. More...|
|If the content is interlaced, is top field displayed first. More...|
|Tell user application that palette has changed from previous frame. More...|
|reordered opaque 64 bits (generally an integer or a double precision float PTS but can be anything). More...|
|Sample rate of the audio data. More...|
|Channel layout of the audio data. More...|
|AVBufferRef *||buf [AV_NUM_DATA_POINTERS]|
|AVBuffer references backing the data for this frame. More...|
|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. More...|
|Number of elements in extended_buf. More...|
|Frame flags, a combination of AV_FRAME_FLAGS. More...|
|For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame. More...|
|AVBufferRef for free use by the API user. More...|
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.
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 != 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.
pointer to the picture/channel planes.
This might be different from the first allocated byte
For video, size in bytes of each picture line.
For audio, size in bytes of each plane.
For audio, only linesize may be set. For planar audio, each channel plane must be the same size.
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 contains the size of each channel buffer. For packed audio, there is just one data pointer, and linesize 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.
number of audio samples (per channel) described by this frame
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames, enum AVSampleFormat for audio)
|enum AVPictureType AVFrame::pict_type|
Presentation timestamp in time_base units (time when frame should be shown to user).
|attribute_deprecated int64_t AVFrame::pkt_pts|
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
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.
AVBufferRef for free use by the API user.
Libav will never check the contents of the buffer ref. Libav 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.