annotate lib/libavutil/frame.h @ 2544:c674d547cc7c

GUIWindow switch logic refactored into behaviour classes
author a.parshin
date Mon, 11 May 2015 09:51:04 +0200
parents 992d2e6f907d
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20 #ifndef AVUTIL_FRAME_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21 #define AVUTIL_FRAME_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23 #include <stdint.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25 #include "version.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 #include "avutil.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28 #include "buffer.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29 #include "dict.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30 #include "rational.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31 #include "samplefmt.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 enum AVFrameSideDataType {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35 * The data is the AVPanScan struct defined in libavcodec.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37 AV_FRAME_DATA_PANSCAN,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38 };
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 typedef struct AVFrameSideData {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41 enum AVFrameSideDataType type;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42 uint8_t *data;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 int size;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44 AVDictionary *metadata;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 } AVFrameSideData;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48 * This structure describes decoded (raw) audio or video data.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50 * AVFrame must be allocated using av_frame_alloc(). Note that this only
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51 * allocates the AVFrame itself, the buffers for the data must be managed
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 * through other means (see below).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 * AVFrame must be freed with av_frame_free().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55 * AVFrame is typically allocated once and then reused multiple times to hold
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56 * different data (e.g. a single AVFrame to hold frames received from a
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 * decoder). In such a case, av_frame_unref() will free any references held by
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58 * the frame and reset it to its original clean state before it
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 * is reused again.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 * The data described by an AVFrame is usually reference counted through the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64 * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 * every single data plane must be contained in one of the buffers in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66 * AVFrame.buf or AVFrame.extended_buf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 * There may be a single buffer for all the data, or one separate buffer for
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68 * each plane, or anything in between.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 * to the end with a minor bump.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72 * Similarly fields that are marked as to be only accessed by
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73 * av_opt_ptr() can be reordered. This allows 2 forks to add fields
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74 * without breaking compatibility with each other.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76 typedef struct AVFrame {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 #define AV_NUM_DATA_POINTERS 8
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79 * pointer to the picture/channel planes.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80 * This might be different from the first allocated byte
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 * Some decoders access areas outside 0,0 - width,height, please
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83 * see avcodec_align_dimensions2(). Some filters and swscale can read
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 * up to 16 bytes beyond the planes, if these filters are to be used,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 * then 16 extra bytes must be allocated.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 uint8_t *data[AV_NUM_DATA_POINTERS];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90 * For video, size in bytes of each picture line.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 * For audio, size in bytes of each plane.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93 * For audio, only linesize[0] may be set. For planar audio, each channel
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94 * plane must be the same size.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
96 * For video the linesizes should be multiplies of the CPUs alignment
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
97 * preference, this is 16 or 32 for modern desktop CPUs.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
98 * Some code requires such alignment other code can be slower without
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
99 * correct alignment, for yet other it makes no difference.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
100 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
101 int linesize[AV_NUM_DATA_POINTERS];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
102
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
103 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
104 * pointers to the data planes/channels.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
105 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
106 * For video, this should simply point to data[].
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
107 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
108 * For planar audio, each channel has a separate data pointer, and
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
109 * linesize[0] contains the size of each channel buffer.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
110 * For packed audio, there is just one data pointer, and linesize[0]
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
111 * contains the total size of the buffer for all channels.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
112 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
113 * Note: Both data and extended_data should always be set in a valid frame,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
114 * but for planar audio with more channels that can fit in data,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
115 * extended_data must be used in order to access all channels.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
116 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
117 uint8_t **extended_data;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
118
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
119 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
120 * width and height of the video frame
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
121 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
122 int width, height;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
123
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
124 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
125 * number of audio samples (per channel) described by this frame
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
126 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
127 int nb_samples;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
128
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
129 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
130 * format of the frame, -1 if unknown or unset
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
131 * Values correspond to enum AVPixelFormat for video frames,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
132 * enum AVSampleFormat for audio)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
133 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
134 int format;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
135
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
136 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
137 * 1 -> keyframe, 0-> not
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
138 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
139 int key_frame;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
140
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
141 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
142 * Picture type of the frame.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
143 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
144 enum AVPictureType pict_type;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
145
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
146 #if FF_API_AVFRAME_LAVC
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
147 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
148 uint8_t *base[AV_NUM_DATA_POINTERS];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
149 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
150
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
151 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
152 * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
153 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
154 AVRational sample_aspect_ratio;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
155
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
156 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
157 * Presentation timestamp in time_base units (time when frame should be shown to user).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
158 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
159 int64_t pts;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
160
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
161 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
162 * PTS copied from the AVPacket that was decoded to produce this frame.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
163 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
164 int64_t pkt_pts;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
165
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
166 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
167 * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isnt used)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
168 * This is also the Presentation time of this AVFrame calculated from
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
169 * only AVPacket.dts values without pts values.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
170 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
171 int64_t pkt_dts;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
172
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
173 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
174 * picture number in bitstream order
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
175 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
176 int coded_picture_number;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
177 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
178 * picture number in display order
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
179 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
180 int display_picture_number;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
181
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
182 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
183 * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
184 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
185 int quality;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
186
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
187 #if FF_API_AVFRAME_LAVC
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
188 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
189 int reference;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
190
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
191 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
192 * QP table
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
193 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
194 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
195 int8_t *qscale_table;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
196 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
197 * QP store stride
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
198 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
199 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
200 int qstride;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
201
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
202 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
203 int qscale_type;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
204
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
205 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
206 * mbskip_table[mb]>=1 if MB didn't change
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
207 * stride= mb_width = (width+15)>>4
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
208 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
209 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
210 uint8_t *mbskip_table;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
211
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
212 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
213 * motion vector table
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
214 * @code
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
215 * example:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
216 * int mv_sample_log2= 4 - motion_subsample_log2;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
217 * int mb_width= (width+15)>>4;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
218 * int mv_stride= (mb_width << mv_sample_log2) + 1;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
219 * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
220 * @endcode
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
221 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
222 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
223 int16_t (*motion_val[2])[2];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
224
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
225 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
226 * macroblock type table
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
227 * mb_type_base + mb_width + 2
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
228 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
229 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
230 uint32_t *mb_type;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
231
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
232 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
233 * DCT coefficients
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
234 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
235 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
236 short *dct_coeff;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
237
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
238 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
239 * motion reference frame index
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
240 * the order in which these are stored can depend on the codec.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
241 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
242 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
243 int8_t *ref_index[2];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
244 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
245
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
246 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
247 * for some private data of the user
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
248 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
249 void *opaque;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
250
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
251 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
252 * error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
253 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
254 uint64_t error[AV_NUM_DATA_POINTERS];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
255
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
256 #if FF_API_AVFRAME_LAVC
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
257 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
258 int type;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
259 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
260
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
261 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
262 * When decoding, this signals how much the picture must be delayed.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
263 * extra_delay = repeat_pict / (2*fps)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
264 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
265 int repeat_pict;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
266
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
267 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
268 * The content of the picture is interlaced.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
269 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
270 int interlaced_frame;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
271
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
272 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
273 * If the content is interlaced, is top field displayed first.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
274 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
275 int top_field_first;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
276
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
277 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
278 * Tell user application that palette has changed from previous frame.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
279 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
280 int palette_has_changed;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
281
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
282 #if FF_API_AVFRAME_LAVC
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
283 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
284 int buffer_hints;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
285
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
286 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
287 * Pan scan.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
288 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
289 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
290 struct AVPanScan *pan_scan;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
291 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
292
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
293 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
294 * reordered opaque 64bit (generally an integer or a double precision float
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
295 * PTS but can be anything).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
296 * The user sets AVCodecContext.reordered_opaque to represent the input at
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
297 * that time,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
298 * the decoder reorders values as needed and sets AVFrame.reordered_opaque
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
299 * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
300 * @deprecated in favor of pkt_pts
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
301 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
302 int64_t reordered_opaque;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
303
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
304 #if FF_API_AVFRAME_LAVC
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
305 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
306 * @deprecated this field is unused
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
307 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
308 attribute_deprecated void *hwaccel_picture_private;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
309
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
310 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
311 struct AVCodecContext *owner;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
312 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
313 void *thread_opaque;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
314
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
315 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
316 * log2 of the size of the block which a single vector in motion_val represents:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
317 * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
318 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
319 attribute_deprecated
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
320 uint8_t motion_subsample_log2;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
321 #endif
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
322
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
323 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
324 * Sample rate of the audio data.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
325 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
326 int sample_rate;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
327
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
328 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
329 * Channel layout of the audio data.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
330 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
331 uint64_t channel_layout;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
332
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
333 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
334 * AVBuffer references backing the data for this frame. If all elements of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
335 * this array are NULL, then this frame is not reference counted.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
336 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
337 * There may be at most one AVBuffer per data plane, so for video this array
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
338 * always contains all the references. For planar audio with more than
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
339 * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
340 * this array. Then the extra AVBufferRef pointers are stored in the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
341 * extended_buf array.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
342 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
343 AVBufferRef *buf[AV_NUM_DATA_POINTERS];
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
344
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
345 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
346 * For planar audio which requires more than AV_NUM_DATA_POINTERS
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
347 * AVBufferRef pointers, this array will hold all the references which
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
348 * cannot fit into AVFrame.buf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
349 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
350 * Note that this is different from AVFrame.extended_data, which always
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
351 * contains all the pointers. This array only contains the extra pointers,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
352 * which cannot fit into AVFrame.buf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
353 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
354 * This array is always allocated using av_malloc() by whoever constructs
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
355 * the frame. It is freed in av_frame_unref().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
356 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
357 AVBufferRef **extended_buf;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
358 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
359 * Number of elements in extended_buf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
360 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
361 int nb_extended_buf;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
362
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
363 AVFrameSideData **side_data;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
364 int nb_side_data;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
365
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
366 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
367 * frame timestamp estimated using various heuristics, in stream time base
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
368 * Code outside libavcodec should access this field using:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
369 * av_frame_get_best_effort_timestamp(frame)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
370 * - encoding: unused
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
371 * - decoding: set by libavcodec, read by user.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
372 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
373 int64_t best_effort_timestamp;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
374
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
375 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
376 * reordered pos from the last AVPacket that has been input into the decoder
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
377 * Code outside libavcodec should access this field using:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
378 * av_frame_get_pkt_pos(frame)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
379 * - encoding: unused
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
380 * - decoding: Read by user.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
381 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
382 int64_t pkt_pos;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
383
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
384 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
385 * duration of the corresponding packet, expressed in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
386 * AVStream->time_base units, 0 if unknown.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
387 * Code outside libavcodec should access this field using:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
388 * av_frame_get_pkt_duration(frame)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
389 * - encoding: unused
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
390 * - decoding: Read by user.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
391 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
392 int64_t pkt_duration;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
393
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
394 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
395 * metadata.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
396 * Code outside libavcodec should access this field using:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
397 * av_frame_get_metadata(frame)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
398 * - encoding: Set by user.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
399 * - decoding: Set by libavcodec.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
400 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
401 AVDictionary *metadata;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
402
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
403 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
404 * decode error flags of the frame, set to a combination of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
405 * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
406 * were errors during the decoding.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
407 * Code outside libavcodec should access this field using:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
408 * av_frame_get_decode_error_flags(frame)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
409 * - encoding: unused
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
410 * - decoding: set by libavcodec, read by user.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
411 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
412 int decode_error_flags;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
413 #define FF_DECODE_ERROR_INVALID_BITSTREAM 1
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
414 #define FF_DECODE_ERROR_MISSING_REFERENCE 2
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
415
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
416 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
417 * number of audio channels, only used for audio.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
418 * Code outside libavcodec should access this field using:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
419 * av_frame_get_channels(frame)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
420 * - encoding: unused
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
421 * - decoding: Read by user.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
422 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
423 int channels;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
424
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
425 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
426 * size of the corresponding packet containing the compressed
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
427 * frame. It must be accessed using av_frame_get_pkt_size() and
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
428 * av_frame_set_pkt_size().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
429 * It is set to a negative value if unknown.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
430 * - encoding: unused
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
431 * - decoding: set by libavcodec, read by user.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
432 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
433 int pkt_size;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
434
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
435 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
436 * Not to be accessed directly from outside libavutil
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
437 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
438 AVBufferRef *qp_table_buf;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
439 } AVFrame;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
440
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
441 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
442 * Accessors for some AVFrame fields.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
443 * The position of these field in the structure is not part of the ABI,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
444 * they should not be accessed directly outside libavcodec.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
445 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
446 int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
447 void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
448 int64_t av_frame_get_pkt_duration (const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
449 void av_frame_set_pkt_duration (AVFrame *frame, int64_t val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
450 int64_t av_frame_get_pkt_pos (const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
451 void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
452 int64_t av_frame_get_channel_layout (const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
453 void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
454 int av_frame_get_channels (const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
455 void av_frame_set_channels (AVFrame *frame, int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
456 int av_frame_get_sample_rate (const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
457 void av_frame_set_sample_rate (AVFrame *frame, int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
458 AVDictionary *av_frame_get_metadata (const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
459 void av_frame_set_metadata (AVFrame *frame, AVDictionary *val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
460 int av_frame_get_decode_error_flags (const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
461 void av_frame_set_decode_error_flags (AVFrame *frame, int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
462 int av_frame_get_pkt_size(const AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
463 void av_frame_set_pkt_size(AVFrame *frame, int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
464 AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
465 int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
466 int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
467
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
468 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
469 * Allocate an AVFrame and set its fields to default values. The resulting
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
470 * struct must be freed using av_frame_free().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
471 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
472 * @return An AVFrame filled with default values or NULL on failure.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
473 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
474 * @note this only allocates the AVFrame itself, not the data buffers. Those
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
475 * must be allocated through other means, e.g. with av_frame_get_buffer() or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
476 * manually.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
477 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
478 AVFrame *av_frame_alloc(void);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
479
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
480 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
481 * Free the frame and any dynamically allocated objects in it,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
482 * e.g. extended_data. If the frame is reference counted, it will be
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
483 * unreferenced first.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
484 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
485 * @param frame frame to be freed. The pointer will be set to NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
486 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
487 void av_frame_free(AVFrame **frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
488
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
489 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
490 * Setup a new reference to the data described by an given frame.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
491 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
492 * Copy frame properties from src to dst and create a new reference for each
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
493 * AVBufferRef from src.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
494 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
495 * If src is not reference counted, new buffers are allocated and the data is
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
496 * copied.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
497 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
498 * @return 0 on success, a negative AVERROR on error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
499 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
500 int av_frame_ref(AVFrame *dst, AVFrame *src);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
501
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
502 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
503 * Create a new frame that references the same data as src.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
504 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
505 * This is a shortcut for av_frame_alloc()+av_frame_ref().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
506 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
507 * @return newly created AVFrame on success, NULL on error.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
508 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
509 AVFrame *av_frame_clone(AVFrame *src);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
510
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
511 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
512 * Unreference all the buffers referenced by frame and reset the frame fields.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
513 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
514 void av_frame_unref(AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
515
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
516 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
517 * Move everythnig contained in src to dst and reset src.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
518 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
519 void av_frame_move_ref(AVFrame *dst, AVFrame *src);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
520
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
521 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
522 * Allocate new buffer(s) for audio or video data.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
523 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
524 * The following fields must be set on frame before calling this function:
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
525 * - format (pixel format for video, sample format for audio)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
526 * - width and height for video
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
527 * - nb_samples and channel_layout for audio
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
528 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
529 * This function will fill AVFrame.data and AVFrame.buf arrays and, if
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
530 * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
531 * For planar formats, one buffer will be allocated for each plane.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
532 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
533 * @param frame frame in which to store the new buffers.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
534 * @param align required buffer size alignment
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
535 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
536 * @return 0 on success, a negative AVERROR on error.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
537 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
538 int av_frame_get_buffer(AVFrame *frame, int align);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
539
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
540 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
541 * Check if the frame data is writable.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
542 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
543 * @return A positive value if the frame data is writable (which is true if and
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
544 * only if each of the underlying buffers has only one reference, namely the one
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
545 * stored in this frame). Return 0 otherwise.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
546 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
547 * If 1 is returned the answer is valid until av_buffer_ref() is called on any
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
548 * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
549 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
550 * @see av_frame_make_writable(), av_buffer_is_writable()
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
551 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
552 int av_frame_is_writable(AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
553
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
554 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
555 * Ensure that the frame data is writable, avoiding data copy if possible.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
556 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
557 * Do nothing if the frame is writable, allocate new buffers and copy the data
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
558 * if it is not.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
559 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
560 * @return 0 on success, a negative AVERROR on error.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
561 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
562 * @see av_frame_is_writable(), av_buffer_is_writable(),
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
563 * av_buffer_make_writable()
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
564 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
565 int av_frame_make_writable(AVFrame *frame);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
566
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
567 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
568 * Copy only "metadata" fields from src to dst.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
569 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
570 * Metadata for the purpose of this function are those fields that do not affect
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
571 * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
572 * aspect ratio (for video), but not width/height or channel layout.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
573 * Side data is also copied.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
574 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
575 int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
576
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
577 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
578 * Get the buffer reference a given data plane is stored in.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
579 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
580 * @param plane index of the data plane of interest in frame->extended_data.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
581 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
582 * @return the buffer reference that contains the plane or NULL if the input
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
583 * frame is not valid.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
584 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
585 AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
586
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
587 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
588 * Add a new side data to a frame.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
589 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
590 * @param frame a frame to which the side data should be added
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
591 * @param type type of the added side data
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
592 * @param size size of the side data
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
593 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
594 * @return newly added side data on success, NULL on error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
595 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
596 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
597 enum AVFrameSideDataType type,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
598 int size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
599
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
600 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
601 * @return a pointer to the side data of a given type on success, NULL if there
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
602 * is no side data with such type in this frame.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
603 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
604 AVFrameSideData *av_frame_get_side_data(AVFrame *frame,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
605 enum AVFrameSideDataType type);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
606
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
607 #endif /* AVUTIL_FRAME_H */