Libav 0.7.1
libavcodec/avcodec.h
Go to the documentation of this file.
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 
00034 #include "libavcodec/version.h"
00035 
00048 enum CodecID {
00049     CODEC_ID_NONE,
00050 
00051     /* video codecs */
00052     CODEC_ID_MPEG1VIDEO,
00053     CODEC_ID_MPEG2VIDEO, 
00054     CODEC_ID_MPEG2VIDEO_XVMC,
00055     CODEC_ID_H261,
00056     CODEC_ID_H263,
00057     CODEC_ID_RV10,
00058     CODEC_ID_RV20,
00059     CODEC_ID_MJPEG,
00060     CODEC_ID_MJPEGB,
00061     CODEC_ID_LJPEG,
00062     CODEC_ID_SP5X,
00063     CODEC_ID_JPEGLS,
00064     CODEC_ID_MPEG4,
00065     CODEC_ID_RAWVIDEO,
00066     CODEC_ID_MSMPEG4V1,
00067     CODEC_ID_MSMPEG4V2,
00068     CODEC_ID_MSMPEG4V3,
00069     CODEC_ID_WMV1,
00070     CODEC_ID_WMV2,
00071     CODEC_ID_H263P,
00072     CODEC_ID_H263I,
00073     CODEC_ID_FLV1,
00074     CODEC_ID_SVQ1,
00075     CODEC_ID_SVQ3,
00076     CODEC_ID_DVVIDEO,
00077     CODEC_ID_HUFFYUV,
00078     CODEC_ID_CYUV,
00079     CODEC_ID_H264,
00080     CODEC_ID_INDEO3,
00081     CODEC_ID_VP3,
00082     CODEC_ID_THEORA,
00083     CODEC_ID_ASV1,
00084     CODEC_ID_ASV2,
00085     CODEC_ID_FFV1,
00086     CODEC_ID_4XM,
00087     CODEC_ID_VCR1,
00088     CODEC_ID_CLJR,
00089     CODEC_ID_MDEC,
00090     CODEC_ID_ROQ,
00091     CODEC_ID_INTERPLAY_VIDEO,
00092     CODEC_ID_XAN_WC3,
00093     CODEC_ID_XAN_WC4,
00094     CODEC_ID_RPZA,
00095     CODEC_ID_CINEPAK,
00096     CODEC_ID_WS_VQA,
00097     CODEC_ID_MSRLE,
00098     CODEC_ID_MSVIDEO1,
00099     CODEC_ID_IDCIN,
00100     CODEC_ID_8BPS,
00101     CODEC_ID_SMC,
00102     CODEC_ID_FLIC,
00103     CODEC_ID_TRUEMOTION1,
00104     CODEC_ID_VMDVIDEO,
00105     CODEC_ID_MSZH,
00106     CODEC_ID_ZLIB,
00107     CODEC_ID_QTRLE,
00108     CODEC_ID_SNOW,
00109     CODEC_ID_TSCC,
00110     CODEC_ID_ULTI,
00111     CODEC_ID_QDRAW,
00112     CODEC_ID_VIXL,
00113     CODEC_ID_QPEG,
00114     CODEC_ID_PNG,
00115     CODEC_ID_PPM,
00116     CODEC_ID_PBM,
00117     CODEC_ID_PGM,
00118     CODEC_ID_PGMYUV,
00119     CODEC_ID_PAM,
00120     CODEC_ID_FFVHUFF,
00121     CODEC_ID_RV30,
00122     CODEC_ID_RV40,
00123     CODEC_ID_VC1,
00124     CODEC_ID_WMV3,
00125     CODEC_ID_LOCO,
00126     CODEC_ID_WNV1,
00127     CODEC_ID_AASC,
00128     CODEC_ID_INDEO2,
00129     CODEC_ID_FRAPS,
00130     CODEC_ID_TRUEMOTION2,
00131     CODEC_ID_BMP,
00132     CODEC_ID_CSCD,
00133     CODEC_ID_MMVIDEO,
00134     CODEC_ID_ZMBV,
00135     CODEC_ID_AVS,
00136     CODEC_ID_SMACKVIDEO,
00137     CODEC_ID_NUV,
00138     CODEC_ID_KMVC,
00139     CODEC_ID_FLASHSV,
00140     CODEC_ID_CAVS,
00141     CODEC_ID_JPEG2000,
00142     CODEC_ID_VMNC,
00143     CODEC_ID_VP5,
00144     CODEC_ID_VP6,
00145     CODEC_ID_VP6F,
00146     CODEC_ID_TARGA,
00147     CODEC_ID_DSICINVIDEO,
00148     CODEC_ID_TIERTEXSEQVIDEO,
00149     CODEC_ID_TIFF,
00150     CODEC_ID_GIF,
00151     CODEC_ID_FFH264,
00152     CODEC_ID_DXA,
00153     CODEC_ID_DNXHD,
00154     CODEC_ID_THP,
00155     CODEC_ID_SGI,
00156     CODEC_ID_C93,
00157     CODEC_ID_BETHSOFTVID,
00158     CODEC_ID_PTX,
00159     CODEC_ID_TXD,
00160     CODEC_ID_VP6A,
00161     CODEC_ID_AMV,
00162     CODEC_ID_VB,
00163     CODEC_ID_PCX,
00164     CODEC_ID_SUNRAST,
00165     CODEC_ID_INDEO4,
00166     CODEC_ID_INDEO5,
00167     CODEC_ID_MIMIC,
00168     CODEC_ID_RL2,
00169     CODEC_ID_8SVX_EXP,
00170     CODEC_ID_8SVX_FIB,
00171     CODEC_ID_ESCAPE124,
00172     CODEC_ID_DIRAC,
00173     CODEC_ID_BFI,
00174     CODEC_ID_CMV,
00175     CODEC_ID_MOTIONPIXELS,
00176     CODEC_ID_TGV,
00177     CODEC_ID_TGQ,
00178     CODEC_ID_TQI,
00179     CODEC_ID_AURA,
00180     CODEC_ID_AURA2,
00181     CODEC_ID_V210X,
00182     CODEC_ID_TMV,
00183     CODEC_ID_V210,
00184     CODEC_ID_DPX,
00185     CODEC_ID_MAD,
00186     CODEC_ID_FRWU,
00187     CODEC_ID_FLASHSV2,
00188     CODEC_ID_CDGRAPHICS,
00189     CODEC_ID_R210,
00190     CODEC_ID_ANM,
00191     CODEC_ID_BINKVIDEO,
00192     CODEC_ID_IFF_ILBM,
00193     CODEC_ID_IFF_BYTERUN1,
00194     CODEC_ID_KGV1,
00195     CODEC_ID_YOP,
00196     CODEC_ID_VP8,
00197     CODEC_ID_PICTOR,
00198     CODEC_ID_ANSI,
00199     CODEC_ID_A64_MULTI,
00200     CODEC_ID_A64_MULTI5,
00201     CODEC_ID_R10K,
00202     CODEC_ID_MXPEG,
00203     CODEC_ID_LAGARITH,
00204     CODEC_ID_PRORES,
00205     CODEC_ID_JV,
00206     CODEC_ID_DFA,
00207 
00208     /* various PCM "codecs" */
00209     CODEC_ID_PCM_S16LE= 0x10000,
00210     CODEC_ID_PCM_S16BE,
00211     CODEC_ID_PCM_U16LE,
00212     CODEC_ID_PCM_U16BE,
00213     CODEC_ID_PCM_S8,
00214     CODEC_ID_PCM_U8,
00215     CODEC_ID_PCM_MULAW,
00216     CODEC_ID_PCM_ALAW,
00217     CODEC_ID_PCM_S32LE,
00218     CODEC_ID_PCM_S32BE,
00219     CODEC_ID_PCM_U32LE,
00220     CODEC_ID_PCM_U32BE,
00221     CODEC_ID_PCM_S24LE,
00222     CODEC_ID_PCM_S24BE,
00223     CODEC_ID_PCM_U24LE,
00224     CODEC_ID_PCM_U24BE,
00225     CODEC_ID_PCM_S24DAUD,
00226     CODEC_ID_PCM_ZORK,
00227     CODEC_ID_PCM_S16LE_PLANAR,
00228     CODEC_ID_PCM_DVD,
00229     CODEC_ID_PCM_F32BE,
00230     CODEC_ID_PCM_F32LE,
00231     CODEC_ID_PCM_F64BE,
00232     CODEC_ID_PCM_F64LE,
00233     CODEC_ID_PCM_BLURAY,
00234     CODEC_ID_PCM_LXF,
00235     CODEC_ID_S302M,
00236 
00237     /* various ADPCM codecs */
00238     CODEC_ID_ADPCM_IMA_QT= 0x11000,
00239     CODEC_ID_ADPCM_IMA_WAV,
00240     CODEC_ID_ADPCM_IMA_DK3,
00241     CODEC_ID_ADPCM_IMA_DK4,
00242     CODEC_ID_ADPCM_IMA_WS,
00243     CODEC_ID_ADPCM_IMA_SMJPEG,
00244     CODEC_ID_ADPCM_MS,
00245     CODEC_ID_ADPCM_4XM,
00246     CODEC_ID_ADPCM_XA,
00247     CODEC_ID_ADPCM_ADX,
00248     CODEC_ID_ADPCM_EA,
00249     CODEC_ID_ADPCM_G726,
00250     CODEC_ID_ADPCM_CT,
00251     CODEC_ID_ADPCM_SWF,
00252     CODEC_ID_ADPCM_YAMAHA,
00253     CODEC_ID_ADPCM_SBPRO_4,
00254     CODEC_ID_ADPCM_SBPRO_3,
00255     CODEC_ID_ADPCM_SBPRO_2,
00256     CODEC_ID_ADPCM_THP,
00257     CODEC_ID_ADPCM_IMA_AMV,
00258     CODEC_ID_ADPCM_EA_R1,
00259     CODEC_ID_ADPCM_EA_R3,
00260     CODEC_ID_ADPCM_EA_R2,
00261     CODEC_ID_ADPCM_IMA_EA_SEAD,
00262     CODEC_ID_ADPCM_IMA_EA_EACS,
00263     CODEC_ID_ADPCM_EA_XAS,
00264     CODEC_ID_ADPCM_EA_MAXIS_XA,
00265     CODEC_ID_ADPCM_IMA_ISS,
00266     CODEC_ID_ADPCM_G722,
00267 
00268     /* AMR */
00269     CODEC_ID_AMR_NB= 0x12000,
00270     CODEC_ID_AMR_WB,
00271 
00272     /* RealAudio codecs*/
00273     CODEC_ID_RA_144= 0x13000,
00274     CODEC_ID_RA_288,
00275 
00276     /* various DPCM codecs */
00277     CODEC_ID_ROQ_DPCM= 0x14000,
00278     CODEC_ID_INTERPLAY_DPCM,
00279     CODEC_ID_XAN_DPCM,
00280     CODEC_ID_SOL_DPCM,
00281 
00282     /* audio codecs */
00283     CODEC_ID_MP2= 0x15000,
00284     CODEC_ID_MP3, 
00285     CODEC_ID_AAC,
00286     CODEC_ID_AC3,
00287     CODEC_ID_DTS,
00288     CODEC_ID_VORBIS,
00289     CODEC_ID_DVAUDIO,
00290     CODEC_ID_WMAV1,
00291     CODEC_ID_WMAV2,
00292     CODEC_ID_MACE3,
00293     CODEC_ID_MACE6,
00294     CODEC_ID_VMDAUDIO,
00295     CODEC_ID_SONIC,
00296     CODEC_ID_SONIC_LS,
00297     CODEC_ID_FLAC,
00298     CODEC_ID_MP3ADU,
00299     CODEC_ID_MP3ON4,
00300     CODEC_ID_SHORTEN,
00301     CODEC_ID_ALAC,
00302     CODEC_ID_WESTWOOD_SND1,
00303     CODEC_ID_GSM, 
00304     CODEC_ID_QDM2,
00305     CODEC_ID_COOK,
00306     CODEC_ID_TRUESPEECH,
00307     CODEC_ID_TTA,
00308     CODEC_ID_SMACKAUDIO,
00309     CODEC_ID_QCELP,
00310     CODEC_ID_WAVPACK,
00311     CODEC_ID_DSICINAUDIO,
00312     CODEC_ID_IMC,
00313     CODEC_ID_MUSEPACK7,
00314     CODEC_ID_MLP,
00315     CODEC_ID_GSM_MS, /* as found in WAV */
00316     CODEC_ID_ATRAC3,
00317     CODEC_ID_VOXWARE,
00318     CODEC_ID_APE,
00319     CODEC_ID_NELLYMOSER,
00320     CODEC_ID_MUSEPACK8,
00321     CODEC_ID_SPEEX,
00322     CODEC_ID_WMAVOICE,
00323     CODEC_ID_WMAPRO,
00324     CODEC_ID_WMALOSSLESS,
00325     CODEC_ID_ATRAC3P,
00326     CODEC_ID_EAC3,
00327     CODEC_ID_SIPR,
00328     CODEC_ID_MP1,
00329     CODEC_ID_TWINVQ,
00330     CODEC_ID_TRUEHD,
00331     CODEC_ID_MP4ALS,
00332     CODEC_ID_ATRAC1,
00333     CODEC_ID_BINKAUDIO_RDFT,
00334     CODEC_ID_BINKAUDIO_DCT,
00335     CODEC_ID_AAC_LATM,
00336     CODEC_ID_QDMC,
00337 
00338     /* subtitle codecs */
00339     CODEC_ID_DVD_SUBTITLE= 0x17000,
00340     CODEC_ID_DVB_SUBTITLE,
00341     CODEC_ID_TEXT,  
00342     CODEC_ID_XSUB,
00343     CODEC_ID_SSA,
00344     CODEC_ID_MOV_TEXT,
00345     CODEC_ID_HDMV_PGS_SUBTITLE,
00346     CODEC_ID_DVB_TELETEXT,
00347     CODEC_ID_SRT,
00348 
00349     /* other specific kind of codecs (generally used for attachments) */
00350     CODEC_ID_TTF= 0x18000,
00351 
00352     CODEC_ID_PROBE= 0x19000, 
00353 
00354     CODEC_ID_MPEG2TS= 0x20000, 
00356     CODEC_ID_FFMETADATA=0x21000,   
00357 };
00358 
00359 #if FF_API_OLD_SAMPLE_FMT
00360 #define SampleFormat AVSampleFormat
00361 
00362 #define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE
00363 #define SAMPLE_FMT_U8   AV_SAMPLE_FMT_U8
00364 #define SAMPLE_FMT_S16  AV_SAMPLE_FMT_S16
00365 #define SAMPLE_FMT_S32  AV_SAMPLE_FMT_S32
00366 #define SAMPLE_FMT_FLT  AV_SAMPLE_FMT_FLT
00367 #define SAMPLE_FMT_DBL  AV_SAMPLE_FMT_DBL
00368 #define SAMPLE_FMT_NB   AV_SAMPLE_FMT_NB
00369 #endif
00370 
00371 #if FF_API_OLD_AUDIOCONVERT
00372 #include "libavutil/audioconvert.h"
00373 
00374 /* Audio channel masks */
00375 #define CH_FRONT_LEFT            AV_CH_FRONT_LEFT
00376 #define CH_FRONT_RIGHT           AV_CH_FRONT_RIGHT
00377 #define CH_FRONT_CENTER          AV_CH_FRONT_CENTER
00378 #define CH_LOW_FREQUENCY         AV_CH_LOW_FREQUENCY
00379 #define CH_BACK_LEFT             AV_CH_BACK_LEFT
00380 #define CH_BACK_RIGHT            AV_CH_BACK_RIGHT
00381 #define CH_FRONT_LEFT_OF_CENTER  AV_CH_FRONT_LEFT_OF_CENTER
00382 #define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER
00383 #define CH_BACK_CENTER           AV_CH_BACK_CENTER
00384 #define CH_SIDE_LEFT             AV_CH_SIDE_LEFT
00385 #define CH_SIDE_RIGHT            AV_CH_SIDE_RIGHT
00386 #define CH_TOP_CENTER            AV_CH_TOP_CENTER
00387 #define CH_TOP_FRONT_LEFT        AV_CH_TOP_FRONT_LEFT
00388 #define CH_TOP_FRONT_CENTER      AV_CH_TOP_FRONT_CENTER
00389 #define CH_TOP_FRONT_RIGHT       AV_CH_TOP_FRONT_RIGHT
00390 #define CH_TOP_BACK_LEFT         AV_CH_TOP_BACK_LEFT
00391 #define CH_TOP_BACK_CENTER       AV_CH_TOP_BACK_CENTER
00392 #define CH_TOP_BACK_RIGHT        AV_CH_TOP_BACK_RIGHT
00393 #define CH_STEREO_LEFT           AV_CH_STEREO_LEFT
00394 #define CH_STEREO_RIGHT          AV_CH_STEREO_RIGHT
00395 
00399 #define CH_LAYOUT_NATIVE         AV_CH_LAYOUT_NATIVE
00400 
00401 /* Audio channel convenience macros */
00402 #define CH_LAYOUT_MONO           AV_CH_LAYOUT_MONO
00403 #define CH_LAYOUT_STEREO         AV_CH_LAYOUT_STEREO
00404 #define CH_LAYOUT_2_1            AV_CH_LAYOUT_2_1
00405 #define CH_LAYOUT_SURROUND       AV_CH_LAYOUT_SURROUND
00406 #define CH_LAYOUT_4POINT0        AV_CH_LAYOUT_4POINT0
00407 #define CH_LAYOUT_2_2            AV_CH_LAYOUT_2_2
00408 #define CH_LAYOUT_QUAD           AV_CH_LAYOUT_QUAD
00409 #define CH_LAYOUT_5POINT0        AV_CH_LAYOUT_5POINT0
00410 #define CH_LAYOUT_5POINT1        AV_CH_LAYOUT_5POINT1
00411 #define CH_LAYOUT_5POINT0_BACK   AV_CH_LAYOUT_5POINT0_BACK
00412 #define CH_LAYOUT_5POINT1_BACK   AV_CH_LAYOUT_5POINT1_BACK
00413 #define CH_LAYOUT_7POINT0        AV_CH_LAYOUT_7POINT0
00414 #define CH_LAYOUT_7POINT1        AV_CH_LAYOUT_7POINT1
00415 #define CH_LAYOUT_7POINT1_WIDE   AV_CH_LAYOUT_7POINT1_WIDE
00416 #define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX
00417 #endif
00418 
00419 /* in bytes */
00420 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
00421 
00429 #define FF_INPUT_BUFFER_PADDING_SIZE 8
00430 
00435 #define FF_MIN_BUFFER_SIZE 16384
00436 
00437 
00441 enum Motion_Est_ID {
00442     ME_ZERO = 1,    
00443     ME_FULL,
00444     ME_LOG,
00445     ME_PHODS,
00446     ME_EPZS,        
00447     ME_X1,          
00448     ME_HEX,         
00449     ME_UMH,         
00450     ME_ITER,        
00451     ME_TESA,        
00452 };
00453 
00454 enum AVDiscard{
00455     /* We leave some space between them for extensions (drop some
00456      * keyframes for intra-only or drop just some bidir frames). */
00457     AVDISCARD_NONE   =-16, 
00458     AVDISCARD_DEFAULT=  0, 
00459     AVDISCARD_NONREF =  8, 
00460     AVDISCARD_BIDIR  = 16, 
00461     AVDISCARD_NONKEY = 32, 
00462     AVDISCARD_ALL    = 48, 
00463 };
00464 
00465 enum AVColorPrimaries{
00466     AVCOL_PRI_BT709      =1, 
00467     AVCOL_PRI_UNSPECIFIED=2,
00468     AVCOL_PRI_BT470M     =4,
00469     AVCOL_PRI_BT470BG    =5, 
00470     AVCOL_PRI_SMPTE170M  =6, 
00471     AVCOL_PRI_SMPTE240M  =7, 
00472     AVCOL_PRI_FILM       =8,
00473     AVCOL_PRI_NB           , 
00474 };
00475 
00476 enum AVColorTransferCharacteristic{
00477     AVCOL_TRC_BT709      =1, 
00478     AVCOL_TRC_UNSPECIFIED=2,
00479     AVCOL_TRC_GAMMA22    =4, 
00480     AVCOL_TRC_GAMMA28    =5, 
00481     AVCOL_TRC_NB           , 
00482 };
00483 
00484 enum AVColorSpace{
00485     AVCOL_SPC_RGB        =0,
00486     AVCOL_SPC_BT709      =1, 
00487     AVCOL_SPC_UNSPECIFIED=2,
00488     AVCOL_SPC_FCC        =4,
00489     AVCOL_SPC_BT470BG    =5, 
00490     AVCOL_SPC_SMPTE170M  =6, 
00491     AVCOL_SPC_SMPTE240M  =7,
00492     AVCOL_SPC_NB           , 
00493 };
00494 
00495 enum AVColorRange{
00496     AVCOL_RANGE_UNSPECIFIED=0,
00497     AVCOL_RANGE_MPEG       =1, 
00498     AVCOL_RANGE_JPEG       =2, 
00499     AVCOL_RANGE_NB           , 
00500 };
00501 
00507 enum AVChromaLocation{
00508     AVCHROMA_LOC_UNSPECIFIED=0,
00509     AVCHROMA_LOC_LEFT       =1, 
00510     AVCHROMA_LOC_CENTER     =2, 
00511     AVCHROMA_LOC_TOPLEFT    =3, 
00512     AVCHROMA_LOC_TOP        =4,
00513     AVCHROMA_LOC_BOTTOMLEFT =5,
00514     AVCHROMA_LOC_BOTTOM     =6,
00515     AVCHROMA_LOC_NB           , 
00516 };
00517 
00518 #if FF_API_FLAC_GLOBAL_OPTS
00519 
00522 attribute_deprecated enum AVLPCType {
00523     AV_LPC_TYPE_DEFAULT     = -1, 
00524     AV_LPC_TYPE_NONE        =  0, 
00525     AV_LPC_TYPE_FIXED       =  1, 
00526     AV_LPC_TYPE_LEVINSON    =  2, 
00527     AV_LPC_TYPE_CHOLESKY    =  3, 
00528     AV_LPC_TYPE_NB              , 
00529 };
00530 #endif
00531 
00532 enum AVAudioServiceType {
00533     AV_AUDIO_SERVICE_TYPE_MAIN              = 0,
00534     AV_AUDIO_SERVICE_TYPE_EFFECTS           = 1,
00535     AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
00536     AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED  = 3,
00537     AV_AUDIO_SERVICE_TYPE_DIALOGUE          = 4,
00538     AV_AUDIO_SERVICE_TYPE_COMMENTARY        = 5,
00539     AV_AUDIO_SERVICE_TYPE_EMERGENCY         = 6,
00540     AV_AUDIO_SERVICE_TYPE_VOICE_OVER        = 7,
00541     AV_AUDIO_SERVICE_TYPE_KARAOKE           = 8,
00542     AV_AUDIO_SERVICE_TYPE_NB                   , 
00543 };
00544 
00545 typedef struct RcOverride{
00546     int start_frame;
00547     int end_frame;
00548     int qscale; // If this is 0 then quality_factor will be used instead.
00549     float quality_factor;
00550 } RcOverride;
00551 
00552 #define FF_MAX_B_FRAMES 16
00553 
00554 /* encoding support
00555    These flags can be passed in AVCodecContext.flags before initialization.
00556    Note: Not everything is supported yet.
00557 */
00558 
00559 #define CODEC_FLAG_QSCALE 0x0002  ///< Use fixed qscale.
00560 #define CODEC_FLAG_4MV    0x0004  ///< 4 MV per MB allowed / advanced prediction for H.263.
00561 #define CODEC_FLAG_QPEL   0x0010  ///< Use qpel MC.
00562 #define CODEC_FLAG_GMC    0x0020  ///< Use GMC.
00563 #define CODEC_FLAG_MV0    0x0040  ///< Always try a MB with MV=<0,0>.
00564 #define CODEC_FLAG_PART   0x0080  ///< Use data partitioning.
00565 
00570 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
00571 #define CODEC_FLAG_PASS1           0x0200   ///< Use internal 2pass ratecontrol in first pass mode.
00572 #define CODEC_FLAG_PASS2           0x0400   ///< Use internal 2pass ratecontrol in second pass mode.
00573 #define CODEC_FLAG_EXTERN_HUFF     0x1000   ///< Use external Huffman table (for MJPEG).
00574 #define CODEC_FLAG_GRAY            0x2000   ///< Only decode/encode grayscale.
00575 #define CODEC_FLAG_EMU_EDGE        0x4000   ///< Don't draw edges.
00576 #define CODEC_FLAG_PSNR            0x8000   ///< error[?] variables will be set during encoding.
00577 #define CODEC_FLAG_TRUNCATED       0x00010000 
00579 #define CODEC_FLAG_NORMALIZE_AQP  0x00020000 ///< Normalize adaptive quantization.
00580 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
00581 #define CODEC_FLAG_LOW_DELAY      0x00080000 ///< Force low delay.
00582 #define CODEC_FLAG_ALT_SCAN       0x00100000 ///< Use alternate scan.
00583 #define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< Place global headers in extradata instead of every keyframe.
00584 #define CODEC_FLAG_BITEXACT       0x00800000 ///< Use only bitexact stuff (except (I)DCT).
00585 /* Fx : Flag for h263+ extra options */
00586 #define CODEC_FLAG_AC_PRED        0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
00587 #define CODEC_FLAG_H263P_UMV      0x02000000 ///< unlimited motion vector
00588 #define CODEC_FLAG_CBP_RD         0x04000000 ///< Use rate distortion optimization for cbp.
00589 #define CODEC_FLAG_QP_RD          0x08000000 ///< Use rate distortion optimization for qp selectioon.
00590 #define CODEC_FLAG_H263P_AIV      0x00000008 ///< H.263 alternative inter VLC
00591 #define CODEC_FLAG_OBMC           0x00000001 ///< OBMC
00592 #define CODEC_FLAG_LOOP_FILTER    0x00000800 ///< loop filter
00593 #define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
00594 #define CODEC_FLAG_INTERLACED_ME  0x20000000 ///< interlaced motion estimation
00595 #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data.
00596 #define CODEC_FLAG_CLOSED_GOP     0x80000000
00597 #define CODEC_FLAG2_FAST          0x00000001 ///< Allow non spec compliant speedup tricks.
00598 #define CODEC_FLAG2_STRICT_GOP    0x00000002 ///< Strictly enforce GOP size.
00599 #define CODEC_FLAG2_NO_OUTPUT     0x00000004 ///< Skip bitstream encoding.
00600 #define CODEC_FLAG2_LOCAL_HEADER  0x00000008 ///< Place global headers at every keyframe instead of in extradata.
00601 #define CODEC_FLAG2_BPYRAMID      0x00000010 ///< H.264 allow B-frames to be used as references.
00602 #define CODEC_FLAG2_WPRED         0x00000020 ///< H.264 weighted biprediction for B-frames
00603 #define CODEC_FLAG2_MIXED_REFS    0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
00604 #define CODEC_FLAG2_8X8DCT        0x00000080 ///< H.264 high profile 8x8 transform
00605 #define CODEC_FLAG2_FASTPSKIP     0x00000100 ///< H.264 fast pskip
00606 #define CODEC_FLAG2_AUD           0x00000200 ///< H.264 access unit delimiters
00607 #define CODEC_FLAG2_BRDO          0x00000400 ///< B-frame rate-distortion optimization
00608 #define CODEC_FLAG2_INTRA_VLC     0x00000800 ///< Use MPEG-2 intra VLC table.
00609 #define CODEC_FLAG2_MEMC_ONLY     0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
00610 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
00611 #define CODEC_FLAG2_SKIP_RD       0x00004000 ///< RD optimal MB level residual skipping
00612 #define CODEC_FLAG2_CHUNKS        0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
00613 #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
00614 #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
00615 #define CODEC_FLAG2_MBTREE        0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
00616 #define CODEC_FLAG2_PSY           0x00080000 ///< Use psycho visual optimizations.
00617 #define CODEC_FLAG2_SSIM          0x00100000 ///< Compute SSIM during encoding, error[] values are undefined.
00618 #define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes.
00619 
00620 /* Unsupported options :
00621  *              Syntax Arithmetic coding (SAC)
00622  *              Reference Picture Selection
00623  *              Independent Segment Decoding */
00624 /* /Fx */
00625 /* codec capabilities */
00626 
00627 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
00628 
00633 #define CODEC_CAP_DR1             0x0002
00634 /* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
00635 #define CODEC_CAP_PARSE_ONLY      0x0004
00636 #define CODEC_CAP_TRUNCATED       0x0008
00637 /* Codec can export data for HW decoding (XvMC). */
00638 #define CODEC_CAP_HWACCEL         0x0010
00639 
00643 #define CODEC_CAP_DELAY           0x0020
00644 
00648 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
00649 
00652 #define CODEC_CAP_HWACCEL_VDPAU    0x0080
00653 
00664 #define CODEC_CAP_SUBFRAMES        0x0100
00665 
00669 #define CODEC_CAP_EXPERIMENTAL     0x0200
00670 
00673 #define CODEC_CAP_CHANNEL_CONF     0x0400
00674 
00677 #define CODEC_CAP_NEG_LINESIZES    0x0800
00678 
00681 #define CODEC_CAP_FRAME_THREADS    0x1000
00682 
00685 #define CODEC_CAP_SLICE_THREADS    0x2000
00686 
00687 //The following defines may change, don't expect compatibility if you use them.
00688 #define MB_TYPE_INTRA4x4   0x0001
00689 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
00690 #define MB_TYPE_INTRA_PCM  0x0004 //FIXME H.264-specific
00691 #define MB_TYPE_16x16      0x0008
00692 #define MB_TYPE_16x8       0x0010
00693 #define MB_TYPE_8x16       0x0020
00694 #define MB_TYPE_8x8        0x0040
00695 #define MB_TYPE_INTERLACED 0x0080
00696 #define MB_TYPE_DIRECT2    0x0100 //FIXME
00697 #define MB_TYPE_ACPRED     0x0200
00698 #define MB_TYPE_GMC        0x0400
00699 #define MB_TYPE_SKIP       0x0800
00700 #define MB_TYPE_P0L0       0x1000
00701 #define MB_TYPE_P1L0       0x2000
00702 #define MB_TYPE_P0L1       0x4000
00703 #define MB_TYPE_P1L1       0x8000
00704 #define MB_TYPE_L0         (MB_TYPE_P0L0 | MB_TYPE_P1L0)
00705 #define MB_TYPE_L1         (MB_TYPE_P0L1 | MB_TYPE_P1L1)
00706 #define MB_TYPE_L0L1       (MB_TYPE_L0   | MB_TYPE_L1)
00707 #define MB_TYPE_QUANT      0x00010000
00708 #define MB_TYPE_CBP        0x00020000
00709 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
00710 
00716 typedef struct AVPanScan{
00722     int id;
00723 
00729     int width;
00730     int height;
00731 
00737     int16_t position[3][2];
00738 }AVPanScan;
00739 
00740 #define FF_COMMON_FRAME \
00741 \
00747     uint8_t *data[4];\
00748     int linesize[4];\
00749 \
00755     uint8_t *base[4];\
00756 \
00761     int key_frame;\
00762 \
00763 \
00768     enum AVPictureType pict_type;\
00769 \
00770 \
00776     int64_t pts;\
00777 \
00778 \
00783     int coded_picture_number;\
00784 \
00789     int display_picture_number;\
00790 \
00791 \
00796     int quality; \
00797 \
00798 \
00804     int age;\
00805 \
00806 \
00814     int reference;\
00815 \
00816 \
00821     int8_t *qscale_table;\
00822 \
00827     int qstride;\
00828 \
00829 \
00835     uint8_t *mbskip_table;\
00836 \
00837 \
00849     int16_t (*motion_val[2])[2];\
00850 \
00851 \
00857     uint32_t *mb_type;\
00858 \
00859 \
00865     uint8_t motion_subsample_log2;\
00866 \
00867 \
00872     void *opaque;\
00873 \
00874 \
00879     uint64_t error[4];\
00880 \
00881 \
00887     int type;\
00888     \
00889 \
00895     int repeat_pict;\
00896     \
00897 \
00900     int qscale_type;\
00901     \
00902 \
00907     int interlaced_frame;\
00908     \
00909 \
00914     int top_field_first;\
00915     \
00916 \
00921     AVPanScan *pan_scan;\
00922     \
00923 \
00928     int palette_has_changed;\
00929     \
00930 \
00935     int buffer_hints;\
00936 \
00937 \
00942     short *dct_coeff;\
00943 \
00944 \
00950     int8_t *ref_index[2];\
00951 \
00952 \
00963     int64_t reordered_opaque;\
00964 \
00965 \
00970     void *hwaccel_picture_private;\
00971 \
00972 \
00977     int64_t pkt_pts;\
00978 \
00979 \
00984     int64_t pkt_dts;\
00985 \
00986 \
00991     struct AVCodecContext *owner;\
00992 \
00993 \
00998     void *thread_opaque;\
00999 
01000 #define FF_QSCALE_TYPE_MPEG1 0
01001 #define FF_QSCALE_TYPE_MPEG2 1
01002 #define FF_QSCALE_TYPE_H264  2
01003 #define FF_QSCALE_TYPE_VP56  3
01004 
01005 #define FF_BUFFER_TYPE_INTERNAL 1
01006 #define FF_BUFFER_TYPE_USER     2 ///< direct rendering buffers (image is (de)allocated by user)
01007 #define FF_BUFFER_TYPE_SHARED   4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
01008 #define FF_BUFFER_TYPE_COPY     8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
01009 
01010 #if FF_API_OLD_FF_PICT_TYPES
01011 /* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */
01012 #define FF_I_TYPE  AV_PICTURE_TYPE_I  ///< Intra
01013 #define FF_P_TYPE  AV_PICTURE_TYPE_P  ///< Predicted
01014 #define FF_B_TYPE  AV_PICTURE_TYPE_B  ///< Bi-dir predicted
01015 #define FF_S_TYPE  AV_PICTURE_TYPE_S  ///< S(GMC)-VOP MPEG4
01016 #define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra
01017 #define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted
01018 #define FF_BI_TYPE AV_PICTURE_TYPE_BI
01019 #endif
01020 
01021 #define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore).
01022 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
01023 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
01024 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
01025 
01026 enum AVPacketSideDataType {
01027     AV_PKT_DATA_PALETTE,
01028 };
01029 
01030 typedef struct AVPacket {
01040     int64_t pts;
01046     int64_t dts;
01047     uint8_t *data;
01048     int   size;
01049     int   stream_index;
01050     int   flags;
01055     struct {
01056         uint8_t *data;
01057         int      size;
01058         enum AVPacketSideDataType type;
01059     } *side_data;
01060     int side_data_elems;
01061 
01066     int   duration;
01067     void  (*destruct)(struct AVPacket *);
01068     void  *priv;
01069     int64_t pos;                            
01070 
01088     int64_t convergence_duration;
01089 } AVPacket;
01090 #define AV_PKT_FLAG_KEY   0x0001
01091 
01101 typedef struct AVFrame {
01102     FF_COMMON_FRAME
01103 } AVFrame;
01104 
01112 typedef struct AVCodecContext {
01117     const AVClass *av_class;
01123     int bit_rate;
01124 
01131     int bit_rate_tolerance;
01132 
01138     int flags;
01139 
01148     int sub_id;
01149 
01157     int me_method;
01158 
01170     uint8_t *extradata;
01171     int extradata_size;
01172 
01181     AVRational time_base;
01182 
01183     /* video only */
01191     int width, height;
01192 
01193 #define FF_ASPECT_EXTENDED 15
01194 
01200     int gop_size;
01201 
01209     enum PixelFormat pix_fmt;
01210 
01234     void (*draw_horiz_band)(struct AVCodecContext *s,
01235                             const AVFrame *src, int offset[4],
01236                             int y, int type, int height);
01237 
01238     /* audio only */
01239     int sample_rate; 
01240     int channels;    
01241 
01247     enum AVSampleFormat sample_fmt;  
01248 
01249     /* The following data should not be initialized. */
01253     int frame_size;
01254     int frame_number;   
01255 
01262     int delay;
01263 
01264     /* - encoding parameters */
01265     float qcompress;  
01266     float qblur;      
01267 
01273     int qmin;
01274 
01280     int qmax;
01281 
01287     int max_qdiff;
01288 
01295     int max_b_frames;
01296 
01304     float b_quant_factor;
01305 
01307     int rc_strategy;
01308 #define FF_RC_STRATEGY_XVID 1
01309 
01310     int b_frame_strategy;
01311 
01312     struct AVCodec *codec;
01313 
01314     void *priv_data;
01315 
01316     int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
01317                             /* do its best to deliver a chunk with size     */
01318                             /* below rtp_payload_size, the chunk will start */
01319                             /* with a start code on some codecs like H.263. */
01320                             /* This doesn't take account of any particular  */
01321                             /* headers inside the transmitted RTP payload.  */
01322 
01323 
01324     /* The RTP callback: This function is called    */
01325     /* every time the encoder has a packet to send. */
01326     /* It depends on the encoder if the data starts */
01327     /* with a Start Code (it should). H.263 does.   */
01328     /* mb_nb contains the number of macroblocks     */
01329     /* encoded in the RTP payload.                  */
01330     void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
01331 
01332     /* statistics, used for 2-pass encoding */
01333     int mv_bits;
01334     int header_bits;
01335     int i_tex_bits;
01336     int p_tex_bits;
01337     int i_count;
01338     int p_count;
01339     int skip_count;
01340     int misc_bits;
01341 
01347     int frame_bits;
01348 
01354     void *opaque;
01355 
01356     char codec_name[32];
01357     enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
01358     enum CodecID codec_id; /* see CODEC_ID_xxx */
01359 
01373     unsigned int codec_tag;
01374 
01380     int workaround_bugs;
01381 #define FF_BUG_AUTODETECT       1  ///< autodetection
01382 #define FF_BUG_OLD_MSMPEG4      2
01383 #define FF_BUG_XVID_ILACE       4
01384 #define FF_BUG_UMP4             8
01385 #define FF_BUG_NO_PADDING       16
01386 #define FF_BUG_AMV              32
01387 #define FF_BUG_AC_VLC           0  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
01388 #define FF_BUG_QPEL_CHROMA      64
01389 #define FF_BUG_STD_QPEL         128
01390 #define FF_BUG_QPEL_CHROMA2     256
01391 #define FF_BUG_DIRECT_BLOCKSIZE 512
01392 #define FF_BUG_EDGE             1024
01393 #define FF_BUG_HPEL_CHROMA      2048
01394 #define FF_BUG_DC_CLIP          4096
01395 #define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
01396 #define FF_BUG_TRUNCATED       16384
01397 //#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
01398 
01404     int luma_elim_threshold;
01405 
01411     int chroma_elim_threshold;
01412 
01425     int strict_std_compliance;
01426 #define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
01427 #define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
01428 #define FF_COMPLIANCE_NORMAL        0
01429 #define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
01430 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
01431 
01437     float b_quant_offset;
01438 
01445     int error_recognition;
01446 #define FF_ER_CAREFUL         1
01447 #define FF_ER_COMPLIANT       2
01448 #define FF_ER_AGGRESSIVE      3
01449 #define FF_ER_VERY_AGGRESSIVE 4
01450 
01465     int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
01466 
01476     void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
01477 
01484     int has_b_frames;
01485 
01490     int block_align;
01491 
01492     int parse_only; /* - decoding only: If true, only parsing is done
01493                        (function avcodec_parse_frame()). The frame
01494                        data is returned. Only MPEG codecs support this now. */
01495 
01501     int mpeg_quant;
01502 
01508     char *stats_out;
01509 
01516     char *stats_in;
01517 
01524     float rc_qsquish;
01525 
01526     float rc_qmod_amp;
01527     int rc_qmod_freq;
01528 
01534     RcOverride *rc_override;
01535     int rc_override_count;
01536 
01542     const char *rc_eq;
01543 
01549     int rc_max_rate;
01550 
01556     int rc_min_rate;
01557 
01563     int rc_buffer_size;
01564     float rc_buffer_aggressivity;
01565 
01573     float i_quant_factor;
01574 
01580     float i_quant_offset;
01581 
01587     float rc_initial_cplx;
01588 
01594     int dct_algo;
01595 #define FF_DCT_AUTO    0
01596 #define FF_DCT_FASTINT 1
01597 #define FF_DCT_INT     2
01598 #define FF_DCT_MMX     3
01599 #define FF_DCT_MLIB    4
01600 #define FF_DCT_ALTIVEC 5
01601 #define FF_DCT_FAAN    6
01602 
01608     float lumi_masking;
01609 
01615     float temporal_cplx_masking;
01616 
01622     float spatial_cplx_masking;
01623 
01629     float p_masking;
01630 
01636     float dark_masking;
01637 
01643     int idct_algo;
01644 #define FF_IDCT_AUTO          0
01645 #define FF_IDCT_INT           1
01646 #define FF_IDCT_SIMPLE        2
01647 #define FF_IDCT_SIMPLEMMX     3
01648 #define FF_IDCT_LIBMPEG2MMX   4
01649 #define FF_IDCT_PS2           5
01650 #define FF_IDCT_MLIB          6
01651 #define FF_IDCT_ARM           7
01652 #define FF_IDCT_ALTIVEC       8
01653 #define FF_IDCT_SH4           9
01654 #define FF_IDCT_SIMPLEARM     10
01655 #define FF_IDCT_H264          11
01656 #define FF_IDCT_VP3           12
01657 #define FF_IDCT_IPP           13
01658 #define FF_IDCT_XVIDMMX       14
01659 #define FF_IDCT_CAVS          15
01660 #define FF_IDCT_SIMPLEARMV5TE 16
01661 #define FF_IDCT_SIMPLEARMV6   17
01662 #define FF_IDCT_SIMPLEVIS     18
01663 #define FF_IDCT_WMV2          19
01664 #define FF_IDCT_FAAN          20
01665 #define FF_IDCT_EA            21
01666 #define FF_IDCT_SIMPLENEON    22
01667 #define FF_IDCT_SIMPLEALPHA   23
01668 #define FF_IDCT_BINK          24
01669 
01675     int slice_count;
01681     int *slice_offset;
01682 
01688     int error_concealment;
01689 #define FF_EC_GUESS_MVS   1
01690 #define FF_EC_DEBLOCK     2
01691 
01700     unsigned dsp_mask;
01701 
01707      int bits_per_coded_sample;
01708 
01714      int prediction_method;
01715 #define FF_PRED_LEFT   0
01716 #define FF_PRED_PLANE  1
01717 #define FF_PRED_MEDIAN 2
01718 
01726     AVRational sample_aspect_ratio;
01727 
01733     AVFrame *coded_frame;
01734 
01740     int debug;
01741 #define FF_DEBUG_PICT_INFO   1
01742 #define FF_DEBUG_RC          2
01743 #define FF_DEBUG_BITSTREAM   4
01744 #define FF_DEBUG_MB_TYPE     8
01745 #define FF_DEBUG_QP          16
01746 #define FF_DEBUG_MV          32
01747 #define FF_DEBUG_DCT_COEFF   0x00000040
01748 #define FF_DEBUG_SKIP        0x00000080
01749 #define FF_DEBUG_STARTCODE   0x00000100
01750 #define FF_DEBUG_PTS         0x00000200
01751 #define FF_DEBUG_ER          0x00000400
01752 #define FF_DEBUG_MMCO        0x00000800
01753 #define FF_DEBUG_BUGS        0x00001000
01754 #define FF_DEBUG_VIS_QP      0x00002000
01755 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
01756 #define FF_DEBUG_BUFFERS     0x00008000
01757 #define FF_DEBUG_THREADS     0x00010000
01758 
01764     int debug_mv;
01765 #define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
01766 #define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
01767 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
01768 
01774     uint64_t error[4];
01775 
01781     int me_cmp;
01787     int me_sub_cmp;
01793     int mb_cmp;
01799     int ildct_cmp;
01800 #define FF_CMP_SAD    0
01801 #define FF_CMP_SSE    1
01802 #define FF_CMP_SATD   2
01803 #define FF_CMP_DCT    3
01804 #define FF_CMP_PSNR   4
01805 #define FF_CMP_BIT    5
01806 #define FF_CMP_RD     6
01807 #define FF_CMP_ZERO   7
01808 #define FF_CMP_VSAD   8
01809 #define FF_CMP_VSSE   9
01810 #define FF_CMP_NSSE   10
01811 #define FF_CMP_W53    11
01812 #define FF_CMP_W97    12
01813 #define FF_CMP_DCTMAX 13
01814 #define FF_CMP_DCT264 14
01815 #define FF_CMP_CHROMA 256
01816 
01822     int dia_size;
01823 
01829     int last_predictor_count;
01830 
01836     int pre_me;
01837 
01843     int me_pre_cmp;
01844 
01850     int pre_dia_size;
01851 
01857     int me_subpel_quality;
01858 
01868     enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
01869 
01878     int dtg_active_format;
01879 #define FF_DTG_AFD_SAME         8
01880 #define FF_DTG_AFD_4_3          9
01881 #define FF_DTG_AFD_16_9         10
01882 #define FF_DTG_AFD_14_9         11
01883 #define FF_DTG_AFD_4_3_SP_14_9  13
01884 #define FF_DTG_AFD_16_9_SP_14_9 14
01885 #define FF_DTG_AFD_SP_4_3       15
01886 
01894     int me_range;
01895 
01901     int intra_quant_bias;
01902 #define FF_DEFAULT_QUANT_BIAS 999999
01903 
01909     int inter_quant_bias;
01910 
01917     int color_table_id;
01918 
01923     int internal_buffer_count;
01924 
01929     void *internal_buffer;
01930 
01937     int global_quality;
01938 
01939 #define FF_CODER_TYPE_VLC       0
01940 #define FF_CODER_TYPE_AC        1
01941 #define FF_CODER_TYPE_RAW       2
01942 #define FF_CODER_TYPE_RLE       3
01943 #define FF_CODER_TYPE_DEFLATE   4
01944 
01949     int coder_type;
01950 
01956     int context_model;
01957 #if 0
01958 
01963     uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
01964 #endif
01965 
01971     int slice_flags;
01972 #define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
01973 #define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
01974 #define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
01975 
01981     int xvmc_acceleration;
01982 
01988     int mb_decision;
01989 #define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
01990 #define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
01991 #define FF_MB_DECISION_RD     2        ///< rate distortion
01992 
01998     uint16_t *intra_matrix;
01999 
02005     uint16_t *inter_matrix;
02006 
02013     unsigned int stream_codec_tag;
02014 
02021     int scenechange_threshold;
02022 
02028     int lmin;
02029 
02035     int lmax;
02036 
02037 #if FF_API_PALETTE_CONTROL
02038 
02043     struct AVPaletteControl *palctrl;
02044 #endif
02045 
02051     int noise_reduction;
02052 
02065     int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
02066 
02072     int rc_initial_buffer_occupancy;
02073 
02079     int inter_threshold;
02080 
02086     int flags2;
02087 
02093     int error_rate;
02094 
02095 #if FF_API_ANTIALIAS_ALGO
02096 
02101     attribute_deprecated int antialias_algo;
02102 #define FF_AA_AUTO    0
02103 #define FF_AA_FASTINT 1 //not implemented yet
02104 #define FF_AA_INT     2
02105 #define FF_AA_FLOAT   3
02106 #endif
02107 
02113     int quantizer_noise_shaping;
02114 
02121     int thread_count;
02122 
02132     int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
02133 
02140     void *thread_opaque;
02141 
02149      int me_threshold;
02150 
02156      int mb_threshold;
02157 
02163      int intra_dc_precision;
02164 
02170      int nsse_weight;
02171 
02177      int skip_top;
02178 
02184      int skip_bottom;
02185 
02191      int profile;
02192 #define FF_PROFILE_UNKNOWN -99
02193 #define FF_PROFILE_RESERVED -100
02194 
02195 #define FF_PROFILE_AAC_MAIN 0
02196 #define FF_PROFILE_AAC_LOW  1
02197 #define FF_PROFILE_AAC_SSR  2
02198 #define FF_PROFILE_AAC_LTP  3
02199 
02200 #define FF_PROFILE_DTS         20
02201 #define FF_PROFILE_DTS_ES      30
02202 #define FF_PROFILE_DTS_96_24   40
02203 #define FF_PROFILE_DTS_HD_HRA  50
02204 #define FF_PROFILE_DTS_HD_MA   60
02205 
02206 #define FF_PROFILE_MPEG2_422    0
02207 #define FF_PROFILE_MPEG2_HIGH   1
02208 #define FF_PROFILE_MPEG2_SS     2
02209 #define FF_PROFILE_MPEG2_SNR_SCALABLE  3
02210 #define FF_PROFILE_MPEG2_MAIN   4
02211 #define FF_PROFILE_MPEG2_SIMPLE 5
02212 
02213 #define FF_PROFILE_H264_CONSTRAINED  (1<<9)  // 8+1; constraint_set1_flag
02214 #define FF_PROFILE_H264_INTRA        (1<<11) // 8+3; constraint_set3_flag
02215 
02216 #define FF_PROFILE_H264_BASELINE             66
02217 #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
02218 #define FF_PROFILE_H264_MAIN                 77
02219 #define FF_PROFILE_H264_EXTENDED             88
02220 #define FF_PROFILE_H264_HIGH                 100
02221 #define FF_PROFILE_H264_HIGH_10              110
02222 #define FF_PROFILE_H264_HIGH_10_INTRA        (110|FF_PROFILE_H264_INTRA)
02223 #define FF_PROFILE_H264_HIGH_422             122
02224 #define FF_PROFILE_H264_HIGH_422_INTRA       (122|FF_PROFILE_H264_INTRA)
02225 #define FF_PROFILE_H264_HIGH_444             144
02226 #define FF_PROFILE_H264_HIGH_444_PREDICTIVE  244
02227 #define FF_PROFILE_H264_HIGH_444_INTRA       (244|FF_PROFILE_H264_INTRA)
02228 #define FF_PROFILE_H264_CAVLC_444            44
02229 
02230 #define FF_PROFILE_VC1_SIMPLE   0
02231 #define FF_PROFILE_VC1_MAIN     1
02232 #define FF_PROFILE_VC1_COMPLEX  2
02233 #define FF_PROFILE_VC1_ADVANCED 3
02234 
02240      int level;
02241 #define FF_LEVEL_UNKNOWN -99
02242 
02248      int lowres;
02249 
02256     int coded_width, coded_height;
02257 
02263     int frame_skip_threshold;
02264 
02270     int frame_skip_factor;
02271 
02277     int frame_skip_exp;
02278 
02284     int frame_skip_cmp;
02285 
02292     float border_masking;
02293 
02299     int mb_lmin;
02300 
02306     int mb_lmax;
02307 
02313     int me_penalty_compensation;
02314 
02320     enum AVDiscard skip_loop_filter;
02321 
02327     enum AVDiscard skip_idct;
02328 
02334     enum AVDiscard skip_frame;
02335 
02341     int bidir_refine;
02342 
02348     int brd_scale;
02349 
02355     float crf;
02356 
02362     int cqp;
02363 
02369     int keyint_min;
02370 
02376     int refs;
02377 
02383     int chromaoffset;
02384 
02390     int bframebias;
02391 
02397     int trellis;
02398 
02404     float complexityblur;
02405 
02412     int deblockalpha;
02413 
02420     int deblockbeta;
02421 
02427     int partitions;
02428 #define X264_PART_I4X4 0x001  /* Analyze i4x4 */
02429 #define X264_PART_I8X8 0x002  /* Analyze i8x8 (requires 8x8 transform) */
02430 #define X264_PART_P8X8 0x010  /* Analyze p16x8, p8x16 and p8x8 */
02431 #define X264_PART_P4X4 0x020  /* Analyze p8x4, p4x8, p4x4 */
02432 #define X264_PART_B8X8 0x100  /* Analyze b16x8, b8x16 and b8x8 */
02433 
02439     int directpred;
02440 
02446     int cutoff;
02447 
02453     int scenechange_factor;
02454 
02461     int mv0_threshold;
02462 
02468     int b_sensitivity;
02469 
02474     int compression_level;
02475 #define FF_COMPRESSION_DEFAULT -1
02476 
02481     int min_prediction_order;
02482 
02487     int max_prediction_order;
02488 
02489 #if FF_API_FLAC_GLOBAL_OPTS
02490 
02501     attribute_deprecated int lpc_coeff_precision;
02502 
02508     attribute_deprecated int prediction_order_method;
02509 
02514     attribute_deprecated int min_partition_order;
02515 
02520     attribute_deprecated int max_partition_order;
02524 #endif
02525 
02531     int64_t timecode_frame_start;
02532 
02533 #if FF_API_REQUEST_CHANNELS
02534 
02540     int request_channels;
02541 #endif
02542 
02549     float drc_scale;
02550 
02558     int64_t reordered_opaque;
02559 
02565     int bits_per_raw_sample;
02566 
02572     int64_t channel_layout;
02573 
02579     int64_t request_channel_layout;
02580 
02586     float rc_max_available_vbv_use;
02587 
02593     float rc_min_vbv_overflow_use;
02594 
02600     struct AVHWAccel *hwaccel;
02601 
02609     int ticks_per_frame;
02610 
02621     void *hwaccel_context;
02622 
02628     enum AVColorPrimaries color_primaries;
02629 
02635     enum AVColorTransferCharacteristic color_trc;
02636 
02642     enum AVColorSpace colorspace;
02643 
02649     enum AVColorRange color_range;
02650 
02656     enum AVChromaLocation chroma_sample_location;
02657 
02676     int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
02677 
02686     int weighted_p_pred;
02687 
02696     int aq_mode;
02697 
02704     float aq_strength;
02705 
02712     float psy_rd;
02713 
02720     float psy_trellis;
02721 
02728     int rc_lookahead;
02729 
02737     float crf_max;
02738 
02739     int log_level_offset;
02740 
02741 #if FF_API_FLAC_GLOBAL_OPTS
02742 
02747     attribute_deprecated enum AVLPCType lpc_type;
02748 
02754     attribute_deprecated int lpc_passes;
02755 #endif
02756 
02764     int slices;
02765 
02774     uint8_t *subtitle_header;
02775     int subtitle_header_size;
02776 
02784     AVPacket *pkt;
02785 
02793     int is_copy;
02794 
02803     int thread_type;
02804 #define FF_THREAD_FRAME   1 //< Decode more than one frame at once
02805 #define FF_THREAD_SLICE   2 //< Decode more than one part of a single frame at once
02806 
02812     int active_thread_type;
02813 
02822     int thread_safe_callbacks;
02823 
02830     uint64_t vbv_delay;
02831 
02837     enum AVAudioServiceType audio_service_type;
02838 
02844     enum AVSampleFormat request_sample_fmt;
02845 } AVCodecContext;
02846 
02850 typedef struct AVProfile {
02851     int profile;
02852     const char *name; 
02853 } AVProfile;
02854 
02858 typedef struct AVCodec {
02865     const char *name;
02866     enum AVMediaType type;
02867     enum CodecID id;
02868     int priv_data_size;
02869     int (*init)(AVCodecContext *);
02870     int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
02871     int (*close)(AVCodecContext *);
02872     int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
02877     int capabilities;
02878     struct AVCodec *next;
02883     void (*flush)(AVCodecContext *);
02884     const AVRational *supported_framerates; 
02885     const enum PixelFormat *pix_fmts;       
02886 
02890     const char *long_name;
02891     const int *supported_samplerates;       
02892     const enum AVSampleFormat *sample_fmts; 
02893     const int64_t *channel_layouts;         
02894     uint8_t max_lowres;                     
02895     const AVClass *priv_class;              
02896     const AVProfile *profiles;              
02897 
02907     int (*init_thread_copy)(AVCodecContext *);
02915     int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
02917 } AVCodec;
02918 
02922 typedef struct AVHWAccel {
02928     const char *name;
02929 
02935     enum AVMediaType type;
02936 
02942     enum CodecID id;
02943 
02949     enum PixelFormat pix_fmt;
02950 
02955     int capabilities;
02956 
02957     struct AVHWAccel *next;
02958 
02973     int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
02974 
02986     int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
02987 
02997     int (*end_frame)(AVCodecContext *avctx);
02998 
03006     int priv_data_size;
03007 } AVHWAccel;
03008 
03013 typedef struct AVPicture {
03014     uint8_t *data[4];
03015     int linesize[4];       
03016 } AVPicture;
03017 
03018 #if FF_API_PALETTE_CONTROL
03019 
03027 #define AVPALETTE_SIZE 1024
03028 #define AVPALETTE_COUNT 256
03029 typedef struct AVPaletteControl {
03030 
03031     /* Demuxer sets this to 1 to indicate the palette has changed;
03032      * decoder resets to 0. */
03033     int palette_changed;
03034 
03035     /* 4-byte ARGB palette entries, stored in native byte order; note that
03036      * the individual palette components should be on a 8-bit scale; if
03037      * the palette data comes from an IBM VGA native format, the component
03038      * data is probably 6 bits in size and needs to be scaled. */
03039     unsigned int palette[AVPALETTE_COUNT];
03040 
03041 } AVPaletteControl attribute_deprecated;
03042 #endif
03043 
03044 enum AVSubtitleType {
03045     SUBTITLE_NONE,
03046 
03047     SUBTITLE_BITMAP,                
03048 
03053     SUBTITLE_TEXT,
03054 
03059     SUBTITLE_ASS,
03060 };
03061 
03062 typedef struct AVSubtitleRect {
03063     int x;         
03064     int y;         
03065     int w;         
03066     int h;         
03067     int nb_colors; 
03068 
03073     AVPicture pict;
03074     enum AVSubtitleType type;
03075 
03076     char *text;                     
03077 
03083     char *ass;
03084 } AVSubtitleRect;
03085 
03086 typedef struct AVSubtitle {
03087     uint16_t format; /* 0 = graphics */
03088     uint32_t start_display_time; /* relative to packet pts, in ms */
03089     uint32_t end_display_time; /* relative to packet pts, in ms */
03090     unsigned num_rects;
03091     AVSubtitleRect **rects;
03092     int64_t pts;    
03093 } AVSubtitle;
03094 
03095 /* packet functions */
03096 
03100 attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
03101 
03105 void av_destruct_packet(AVPacket *pkt);
03106 
03112 void av_init_packet(AVPacket *pkt);
03113 
03122 int av_new_packet(AVPacket *pkt, int size);
03123 
03130 void av_shrink_packet(AVPacket *pkt, int size);
03131 
03138 int av_grow_packet(AVPacket *pkt, int grow_by);
03139 
03144 int av_dup_packet(AVPacket *pkt);
03145 
03151 void av_free_packet(AVPacket *pkt);
03152 
03161 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
03162                                  int size);
03163 
03172 uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
03173                                  int *size);
03174 
03175 /* resample.c */
03176 
03177 struct ReSampleContext;
03178 struct AVResampleContext;
03179 
03180 typedef struct ReSampleContext ReSampleContext;
03181 
03198 ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
03199                                         int output_rate, int input_rate,
03200                                         enum AVSampleFormat sample_fmt_out,
03201                                         enum AVSampleFormat sample_fmt_in,
03202                                         int filter_length, int log2_phase_count,
03203                                         int linear, double cutoff);
03204 
03205 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
03206 
03213 void audio_resample_close(ReSampleContext *s);
03214 
03215 
03225 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
03226 
03236 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
03237 
03238 
03251 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
03252 void av_resample_close(struct AVResampleContext *c);
03253 
03265 int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
03266 
03274 void avpicture_free(AVPicture *picture);
03275 
03296 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
03297                    enum PixelFormat pix_fmt, int width, int height);
03298 
03314 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
03315                      unsigned char *dest, int dest_size);
03316 
03329 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
03330 void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
03331 
03332 #if FF_API_GET_PIX_FMT_NAME
03333 
03336 attribute_deprecated
03337 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
03338 #endif
03339 
03340 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
03341 
03347 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt);
03348 
03356 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
03357 
03358 #define FF_LOSS_RESOLUTION  0x0001 
03359 #define FF_LOSS_DEPTH       0x0002 
03360 #define FF_LOSS_COLORSPACE  0x0004 
03361 #define FF_LOSS_ALPHA       0x0008 
03362 #define FF_LOSS_COLORQUANT  0x0010 
03363 #define FF_LOSS_CHROMA      0x0020 
03382 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
03383                              int has_alpha);
03384 
03407 enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
03408                               int has_alpha, int *loss_ptr);
03409 
03410 #define FF_ALPHA_TRANSP       0x0001 /* image has some totally transparent pixels */
03411 #define FF_ALPHA_SEMI_TRANSP  0x0002 /* image has some transparent pixels */
03412 
03417 int img_get_alpha_info(const AVPicture *src,
03418                        enum PixelFormat pix_fmt, int width, int height);
03419 
03420 /* deinterlace a picture */
03421 /* deinterlace - if not supported return -1 */
03422 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
03423                           enum PixelFormat pix_fmt, int width, int height);
03424 
03425 /* external high level API */
03426 
03432 AVCodec *av_codec_next(AVCodec *c);
03433 
03437 unsigned avcodec_version(void);
03438 
03442 const char *avcodec_configuration(void);
03443 
03447 const char *avcodec_license(void);
03448 
03458 void avcodec_init(void);
03459 
03465 void avcodec_register(AVCodec *codec);
03466 
03473 AVCodec *avcodec_find_encoder(enum CodecID id);
03474 
03481 AVCodec *avcodec_find_encoder_by_name(const char *name);
03482 
03489 AVCodec *avcodec_find_decoder(enum CodecID id);
03490 
03497 AVCodec *avcodec_find_decoder_by_name(const char *name);
03498 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
03499 
03507 const char *av_get_profile_name(const AVCodec *codec, int profile);
03508 
03514 void avcodec_get_context_defaults(AVCodecContext *s);
03515 
03518 void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
03519 
03522 int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
03523 
03531 AVCodecContext *avcodec_alloc_context(void);
03532 
03535 AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
03536 
03539 AVCodecContext *avcodec_alloc_context3(AVCodec *codec);
03540 
03552 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
03553 
03559 void avcodec_get_frame_defaults(AVFrame *pic);
03560 
03568 AVFrame *avcodec_alloc_frame(void);
03569 
03570 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
03571 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
03572 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
03573 
03581 unsigned avcodec_get_edge_width(void);
03591 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
03601 void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
03602                                int linesize_align[4]);
03603 
03604 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
03605 
03606 #if FF_API_THREAD_INIT
03607 
03610 attribute_deprecated
03611 int avcodec_thread_init(AVCodecContext *s, int thread_count);
03612 #endif
03613 
03614 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
03615 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
03616 //FIXME func typedef
03617 
03645 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
03646 
03686 int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
03687                          int *frame_size_ptr,
03688                          AVPacket *avpkt);
03689 
03730 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
03731                          int *got_picture_ptr,
03732                          AVPacket *avpkt);
03733 
03750 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
03751                             int *got_sub_ptr,
03752                             AVPacket *avpkt);
03753 
03759 void avsubtitle_free(AVSubtitle *sub);
03760 
03761 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
03762                         int *data_size_ptr,
03763                         uint8_t *buf, int buf_size);
03764 
03784 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
03785                          const short *samples);
03786 
03799 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
03800                          const AVFrame *pict);
03801 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
03802                             const AVSubtitle *sub);
03803 
03804 int avcodec_close(AVCodecContext *avctx);
03805 
03816 void avcodec_register_all(void);
03817 
03821 void avcodec_flush_buffers(AVCodecContext *avctx);
03822 
03823 void avcodec_default_free_buffers(AVCodecContext *s);
03824 
03825 /* misc useful functions */
03826 
03827 #if FF_API_OLD_FF_PICT_TYPES
03828 
03835 attribute_deprecated
03836 char av_get_pict_type_char(int pict_type);
03837 #endif
03838 
03845 int av_get_bits_per_sample(enum CodecID codec_id);
03846 
03847 #if FF_API_OLD_SAMPLE_FMT
03848 
03851 attribute_deprecated
03852 int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt);
03853 #endif
03854 
03855 /* frame parsing */
03856 typedef struct AVCodecParserContext {
03857     void *priv_data;
03858     struct AVCodecParser *parser;
03859     int64_t frame_offset; /* offset of the current frame */
03860     int64_t cur_offset; /* current offset
03861                            (incremented by each av_parser_parse()) */
03862     int64_t next_frame_offset; /* offset of the next frame */
03863     /* video info */
03864     int pict_type; /* XXX: Put it back in AVCodecContext. */
03874     int repeat_pict; /* XXX: Put it back in AVCodecContext. */
03875     int64_t pts;     /* pts of the current frame */
03876     int64_t dts;     /* dts of the current frame */
03877 
03878     /* private data */
03879     int64_t last_pts;
03880     int64_t last_dts;
03881     int fetch_timestamp;
03882 
03883 #define AV_PARSER_PTS_NB 4
03884     int cur_frame_start_index;
03885     int64_t cur_frame_offset[AV_PARSER_PTS_NB];
03886     int64_t cur_frame_pts[AV_PARSER_PTS_NB];
03887     int64_t cur_frame_dts[AV_PARSER_PTS_NB];
03888 
03889     int flags;
03890 #define PARSER_FLAG_COMPLETE_FRAMES           0x0001
03891 #define PARSER_FLAG_ONCE                      0x0002
03892 
03893 #define PARSER_FLAG_FETCHED_OFFSET            0x0004
03894 
03895     int64_t offset;      
03896     int64_t cur_frame_end[AV_PARSER_PTS_NB];
03897 
03904     int key_frame;
03905 
03923     int64_t convergence_duration;
03924 
03925     // Timestamp generation support:
03935     int dts_sync_point;
03936 
03950     int dts_ref_dts_delta;
03951 
03964     int pts_dts_delta;
03965 
03971     int64_t cur_frame_pos[AV_PARSER_PTS_NB];
03972 
03976     int64_t pos;
03977 
03981     int64_t last_pos;
03982 } AVCodecParserContext;
03983 
03984 typedef struct AVCodecParser {
03985     int codec_ids[5]; /* several codec IDs are permitted */
03986     int priv_data_size;
03987     int (*parser_init)(AVCodecParserContext *s);
03988     int (*parser_parse)(AVCodecParserContext *s,
03989                         AVCodecContext *avctx,
03990                         const uint8_t **poutbuf, int *poutbuf_size,
03991                         const uint8_t *buf, int buf_size);
03992     void (*parser_close)(AVCodecParserContext *s);
03993     int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
03994     struct AVCodecParser *next;
03995 } AVCodecParser;
03996 
03997 AVCodecParser *av_parser_next(AVCodecParser *c);
03998 
03999 void av_register_codec_parser(AVCodecParser *parser);
04000 AVCodecParserContext *av_parser_init(int codec_id);
04001 
04030 int av_parser_parse2(AVCodecParserContext *s,
04031                      AVCodecContext *avctx,
04032                      uint8_t **poutbuf, int *poutbuf_size,
04033                      const uint8_t *buf, int buf_size,
04034                      int64_t pts, int64_t dts,
04035                      int64_t pos);
04036 
04037 int av_parser_change(AVCodecParserContext *s,
04038                      AVCodecContext *avctx,
04039                      uint8_t **poutbuf, int *poutbuf_size,
04040                      const uint8_t *buf, int buf_size, int keyframe);
04041 void av_parser_close(AVCodecParserContext *s);
04042 
04043 
04044 typedef struct AVBitStreamFilterContext {
04045     void *priv_data;
04046     struct AVBitStreamFilter *filter;
04047     AVCodecParserContext *parser;
04048     struct AVBitStreamFilterContext *next;
04049 } AVBitStreamFilterContext;
04050 
04051 
04052 typedef struct AVBitStreamFilter {
04053     const char *name;
04054     int priv_data_size;
04055     int (*filter)(AVBitStreamFilterContext *bsfc,
04056                   AVCodecContext *avctx, const char *args,
04057                   uint8_t **poutbuf, int *poutbuf_size,
04058                   const uint8_t *buf, int buf_size, int keyframe);
04059     void (*close)(AVBitStreamFilterContext *bsfc);
04060     struct AVBitStreamFilter *next;
04061 } AVBitStreamFilter;
04062 
04063 void av_register_bitstream_filter(AVBitStreamFilter *bsf);
04064 AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
04065 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
04066                                AVCodecContext *avctx, const char *args,
04067                                uint8_t **poutbuf, int *poutbuf_size,
04068                                const uint8_t *buf, int buf_size, int keyframe);
04069 void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
04070 
04071 AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
04072 
04073 /* memory */
04074 
04080 void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
04081 
04094 void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
04095 
04099 void av_picture_copy(AVPicture *dst, const AVPicture *src,
04100                      enum PixelFormat pix_fmt, int width, int height);
04101 
04105 int av_picture_crop(AVPicture *dst, const AVPicture *src,
04106                     enum PixelFormat pix_fmt, int top_band, int left_band);
04107 
04111 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
04112             int padtop, int padbottom, int padleft, int padright, int *color);
04113 
04121 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
04122 
04135 void av_log_missing_feature(void *avc, const char *feature, int want_sample);
04136 
04145 void av_log_ask_for_sample(void *avc, const char *msg, ...);
04146 
04150 void av_register_hwaccel(AVHWAccel *hwaccel);
04151 
04157 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
04158 
04159 
04163 enum AVLockOp {
04164   AV_LOCK_CREATE,  
04165   AV_LOCK_OBTAIN,  
04166   AV_LOCK_RELEASE, 
04167   AV_LOCK_DESTROY, 
04168 };
04169 
04183 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
04184 
04185 #endif /* AVCODEC_AVCODEC_H */