Libav
frame.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of Libav.
4  *
5  * Libav is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * Libav is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with Libav; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
26 #ifndef AVUTIL_FRAME_H
27 #define AVUTIL_FRAME_H
28 
29 #include <stdint.h>
30 
31 #include "avutil.h"
32 #include "buffer.h"
33 #include "dict.h"
34 #include "rational.h"
35 #include "samplefmt.h"
36 #include "pixfmt.h"
37 #include "version.h"
38 
39 
90 };
91 
100 };
101 
102 typedef struct AVFrameSideData {
104  uint8_t *data;
105  int size;
108 
135 typedef struct AVFrame {
136 #define AV_NUM_DATA_POINTERS 8
137 
142 
154 
170 
174  int width, height;
175 
179  int nb_samples;
180 
186  int format;
187 
191  int key_frame;
192 
197 
198 #if FF_API_AVFRAME_LAVC
201 #endif
202 
207 
211  int64_t pts;
212 
216  int64_t pkt_pts;
217 
221  int64_t pkt_dts;
222 
231 
235  int quality;
236 
237 #if FF_API_AVFRAME_LAVC
239  int reference;
240 
245  int8_t *qscale_table;
250  int qstride;
251 
253  int qscale_type;
254 
261 
273  int16_t (*motion_val[2])[2];
274 
280  uint32_t *mb_type;
281 
286  short *dct_coeff;
287 
293  int8_t *ref_index[2];
294 #endif
295 
299  void *opaque;
300 
304  uint64_t error[AV_NUM_DATA_POINTERS];
305 
306 #if FF_API_AVFRAME_LAVC
308  int type;
309 #endif
310 
315  int repeat_pict;
316 
320  int interlaced_frame;
321 
325  int top_field_first;
326 
331 
332 #if FF_API_AVFRAME_LAVC
334  int buffer_hints;
335 
340  struct AVPanScan *pan_scan;
341 #endif
342 
352  int64_t reordered_opaque;
353 
354 #if FF_API_AVFRAME_LAVC
355 
359 
361  struct AVCodecContext *owner;
363  void *thread_opaque;
364 
371 #endif
372 
376  int sample_rate;
377 
381  uint64_t channel_layout;
382 
394 
411  int nb_extended_buf;
412 
414  int nb_side_data;
415 
426 #define AV_FRAME_FLAG_CORRUPT (1 << 0)
427 
434  int flags;
435 
437 
439 
441 
443 
445 } AVFrame;
446 
457 AVFrame *av_frame_alloc(void);
458 
466 void av_frame_free(AVFrame **frame);
467 
479 int av_frame_ref(AVFrame *dst, const AVFrame *src);
480 
488 AVFrame *av_frame_clone(const AVFrame *src);
489 
493 void av_frame_unref(AVFrame *frame);
494 
498 void av_frame_move_ref(AVFrame *dst, AVFrame *src);
499 
517 int av_frame_get_buffer(AVFrame *frame, int align);
518 
531 int av_frame_is_writable(AVFrame *frame);
532 
544 int av_frame_make_writable(AVFrame *frame);
545 
557 int av_frame_copy(AVFrame *dst, const AVFrame *src);
558 
567 int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
568 
577 AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
578 
589  enum AVFrameSideDataType type,
590  int size);
591 
597  enum AVFrameSideDataType type);
598 
604 
609 #endif /* AVUTIL_FRAME_H */
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:344
int size
This structure describes decoded (raw) audio or video data.
Definition: frame.h:135
attribute_deprecated int qscale_type
Definition: frame.h:253
int nb_extended_buf
Number of elements in extended_buf.
Definition: frame.h:411
int repeat_pict
When decoding, this signals how much the picture must be delayed.
Definition: frame.h:315
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:169
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:270
AVDictionary * metadata
Definition: frame.h:106
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everythnig contained in src to dst and reset src.
Definition: frame.c:300
uint8_t * data
Definition: frame.h:104
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:57
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:376
uint8_t
attribute_deprecated int qstride
QP store stride.
Definition: frame.h:250
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
Definition: frame.c:444
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:188
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:211
The data is the AVPanScan struct defined in libavcodec.
Definition: frame.h:52
pixel format definitions
AVFrameSideData ** side_data
Definition: frame.h:413
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:320
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using enum...
Definition: frame.h:89
Metadata relevant to a downmix procedure.
Definition: frame.h:72
int nb_side_data
Definition: frame.h:414
#define attribute_deprecated
Definition: attributes.h:80
Public dictionary API.
int width
width and height of the video frame
Definition: frame.h:174
void * opaque
for some private data of the user
Definition: frame.h:299
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:69
enum AVColorRange color_range
Definition: frame.h:436
ATSC A53 Part 4 Closed Captions.
Definition: frame.h:58
enum AVColorSpace colorspace
Definition: frame.h:442
Libavutil version macros.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
Definition: frame.c:532
#define AV_NUM_DATA_POINTERS
Definition: frame.h:136
uint64_t channel_layout
Channel layout of the audio data.
Definition: frame.h:381
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
Definition: frame.c:414
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:477
attribute_deprecated uint8_t * mbskip_table
mbskip_table[mb]>=1 if MB didn't change stride= mb_width = (width+15)>>4
Definition: frame.h:260
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:196
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:434
refcounted data buffer API
int display_picture_number
picture number in display order
Definition: frame.h:230
attribute_deprecated int buffer_hints
Definition: frame.h:334
attribute_deprecated int reference
Definition: frame.h:239
attribute_deprecated void * hwaccel_picture_private
Definition: frame.h:358
uint64_t error[AV_NUM_DATA_POINTERS]
error
Definition: frame.h:304
AVFrameSideDataType
Definition: frame.h:48
attribute_deprecated int8_t * ref_index[2]
motion reference frame index the order in which these are stored can depend on the codec...
Definition: frame.h:293
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
Definition: frame.h:235
AVBufferRef ** extended_buf
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.
Definition: frame.h:407
attribute_deprecated struct AVPanScan * pan_scan
Pan scan.
Definition: frame.h:340
attribute_deprecated short * dct_coeff
DCT coefficients.
Definition: frame.h:286
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:186
int coded_picture_number
picture number in bitstream order
Definition: frame.h:226
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: frame.h:84
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:309
external API header
main external API structure.
Definition: avcodec.h:1050
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:206
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
If side data of the supplied type exists in the frame, free it and remove it from the frame...
Definition: frame.c:545
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
Definition: frame.h:393
int64_t reordered_opaque
reordered opaque 64bit (generally an integer or a double precision float PTS but can be anything)...
Definition: frame.h:352
int sample_rate
Sample rate of the audio data.
Definition: frame.h:376
attribute_deprecated uint8_t motion_subsample_log2
log2 of the size of the block which a single vector in motion_val represents: (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
Definition: frame.h:370
rational number numerator/denominator
Definition: rational.h:43
attribute_deprecated uint8_t * base[AV_NUM_DATA_POINTERS]
Definition: frame.h:200
int palette_has_changed
Tell user application that palette has changed from previous frame.
Definition: frame.h:330
attribute_deprecated int16_t(*[2] motion_val)[2]
motion vector table
Definition: frame.h:273
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:153
AVPictureType
Definition: avutil.h:252
enum AVChromaLocation chroma_location
Definition: frame.h:444
AVActiveFormatDescription
Definition: frame.h:92
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:306
int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
Definition: frame.h:216
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
Definition: frame.c:175
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:283
enum AVFrameSideDataType type
Definition: frame.h:103
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
Definition: frame.c:325
Pan Scan area.
Definition: avcodec.h:804
AVColorRange
MPEG vs JPEG YUV range.
Definition: pixfmt.h:362
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
Definition: frame.h:221
A reference to a data buffer.
Definition: buffer.h:81
attribute_deprecated int8_t * qscale_table
QP table.
Definition: frame.h:245
int top_field_first
If the content is interlaced, is top field displayed first.
Definition: frame.h:325
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:191
enum AVColorPrimaries color_primaries
Definition: frame.h:438
int height
Definition: frame.h:174
attribute_deprecated struct AVCodecContext * owner
Definition: frame.h:361
enum AVColorTransferCharacteristic color_trc
Definition: frame.h:440
attribute_deprecated void * thread_opaque
Definition: frame.h:363
ReplayGain information in the form of the AVReplayGain struct.
Definition: frame.h:76
attribute_deprecated uint32_t * mb_type
macroblock type table mb_type_base + mb_width + 2
Definition: frame.h:280
attribute_deprecated int type
Definition: frame.h:308
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:322
Stereoscopic 3d metadata.
Definition: frame.h:63
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:179
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:141
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition: frame.h:67
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:367
rational numbers