defs.h (6610B)
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 35 * bitstream for decoding. This is mainly needed because some optimized 36 * bitstream readers read 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 45 * mismatch. If AV_EF_EXPLODE is also set, a mismatching checksum will result in 46 * the 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 \ 55 (1 << 16) ///< consider things that violate the spec, are fast to calculate 56 ///< and have not been seen in the wild as errors 57 #define AV_EF_COMPLIANT \ 58 (1 << 17) ///< consider all spec non compliances as errors 59 #define AV_EF_AGGRESSIVE \ 60 (1 << 18) ///< consider things that a sane encoder/muxer should not do as an 61 ///< error 62 63 #define FF_COMPLIANCE_VERY_STRICT \ 64 2 ///< Strictly conform to an older more strict version of the spec or 65 ///< reference software. 66 #define FF_COMPLIANCE_STRICT \ 67 1 ///< Strictly conform to all the things in the spec no matter what 68 ///< consequences. 69 #define FF_COMPLIANCE_NORMAL 0 70 #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions 71 #define FF_COMPLIANCE_EXPERIMENTAL \ 72 -2 ///< Allow nonstandardized experimental things. 73 74 /** 75 * @ingroup lavc_decoding 76 */ 77 enum AVDiscard { 78 /* We leave some space between them for extensions (drop some 79 * keyframes for intra-only or drop just some bidir frames). */ 80 AVDISCARD_NONE = -16, ///< discard nothing 81 AVDISCARD_DEFAULT = 82 0, ///< discard useless packets like 0 size packets in avi 83 AVDISCARD_NONREF = 8, ///< discard all non reference 84 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames 85 AVDISCARD_NONINTRA = 24, ///< discard all non intra frames 86 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes 87 AVDISCARD_ALL = 48, ///< discard all 88 }; 89 90 enum AVAudioServiceType { 91 AV_AUDIO_SERVICE_TYPE_MAIN = 0, 92 AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, 93 AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, 94 AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, 95 AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, 96 AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, 97 AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, 98 AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, 99 AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, 100 AV_AUDIO_SERVICE_TYPE_NB, ///< Not part of ABI 101 }; 102 103 /** 104 * Pan Scan area. 105 * This specifies the area which should be displayed. 106 * Note there may be multiple such areas for one frame. 107 */ 108 typedef struct AVPanScan { 109 /** 110 * id 111 * - encoding: Set by user. 112 * - decoding: Set by libavcodec. 113 */ 114 int id; 115 116 /** 117 * width and height in 1/16 pel 118 * - encoding: Set by user. 119 * - decoding: Set by libavcodec. 120 */ 121 int width; 122 int height; 123 124 /** 125 * position of the top left corner in 1/16 pel for up to 3 fields/frames 126 * - encoding: Set by user. 127 * - decoding: Set by libavcodec. 128 */ 129 int16_t position[3][2]; 130 } AVPanScan; 131 132 /** 133 * This structure describes the bitrate properties of an encoded bitstream. It 134 * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD 135 * parameters for H.264/HEVC. 136 */ 137 typedef struct AVCPBProperties { 138 /** 139 * Maximum bitrate of the stream, in bits per second. 140 * Zero if unknown or unspecified. 141 */ 142 int64_t max_bitrate; 143 /** 144 * Minimum bitrate of the stream, in bits per second. 145 * Zero if unknown or unspecified. 146 */ 147 int64_t min_bitrate; 148 /** 149 * Average bitrate of the stream, in bits per second. 150 * Zero if unknown or unspecified. 151 */ 152 int64_t avg_bitrate; 153 154 /** 155 * The size of the buffer to which the ratecontrol is applied, in bits. 156 * Zero if unknown or unspecified. 157 */ 158 int64_t buffer_size; 159 160 /** 161 * The delay between the time the packet this structure is associated with 162 * is received and the time when it should be decoded, in periods of a 27MHz 163 * clock. 164 * 165 * UINT64_MAX when unknown or unspecified. 166 */ 167 uint64_t vbv_delay; 168 } AVCPBProperties; 169 170 /** 171 * Allocate a CPB properties structure and initialize its fields to default 172 * values. 173 * 174 * @param size if non-NULL, the size of the allocated struct will be written 175 * here. This is useful for embedding it in side data. 176 * 177 * @return the newly allocated struct or NULL on failure 178 */ 179 AVCPBProperties* av_cpb_properties_alloc(size_t* size); 180 181 /** 182 * This structure supplies correlation between a packet timestamp and a wall 183 * clock production time. The definition follows the Producer Reference Time 184 * ('prft') as defined in ISO/IEC 14496-12 185 */ 186 typedef struct AVProducerReferenceTime { 187 /** 188 * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). 189 */ 190 int64_t wallclock; 191 int flags; 192 } AVProducerReferenceTime; 193 194 /** 195 * Encode extradata length to a buffer. Used by xiph codecs. 196 * 197 * @param s buffer to write to; must be at least (v/255+1) bytes long 198 * @param v size of extradata in bytes 199 * @return number of bytes written to the buffer. 200 */ 201 unsigned int av_xiphlacing(unsigned char* s, unsigned int v); 202 203 #endif // AVCODEC_DEFS_H