FFmpeg
defs.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg 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  * FFmpeg 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 FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef AVCODEC_DEFS_H
21 #define AVCODEC_DEFS_H
22 
23 /**
24  * @file
25  * @ingroup libavc
26  * Misc types and constants that do not belong anywhere else.
27  */
28 
29 #include <stdint.h>
30 #include <stdlib.h>
31 
32 /**
33  * @ingroup lavc_decoding
34  * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
35  * This is mainly needed because some optimized bitstream readers read
36  * 32 or 64 bit at once and could read over the end.<br>
37  * Note: If the first 23 bits of the additional bytes are not 0, then damaged
38  * MPEG bitstreams could cause overread and segfault.
39  */
40 #define AV_INPUT_BUFFER_PADDING_SIZE 64
41 
42 /**
43  * Verify checksums embedded in the bitstream (could be of either encoded or
44  * decoded data, depending on the format) and print an error message on mismatch.
45  * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
46  * decoder/demuxer returning an error.
47  */
48 #define AV_EF_CRCCHECK (1<<0)
49 #define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations
50 #define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length
51 #define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection
52 
53 #define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue
54 #define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors
55 #define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors
56 #define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder/muxer should not do as an error
57 
58 #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
59 #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
60 #define FF_COMPLIANCE_NORMAL 0
61 #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
62 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
63 
64 
65 #define AV_PROFILE_UNKNOWN -99
66 #define AV_PROFILE_RESERVED -100
67 
68 #define AV_PROFILE_AAC_MAIN 0
69 #define AV_PROFILE_AAC_LOW 1
70 #define AV_PROFILE_AAC_SSR 2
71 #define AV_PROFILE_AAC_LTP 3
72 #define AV_PROFILE_AAC_HE 4
73 #define AV_PROFILE_AAC_HE_V2 28
74 #define AV_PROFILE_AAC_LD 22
75 #define AV_PROFILE_AAC_ELD 38
76 #define AV_PROFILE_AAC_USAC 41
77 #define AV_PROFILE_MPEG2_AAC_LOW 128
78 #define AV_PROFILE_MPEG2_AAC_HE 131
79 
80 #define AV_PROFILE_DNXHD 0
81 #define AV_PROFILE_DNXHR_LB 1
82 #define AV_PROFILE_DNXHR_SQ 2
83 #define AV_PROFILE_DNXHR_HQ 3
84 #define AV_PROFILE_DNXHR_HQX 4
85 #define AV_PROFILE_DNXHR_444 5
86 
87 #define AV_PROFILE_DTS 20
88 #define AV_PROFILE_DTS_ES 30
89 #define AV_PROFILE_DTS_96_24 40
90 #define AV_PROFILE_DTS_HD_HRA 50
91 #define AV_PROFILE_DTS_HD_MA 60
92 #define AV_PROFILE_DTS_EXPRESS 70
93 #define AV_PROFILE_DTS_HD_MA_X 61
94 #define AV_PROFILE_DTS_HD_MA_X_IMAX 62
95 
96 #define AV_PROFILE_EAC3_DDP_ATMOS 30
97 
98 #define AV_PROFILE_TRUEHD_ATMOS 30
99 
100 #define AV_PROFILE_MPEG2_422 0
101 #define AV_PROFILE_MPEG2_HIGH 1
102 #define AV_PROFILE_MPEG2_SS 2
103 #define AV_PROFILE_MPEG2_SNR_SCALABLE 3
104 #define AV_PROFILE_MPEG2_MAIN 4
105 #define AV_PROFILE_MPEG2_SIMPLE 5
106 
107 #define AV_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
108 #define AV_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
109 
110 #define AV_PROFILE_H264_BASELINE 66
111 #define AV_PROFILE_H264_CONSTRAINED_BASELINE (66|AV_PROFILE_H264_CONSTRAINED)
112 #define AV_PROFILE_H264_MAIN 77
113 #define AV_PROFILE_H264_EXTENDED 88
114 #define AV_PROFILE_H264_HIGH 100
115 #define AV_PROFILE_H264_HIGH_10 110
116 #define AV_PROFILE_H264_HIGH_10_INTRA (110|AV_PROFILE_H264_INTRA)
117 #define AV_PROFILE_H264_MULTIVIEW_HIGH 118
118 #define AV_PROFILE_H264_HIGH_422 122
119 #define AV_PROFILE_H264_HIGH_422_INTRA (122|AV_PROFILE_H264_INTRA)
120 #define AV_PROFILE_H264_STEREO_HIGH 128
121 #define AV_PROFILE_H264_HIGH_444 144
122 #define AV_PROFILE_H264_HIGH_444_PREDICTIVE 244
123 #define AV_PROFILE_H264_HIGH_444_INTRA (244|AV_PROFILE_H264_INTRA)
124 #define AV_PROFILE_H264_CAVLC_444 44
125 
126 #define AV_PROFILE_VC1_SIMPLE 0
127 #define AV_PROFILE_VC1_MAIN 1
128 #define AV_PROFILE_VC1_COMPLEX 2
129 #define AV_PROFILE_VC1_ADVANCED 3
130 
131 #define AV_PROFILE_MPEG4_SIMPLE 0
132 #define AV_PROFILE_MPEG4_SIMPLE_SCALABLE 1
133 #define AV_PROFILE_MPEG4_CORE 2
134 #define AV_PROFILE_MPEG4_MAIN 3
135 #define AV_PROFILE_MPEG4_N_BIT 4
136 #define AV_PROFILE_MPEG4_SCALABLE_TEXTURE 5
137 #define AV_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
138 #define AV_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
139 #define AV_PROFILE_MPEG4_HYBRID 8
140 #define AV_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
141 #define AV_PROFILE_MPEG4_CORE_SCALABLE 10
142 #define AV_PROFILE_MPEG4_ADVANCED_CODING 11
143 #define AV_PROFILE_MPEG4_ADVANCED_CORE 12
144 #define AV_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
145 #define AV_PROFILE_MPEG4_SIMPLE_STUDIO 14
146 #define AV_PROFILE_MPEG4_ADVANCED_SIMPLE 15
147 
148 #define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1
149 #define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2
150 #define AV_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768
151 #define AV_PROFILE_JPEG2000_DCINEMA_2K 3
152 #define AV_PROFILE_JPEG2000_DCINEMA_4K 4
153 
154 #define AV_PROFILE_VP9_0 0
155 #define AV_PROFILE_VP9_1 1
156 #define AV_PROFILE_VP9_2 2
157 #define AV_PROFILE_VP9_3 3
158 
159 #define AV_PROFILE_HEVC_MAIN 1
160 #define AV_PROFILE_HEVC_MAIN_10 2
161 #define AV_PROFILE_HEVC_MAIN_STILL_PICTURE 3
162 #define AV_PROFILE_HEVC_REXT 4
163 #define AV_PROFILE_HEVC_MULTIVIEW_MAIN 6
164 #define AV_PROFILE_HEVC_SCC 9
165 
166 #define AV_PROFILE_VVC_MAIN_10 1
167 #define AV_PROFILE_VVC_MAIN_10_444 33
168 
169 #define AV_PROFILE_AV1_MAIN 0
170 #define AV_PROFILE_AV1_HIGH 1
171 #define AV_PROFILE_AV1_PROFESSIONAL 2
172 
173 #define AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0
174 #define AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1
175 #define AV_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2
176 #define AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3
177 #define AV_PROFILE_MJPEG_JPEG_LS 0xf7
178 
179 #define AV_PROFILE_SBC_MSBC 1
180 
181 #define AV_PROFILE_PRORES_PROXY 0
182 #define AV_PROFILE_PRORES_LT 1
183 #define AV_PROFILE_PRORES_STANDARD 2
184 #define AV_PROFILE_PRORES_HQ 3
185 #define AV_PROFILE_PRORES_4444 4
186 #define AV_PROFILE_PRORES_XQ 5
187 
188 #define AV_PROFILE_PRORES_RAW 0
189 #define AV_PROFILE_PRORES_RAW_HQ 1
190 
191 #define AV_PROFILE_ARIB_PROFILE_A 0
192 #define AV_PROFILE_ARIB_PROFILE_C 1
193 
194 #define AV_PROFILE_KLVA_SYNC 0
195 #define AV_PROFILE_KLVA_ASYNC 1
196 
197 #define AV_PROFILE_EVC_BASELINE 0
198 #define AV_PROFILE_EVC_MAIN 1
199 
200 #define AV_PROFILE_APV_422_10 33
201 #define AV_PROFILE_APV_422_12 44
202 #define AV_PROFILE_APV_444_10 55
203 #define AV_PROFILE_APV_444_12 66
204 #define AV_PROFILE_APV_4444_10 77
205 #define AV_PROFILE_APV_4444_12 88
206 #define AV_PROFILE_APV_400_10 99
207 
208 
209 #define AV_LEVEL_UNKNOWN -99
210 
214  AV_FIELD_TT, ///< Top coded_first, top displayed first
215  AV_FIELD_BB, ///< Bottom coded first, bottom displayed first
216  AV_FIELD_TB, ///< Top coded first, bottom displayed first
217  AV_FIELD_BT, ///< Bottom coded first, top displayed first
218 };
219 
220 /**
221  * @ingroup lavc_decoding
222  */
224  /* We leave some space between them for extensions (drop some
225  * keyframes for intra-only or drop just some bidir frames). */
226  AVDISCARD_NONE =-16, ///< discard nothing
227  AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
228  AVDISCARD_NONREF = 8, ///< discard all non reference
229  AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
230  AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
231  AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
232  AVDISCARD_ALL = 48, ///< discard all
233 };
234 
245  AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
246 };
247 
248 /**
249  * Pan Scan area.
250  * This specifies the area which should be displayed.
251  * Note there may be multiple such areas for one frame.
252  */
253 typedef struct AVPanScan {
254  /**
255  * id
256  * - encoding: Set by user.
257  * - decoding: Set by libavcodec.
258  */
259  int id;
260 
261  /**
262  * width and height in 1/16 pel
263  * - encoding: Set by user.
264  * - decoding: Set by libavcodec.
265  */
266  int width;
267  int height;
268 
269  /**
270  * position of the top left corner in 1/16 pel for up to 3 fields/frames
271  * - encoding: Set by user.
272  * - decoding: Set by libavcodec.
273  */
274  int16_t position[3][2];
275 } AVPanScan;
276 
277 /**
278  * This structure describes the bitrate properties of an encoded bitstream. It
279  * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
280  * parameters for H.264/HEVC.
281  */
282 typedef struct AVCPBProperties {
283  /**
284  * Maximum bitrate of the stream, in bits per second.
285  * Zero if unknown or unspecified.
286  */
288  /**
289  * Minimum bitrate of the stream, in bits per second.
290  * Zero if unknown or unspecified.
291  */
293  /**
294  * Average bitrate of the stream, in bits per second.
295  * Zero if unknown or unspecified.
296  */
298 
299  /**
300  * The size of the buffer to which the ratecontrol is applied, in bits.
301  * Zero if unknown or unspecified.
302  */
304 
305  /**
306  * The delay between the time the packet this structure is associated with
307  * is received and the time when it should be decoded, in periods of a 27MHz
308  * clock.
309  *
310  * UINT64_MAX when unknown or unspecified.
311  */
312  uint64_t vbv_delay;
314 
315 /**
316  * Allocate a CPB properties structure and initialize its fields to default
317  * values.
318  *
319  * @param size if non-NULL, the size of the allocated struct will be written
320  * here. This is useful for embedding it in side data.
321  *
322  * @return the newly allocated struct or NULL on failure
323  */
325 
326 /**
327  * This structure supplies correlation between a packet timestamp and a wall clock
328  * production time. The definition follows the Producer Reference Time ('prft')
329  * as defined in ISO/IEC 14496-12
330  */
331 typedef struct AVProducerReferenceTime {
332  /**
333  * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
334  */
336  int flags;
338 
339 /**
340  * RTCP SR (Sender Report) information
341  *
342  * The received sender report information for an RTSP
343  * stream, exposed as AV_PKT_DATA_RTCP_SR side data.
344  */
345 typedef struct AVRTCPSenderReport {
346  uint32_t ssrc; ///< Synchronization source identifier
347  uint64_t ntp_timestamp; ///< NTP time when the report was sent
348  uint32_t rtp_timestamp; ///< RTP time when the report was sent
349  uint32_t sender_nb_packets; ///< Total number of packets sent
350  uint32_t sender_nb_bytes; ///< Total number of bytes sent (excluding headers or padding)
352 
353 /**
354  * Encode extradata length to a buffer. Used by xiph codecs.
355  *
356  * @param s buffer to write to; must be at least (v/255+1) bytes long
357  * @param v size of extradata in bytes
358  * @return number of bytes written to the buffer.
359  */
360 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
361 
362 #endif // AVCODEC_DEFS_H
AVPanScan::id
int id
id
Definition: defs.h:259
AVRTCPSenderReport::ntp_timestamp
uint64_t ntp_timestamp
NTP time when the report was sent.
Definition: defs.h:347
AVPanScan::position
int16_t position[3][2]
position of the top left corner in 1/16 pel for up to 3 fields/frames
Definition: defs.h:274
AVFieldOrder
AVFieldOrder
Definition: defs.h:211
AV_FIELD_PROGRESSIVE
@ AV_FIELD_PROGRESSIVE
Definition: defs.h:213
AV_AUDIO_SERVICE_TYPE_NB
@ AV_AUDIO_SERVICE_TYPE_NB
Not part of ABI.
Definition: defs.h:245
AVPanScan
Pan Scan area.
Definition: defs.h:253
int64_t
long long int64_t
Definition: coverity.c:34
AVProducerReferenceTime::wallclock
int64_t wallclock
A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
Definition: defs.h:335
AV_AUDIO_SERVICE_TYPE_VOICE_OVER
@ AV_AUDIO_SERVICE_TYPE_VOICE_OVER
Definition: defs.h:243
AV_FIELD_BT
@ AV_FIELD_BT
Bottom coded first, top displayed first.
Definition: defs.h:217
AV_FIELD_TT
@ AV_FIELD_TT
Top coded_first, top displayed first.
Definition: defs.h:214
AVPanScan::width
int width
width and height in 1/16 pel
Definition: defs.h:266
AVDISCARD_NONE
@ AVDISCARD_NONE
discard nothing
Definition: defs.h:226
AV_FIELD_TB
@ AV_FIELD_TB
Top coded first, bottom displayed first.
Definition: defs.h:216
AV_FIELD_UNKNOWN
@ AV_FIELD_UNKNOWN
Definition: defs.h:212
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVRTCPSenderReport::sender_nb_packets
uint32_t sender_nb_packets
Total number of packets sent.
Definition: defs.h:349
AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
@ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
Definition: defs.h:239
AVRTCPSenderReport::sender_nb_bytes
uint32_t sender_nb_bytes
Total number of bytes sent (excluding headers or padding)
Definition: defs.h:350
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: defs.h:282
AVDISCARD_BIDIR
@ AVDISCARD_BIDIR
discard all bidirectional frames
Definition: defs.h:229
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:232
AV_AUDIO_SERVICE_TYPE_EMERGENCY
@ AV_AUDIO_SERVICE_TYPE_EMERGENCY
Definition: defs.h:242
AVProducerReferenceTime
This structure supplies correlation between a packet timestamp and a wall clock production time.
Definition: defs.h:331
AVProducerReferenceTime::flags
int flags
Definition: defs.h:336
AVAudioServiceType
AVAudioServiceType
Definition: defs.h:235
AVDISCARD_NONKEY
@ AVDISCARD_NONKEY
discard all frames except keyframes
Definition: defs.h:231
AVRTCPSenderReport::ssrc
uint32_t ssrc
Synchronization source identifier.
Definition: defs.h:346
AVDISCARD_DEFAULT
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
Definition: defs.h:227
size
int size
Definition: twinvq_data.h:10344
av_xiphlacing
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
Definition: utils.c:816
AVCPBProperties::min_bitrate
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: defs.h:292
AVCPBProperties::avg_bitrate
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: defs.h:297
AVCPBProperties::vbv_delay
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
Definition: defs.h:312
AVDISCARD_NONINTRA
@ AVDISCARD_NONINTRA
discard all non intra frames
Definition: defs.h:230
AV_FIELD_BB
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
Definition: defs.h:215
AVCPBProperties::max_bitrate
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: defs.h:287
AVRTCPSenderReport
RTCP SR (Sender Report) information.
Definition: defs.h:345
AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
@ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
Definition: defs.h:238
AVCPBProperties::buffer_size
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: defs.h:303
AV_AUDIO_SERVICE_TYPE_KARAOKE
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
Definition: defs.h:244
AV_AUDIO_SERVICE_TYPE_COMMENTARY
@ AV_AUDIO_SERVICE_TYPE_COMMENTARY
Definition: defs.h:241
AV_AUDIO_SERVICE_TYPE_EFFECTS
@ AV_AUDIO_SERVICE_TYPE_EFFECTS
Definition: defs.h:237
AVPanScan::height
int height
Definition: defs.h:267
AV_AUDIO_SERVICE_TYPE_DIALOGUE
@ AV_AUDIO_SERVICE_TYPE_DIALOGUE
Definition: defs.h:240
AVDiscard
AVDiscard
Definition: defs.h:223
AVDISCARD_NONREF
@ AVDISCARD_NONREF
discard all non reference
Definition: defs.h:228
AV_AUDIO_SERVICE_TYPE_MAIN
@ AV_AUDIO_SERVICE_TYPE_MAIN
Definition: defs.h:236
AVRTCPSenderReport::rtp_timestamp
uint32_t rtp_timestamp
RTP time when the report was sent.
Definition: defs.h:348
av_cpb_properties_alloc
AVCPBProperties * av_cpb_properties_alloc(size_t *size)
Allocate a CPB properties structure and initialize its fields to default values.
Definition: utils.c:955