Libav 0.7.1
|
00001 /* 00002 * copyright (c) 2001 Fabrice Bellard 00003 * 00004 * This file is part of Libav. 00005 * 00006 * Libav is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * Libav is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with Libav; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef AVCODEC_AVCODEC_H 00022 #define AVCODEC_AVCODEC_H 00023 00029 #include <errno.h> 00030 #include "libavutil/samplefmt.h" 00031 #include "libavutil/avutil.h" 00032 #include "libavutil/cpu.h" 00033 #include "libavutil/dict.h" 00034 00035 #include "libavcodec/version.h" 00036 00049 enum CodecID { 00050 CODEC_ID_NONE, 00051 00052 /* video codecs */ 00053 CODEC_ID_MPEG1VIDEO, 00054 CODEC_ID_MPEG2VIDEO, 00055 CODEC_ID_MPEG2VIDEO_XVMC, 00056 CODEC_ID_H261, 00057 CODEC_ID_H263, 00058 CODEC_ID_RV10, 00059 CODEC_ID_RV20, 00060 CODEC_ID_MJPEG, 00061 CODEC_ID_MJPEGB, 00062 CODEC_ID_LJPEG, 00063 CODEC_ID_SP5X, 00064 CODEC_ID_JPEGLS, 00065 CODEC_ID_MPEG4, 00066 CODEC_ID_RAWVIDEO, 00067 CODEC_ID_MSMPEG4V1, 00068 CODEC_ID_MSMPEG4V2, 00069 CODEC_ID_MSMPEG4V3, 00070 CODEC_ID_WMV1, 00071 CODEC_ID_WMV2, 00072 CODEC_ID_H263P, 00073 CODEC_ID_H263I, 00074 CODEC_ID_FLV1, 00075 CODEC_ID_SVQ1, 00076 CODEC_ID_SVQ3, 00077 CODEC_ID_DVVIDEO, 00078 CODEC_ID_HUFFYUV, 00079 CODEC_ID_CYUV, 00080 CODEC_ID_H264, 00081 CODEC_ID_INDEO3, 00082 CODEC_ID_VP3, 00083 CODEC_ID_THEORA, 00084 CODEC_ID_ASV1, 00085 CODEC_ID_ASV2, 00086 CODEC_ID_FFV1, 00087 CODEC_ID_4XM, 00088 CODEC_ID_VCR1, 00089 CODEC_ID_CLJR, 00090 CODEC_ID_MDEC, 00091 CODEC_ID_ROQ, 00092 CODEC_ID_INTERPLAY_VIDEO, 00093 CODEC_ID_XAN_WC3, 00094 CODEC_ID_XAN_WC4, 00095 CODEC_ID_RPZA, 00096 CODEC_ID_CINEPAK, 00097 CODEC_ID_WS_VQA, 00098 CODEC_ID_MSRLE, 00099 CODEC_ID_MSVIDEO1, 00100 CODEC_ID_IDCIN, 00101 CODEC_ID_8BPS, 00102 CODEC_ID_SMC, 00103 CODEC_ID_FLIC, 00104 CODEC_ID_TRUEMOTION1, 00105 CODEC_ID_VMDVIDEO, 00106 CODEC_ID_MSZH, 00107 CODEC_ID_ZLIB, 00108 CODEC_ID_QTRLE, 00109 CODEC_ID_SNOW, 00110 CODEC_ID_TSCC, 00111 CODEC_ID_ULTI, 00112 CODEC_ID_QDRAW, 00113 CODEC_ID_VIXL, 00114 CODEC_ID_QPEG, 00115 CODEC_ID_PNG, 00116 CODEC_ID_PPM, 00117 CODEC_ID_PBM, 00118 CODEC_ID_PGM, 00119 CODEC_ID_PGMYUV, 00120 CODEC_ID_PAM, 00121 CODEC_ID_FFVHUFF, 00122 CODEC_ID_RV30, 00123 CODEC_ID_RV40, 00124 CODEC_ID_VC1, 00125 CODEC_ID_WMV3, 00126 CODEC_ID_LOCO, 00127 CODEC_ID_WNV1, 00128 CODEC_ID_AASC, 00129 CODEC_ID_INDEO2, 00130 CODEC_ID_FRAPS, 00131 CODEC_ID_TRUEMOTION2, 00132 CODEC_ID_BMP, 00133 CODEC_ID_CSCD, 00134 CODEC_ID_MMVIDEO, 00135 CODEC_ID_ZMBV, 00136 CODEC_ID_AVS, 00137 CODEC_ID_SMACKVIDEO, 00138 CODEC_ID_NUV, 00139 CODEC_ID_KMVC, 00140 CODEC_ID_FLASHSV, 00141 CODEC_ID_CAVS, 00142 CODEC_ID_JPEG2000, 00143 CODEC_ID_VMNC, 00144 CODEC_ID_VP5, 00145 CODEC_ID_VP6, 00146 CODEC_ID_VP6F, 00147 CODEC_ID_TARGA, 00148 CODEC_ID_DSICINVIDEO, 00149 CODEC_ID_TIERTEXSEQVIDEO, 00150 CODEC_ID_TIFF, 00151 CODEC_ID_GIF, 00152 CODEC_ID_FFH264, 00153 CODEC_ID_DXA, 00154 CODEC_ID_DNXHD, 00155 CODEC_ID_THP, 00156 CODEC_ID_SGI, 00157 CODEC_ID_C93, 00158 CODEC_ID_BETHSOFTVID, 00159 CODEC_ID_PTX, 00160 CODEC_ID_TXD, 00161 CODEC_ID_VP6A, 00162 CODEC_ID_AMV, 00163 CODEC_ID_VB, 00164 CODEC_ID_PCX, 00165 CODEC_ID_SUNRAST, 00166 CODEC_ID_INDEO4, 00167 CODEC_ID_INDEO5, 00168 CODEC_ID_MIMIC, 00169 CODEC_ID_RL2, 00170 CODEC_ID_8SVX_EXP, 00171 CODEC_ID_8SVX_FIB, 00172 CODEC_ID_ESCAPE124, 00173 CODEC_ID_DIRAC, 00174 CODEC_ID_BFI, 00175 CODEC_ID_CMV, 00176 CODEC_ID_MOTIONPIXELS, 00177 CODEC_ID_TGV, 00178 CODEC_ID_TGQ, 00179 CODEC_ID_TQI, 00180 CODEC_ID_AURA, 00181 CODEC_ID_AURA2, 00182 CODEC_ID_V210X, 00183 CODEC_ID_TMV, 00184 CODEC_ID_V210, 00185 CODEC_ID_DPX, 00186 CODEC_ID_MAD, 00187 CODEC_ID_FRWU, 00188 CODEC_ID_FLASHSV2, 00189 CODEC_ID_CDGRAPHICS, 00190 CODEC_ID_R210, 00191 CODEC_ID_ANM, 00192 CODEC_ID_BINKVIDEO, 00193 CODEC_ID_IFF_ILBM, 00194 CODEC_ID_IFF_BYTERUN1, 00195 CODEC_ID_KGV1, 00196 CODEC_ID_YOP, 00197 CODEC_ID_VP8, 00198 CODEC_ID_PICTOR, 00199 CODEC_ID_ANSI, 00200 CODEC_ID_A64_MULTI, 00201 CODEC_ID_A64_MULTI5, 00202 CODEC_ID_R10K, 00203 CODEC_ID_MXPEG, 00204 CODEC_ID_LAGARITH, 00205 CODEC_ID_PRORES, 00206 CODEC_ID_JV, 00207 CODEC_ID_DFA, 00208 00209 /* various PCM "codecs" */ 00210 CODEC_ID_PCM_S16LE= 0x10000, 00211 CODEC_ID_PCM_S16BE, 00212 CODEC_ID_PCM_U16LE, 00213 CODEC_ID_PCM_U16BE, 00214 CODEC_ID_PCM_S8, 00215 CODEC_ID_PCM_U8, 00216 CODEC_ID_PCM_MULAW, 00217 CODEC_ID_PCM_ALAW, 00218 CODEC_ID_PCM_S32LE, 00219 CODEC_ID_PCM_S32BE, 00220 CODEC_ID_PCM_U32LE, 00221 CODEC_ID_PCM_U32BE, 00222 CODEC_ID_PCM_S24LE, 00223 CODEC_ID_PCM_S24BE, 00224 CODEC_ID_PCM_U24LE, 00225 CODEC_ID_PCM_U24BE, 00226 CODEC_ID_PCM_S24DAUD, 00227 CODEC_ID_PCM_ZORK, 00228 CODEC_ID_PCM_S16LE_PLANAR, 00229 CODEC_ID_PCM_DVD, 00230 CODEC_ID_PCM_F32BE, 00231 CODEC_ID_PCM_F32LE, 00232 CODEC_ID_PCM_F64BE, 00233 CODEC_ID_PCM_F64LE, 00234 CODEC_ID_PCM_BLURAY, 00235 CODEC_ID_PCM_LXF, 00236 CODEC_ID_S302M, 00237 00238 /* various ADPCM codecs */ 00239 CODEC_ID_ADPCM_IMA_QT= 0x11000, 00240 CODEC_ID_ADPCM_IMA_WAV, 00241 CODEC_ID_ADPCM_IMA_DK3, 00242 CODEC_ID_ADPCM_IMA_DK4, 00243 CODEC_ID_ADPCM_IMA_WS, 00244 CODEC_ID_ADPCM_IMA_SMJPEG, 00245 CODEC_ID_ADPCM_MS, 00246 CODEC_ID_ADPCM_4XM, 00247 CODEC_ID_ADPCM_XA, 00248 CODEC_ID_ADPCM_ADX, 00249 CODEC_ID_ADPCM_EA, 00250 CODEC_ID_ADPCM_G726, 00251 CODEC_ID_ADPCM_CT, 00252 CODEC_ID_ADPCM_SWF, 00253 CODEC_ID_ADPCM_YAMAHA, 00254 CODEC_ID_ADPCM_SBPRO_4, 00255 CODEC_ID_ADPCM_SBPRO_3, 00256 CODEC_ID_ADPCM_SBPRO_2, 00257 CODEC_ID_ADPCM_THP, 00258 CODEC_ID_ADPCM_IMA_AMV, 00259 CODEC_ID_ADPCM_EA_R1, 00260 CODEC_ID_ADPCM_EA_R3, 00261 CODEC_ID_ADPCM_EA_R2, 00262 CODEC_ID_ADPCM_IMA_EA_SEAD, 00263 CODEC_ID_ADPCM_IMA_EA_EACS, 00264 CODEC_ID_ADPCM_EA_XAS, 00265 CODEC_ID_ADPCM_EA_MAXIS_XA, 00266 CODEC_ID_ADPCM_IMA_ISS, 00267 CODEC_ID_ADPCM_G722, 00268 00269 /* AMR */ 00270 CODEC_ID_AMR_NB= 0x12000, 00271 CODEC_ID_AMR_WB, 00272 00273 /* RealAudio codecs*/ 00274 CODEC_ID_RA_144= 0x13000, 00275 CODEC_ID_RA_288, 00276 00277 /* various DPCM codecs */ 00278 CODEC_ID_ROQ_DPCM= 0x14000, 00279 CODEC_ID_INTERPLAY_DPCM, 00280 CODEC_ID_XAN_DPCM, 00281 CODEC_ID_SOL_DPCM, 00282 00283 /* audio codecs */ 00284 CODEC_ID_MP2= 0x15000, 00285 CODEC_ID_MP3, 00286 CODEC_ID_AAC, 00287 CODEC_ID_AC3, 00288 CODEC_ID_DTS, 00289 CODEC_ID_VORBIS, 00290 CODEC_ID_DVAUDIO, 00291 CODEC_ID_WMAV1, 00292 CODEC_ID_WMAV2, 00293 CODEC_ID_MACE3, 00294 CODEC_ID_MACE6, 00295 CODEC_ID_VMDAUDIO, 00296 CODEC_ID_SONIC, 00297 CODEC_ID_SONIC_LS, 00298 CODEC_ID_FLAC, 00299 CODEC_ID_MP3ADU, 00300 CODEC_ID_MP3ON4, 00301 CODEC_ID_SHORTEN, 00302 CODEC_ID_ALAC, 00303 CODEC_ID_WESTWOOD_SND1, 00304 CODEC_ID_GSM, 00305 CODEC_ID_QDM2, 00306 CODEC_ID_COOK, 00307 CODEC_ID_TRUESPEECH, 00308 CODEC_ID_TTA, 00309 CODEC_ID_SMACKAUDIO, 00310 CODEC_ID_QCELP, 00311 CODEC_ID_WAVPACK, 00312 CODEC_ID_DSICINAUDIO, 00313 CODEC_ID_IMC, 00314 CODEC_ID_MUSEPACK7, 00315 CODEC_ID_MLP, 00316 CODEC_ID_GSM_MS, /* as found in WAV */ 00317 CODEC_ID_ATRAC3, 00318 CODEC_ID_VOXWARE, 00319 CODEC_ID_APE, 00320 CODEC_ID_NELLYMOSER, 00321 CODEC_ID_MUSEPACK8, 00322 CODEC_ID_SPEEX, 00323 CODEC_ID_WMAVOICE, 00324 CODEC_ID_WMAPRO, 00325 CODEC_ID_WMALOSSLESS, 00326 CODEC_ID_ATRAC3P, 00327 CODEC_ID_EAC3, 00328 CODEC_ID_SIPR, 00329 CODEC_ID_MP1, 00330 CODEC_ID_TWINVQ, 00331 CODEC_ID_TRUEHD, 00332 CODEC_ID_MP4ALS, 00333 CODEC_ID_ATRAC1, 00334 CODEC_ID_BINKAUDIO_RDFT, 00335 CODEC_ID_BINKAUDIO_DCT, 00336 CODEC_ID_AAC_LATM, 00337 CODEC_ID_QDMC, 00338 00339 /* subtitle codecs */ 00340 CODEC_ID_DVD_SUBTITLE= 0x17000, 00341 CODEC_ID_DVB_SUBTITLE, 00342 CODEC_ID_TEXT, 00343 CODEC_ID_XSUB, 00344 CODEC_ID_SSA, 00345 CODEC_ID_MOV_TEXT, 00346 CODEC_ID_HDMV_PGS_SUBTITLE, 00347 CODEC_ID_DVB_TELETEXT, 00348 CODEC_ID_SRT, 00349 00350 /* other specific kind of codecs (generally used for attachments) */ 00351 CODEC_ID_TTF= 0x18000, 00352 00353 CODEC_ID_PROBE= 0x19000, 00354 00355 CODEC_ID_MPEG2TS= 0x20000, 00357 CODEC_ID_FFMETADATA=0x21000, 00358 }; 00359 00360 #if FF_API_OLD_SAMPLE_FMT 00361 #define SampleFormat AVSampleFormat 00362 00363 #define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE 00364 #define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8 00365 #define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16 00366 #define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32 00367 #define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT 00368 #define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL 00369 #define SAMPLE_FMT_NB AV_SAMPLE_FMT_NB 00370 #endif 00371 00372 #if FF_API_OLD_AUDIOCONVERT 00373 #include "libavutil/audioconvert.h" 00374 00375 /* Audio channel masks */ 00376 #define CH_FRONT_LEFT AV_CH_FRONT_LEFT 00377 #define CH_FRONT_RIGHT AV_CH_FRONT_RIGHT 00378 #define CH_FRONT_CENTER AV_CH_FRONT_CENTER 00379 #define CH_LOW_FREQUENCY AV_CH_LOW_FREQUENCY 00380 #define CH_BACK_LEFT AV_CH_BACK_LEFT 00381 #define CH_BACK_RIGHT AV_CH_BACK_RIGHT 00382 #define CH_FRONT_LEFT_OF_CENTER AV_CH_FRONT_LEFT_OF_CENTER 00383 #define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER 00384 #define CH_BACK_CENTER AV_CH_BACK_CENTER 00385 #define CH_SIDE_LEFT AV_CH_SIDE_LEFT 00386 #define CH_SIDE_RIGHT AV_CH_SIDE_RIGHT 00387 #define CH_TOP_CENTER AV_CH_TOP_CENTER 00388 #define CH_TOP_FRONT_LEFT AV_CH_TOP_FRONT_LEFT 00389 #define CH_TOP_FRONT_CENTER AV_CH_TOP_FRONT_CENTER 00390 #define CH_TOP_FRONT_RIGHT AV_CH_TOP_FRONT_RIGHT 00391 #define CH_TOP_BACK_LEFT AV_CH_TOP_BACK_LEFT 00392 #define CH_TOP_BACK_CENTER AV_CH_TOP_BACK_CENTER 00393 #define CH_TOP_BACK_RIGHT AV_CH_TOP_BACK_RIGHT 00394 #define CH_STEREO_LEFT AV_CH_STEREO_LEFT 00395 #define CH_STEREO_RIGHT AV_CH_STEREO_RIGHT 00396 00400 #define CH_LAYOUT_NATIVE AV_CH_LAYOUT_NATIVE 00401 00402 /* Audio channel convenience macros */ 00403 #define CH_LAYOUT_MONO AV_CH_LAYOUT_MONO 00404 #define CH_LAYOUT_STEREO AV_CH_LAYOUT_STEREO 00405 #define CH_LAYOUT_2_1 AV_CH_LAYOUT_2_1 00406 #define CH_LAYOUT_SURROUND AV_CH_LAYOUT_SURROUND 00407 #define CH_LAYOUT_4POINT0 AV_CH_LAYOUT_4POINT0 00408 #define CH_LAYOUT_2_2 AV_CH_LAYOUT_2_2 00409 #define CH_LAYOUT_QUAD AV_CH_LAYOUT_QUAD 00410 #define CH_LAYOUT_5POINT0 AV_CH_LAYOUT_5POINT0 00411 #define CH_LAYOUT_5POINT1 AV_CH_LAYOUT_5POINT1 00412 #define CH_LAYOUT_5POINT0_BACK AV_CH_LAYOUT_5POINT0_BACK 00413 #define CH_LAYOUT_5POINT1_BACK AV_CH_LAYOUT_5POINT1_BACK 00414 #define CH_LAYOUT_7POINT0 AV_CH_LAYOUT_7POINT0 00415 #define CH_LAYOUT_7POINT1 AV_CH_LAYOUT_7POINT1 00416 #define CH_LAYOUT_7POINT1_WIDE AV_CH_LAYOUT_7POINT1_WIDE 00417 #define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX 00418 #endif 00419 00420 /* in bytes */ 00421 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio 00422 00430 #define FF_INPUT_BUFFER_PADDING_SIZE 8 00431 00436 #define FF_MIN_BUFFER_SIZE 16384 00437 00438 00442 enum Motion_Est_ID { 00443 ME_ZERO = 1, 00444 ME_FULL, 00445 ME_LOG, 00446 ME_PHODS, 00447 ME_EPZS, 00448 ME_X1, 00449 ME_HEX, 00450 ME_UMH, 00451 ME_ITER, 00452 ME_TESA, 00453 }; 00454 00455 enum AVDiscard{ 00456 /* We leave some space between them for extensions (drop some 00457 * keyframes for intra-only or drop just some bidir frames). */ 00458 AVDISCARD_NONE =-16, 00459 AVDISCARD_DEFAULT= 0, 00460 AVDISCARD_NONREF = 8, 00461 AVDISCARD_BIDIR = 16, 00462 AVDISCARD_NONKEY = 32, 00463 AVDISCARD_ALL = 48, 00464 }; 00465 00466 enum AVColorPrimaries{ 00467 AVCOL_PRI_BT709 =1, 00468 AVCOL_PRI_UNSPECIFIED=2, 00469 AVCOL_PRI_BT470M =4, 00470 AVCOL_PRI_BT470BG =5, 00471 AVCOL_PRI_SMPTE170M =6, 00472 AVCOL_PRI_SMPTE240M =7, 00473 AVCOL_PRI_FILM =8, 00474 AVCOL_PRI_NB , 00475 }; 00476 00477 enum AVColorTransferCharacteristic{ 00478 AVCOL_TRC_BT709 =1, 00479 AVCOL_TRC_UNSPECIFIED=2, 00480 AVCOL_TRC_GAMMA22 =4, 00481 AVCOL_TRC_GAMMA28 =5, 00482 AVCOL_TRC_NB , 00483 }; 00484 00485 enum AVColorSpace{ 00486 AVCOL_SPC_RGB =0, 00487 AVCOL_SPC_BT709 =1, 00488 AVCOL_SPC_UNSPECIFIED=2, 00489 AVCOL_SPC_FCC =4, 00490 AVCOL_SPC_BT470BG =5, 00491 AVCOL_SPC_SMPTE170M =6, 00492 AVCOL_SPC_SMPTE240M =7, 00493 AVCOL_SPC_NB , 00494 }; 00495 00496 enum AVColorRange{ 00497 AVCOL_RANGE_UNSPECIFIED=0, 00498 AVCOL_RANGE_MPEG =1, 00499 AVCOL_RANGE_JPEG =2, 00500 AVCOL_RANGE_NB , 00501 }; 00502 00508 enum AVChromaLocation{ 00509 AVCHROMA_LOC_UNSPECIFIED=0, 00510 AVCHROMA_LOC_LEFT =1, 00511 AVCHROMA_LOC_CENTER =2, 00512 AVCHROMA_LOC_TOPLEFT =3, 00513 AVCHROMA_LOC_TOP =4, 00514 AVCHROMA_LOC_BOTTOMLEFT =5, 00515 AVCHROMA_LOC_BOTTOM =6, 00516 AVCHROMA_LOC_NB , 00517 }; 00518 00519 #if FF_API_FLAC_GLOBAL_OPTS 00520 00523 enum AVLPCType { 00524 AV_LPC_TYPE_DEFAULT = -1, 00525 AV_LPC_TYPE_NONE = 0, 00526 AV_LPC_TYPE_FIXED = 1, 00527 AV_LPC_TYPE_LEVINSON = 2, 00528 AV_LPC_TYPE_CHOLESKY = 3, 00529 AV_LPC_TYPE_NB , 00530 }; 00531 #endif 00532 00533 enum AVAudioServiceType { 00534 AV_AUDIO_SERVICE_TYPE_MAIN = 0, 00535 AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, 00536 AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, 00537 AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, 00538 AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, 00539 AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, 00540 AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, 00541 AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, 00542 AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, 00543 AV_AUDIO_SERVICE_TYPE_NB , 00544 }; 00545 00546 typedef struct RcOverride{ 00547 int start_frame; 00548 int end_frame; 00549 int qscale; // If this is 0 then quality_factor will be used instead. 00550 float quality_factor; 00551 } RcOverride; 00552 00553 #define FF_MAX_B_FRAMES 16 00554 00555 /* encoding support 00556 These flags can be passed in AVCodecContext.flags before initialization. 00557 Note: Not everything is supported yet. 00558 */ 00559 00560 #define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. 00561 #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. 00562 #define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. 00563 #define CODEC_FLAG_GMC 0x0020 ///< Use GMC. 00564 #define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>. 00565 #define CODEC_FLAG_PART 0x0080 ///< Use data partitioning. 00566 00571 #define CODEC_FLAG_INPUT_PRESERVED 0x0100 00572 #define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. 00573 #define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. 00574 #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< Use external Huffman table (for MJPEG). 00575 #define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. 00576 #define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges. 00577 #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. 00578 #define CODEC_FLAG_TRUNCATED 0x00010000 00580 #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization. 00581 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. 00582 #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. 00583 #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< Use alternate scan. 00584 #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. 00585 #define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). 00586 /* Fx : Flag for h263+ extra options */ 00587 #define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction 00588 #define CODEC_FLAG_H263P_UMV 0x02000000 ///< unlimited motion vector 00589 #define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp. 00590 #define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon. 00591 #define CODEC_FLAG_H263P_AIV 0x00000008 ///< H.263 alternative inter VLC 00592 #define CODEC_FLAG_OBMC 0x00000001 ///< OBMC 00593 #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter 00594 #define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000 00595 #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation 00596 #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data. 00597 #define CODEC_FLAG_CLOSED_GOP 0x80000000 00598 #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. 00599 #define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size. 00600 #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. 00601 #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. 00602 #define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow B-frames to be used as references. 00603 #define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for B-frames 00604 #define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock 00605 #define CODEC_FLAG2_8X8DCT 0x00000080 ///< H.264 high profile 8x8 transform 00606 #define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip 00607 #define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters 00608 #define CODEC_FLAG2_BRDO 0x00000400 ///< B-frame rate-distortion optimization 00609 #define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table. 00610 #define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC). 00611 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. 00612 #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping 00613 #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. 00614 #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer. 00615 #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible 00616 #define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) 00617 #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. 00618 #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined. 00619 #define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes. 00620 00621 /* Unsupported options : 00622 * Syntax Arithmetic coding (SAC) 00623 * Reference Picture Selection 00624 * Independent Segment Decoding */ 00625 /* /Fx */ 00626 /* codec capabilities */ 00627 00628 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. 00629 00634 #define CODEC_CAP_DR1 0x0002 00635 /* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */ 00636 #define CODEC_CAP_PARSE_ONLY 0x0004 00637 #define CODEC_CAP_TRUNCATED 0x0008 00638 /* Codec can export data for HW decoding (XvMC). */ 00639 #define CODEC_CAP_HWACCEL 0x0010 00640 00644 #define CODEC_CAP_DELAY 0x0020 00645 00649 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040 00650 00653 #define CODEC_CAP_HWACCEL_VDPAU 0x0080 00654 00665 #define CODEC_CAP_SUBFRAMES 0x0100 00666 00670 #define CODEC_CAP_EXPERIMENTAL 0x0200 00671 00674 #define CODEC_CAP_CHANNEL_CONF 0x0400 00675 00678 #define CODEC_CAP_NEG_LINESIZES 0x0800 00679 00682 #define CODEC_CAP_FRAME_THREADS 0x1000 00683 00686 #define CODEC_CAP_SLICE_THREADS 0x2000 00687 00688 //The following defines may change, don't expect compatibility if you use them. 00689 #define MB_TYPE_INTRA4x4 0x0001 00690 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific 00691 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific 00692 #define MB_TYPE_16x16 0x0008 00693 #define MB_TYPE_16x8 0x0010 00694 #define MB_TYPE_8x16 0x0020 00695 #define MB_TYPE_8x8 0x0040 00696 #define MB_TYPE_INTERLACED 0x0080 00697 #define MB_TYPE_DIRECT2 0x0100 //FIXME 00698 #define MB_TYPE_ACPRED 0x0200 00699 #define MB_TYPE_GMC 0x0400 00700 #define MB_TYPE_SKIP 0x0800 00701 #define MB_TYPE_P0L0 0x1000 00702 #define MB_TYPE_P1L0 0x2000 00703 #define MB_TYPE_P0L1 0x4000 00704 #define MB_TYPE_P1L1 0x8000 00705 #define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) 00706 #define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) 00707 #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) 00708 #define MB_TYPE_QUANT 0x00010000 00709 #define MB_TYPE_CBP 0x00020000 00710 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) 00711 00717 typedef struct AVPanScan{ 00723 int id; 00724 00730 int width; 00731 int height; 00732 00738 int16_t position[3][2]; 00739 }AVPanScan; 00740 00741 #define FF_COMMON_FRAME \ 00742 \ 00748 uint8_t *data[4];\ 00749 int linesize[4];\ 00750 \ 00756 uint8_t *base[4];\ 00757 \ 00762 int key_frame;\ 00763 \ 00764 \ 00769 enum AVPictureType pict_type;\ 00770 \ 00771 \ 00777 int64_t pts;\ 00778 \ 00779 \ 00784 int coded_picture_number;\ 00785 \ 00790 int display_picture_number;\ 00791 \ 00792 \ 00797 int quality; \ 00798 \ 00799 \ 00805 int age;\ 00806 \ 00807 \ 00815 int reference;\ 00816 \ 00817 \ 00822 int8_t *qscale_table;\ 00823 \ 00828 int qstride;\ 00829 \ 00830 \ 00836 uint8_t *mbskip_table;\ 00837 \ 00838 \ 00850 int16_t (*motion_val[2])[2];\ 00851 \ 00852 \ 00858 uint32_t *mb_type;\ 00859 \ 00860 \ 00866 uint8_t motion_subsample_log2;\ 00867 \ 00868 \ 00873 void *opaque;\ 00874 \ 00875 \ 00880 uint64_t error[4];\ 00881 \ 00882 \ 00888 int type;\ 00889 \ 00890 \ 00896 int repeat_pict;\ 00897 \ 00898 \ 00901 int qscale_type;\ 00902 \ 00903 \ 00908 int interlaced_frame;\ 00909 \ 00910 \ 00915 int top_field_first;\ 00916 \ 00917 \ 00922 AVPanScan *pan_scan;\ 00923 \ 00924 \ 00929 int palette_has_changed;\ 00930 \ 00931 \ 00936 int buffer_hints;\ 00937 \ 00938 \ 00943 short *dct_coeff;\ 00944 \ 00945 \ 00951 int8_t *ref_index[2];\ 00952 \ 00953 \ 00964 int64_t reordered_opaque;\ 00965 \ 00966 \ 00971 void *hwaccel_picture_private;\ 00972 \ 00973 \ 00978 int64_t pkt_pts;\ 00979 \ 00980 \ 00985 int64_t pkt_dts;\ 00986 \ 00987 \ 00992 struct AVCodecContext *owner;\ 00993 \ 00994 \ 00999 void *thread_opaque;\ 01000 01001 #define FF_QSCALE_TYPE_MPEG1 0 01002 #define FF_QSCALE_TYPE_MPEG2 1 01003 #define FF_QSCALE_TYPE_H264 2 01004 #define FF_QSCALE_TYPE_VP56 3 01005 01006 #define FF_BUFFER_TYPE_INTERNAL 1 01007 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) 01008 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. 01009 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. 01010 01011 #if FF_API_OLD_FF_PICT_TYPES 01012 /* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */ 01013 #define FF_I_TYPE AV_PICTURE_TYPE_I ///< Intra 01014 #define FF_P_TYPE AV_PICTURE_TYPE_P ///< Predicted 01015 #define FF_B_TYPE AV_PICTURE_TYPE_B ///< Bi-dir predicted 01016 #define FF_S_TYPE AV_PICTURE_TYPE_S ///< S(GMC)-VOP MPEG4 01017 #define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra 01018 #define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted 01019 #define FF_BI_TYPE AV_PICTURE_TYPE_BI 01020 #endif 01021 01022 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). 01023 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. 01024 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. 01025 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). 01026 01027 enum AVPacketSideDataType { 01028 AV_PKT_DATA_PALETTE, 01029 }; 01030 01031 typedef struct AVPacket { 01041 int64_t pts; 01047 int64_t dts; 01048 uint8_t *data; 01049 int size; 01050 int stream_index; 01051 int flags; 01056 struct { 01057 uint8_t *data; 01058 int size; 01059 enum AVPacketSideDataType type; 01060 } *side_data; 01061 int side_data_elems; 01062 01067 int duration; 01068 void (*destruct)(struct AVPacket *); 01069 void *priv; 01070 int64_t pos; 01071 01089 int64_t convergence_duration; 01090 } AVPacket; 01091 #define AV_PKT_FLAG_KEY 0x0001 01092 01102 typedef struct AVFrame { 01103 FF_COMMON_FRAME 01104 } AVFrame; 01105 01113 typedef struct AVCodecContext { 01118 const AVClass *av_class; 01124 int bit_rate; 01125 01132 int bit_rate_tolerance; 01133 01139 int flags; 01140 01149 int sub_id; 01150 01158 int me_method; 01159 01171 uint8_t *extradata; 01172 int extradata_size; 01173 01182 AVRational time_base; 01183 01184 /* video only */ 01192 int width, height; 01193 01194 #define FF_ASPECT_EXTENDED 15 01195 01201 int gop_size; 01202 01210 enum PixelFormat pix_fmt; 01211 01235 void (*draw_horiz_band)(struct AVCodecContext *s, 01236 const AVFrame *src, int offset[4], 01237 int y, int type, int height); 01238 01239 /* audio only */ 01240 int sample_rate; 01241 int channels; 01242 01248 enum AVSampleFormat sample_fmt; 01249 01250 /* The following data should not be initialized. */ 01254 int frame_size; 01255 int frame_number; 01256 01263 int delay; 01264 01265 /* - encoding parameters */ 01266 float qcompress; 01267 float qblur; 01268 01274 int qmin; 01275 01281 int qmax; 01282 01288 int max_qdiff; 01289 01296 int max_b_frames; 01297 01305 float b_quant_factor; 01306 01308 int rc_strategy; 01309 #define FF_RC_STRATEGY_XVID 1 01310 01311 int b_frame_strategy; 01312 01313 struct AVCodec *codec; 01314 01315 void *priv_data; 01316 01317 int rtp_payload_size; /* The size of the RTP payload: the coder will */ 01318 /* do its best to deliver a chunk with size */ 01319 /* below rtp_payload_size, the chunk will start */ 01320 /* with a start code on some codecs like H.263. */ 01321 /* This doesn't take account of any particular */ 01322 /* headers inside the transmitted RTP payload. */ 01323 01324 01325 /* The RTP callback: This function is called */ 01326 /* every time the encoder has a packet to send. */ 01327 /* It depends on the encoder if the data starts */ 01328 /* with a Start Code (it should). H.263 does. */ 01329 /* mb_nb contains the number of macroblocks */ 01330 /* encoded in the RTP payload. */ 01331 void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); 01332 01333 /* statistics, used for 2-pass encoding */ 01334 int mv_bits; 01335 int header_bits; 01336 int i_tex_bits; 01337 int p_tex_bits; 01338 int i_count; 01339 int p_count; 01340 int skip_count; 01341 int misc_bits; 01342 01348 int frame_bits; 01349 01355 void *opaque; 01356 01357 char codec_name[32]; 01358 enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ 01359 enum CodecID codec_id; /* see CODEC_ID_xxx */ 01360 01374 unsigned int codec_tag; 01375 01381 int workaround_bugs; 01382 #define FF_BUG_AUTODETECT 1 ///< autodetection 01383 #define FF_BUG_OLD_MSMPEG4 2 01384 #define FF_BUG_XVID_ILACE 4 01385 #define FF_BUG_UMP4 8 01386 #define FF_BUG_NO_PADDING 16 01387 #define FF_BUG_AMV 32 01388 #define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. 01389 #define FF_BUG_QPEL_CHROMA 64 01390 #define FF_BUG_STD_QPEL 128 01391 #define FF_BUG_QPEL_CHROMA2 256 01392 #define FF_BUG_DIRECT_BLOCKSIZE 512 01393 #define FF_BUG_EDGE 1024 01394 #define FF_BUG_HPEL_CHROMA 2048 01395 #define FF_BUG_DC_CLIP 4096 01396 #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. 01397 #define FF_BUG_TRUNCATED 16384 01398 //#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%. 01399 01405 int luma_elim_threshold; 01406 01412 int chroma_elim_threshold; 01413 01426 int strict_std_compliance; 01427 #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. 01428 #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. 01429 #define FF_COMPLIANCE_NORMAL 0 01430 #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions 01431 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. 01432 01438 float b_quant_offset; 01439 01446 int error_recognition; 01447 #define FF_ER_CAREFUL 1 01448 #define FF_ER_COMPLIANT 2 01449 #define FF_ER_AGGRESSIVE 3 01450 #define FF_ER_VERY_AGGRESSIVE 4 01451 01466 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); 01467 01477 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); 01478 01485 int has_b_frames; 01486 01491 int block_align; 01492 01493 int parse_only; /* - decoding only: If true, only parsing is done 01494 (function avcodec_parse_frame()). The frame 01495 data is returned. Only MPEG codecs support this now. */ 01496 01502 int mpeg_quant; 01503 01509 char *stats_out; 01510 01517 char *stats_in; 01518 01525 float rc_qsquish; 01526 01527 float rc_qmod_amp; 01528 int rc_qmod_freq; 01529 01535 RcOverride *rc_override; 01536 int rc_override_count; 01537 01543 const char *rc_eq; 01544 01550 int rc_max_rate; 01551 01557 int rc_min_rate; 01558 01564 int rc_buffer_size; 01565 float rc_buffer_aggressivity; 01566 01574 float i_quant_factor; 01575 01581 float i_quant_offset; 01582 01588 float rc_initial_cplx; 01589 01595 int dct_algo; 01596 #define FF_DCT_AUTO 0 01597 #define FF_DCT_FASTINT 1 01598 #define FF_DCT_INT 2 01599 #define FF_DCT_MMX 3 01600 #define FF_DCT_MLIB 4 01601 #define FF_DCT_ALTIVEC 5 01602 #define FF_DCT_FAAN 6 01603 01609 float lumi_masking; 01610 01616 float temporal_cplx_masking; 01617 01623 float spatial_cplx_masking; 01624 01630 float p_masking; 01631 01637 float dark_masking; 01638 01644 int idct_algo; 01645 #define FF_IDCT_AUTO 0 01646 #define FF_IDCT_INT 1 01647 #define FF_IDCT_SIMPLE 2 01648 #define FF_IDCT_SIMPLEMMX 3 01649 #define FF_IDCT_LIBMPEG2MMX 4 01650 #define FF_IDCT_PS2 5 01651 #define FF_IDCT_MLIB 6 01652 #define FF_IDCT_ARM 7 01653 #define FF_IDCT_ALTIVEC 8 01654 #define FF_IDCT_SH4 9 01655 #define FF_IDCT_SIMPLEARM 10 01656 #define FF_IDCT_H264 11 01657 #define FF_IDCT_VP3 12 01658 #define FF_IDCT_IPP 13 01659 #define FF_IDCT_XVIDMMX 14 01660 #define FF_IDCT_CAVS 15 01661 #define FF_IDCT_SIMPLEARMV5TE 16 01662 #define FF_IDCT_SIMPLEARMV6 17 01663 #define FF_IDCT_SIMPLEVIS 18 01664 #define FF_IDCT_WMV2 19 01665 #define FF_IDCT_FAAN 20 01666 #define FF_IDCT_EA 21 01667 #define FF_IDCT_SIMPLENEON 22 01668 #define FF_IDCT_SIMPLEALPHA 23 01669 #define FF_IDCT_BINK 24 01670 01676 int slice_count; 01682 int *slice_offset; 01683 01689 int error_concealment; 01690 #define FF_EC_GUESS_MVS 1 01691 #define FF_EC_DEBLOCK 2 01692 01701 unsigned dsp_mask; 01702 01708 int bits_per_coded_sample; 01709 01715 int prediction_method; 01716 #define FF_PRED_LEFT 0 01717 #define FF_PRED_PLANE 1 01718 #define FF_PRED_MEDIAN 2 01719 01727 AVRational sample_aspect_ratio; 01728 01734 AVFrame *coded_frame; 01735 01741 int debug; 01742 #define FF_DEBUG_PICT_INFO 1 01743 #define FF_DEBUG_RC 2 01744 #define FF_DEBUG_BITSTREAM 4 01745 #define FF_DEBUG_MB_TYPE 8 01746 #define FF_DEBUG_QP 16 01747 #define FF_DEBUG_MV 32 01748 #define FF_DEBUG_DCT_COEFF 0x00000040 01749 #define FF_DEBUG_SKIP 0x00000080 01750 #define FF_DEBUG_STARTCODE 0x00000100 01751 #define FF_DEBUG_PTS 0x00000200 01752 #define FF_DEBUG_ER 0x00000400 01753 #define FF_DEBUG_MMCO 0x00000800 01754 #define FF_DEBUG_BUGS 0x00001000 01755 #define FF_DEBUG_VIS_QP 0x00002000 01756 #define FF_DEBUG_VIS_MB_TYPE 0x00004000 01757 #define FF_DEBUG_BUFFERS 0x00008000 01758 #define FF_DEBUG_THREADS 0x00010000 01759 01765 int debug_mv; 01766 #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames 01767 #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames 01768 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames 01769 01775 uint64_t error[4]; 01776 01782 int me_cmp; 01788 int me_sub_cmp; 01794 int mb_cmp; 01800 int ildct_cmp; 01801 #define FF_CMP_SAD 0 01802 #define FF_CMP_SSE 1 01803 #define FF_CMP_SATD 2 01804 #define FF_CMP_DCT 3 01805 #define FF_CMP_PSNR 4 01806 #define FF_CMP_BIT 5 01807 #define FF_CMP_RD 6 01808 #define FF_CMP_ZERO 7 01809 #define FF_CMP_VSAD 8 01810 #define FF_CMP_VSSE 9 01811 #define FF_CMP_NSSE 10 01812 #define FF_CMP_W53 11 01813 #define FF_CMP_W97 12 01814 #define FF_CMP_DCTMAX 13 01815 #define FF_CMP_DCT264 14 01816 #define FF_CMP_CHROMA 256 01817 01823 int dia_size; 01824 01830 int last_predictor_count; 01831 01837 int pre_me; 01838 01844 int me_pre_cmp; 01845 01851 int pre_dia_size; 01852 01858 int me_subpel_quality; 01859 01869 enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt); 01870 01879 int dtg_active_format; 01880 #define FF_DTG_AFD_SAME 8 01881 #define FF_DTG_AFD_4_3 9 01882 #define FF_DTG_AFD_16_9 10 01883 #define FF_DTG_AFD_14_9 11 01884 #define FF_DTG_AFD_4_3_SP_14_9 13 01885 #define FF_DTG_AFD_16_9_SP_14_9 14 01886 #define FF_DTG_AFD_SP_4_3 15 01887 01895 int me_range; 01896 01902 int intra_quant_bias; 01903 #define FF_DEFAULT_QUANT_BIAS 999999 01904 01910 int inter_quant_bias; 01911 01918 int color_table_id; 01919 01924 int internal_buffer_count; 01925 01930 void *internal_buffer; 01931 01938 int global_quality; 01939 01940 #define FF_CODER_TYPE_VLC 0 01941 #define FF_CODER_TYPE_AC 1 01942 #define FF_CODER_TYPE_RAW 2 01943 #define FF_CODER_TYPE_RLE 3 01944 #define FF_CODER_TYPE_DEFLATE 4 01945 01950 int coder_type; 01951 01957 int context_model; 01958 #if 0 01959 01964 uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size); 01965 #endif 01966 01972 int slice_flags; 01973 #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display 01974 #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) 01975 #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) 01976 01982 int xvmc_acceleration; 01983 01989 int mb_decision; 01990 #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp 01991 #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits 01992 #define FF_MB_DECISION_RD 2 ///< rate distortion 01993 01999 uint16_t *intra_matrix; 02000 02006 uint16_t *inter_matrix; 02007 02014 unsigned int stream_codec_tag; 02015 02022 int scenechange_threshold; 02023 02029 int lmin; 02030 02036 int lmax; 02037 02038 #if FF_API_PALETTE_CONTROL 02039 02044 struct AVPaletteControl *palctrl; 02045 #endif 02046 02052 int noise_reduction; 02053 02066 int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); 02067 02073 int rc_initial_buffer_occupancy; 02074 02080 int inter_threshold; 02081 02087 int flags2; 02088 02094 int error_rate; 02095 02096 #if FF_API_ANTIALIAS_ALGO 02097 02102 attribute_deprecated int antialias_algo; 02103 #define FF_AA_AUTO 0 02104 #define FF_AA_FASTINT 1 //not implemented yet 02105 #define FF_AA_INT 2 02106 #define FF_AA_FLOAT 3 02107 #endif 02108 02114 int quantizer_noise_shaping; 02115 02122 int thread_count; 02123 02133 int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); 02134 02141 void *thread_opaque; 02142 02150 int me_threshold; 02151 02157 int mb_threshold; 02158 02164 int intra_dc_precision; 02165 02171 int nsse_weight; 02172 02178 int skip_top; 02179 02185 int skip_bottom; 02186 02192 int profile; 02193 #define FF_PROFILE_UNKNOWN -99 02194 #define FF_PROFILE_RESERVED -100 02195 02196 #define FF_PROFILE_AAC_MAIN 0 02197 #define FF_PROFILE_AAC_LOW 1 02198 #define FF_PROFILE_AAC_SSR 2 02199 #define FF_PROFILE_AAC_LTP 3 02200 02201 #define FF_PROFILE_DTS 20 02202 #define FF_PROFILE_DTS_ES 30 02203 #define FF_PROFILE_DTS_96_24 40 02204 #define FF_PROFILE_DTS_HD_HRA 50 02205 #define FF_PROFILE_DTS_HD_MA 60 02206 02207 #define FF_PROFILE_MPEG2_422 0 02208 #define FF_PROFILE_MPEG2_HIGH 1 02209 #define FF_PROFILE_MPEG2_SS 2 02210 #define FF_PROFILE_MPEG2_SNR_SCALABLE 3 02211 #define FF_PROFILE_MPEG2_MAIN 4 02212 #define FF_PROFILE_MPEG2_SIMPLE 5 02213 02214 #define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag 02215 #define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag 02216 02217 #define FF_PROFILE_H264_BASELINE 66 02218 #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) 02219 #define FF_PROFILE_H264_MAIN 77 02220 #define FF_PROFILE_H264_EXTENDED 88 02221 #define FF_PROFILE_H264_HIGH 100 02222 #define FF_PROFILE_H264_HIGH_10 110 02223 #define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) 02224 #define FF_PROFILE_H264_HIGH_422 122 02225 #define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) 02226 #define FF_PROFILE_H264_HIGH_444 144 02227 #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 02228 #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) 02229 #define FF_PROFILE_H264_CAVLC_444 44 02230 02231 #define FF_PROFILE_VC1_SIMPLE 0 02232 #define FF_PROFILE_VC1_MAIN 1 02233 #define FF_PROFILE_VC1_COMPLEX 2 02234 #define FF_PROFILE_VC1_ADVANCED 3 02235 02241 int level; 02242 #define FF_LEVEL_UNKNOWN -99 02243 02249 int lowres; 02250 02257 int coded_width, coded_height; 02258 02264 int frame_skip_threshold; 02265 02271 int frame_skip_factor; 02272 02278 int frame_skip_exp; 02279 02285 int frame_skip_cmp; 02286 02293 float border_masking; 02294 02300 int mb_lmin; 02301 02307 int mb_lmax; 02308 02314 int me_penalty_compensation; 02315 02321 enum AVDiscard skip_loop_filter; 02322 02328 enum AVDiscard skip_idct; 02329 02335 enum AVDiscard skip_frame; 02336 02342 int bidir_refine; 02343 02349 int brd_scale; 02350 02356 float crf; 02357 02363 int cqp; 02364 02370 int keyint_min; 02371 02377 int refs; 02378 02384 int chromaoffset; 02385 02391 int bframebias; 02392 02398 int trellis; 02399 02405 float complexityblur; 02406 02413 int deblockalpha; 02414 02421 int deblockbeta; 02422 02428 int partitions; 02429 #define X264_PART_I4X4 0x001 /* Analyze i4x4 */ 02430 #define X264_PART_I8X8 0x002 /* Analyze i8x8 (requires 8x8 transform) */ 02431 #define X264_PART_P8X8 0x010 /* Analyze p16x8, p8x16 and p8x8 */ 02432 #define X264_PART_P4X4 0x020 /* Analyze p8x4, p4x8, p4x4 */ 02433 #define X264_PART_B8X8 0x100 /* Analyze b16x8, b8x16 and b8x8 */ 02434 02440 int directpred; 02441 02447 int cutoff; 02448 02454 int scenechange_factor; 02455 02462 int mv0_threshold; 02463 02469 int b_sensitivity; 02470 02475 int compression_level; 02476 #define FF_COMPRESSION_DEFAULT -1 02477 02482 int min_prediction_order; 02483 02488 int max_prediction_order; 02489 02490 #if FF_API_FLAC_GLOBAL_OPTS 02491 02502 attribute_deprecated int lpc_coeff_precision; 02503 02509 attribute_deprecated int prediction_order_method; 02510 02515 attribute_deprecated int min_partition_order; 02516 02521 attribute_deprecated int max_partition_order; 02525 #endif 02526 02532 int64_t timecode_frame_start; 02533 02534 #if FF_API_REQUEST_CHANNELS 02535 02541 int request_channels; 02542 #endif 02543 02550 float drc_scale; 02551 02559 int64_t reordered_opaque; 02560 02566 int bits_per_raw_sample; 02567 02573 int64_t channel_layout; 02574 02580 int64_t request_channel_layout; 02581 02587 float rc_max_available_vbv_use; 02588 02594 float rc_min_vbv_overflow_use; 02595 02601 struct AVHWAccel *hwaccel; 02602 02610 int ticks_per_frame; 02611 02622 void *hwaccel_context; 02623 02629 enum AVColorPrimaries color_primaries; 02630 02636 enum AVColorTransferCharacteristic color_trc; 02637 02643 enum AVColorSpace colorspace; 02644 02650 enum AVColorRange color_range; 02651 02657 enum AVChromaLocation chroma_sample_location; 02658 02677 int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); 02678 02687 int weighted_p_pred; 02688 02697 int aq_mode; 02698 02705 float aq_strength; 02706 02713 float psy_rd; 02714 02721 float psy_trellis; 02722 02729 int rc_lookahead; 02730 02738 float crf_max; 02739 02740 int log_level_offset; 02741 02742 #if FF_API_FLAC_GLOBAL_OPTS 02743 02748 attribute_deprecated enum AVLPCType lpc_type; 02749 02755 attribute_deprecated int lpc_passes; 02756 #endif 02757 02765 int slices; 02766 02775 uint8_t *subtitle_header; 02776 int subtitle_header_size; 02777 02785 AVPacket *pkt; 02786 02794 int is_copy; 02795 02804 int thread_type; 02805 #define FF_THREAD_FRAME 1 //< Decode more than one frame at once 02806 #define FF_THREAD_SLICE 2 //< Decode more than one part of a single frame at once 02807 02813 int active_thread_type; 02814 02823 int thread_safe_callbacks; 02824 02831 uint64_t vbv_delay; 02832 02838 enum AVAudioServiceType audio_service_type; 02839 02845 enum AVSampleFormat request_sample_fmt; 02846 } AVCodecContext; 02847 02851 typedef struct AVProfile { 02852 int profile; 02853 const char *name; 02854 } AVProfile; 02855 02859 typedef struct AVCodec { 02866 const char *name; 02867 enum AVMediaType type; 02868 enum CodecID id; 02869 int priv_data_size; 02870 int (*init)(AVCodecContext *); 02871 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); 02872 int (*close)(AVCodecContext *); 02873 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); 02878 int capabilities; 02879 struct AVCodec *next; 02884 void (*flush)(AVCodecContext *); 02885 const AVRational *supported_framerates; 02886 const enum PixelFormat *pix_fmts; 02887 02891 const char *long_name; 02892 const int *supported_samplerates; 02893 const enum AVSampleFormat *sample_fmts; 02894 const int64_t *channel_layouts; 02895 uint8_t max_lowres; 02896 const AVClass *priv_class; 02897 const AVProfile *profiles; 02898 02908 int (*init_thread_copy)(AVCodecContext *); 02916 int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); 02918 } AVCodec; 02919 02923 typedef struct AVHWAccel { 02929 const char *name; 02930 02936 enum AVMediaType type; 02937 02943 enum CodecID id; 02944 02950 enum PixelFormat pix_fmt; 02951 02956 int capabilities; 02957 02958 struct AVHWAccel *next; 02959 02974 int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); 02975 02987 int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); 02988 02998 int (*end_frame)(AVCodecContext *avctx); 02999 03007 int priv_data_size; 03008 } AVHWAccel; 03009 03014 typedef struct AVPicture { 03015 uint8_t *data[4]; 03016 int linesize[4]; 03017 } AVPicture; 03018 03019 #if FF_API_PALETTE_CONTROL 03020 03028 #define AVPALETTE_SIZE 1024 03029 #define AVPALETTE_COUNT 256 03030 typedef struct AVPaletteControl { 03031 03032 /* Demuxer sets this to 1 to indicate the palette has changed; 03033 * decoder resets to 0. */ 03034 int palette_changed; 03035 03036 /* 4-byte ARGB palette entries, stored in native byte order; note that 03037 * the individual palette components should be on a 8-bit scale; if 03038 * the palette data comes from an IBM VGA native format, the component 03039 * data is probably 6 bits in size and needs to be scaled. */ 03040 unsigned int palette[AVPALETTE_COUNT]; 03041 03042 } AVPaletteControl attribute_deprecated; 03043 #endif 03044 03045 enum AVSubtitleType { 03046 SUBTITLE_NONE, 03047 03048 SUBTITLE_BITMAP, 03049 03054 SUBTITLE_TEXT, 03055 03060 SUBTITLE_ASS, 03061 }; 03062 03063 typedef struct AVSubtitleRect { 03064 int x; 03065 int y; 03066 int w; 03067 int h; 03068 int nb_colors; 03069 03074 AVPicture pict; 03075 enum AVSubtitleType type; 03076 03077 char *text; 03078 03084 char *ass; 03085 } AVSubtitleRect; 03086 03087 typedef struct AVSubtitle { 03088 uint16_t format; /* 0 = graphics */ 03089 uint32_t start_display_time; /* relative to packet pts, in ms */ 03090 uint32_t end_display_time; /* relative to packet pts, in ms */ 03091 unsigned num_rects; 03092 AVSubtitleRect **rects; 03093 int64_t pts; 03094 } AVSubtitle; 03095 03096 /* packet functions */ 03097 03101 attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt); 03102 03106 void av_destruct_packet(AVPacket *pkt); 03107 03113 void av_init_packet(AVPacket *pkt); 03114 03123 int av_new_packet(AVPacket *pkt, int size); 03124 03131 void av_shrink_packet(AVPacket *pkt, int size); 03132 03139 int av_grow_packet(AVPacket *pkt, int grow_by); 03140 03145 int av_dup_packet(AVPacket *pkt); 03146 03152 void av_free_packet(AVPacket *pkt); 03153 03162 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, 03163 int size); 03164 03173 uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, 03174 int *size); 03175 03176 /* resample.c */ 03177 03178 struct ReSampleContext; 03179 struct AVResampleContext; 03180 03181 typedef struct ReSampleContext ReSampleContext; 03182 03199 ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, 03200 int output_rate, int input_rate, 03201 enum AVSampleFormat sample_fmt_out, 03202 enum AVSampleFormat sample_fmt_in, 03203 int filter_length, int log2_phase_count, 03204 int linear, double cutoff); 03205 03206 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); 03207 03214 void audio_resample_close(ReSampleContext *s); 03215 03216 03226 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); 03227 03237 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); 03238 03239 03252 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); 03253 void av_resample_close(struct AVResampleContext *c); 03254 03266 int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height); 03267 03275 void avpicture_free(AVPicture *picture); 03276 03297 int avpicture_fill(AVPicture *picture, uint8_t *ptr, 03298 enum PixelFormat pix_fmt, int width, int height); 03299 03315 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height, 03316 unsigned char *dest, int dest_size); 03317 03330 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height); 03331 void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift); 03332 03333 #if FF_API_GET_PIX_FMT_NAME 03334 03337 attribute_deprecated 03338 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt); 03339 #endif 03340 03341 void avcodec_set_dimensions(AVCodecContext *s, int width, int height); 03342 03348 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt); 03349 03357 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); 03358 03359 #define FF_LOSS_RESOLUTION 0x0001 03360 #define FF_LOSS_DEPTH 0x0002 03361 #define FF_LOSS_COLORSPACE 0x0004 03362 #define FF_LOSS_ALPHA 0x0008 03363 #define FF_LOSS_COLORQUANT 0x0010 03364 #define FF_LOSS_CHROMA 0x0020 03383 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt, 03384 int has_alpha); 03385 03408 enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt, 03409 int has_alpha, int *loss_ptr); 03410 03411 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ 03412 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ 03413 03418 int img_get_alpha_info(const AVPicture *src, 03419 enum PixelFormat pix_fmt, int width, int height); 03420 03421 /* deinterlace a picture */ 03422 /* deinterlace - if not supported return -1 */ 03423 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, 03424 enum PixelFormat pix_fmt, int width, int height); 03425 03426 /* external high level API */ 03427 03433 AVCodec *av_codec_next(AVCodec *c); 03434 03438 unsigned avcodec_version(void); 03439 03443 const char *avcodec_configuration(void); 03444 03448 const char *avcodec_license(void); 03449 03459 void avcodec_init(void); 03460 03466 void avcodec_register(AVCodec *codec); 03467 03474 AVCodec *avcodec_find_encoder(enum CodecID id); 03475 03482 AVCodec *avcodec_find_encoder_by_name(const char *name); 03483 03490 AVCodec *avcodec_find_decoder(enum CodecID id); 03491 03498 AVCodec *avcodec_find_decoder_by_name(const char *name); 03499 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); 03500 03508 const char *av_get_profile_name(const AVCodec *codec, int profile); 03509 03515 void avcodec_get_context_defaults(AVCodecContext *s); 03516 03519 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); 03520 03523 int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); 03524 03532 AVCodecContext *avcodec_alloc_context(void); 03533 03536 AVCodecContext *avcodec_alloc_context2(enum AVMediaType); 03537 03540 AVCodecContext *avcodec_alloc_context3(AVCodec *codec); 03541 03553 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); 03554 03560 void avcodec_get_frame_defaults(AVFrame *pic); 03561 03569 AVFrame *avcodec_alloc_frame(void); 03570 03571 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); 03572 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); 03573 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); 03574 03582 unsigned avcodec_get_edge_width(void); 03592 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); 03602 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, 03603 int linesize_align[4]); 03604 03605 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); 03606 03607 #if FF_API_THREAD_INIT 03608 03611 attribute_deprecated 03612 int avcodec_thread_init(AVCodecContext *s, int thread_count); 03613 #endif 03614 03615 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); 03616 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); 03617 //FIXME func typedef 03618 03619 #if FF_API_AVCODEC_OPEN 03620 03649 attribute_deprecated 03650 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); 03651 #endif 03652 03684 int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options); 03685 03725 int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, 03726 int *frame_size_ptr, 03727 AVPacket *avpkt); 03728 03769 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, 03770 int *got_picture_ptr, 03771 AVPacket *avpkt); 03772 03789 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, 03790 int *got_sub_ptr, 03791 AVPacket *avpkt); 03792 03798 void avsubtitle_free(AVSubtitle *sub); 03799 03800 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, 03801 int *data_size_ptr, 03802 uint8_t *buf, int buf_size); 03803 03823 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, 03824 const short *samples); 03825 03838 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 03839 const AVFrame *pict); 03840 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, 03841 const AVSubtitle *sub); 03842 03843 int avcodec_close(AVCodecContext *avctx); 03844 03855 void avcodec_register_all(void); 03856 03860 void avcodec_flush_buffers(AVCodecContext *avctx); 03861 03862 void avcodec_default_free_buffers(AVCodecContext *s); 03863 03864 /* misc useful functions */ 03865 03866 #if FF_API_OLD_FF_PICT_TYPES 03867 03874 attribute_deprecated 03875 char av_get_pict_type_char(int pict_type); 03876 #endif 03877 03884 int av_get_bits_per_sample(enum CodecID codec_id); 03885 03886 #if FF_API_OLD_SAMPLE_FMT 03887 03890 attribute_deprecated 03891 int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt); 03892 #endif 03893 03894 /* frame parsing */ 03895 typedef struct AVCodecParserContext { 03896 void *priv_data; 03897 struct AVCodecParser *parser; 03898 int64_t frame_offset; /* offset of the current frame */ 03899 int64_t cur_offset; /* current offset 03900 (incremented by each av_parser_parse()) */ 03901 int64_t next_frame_offset; /* offset of the next frame */ 03902 /* video info */ 03903 int pict_type; /* XXX: Put it back in AVCodecContext. */ 03913 int repeat_pict; /* XXX: Put it back in AVCodecContext. */ 03914 int64_t pts; /* pts of the current frame */ 03915 int64_t dts; /* dts of the current frame */ 03916 03917 /* private data */ 03918 int64_t last_pts; 03919 int64_t last_dts; 03920 int fetch_timestamp; 03921 03922 #define AV_PARSER_PTS_NB 4 03923 int cur_frame_start_index; 03924 int64_t cur_frame_offset[AV_PARSER_PTS_NB]; 03925 int64_t cur_frame_pts[AV_PARSER_PTS_NB]; 03926 int64_t cur_frame_dts[AV_PARSER_PTS_NB]; 03927 03928 int flags; 03929 #define PARSER_FLAG_COMPLETE_FRAMES 0x0001 03930 #define PARSER_FLAG_ONCE 0x0002 03931 03932 #define PARSER_FLAG_FETCHED_OFFSET 0x0004 03933 03934 int64_t offset; 03935 int64_t cur_frame_end[AV_PARSER_PTS_NB]; 03936 03943 int key_frame; 03944 03962 int64_t convergence_duration; 03963 03964 // Timestamp generation support: 03974 int dts_sync_point; 03975 03989 int dts_ref_dts_delta; 03990 04003 int pts_dts_delta; 04004 04010 int64_t cur_frame_pos[AV_PARSER_PTS_NB]; 04011 04015 int64_t pos; 04016 04020 int64_t last_pos; 04021 } AVCodecParserContext; 04022 04023 typedef struct AVCodecParser { 04024 int codec_ids[5]; /* several codec IDs are permitted */ 04025 int priv_data_size; 04026 int (*parser_init)(AVCodecParserContext *s); 04027 int (*parser_parse)(AVCodecParserContext *s, 04028 AVCodecContext *avctx, 04029 const uint8_t **poutbuf, int *poutbuf_size, 04030 const uint8_t *buf, int buf_size); 04031 void (*parser_close)(AVCodecParserContext *s); 04032 int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); 04033 struct AVCodecParser *next; 04034 } AVCodecParser; 04035 04036 AVCodecParser *av_parser_next(AVCodecParser *c); 04037 04038 void av_register_codec_parser(AVCodecParser *parser); 04039 AVCodecParserContext *av_parser_init(int codec_id); 04040 04069 int av_parser_parse2(AVCodecParserContext *s, 04070 AVCodecContext *avctx, 04071 uint8_t **poutbuf, int *poutbuf_size, 04072 const uint8_t *buf, int buf_size, 04073 int64_t pts, int64_t dts, 04074 int64_t pos); 04075 04076 int av_parser_change(AVCodecParserContext *s, 04077 AVCodecContext *avctx, 04078 uint8_t **poutbuf, int *poutbuf_size, 04079 const uint8_t *buf, int buf_size, int keyframe); 04080 void av_parser_close(AVCodecParserContext *s); 04081 04082 04083 typedef struct AVBitStreamFilterContext { 04084 void *priv_data; 04085 struct AVBitStreamFilter *filter; 04086 AVCodecParserContext *parser; 04087 struct AVBitStreamFilterContext *next; 04088 } AVBitStreamFilterContext; 04089 04090 04091 typedef struct AVBitStreamFilter { 04092 const char *name; 04093 int priv_data_size; 04094 int (*filter)(AVBitStreamFilterContext *bsfc, 04095 AVCodecContext *avctx, const char *args, 04096 uint8_t **poutbuf, int *poutbuf_size, 04097 const uint8_t *buf, int buf_size, int keyframe); 04098 void (*close)(AVBitStreamFilterContext *bsfc); 04099 struct AVBitStreamFilter *next; 04100 } AVBitStreamFilter; 04101 04102 void av_register_bitstream_filter(AVBitStreamFilter *bsf); 04103 AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); 04104 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, 04105 AVCodecContext *avctx, const char *args, 04106 uint8_t **poutbuf, int *poutbuf_size, 04107 const uint8_t *buf, int buf_size, int keyframe); 04108 void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); 04109 04110 AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); 04111 04112 /* memory */ 04113 04119 void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); 04120 04133 void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); 04134 04138 void av_picture_copy(AVPicture *dst, const AVPicture *src, 04139 enum PixelFormat pix_fmt, int width, int height); 04140 04144 int av_picture_crop(AVPicture *dst, const AVPicture *src, 04145 enum PixelFormat pix_fmt, int top_band, int left_band); 04146 04150 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt, 04151 int padtop, int padbottom, int padleft, int padright, int *color); 04152 04160 unsigned int av_xiphlacing(unsigned char *s, unsigned int v); 04161 04174 void av_log_missing_feature(void *avc, const char *feature, int want_sample); 04175 04184 void av_log_ask_for_sample(void *avc, const char *msg, ...); 04185 04189 void av_register_hwaccel(AVHWAccel *hwaccel); 04190 04196 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); 04197 04198 04202 enum AVLockOp { 04203 AV_LOCK_CREATE, 04204 AV_LOCK_OBTAIN, 04205 AV_LOCK_RELEASE, 04206 AV_LOCK_DESTROY, 04207 }; 04208 04222 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); 04223 04224 #endif /* AVCODEC_AVCODEC_H */