Libav
frame.h
Go to the documentation of this file.
1 /*
2  * This file is part of Libav.
3  *
4  * Libav is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * Libav is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with Libav; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
25 #ifndef AVUTIL_FRAME_H
26 #define AVUTIL_FRAME_H
27 
28 #include <stdint.h>
29 
30 #include "avutil.h"
31 #include "buffer.h"
32 #include "dict.h"
33 #include "rational.h"
34 #include "samplefmt.h"
35 #include "pixfmt.h"
36 #include "version.h"
37 
38 
89 
95 };
96 
105 };
106 
107 typedef struct AVFrameSideData {
110  int size;
113 
140 typedef struct AVFrame {
141 #define AV_NUM_DATA_POINTERS 8
142 
147 
158  int linesize[AV_NUM_DATA_POINTERS];
159 
175 
179  int width, height;
180 
185 
191  int format;
192 
197 
201  enum AVPictureType pict_type;
202 
207 
211  int64_t pts;
212 
213 #if FF_API_PKT_PTS
214 
219  int64_t pkt_pts;
220 #endif
221 
225  int64_t pkt_dts;
226 
235 
239  int quality;
240 
244  void *opaque;
245 
246 #if FF_API_ERROR_FRAME
247 
251  uint64_t error[AV_NUM_DATA_POINTERS];
252 #endif
253 
259 
264 
269 
274 
285 
290 
294  uint64_t channel_layout;
295 
309 
327 
330 
341 #define AV_FRAME_FLAG_CORRUPT (1 << 0)
342 
349  int flags;
350 
351  enum AVColorRange color_range;
352 
353  enum AVColorPrimaries color_primaries;
354 
356 
357  enum AVColorSpace colorspace;
358 
359  enum AVChromaLocation chroma_location;
360 
366 } AVFrame;
367 
378 AVFrame *av_frame_alloc(void);
379 
387 void av_frame_free(AVFrame **frame);
388 
404 int av_frame_ref(AVFrame *dst, const AVFrame *src);
405 
414 
418 void av_frame_unref(AVFrame *frame);
419 
427 void av_frame_move_ref(AVFrame *dst, AVFrame *src);
428 
450 int av_frame_get_buffer(AVFrame *frame, int align);
451 
464 int av_frame_is_writable(AVFrame *frame);
465 
477 int av_frame_make_writable(AVFrame *frame);
478 
490 int av_frame_copy(AVFrame *dst, const AVFrame *src);
491 
500 int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
501 
510 AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
511 
523  int size);
524 
531 
537 
542 #endif /* AVUTIL_FRAME_H */
#define AV_NUM_DATA_POINTERS
Definition: frame.h:141
This structure describes decoded (raw) audio or video data.
Definition: frame.h:140
This side data must be associated with an audio frame and corresponds to enum AVAudioServiceType defi...
Definition: frame.h:94
AVDictionary * metadata
Definition: frame.h:111
void * opaque
for some private data of the user
Definition: frame.h:244
int nb_extended_buf
Number of elements in extended_buf.
Definition: frame.h:326
int repeat_pict
When decoding, this signals how much the picture must be delayed.
Definition: frame.h:258
external API header
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition: frame.c:319
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:315
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:501
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame...
Definition: frame.h:365
Public dictionary API.
uint8_t
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:68
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:343
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:199
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:51
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:263
AVColorRange
MPEG vs JPEG YUV range.
Definition: pixfmt.h:362
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:293
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using enum...
Definition: frame.h:88
Metadata relevant to a downmix procedure.
Definition: frame.h:71
int nb_side_data
Definition: frame.h:329
AVFrameSideData ** side_data
Definition: frame.h:328
#define src
Definition: vp8dsp.c:254
int width
width and height of the video frame
Definition: frame.h:179
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:80
ATSC A53 Part 4 Closed Captions.
Definition: frame.h:57
Libavutil version macros.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
Definition: frame.c:556
uint64_t channel_layout
Channel layout of the audio data.
Definition: frame.h:294
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:349
int display_picture_number
picture number in display order
Definition: frame.h:234
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:322
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
Definition: frame.c:438
AVFrameSideDataType
Definition: frame.h:47
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
Definition: frame.h:239
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:289
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:191
int coded_picture_number
picture number in bitstream order
Definition: frame.h:230
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: frame.h:83
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:328
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:206
uint8_t * data
Definition: frame.h:109
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:569
int64_t reordered_opaque
reordered opaque 64 bits (generally an integer or a double precision float PTS but can be anything)...
Definition: frame.h:284
int sample_rate
Sample rate of the audio data.
Definition: frame.h:289
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
Definition: frame.c:468
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:273
refcounted data buffer API
AVPictureType
Definition: avutil.h:259
AVActiveFormatDescription
Definition: frame.h:97
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
Definition: frame.c:186
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:302
enum AVFrameSideDataType type
Definition: frame.h:108
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
Definition: frame.c:344
#define attribute_deprecated
Definition: attributes.h:80
attribute_deprecated int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
Definition: frame.h:219
int height
Definition: gxfenc.c:72
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
Definition: frame.h:225
A reference to a data buffer.
Definition: buffer.h:81
rational numbers
pixel format definitions
int top_field_first
If the content is interlaced, is top field displayed first.
Definition: frame.h:268
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:196
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:376
ReplayGain information in the form of the AVReplayGain struct.
Definition: frame.h:75
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:174
Stereoscopic 3d metadata.
Definition: frame.h:62
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:184
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:386