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 "version.h"
37 
38 
72 };
73 
74 typedef struct AVFrameSideData {
77  int size;
80 
107 typedef struct AVFrame {
108 #define AV_NUM_DATA_POINTERS 8
109 
114 
126 
142 
146  int width, height;
147 
152 
158  int format;
159 
164 
169 
170 #if FF_API_AVFRAME_LAVC
173 #endif
174 
179 
183  int64_t pts;
184 
188  int64_t pkt_pts;
189 
193  int64_t pkt_dts;
194 
203 
207  int quality;
208 
209 #if FF_API_AVFRAME_LAVC
212 
217  int8_t *qscale_table;
222  int qstride;
223 
226 
233 
245  int16_t (*motion_val[2])[2];
246 
252  uint32_t *mb_type;
253 
258  short *dct_coeff;
259 
265  int8_t *ref_index[2];
266 #endif
267 
271  void *opaque;
272 
277 
278 #if FF_API_AVFRAME_LAVC
280  int type;
281 #endif
282 
288 
293 
298 
303 
304 #if FF_API_AVFRAME_LAVC
307 
313 #endif
314 
325 
326 #if FF_API_AVFRAME_LAVC
327 
331 
336 
343 #endif
344 
349 
353  uint64_t channel_layout;
354 
366 
384 
387 
398 #define AV_FRAME_FLAG_CORRUPT (1 << 0)
399 
406  int flags;
407 } AVFrame;
408 
419 AVFrame *av_frame_alloc(void);
420 
428 void av_frame_free(AVFrame **frame);
429 
441 int av_frame_ref(AVFrame *dst, const AVFrame *src);
442 
450 AVFrame *av_frame_clone(const AVFrame *src);
451 
455 void av_frame_unref(AVFrame *frame);
456 
460 void av_frame_move_ref(AVFrame *dst, AVFrame *src);
461 
479 int av_frame_get_buffer(AVFrame *frame, int align);
480 
493 int av_frame_is_writable(AVFrame *frame);
494 
506 int av_frame_make_writable(AVFrame *frame);
507 
516 int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
517 
526 AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
527 
538  enum AVFrameSideDataType type,
539  int size);
540 
546  enum AVFrameSideDataType type);
547 
552 #endif /* AVUTIL_FRAME_H */
#define AV_NUM_DATA_POINTERS
Definition: frame.h:108
int size
This structure describes decoded (raw) audio or video data.
Definition: frame.h:107
attribute_deprecated int qscale_type
Definition: frame.h:225
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
Definition: frame.h:365
AVDictionary * metadata
Definition: frame.h:78
void * opaque
for some private data of the user
Definition: frame.h:271
int nb_extended_buf
Number of elements in extended_buf.
Definition: frame.h:383
int repeat_pict
When decoding, this signals how much the picture must be delayed.
Definition: frame.h:287
external API header
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everythnig contained in src to dst and reset src.
Definition: frame.c:292
attribute_deprecated int8_t * qscale_table
QP table.
Definition: frame.h:217
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:469
attribute_deprecated void * hwaccel_picture_private
Definition: frame.h:330
Public dictionary API.
uint8_t
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:43
attribute_deprecated int qstride
QP store stride.
Definition: frame.h:222
attribute_deprecated void * thread_opaque
Definition: frame.h:335
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:174
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:183
The data is the AVPanScan struct defined in libavcodec.
Definition: frame.h:51
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:292
Metadata relevant to a downmix procedure.
Definition: frame.h:71
int nb_side_data
Definition: frame.h:386
AVFrameSideData ** side_data
Definition: frame.h:385
int width
width and height of the video frame
Definition: frame.h:146
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:55
ATSC A53 Part 4 Closed Captions.
Definition: frame.h:57
Libavutil version macros.
uint64_t channel_layout
Channel layout of the audio data.
Definition: frame.h:353
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:168
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:406
int display_picture_number
picture number in display order
Definition: frame.h:202
attribute_deprecated int buffer_hints
Definition: frame.h:306
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:379
attribute_deprecated int reference
Definition: frame.h:211
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
Definition: frame.c:406
AVFrameSideDataType
Definition: frame.h:47
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
Definition: frame.h:207
attribute_deprecated uint8_t * base[AV_NUM_DATA_POINTERS]
Definition: frame.h:172
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:260
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:158
int coded_picture_number
picture number in bitstream order
Definition: frame.h:198
uint64_t error[AV_NUM_DATA_POINTERS]
error
Definition: frame.h:276
attribute_deprecated short * dct_coeff
DCT coefficients.
Definition: frame.h:258
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:301
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:125
main external API structure.
Definition: avcodec.h:1054
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:178
uint8_t * data
Definition: frame.h:76
int64_t reordered_opaque
reordered opaque 64bit (generally an integer or a double precision float PTS but can be anything)...
Definition: frame.h:324
int sample_rate
Sample rate of the audio data.
Definition: frame.h:348
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
Definition: frame.c:436
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:342
rational number numerator/denominator
Definition: rational.h:43
int palette_has_changed
Tell user application that palette has changed from previous frame.
Definition: frame.h:302
attribute_deprecated int16_t(*[2] motion_val)[2]
motion vector table
Definition: frame.h:245
refcounted data buffer API
AVPictureType
Definition: avutil.h:252
int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
Definition: frame.h:188
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
Definition: frame.c:161
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:273
enum AVFrameSideDataType type
Definition: frame.h:75
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
Definition: frame.c:317
Pan Scan area.
Definition: avcodec.h:831
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:113
#define attribute_deprecated
Definition: attributes.h:80
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
Definition: frame.h:193
A reference to a data buffer.
Definition: buffer.h:81
attribute_deprecated uint32_t * mb_type
macroblock type table mb_type_base + mb_width + 2
Definition: frame.h:252
rational numbers
attribute_deprecated struct AVCodecContext * owner
Definition: frame.h:333
int top_field_first
If the content is interlaced, is top field displayed first.
Definition: frame.h:297
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:163
attribute_deprecated uint8_t * mbskip_table
mbskip_table[mb]>=1 if MB didn't change stride= mb_width = (width+15)>>4
Definition: frame.h:232
int height
Definition: frame.h:146
attribute_deprecated struct AVPanScan * pan_scan
Pan scan.
Definition: frame.h:312
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:141
attribute_deprecated int type
Definition: frame.h:280
Stereoscopic 3d metadata.
Definition: frame.h:62
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:265
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:151
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition: frame.h:66
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:362