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  * @ingroup lavc_decoding
66  */
67 enum AVDiscard{
68  /* We leave some space between them for extensions (drop some
69  * keyframes for intra-only or drop just some bidir frames). */
70  AVDISCARD_NONE =-16, ///< discard nothing
71  AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
72  AVDISCARD_NONREF = 8, ///< discard all non reference
73  AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
74  AVDISCARD_NONINTRA= 24, ///< discard all non intra frames
75  AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
76  AVDISCARD_ALL = 48, ///< discard all
77 };
78 
89  AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
90 };
91 
92 /**
93  * Pan Scan area.
94  * This specifies the area which should be displayed.
95  * Note there may be multiple such areas for one frame.
96  */
97 typedef struct AVPanScan {
98  /**
99  * id
100  * - encoding: Set by user.
101  * - decoding: Set by libavcodec.
102  */
103  int id;
104 
105  /**
106  * width and height in 1/16 pel
107  * - encoding: Set by user.
108  * - decoding: Set by libavcodec.
109  */
110  int width;
111  int height;
112 
113  /**
114  * position of the top left corner in 1/16 pel for up to 3 fields/frames
115  * - encoding: Set by user.
116  * - decoding: Set by libavcodec.
117  */
118  int16_t position[3][2];
119 } AVPanScan;
120 
121 /**
122  * This structure describes the bitrate properties of an encoded bitstream. It
123  * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD
124  * parameters for H.264/HEVC.
125  */
126 typedef struct AVCPBProperties {
127  /**
128  * Maximum bitrate of the stream, in bits per second.
129  * Zero if unknown or unspecified.
130  */
131  int64_t max_bitrate;
132  /**
133  * Minimum bitrate of the stream, in bits per second.
134  * Zero if unknown or unspecified.
135  */
136  int64_t min_bitrate;
137  /**
138  * Average bitrate of the stream, in bits per second.
139  * Zero if unknown or unspecified.
140  */
141  int64_t avg_bitrate;
142 
143  /**
144  * The size of the buffer to which the ratecontrol is applied, in bits.
145  * Zero if unknown or unspecified.
146  */
147  int64_t buffer_size;
148 
149  /**
150  * The delay between the time the packet this structure is associated with
151  * is received and the time when it should be decoded, in periods of a 27MHz
152  * clock.
153  *
154  * UINT64_MAX when unknown or unspecified.
155  */
156  uint64_t vbv_delay;
158 
159 /**
160  * Allocate a CPB properties structure and initialize its fields to default
161  * values.
162  *
163  * @param size if non-NULL, the size of the allocated struct will be written
164  * here. This is useful for embedding it in side data.
165  *
166  * @return the newly allocated struct or NULL on failure
167  */
169 
170 /**
171  * This structure supplies correlation between a packet timestamp and a wall clock
172  * production time. The definition follows the Producer Reference Time ('prft')
173  * as defined in ISO/IEC 14496-12
174  */
175 typedef struct AVProducerReferenceTime {
176  /**
177  * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
178  */
179  int64_t wallclock;
180  int flags;
182 
183 /**
184  * Encode extradata length to a buffer. Used by xiph codecs.
185  *
186  * @param s buffer to write to; must be at least (v/255+1) bytes long
187  * @param v size of extradata in bytes
188  * @return number of bytes written to the buffer.
189  */
190 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
191 
192 #endif // AVCODEC_DEFS_H
AVPanScan::id
int id
id
Definition: defs.h:103
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:118
AV_AUDIO_SERVICE_TYPE_NB
@ AV_AUDIO_SERVICE_TYPE_NB
Not part of ABI.
Definition: defs.h:89
AVPanScan
Pan Scan area.
Definition: defs.h:97
AVProducerReferenceTime::wallclock
int64_t wallclock
A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
Definition: defs.h:179
AV_AUDIO_SERVICE_TYPE_VOICE_OVER
@ AV_AUDIO_SERVICE_TYPE_VOICE_OVER
Definition: defs.h:87
AVPanScan::width
int width
width and height in 1/16 pel
Definition: defs.h:110
AVDISCARD_NONE
@ AVDISCARD_NONE
discard nothing
Definition: defs.h:70
s
#define s(width, name)
Definition: cbs_vp9.c:256
AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
@ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
Definition: defs.h:83
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: defs.h:126
AVDISCARD_BIDIR
@ AVDISCARD_BIDIR
discard all bidirectional frames
Definition: defs.h:73
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:76
AV_AUDIO_SERVICE_TYPE_EMERGENCY
@ AV_AUDIO_SERVICE_TYPE_EMERGENCY
Definition: defs.h:86
AVProducerReferenceTime
This structure supplies correlation between a packet timestamp and a wall clock production time.
Definition: defs.h:175
AVProducerReferenceTime::flags
int flags
Definition: defs.h:180
AVAudioServiceType
AVAudioServiceType
Definition: defs.h:79
AVDISCARD_NONKEY
@ AVDISCARD_NONKEY
discard all frames except keyframes
Definition: defs.h:75
AVDISCARD_DEFAULT
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
Definition: defs.h:71
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:863
AVCPBProperties::min_bitrate
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: defs.h:136
AVCPBProperties::avg_bitrate
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: defs.h:141
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:156
AVDISCARD_NONINTRA
@ AVDISCARD_NONINTRA
discard all non intra frames
Definition: defs.h:74
AVCPBProperties::max_bitrate
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: defs.h:131
AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
@ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
Definition: defs.h:82
AVCPBProperties::buffer_size
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: defs.h:147
AV_AUDIO_SERVICE_TYPE_KARAOKE
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
Definition: defs.h:88
AV_AUDIO_SERVICE_TYPE_COMMENTARY
@ AV_AUDIO_SERVICE_TYPE_COMMENTARY
Definition: defs.h:85
AV_AUDIO_SERVICE_TYPE_EFFECTS
@ AV_AUDIO_SERVICE_TYPE_EFFECTS
Definition: defs.h:81
AVPanScan::height
int height
Definition: defs.h:111
AV_AUDIO_SERVICE_TYPE_DIALOGUE
@ AV_AUDIO_SERVICE_TYPE_DIALOGUE
Definition: defs.h:84
AVDiscard
AVDiscard
Definition: defs.h:67
AVDISCARD_NONREF
@ AVDISCARD_NONREF
discard all non reference
Definition: defs.h:72
AV_AUDIO_SERVICE_TYPE_MAIN
@ AV_AUDIO_SERVICE_TYPE_MAIN
Definition: defs.h:80
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:1014