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