• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/avcodec.h

Go to the documentation of this file.
00001 /*
00002  * copyright (c) 2001 Fabrice Bellard
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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/avutil.h"
00031 
00032 #define LIBAVCODEC_VERSION_MAJOR 52
00033 #define LIBAVCODEC_VERSION_MINOR 20
00034 #define LIBAVCODEC_VERSION_MICRO  1
00035 
00036 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
00037                                                LIBAVCODEC_VERSION_MINOR, \
00038                                                LIBAVCODEC_VERSION_MICRO)
00039 #define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
00040                                            LIBAVCODEC_VERSION_MINOR,    \
00041                                            LIBAVCODEC_VERSION_MICRO)
00042 #define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
00043 
00044 #define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
00045 
00046 #define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
00047 #define AV_TIME_BASE            1000000
00048 #define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
00049 
00062 enum CodecID {
00063     CODEC_ID_NONE,
00064 
00065     /* video codecs */
00066     CODEC_ID_MPEG1VIDEO,
00067     CODEC_ID_MPEG2VIDEO, 
00068     CODEC_ID_MPEG2VIDEO_XVMC,
00069     CODEC_ID_H261,
00070     CODEC_ID_H263,
00071     CODEC_ID_RV10,
00072     CODEC_ID_RV20,
00073     CODEC_ID_MJPEG,
00074     CODEC_ID_MJPEGB,
00075     CODEC_ID_LJPEG,
00076     CODEC_ID_SP5X,
00077     CODEC_ID_JPEGLS,
00078     CODEC_ID_MPEG4,
00079     CODEC_ID_RAWVIDEO,
00080     CODEC_ID_MSMPEG4V1,
00081     CODEC_ID_MSMPEG4V2,
00082     CODEC_ID_MSMPEG4V3,
00083     CODEC_ID_WMV1,
00084     CODEC_ID_WMV2,
00085     CODEC_ID_H263P,
00086     CODEC_ID_H263I,
00087     CODEC_ID_FLV1,
00088     CODEC_ID_SVQ1,
00089     CODEC_ID_SVQ3,
00090     CODEC_ID_DVVIDEO,
00091     CODEC_ID_HUFFYUV,
00092     CODEC_ID_CYUV,
00093     CODEC_ID_H264,
00094     CODEC_ID_INDEO3,
00095     CODEC_ID_VP3,
00096     CODEC_ID_THEORA,
00097     CODEC_ID_ASV1,
00098     CODEC_ID_ASV2,
00099     CODEC_ID_FFV1,
00100     CODEC_ID_4XM,
00101     CODEC_ID_VCR1,
00102     CODEC_ID_CLJR,
00103     CODEC_ID_MDEC,
00104     CODEC_ID_ROQ,
00105     CODEC_ID_INTERPLAY_VIDEO,
00106     CODEC_ID_XAN_WC3,
00107     CODEC_ID_XAN_WC4,
00108     CODEC_ID_RPZA,
00109     CODEC_ID_CINEPAK,
00110     CODEC_ID_WS_VQA,
00111     CODEC_ID_MSRLE,
00112     CODEC_ID_MSVIDEO1,
00113     CODEC_ID_IDCIN,
00114     CODEC_ID_8BPS,
00115     CODEC_ID_SMC,
00116     CODEC_ID_FLIC,
00117     CODEC_ID_TRUEMOTION1,
00118     CODEC_ID_VMDVIDEO,
00119     CODEC_ID_MSZH,
00120     CODEC_ID_ZLIB,
00121     CODEC_ID_QTRLE,
00122     CODEC_ID_SNOW,
00123     CODEC_ID_TSCC,
00124     CODEC_ID_ULTI,
00125     CODEC_ID_QDRAW,
00126     CODEC_ID_VIXL,
00127     CODEC_ID_QPEG,
00128     CODEC_ID_XVID,
00129     CODEC_ID_PNG,
00130     CODEC_ID_PPM,
00131     CODEC_ID_PBM,
00132     CODEC_ID_PGM,
00133     CODEC_ID_PGMYUV,
00134     CODEC_ID_PAM,
00135     CODEC_ID_FFVHUFF,
00136     CODEC_ID_RV30,
00137     CODEC_ID_RV40,
00138     CODEC_ID_VC1,
00139     CODEC_ID_WMV3,
00140     CODEC_ID_LOCO,
00141     CODEC_ID_WNV1,
00142     CODEC_ID_AASC,
00143     CODEC_ID_INDEO2,
00144     CODEC_ID_FRAPS,
00145     CODEC_ID_TRUEMOTION2,
00146     CODEC_ID_BMP,
00147     CODEC_ID_CSCD,
00148     CODEC_ID_MMVIDEO,
00149     CODEC_ID_ZMBV,
00150     CODEC_ID_AVS,
00151     CODEC_ID_SMACKVIDEO,
00152     CODEC_ID_NUV,
00153     CODEC_ID_KMVC,
00154     CODEC_ID_FLASHSV,
00155     CODEC_ID_CAVS,
00156     CODEC_ID_JPEG2000,
00157     CODEC_ID_VMNC,
00158     CODEC_ID_VP5,
00159     CODEC_ID_VP6,
00160     CODEC_ID_VP6F,
00161     CODEC_ID_TARGA,
00162     CODEC_ID_DSICINVIDEO,
00163     CODEC_ID_TIERTEXSEQVIDEO,
00164     CODEC_ID_TIFF,
00165     CODEC_ID_GIF,
00166     CODEC_ID_FFH264,
00167     CODEC_ID_DXA,
00168     CODEC_ID_DNXHD,
00169     CODEC_ID_THP,
00170     CODEC_ID_SGI,
00171     CODEC_ID_C93,
00172     CODEC_ID_BETHSOFTVID,
00173     CODEC_ID_PTX,
00174     CODEC_ID_TXD,
00175     CODEC_ID_VP6A,
00176     CODEC_ID_AMV,
00177     CODEC_ID_VB,
00178     CODEC_ID_PCX,
00179     CODEC_ID_SUNRAST,
00180     CODEC_ID_INDEO4,
00181     CODEC_ID_INDEO5,
00182     CODEC_ID_MIMIC,
00183     CODEC_ID_RL2,
00184     CODEC_ID_8SVX_EXP,
00185     CODEC_ID_8SVX_FIB,
00186     CODEC_ID_ESCAPE124,
00187     CODEC_ID_DIRAC,
00188     CODEC_ID_BFI,
00189     CODEC_ID_CMV,
00190     CODEC_ID_MOTIONPIXELS,
00191     CODEC_ID_TGV,
00192     CODEC_ID_TGQ,
00193     CODEC_ID_TQI,
00194 
00195     /* various PCM "codecs" */
00196     CODEC_ID_PCM_S16LE= 0x10000,
00197     CODEC_ID_PCM_S16BE,
00198     CODEC_ID_PCM_U16LE,
00199     CODEC_ID_PCM_U16BE,
00200     CODEC_ID_PCM_S8,
00201     CODEC_ID_PCM_U8,
00202     CODEC_ID_PCM_MULAW,
00203     CODEC_ID_PCM_ALAW,
00204     CODEC_ID_PCM_S32LE,
00205     CODEC_ID_PCM_S32BE,
00206     CODEC_ID_PCM_U32LE,
00207     CODEC_ID_PCM_U32BE,
00208     CODEC_ID_PCM_S24LE,
00209     CODEC_ID_PCM_S24BE,
00210     CODEC_ID_PCM_U24LE,
00211     CODEC_ID_PCM_U24BE,
00212     CODEC_ID_PCM_S24DAUD,
00213     CODEC_ID_PCM_ZORK,
00214     CODEC_ID_PCM_S16LE_PLANAR,
00215     CODEC_ID_PCM_DVD,
00216     CODEC_ID_PCM_F32BE,
00217     CODEC_ID_PCM_F32LE,
00218     CODEC_ID_PCM_F64BE,
00219     CODEC_ID_PCM_F64LE,
00220 
00221     /* various ADPCM codecs */
00222     CODEC_ID_ADPCM_IMA_QT= 0x11000,
00223     CODEC_ID_ADPCM_IMA_WAV,
00224     CODEC_ID_ADPCM_IMA_DK3,
00225     CODEC_ID_ADPCM_IMA_DK4,
00226     CODEC_ID_ADPCM_IMA_WS,
00227     CODEC_ID_ADPCM_IMA_SMJPEG,
00228     CODEC_ID_ADPCM_MS,
00229     CODEC_ID_ADPCM_4XM,
00230     CODEC_ID_ADPCM_XA,
00231     CODEC_ID_ADPCM_ADX,
00232     CODEC_ID_ADPCM_EA,
00233     CODEC_ID_ADPCM_G726,
00234     CODEC_ID_ADPCM_CT,
00235     CODEC_ID_ADPCM_SWF,
00236     CODEC_ID_ADPCM_YAMAHA,
00237     CODEC_ID_ADPCM_SBPRO_4,
00238     CODEC_ID_ADPCM_SBPRO_3,
00239     CODEC_ID_ADPCM_SBPRO_2,
00240     CODEC_ID_ADPCM_THP,
00241     CODEC_ID_ADPCM_IMA_AMV,
00242     CODEC_ID_ADPCM_EA_R1,
00243     CODEC_ID_ADPCM_EA_R3,
00244     CODEC_ID_ADPCM_EA_R2,
00245     CODEC_ID_ADPCM_IMA_EA_SEAD,
00246     CODEC_ID_ADPCM_IMA_EA_EACS,
00247     CODEC_ID_ADPCM_EA_XAS,
00248     CODEC_ID_ADPCM_EA_MAXIS_XA,
00249     CODEC_ID_ADPCM_IMA_ISS,
00250 
00251     /* AMR */
00252     CODEC_ID_AMR_NB= 0x12000,
00253     CODEC_ID_AMR_WB,
00254 
00255     /* RealAudio codecs*/
00256     CODEC_ID_RA_144= 0x13000,
00257     CODEC_ID_RA_288,
00258 
00259     /* various DPCM codecs */
00260     CODEC_ID_ROQ_DPCM= 0x14000,
00261     CODEC_ID_INTERPLAY_DPCM,
00262     CODEC_ID_XAN_DPCM,
00263     CODEC_ID_SOL_DPCM,
00264 
00265     /* audio codecs */
00266     CODEC_ID_MP2= 0x15000,
00267     CODEC_ID_MP3, 
00268     CODEC_ID_AAC,
00269     CODEC_ID_AC3,
00270     CODEC_ID_DTS,
00271     CODEC_ID_VORBIS,
00272     CODEC_ID_DVAUDIO,
00273     CODEC_ID_WMAV1,
00274     CODEC_ID_WMAV2,
00275     CODEC_ID_MACE3,
00276     CODEC_ID_MACE6,
00277     CODEC_ID_VMDAUDIO,
00278     CODEC_ID_SONIC,
00279     CODEC_ID_SONIC_LS,
00280     CODEC_ID_FLAC,
00281     CODEC_ID_MP3ADU,
00282     CODEC_ID_MP3ON4,
00283     CODEC_ID_SHORTEN,
00284     CODEC_ID_ALAC,
00285     CODEC_ID_WESTWOOD_SND1,
00286     CODEC_ID_GSM, 
00287     CODEC_ID_QDM2,
00288     CODEC_ID_COOK,
00289     CODEC_ID_TRUESPEECH,
00290     CODEC_ID_TTA,
00291     CODEC_ID_SMACKAUDIO,
00292     CODEC_ID_QCELP,
00293     CODEC_ID_WAVPACK,
00294     CODEC_ID_DSICINAUDIO,
00295     CODEC_ID_IMC,
00296     CODEC_ID_MUSEPACK7,
00297     CODEC_ID_MLP,
00298     CODEC_ID_GSM_MS, /* as found in WAV */
00299     CODEC_ID_ATRAC3,
00300     CODEC_ID_VOXWARE,
00301     CODEC_ID_APE,
00302     CODEC_ID_NELLYMOSER,
00303     CODEC_ID_MUSEPACK8,
00304     CODEC_ID_SPEEX,
00305     CODEC_ID_WMAVOICE,
00306     CODEC_ID_WMAPRO,
00307     CODEC_ID_WMALOSSLESS,
00308     CODEC_ID_ATRAC3P,
00309     CODEC_ID_EAC3,
00310     CODEC_ID_SIPR,
00311     CODEC_ID_MP1,
00312 
00313     /* subtitle codecs */
00314     CODEC_ID_DVD_SUBTITLE= 0x17000,
00315     CODEC_ID_DVB_SUBTITLE,
00316     CODEC_ID_TEXT,  
00317     CODEC_ID_XSUB,
00318     CODEC_ID_SSA,
00319     CODEC_ID_MOV_TEXT,
00320 
00321     /* other specific kind of codecs (generally used for attachments) */
00322     CODEC_ID_TTF= 0x18000,
00323 
00324     CODEC_ID_PROBE= 0x19000, 
00325 
00326     CODEC_ID_MPEG2TS= 0x20000, 
00328 };
00329 
00330 enum CodecType {
00331     CODEC_TYPE_UNKNOWN = -1,
00332     CODEC_TYPE_VIDEO,
00333     CODEC_TYPE_AUDIO,
00334     CODEC_TYPE_DATA,
00335     CODEC_TYPE_SUBTITLE,
00336     CODEC_TYPE_ATTACHMENT,
00337     CODEC_TYPE_NB
00338 };
00339 
00343 enum SampleFormat {
00344     SAMPLE_FMT_NONE = -1,
00345     SAMPLE_FMT_U8,              
00346     SAMPLE_FMT_S16,             
00347     SAMPLE_FMT_S32,             
00348     SAMPLE_FMT_FLT,             
00349     SAMPLE_FMT_DBL,             
00350     SAMPLE_FMT_NB               
00351 };
00352 
00353 /* Audio channel masks */
00354 #define CH_FRONT_LEFT             0x00000001
00355 #define CH_FRONT_RIGHT            0x00000002
00356 #define CH_FRONT_CENTER           0x00000004
00357 #define CH_LOW_FREQUENCY          0x00000008
00358 #define CH_BACK_LEFT              0x00000010
00359 #define CH_BACK_RIGHT             0x00000020
00360 #define CH_FRONT_LEFT_OF_CENTER   0x00000040
00361 #define CH_FRONT_RIGHT_OF_CENTER  0x00000080
00362 #define CH_BACK_CENTER            0x00000100
00363 #define CH_SIDE_LEFT              0x00000200
00364 #define CH_SIDE_RIGHT             0x00000400
00365 #define CH_TOP_CENTER             0x00000800
00366 #define CH_TOP_FRONT_LEFT         0x00001000
00367 #define CH_TOP_FRONT_CENTER       0x00002000
00368 #define CH_TOP_FRONT_RIGHT        0x00004000
00369 #define CH_TOP_BACK_LEFT          0x00008000
00370 #define CH_TOP_BACK_CENTER        0x00010000
00371 #define CH_TOP_BACK_RIGHT         0x00020000
00372 #define CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
00373 #define CH_STEREO_RIGHT           0x40000000  ///< See CH_STEREO_LEFT.
00374 
00375 /* Audio channel convenience macros */
00376 #define CH_LAYOUT_MONO              (CH_FRONT_CENTER)
00377 #define CH_LAYOUT_STEREO            (CH_FRONT_LEFT|CH_FRONT_RIGHT)
00378 #define CH_LAYOUT_SURROUND          (CH_LAYOUT_STEREO|CH_FRONT_CENTER)
00379 #define CH_LAYOUT_QUAD              (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT)
00380 #define CH_LAYOUT_5POINT0           (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT)
00381 #define CH_LAYOUT_5POINT1           (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY)
00382 #define CH_LAYOUT_7POINT1           (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT)
00383 #define CH_LAYOUT_7POINT1_WIDE      (CH_LAYOUT_SURROUND|CH_LOW_FREQUENCY|\
00384                                           CH_BACK_LEFT|CH_BACK_RIGHT|\
00385                                           CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER)
00386 #define CH_LAYOUT_STEREO_DOWNMIX    (CH_STEREO_LEFT|CH_STEREO_RIGHT)
00387 
00388 /* in bytes */
00389 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
00390 
00398 #define FF_INPUT_BUFFER_PADDING_SIZE 8
00399 
00404 #define FF_MIN_BUFFER_SIZE 16384
00405 
00406 
00410 enum Motion_Est_ID {
00411     ME_ZERO = 1,    
00412     ME_FULL,
00413     ME_LOG,
00414     ME_PHODS,
00415     ME_EPZS,        
00416     ME_X1,          
00417     ME_HEX,         
00418     ME_UMH,         
00419     ME_ITER,        
00420     ME_TESA,        
00421 };
00422 
00423 enum AVDiscard{
00424     /* We leave some space between them for extensions (drop some
00425      * keyframes for intra-only or drop just some bidir frames). */
00426     AVDISCARD_NONE   =-16, 
00427     AVDISCARD_DEFAULT=  0, 
00428     AVDISCARD_NONREF =  8, 
00429     AVDISCARD_BIDIR  = 16, 
00430     AVDISCARD_NONKEY = 32, 
00431     AVDISCARD_ALL    = 48, 
00432 };
00433 
00434 typedef struct RcOverride{
00435     int start_frame;
00436     int end_frame;
00437     int qscale; // If this is 0 then quality_factor will be used instead.
00438     float quality_factor;
00439 } RcOverride;
00440 
00441 #define FF_MAX_B_FRAMES 16
00442 
00443 /* encoding support
00444    These flags can be passed in AVCodecContext.flags before initialization.
00445    Note: Not everything is supported yet.
00446 */
00447 
00448 #define CODEC_FLAG_QSCALE 0x0002  ///< Use fixed qscale.
00449 #define CODEC_FLAG_4MV    0x0004  ///< 4 MV per MB allowed / advanced prediction for H.263.
00450 #define CODEC_FLAG_QPEL   0x0010  ///< Use qpel MC.
00451 #define CODEC_FLAG_GMC    0x0020  ///< Use GMC.
00452 #define CODEC_FLAG_MV0    0x0040  ///< Always try a MB with MV=<0,0>.
00453 #define CODEC_FLAG_PART   0x0080  ///< Use data partitioning.
00454 
00459 #define CODEC_FLAG_INPUT_PRESERVED 0x0100
00460 #define CODEC_FLAG_PASS1           0x0200   ///< Use internal 2pass ratecontrol in first pass mode.
00461 #define CODEC_FLAG_PASS2           0x0400   ///< Use internal 2pass ratecontrol in second pass mode.
00462 #define CODEC_FLAG_EXTERN_HUFF     0x1000   ///< Use external Huffman table (for MJPEG).
00463 #define CODEC_FLAG_GRAY            0x2000   ///< Only decode/encode grayscale.
00464 #define CODEC_FLAG_EMU_EDGE        0x4000   ///< Don't draw edges.
00465 #define CODEC_FLAG_PSNR            0x8000   ///< error[?] variables will be set during encoding.
00466 #define CODEC_FLAG_TRUNCATED       0x00010000 
00468 #define CODEC_FLAG_NORMALIZE_AQP  0x00020000 ///< Normalize adaptive quantization.
00469 #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
00470 #define CODEC_FLAG_LOW_DELAY      0x00080000 ///< Force low delay.
00471 #define CODEC_FLAG_ALT_SCAN       0x00100000 ///< Use alternate scan.
00472 #define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< Place global headers in extradata instead of every keyframe.
00473 #define CODEC_FLAG_BITEXACT       0x00800000 ///< Use only bitexact stuff (except (I)DCT).
00474 /* Fx : Flag for h263+ extra options */
00475 #define CODEC_FLAG_AC_PRED        0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
00476 #define CODEC_FLAG_H263P_UMV      0x02000000 ///< unlimited motion vector
00477 #define CODEC_FLAG_CBP_RD         0x04000000 ///< Use rate distortion optimization for cbp.
00478 #define CODEC_FLAG_QP_RD          0x08000000 ///< Use rate distortion optimization for qp selectioon.
00479 #define CODEC_FLAG_H263P_AIV      0x00000008 ///< H.263 alternative inter VLC
00480 #define CODEC_FLAG_OBMC           0x00000001 ///< OBMC
00481 #define CODEC_FLAG_LOOP_FILTER    0x00000800 ///< loop filter
00482 #define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
00483 #define CODEC_FLAG_INTERLACED_ME  0x20000000 ///< interlaced motion estimation
00484 #define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data.
00485 #define CODEC_FLAG_CLOSED_GOP     0x80000000
00486 #define CODEC_FLAG2_FAST          0x00000001 ///< Allow non spec compliant speedup tricks.
00487 #define CODEC_FLAG2_STRICT_GOP    0x00000002 ///< Strictly enforce GOP size.
00488 #define CODEC_FLAG2_NO_OUTPUT     0x00000004 ///< Skip bitstream encoding.
00489 #define CODEC_FLAG2_LOCAL_HEADER  0x00000008 ///< Place global headers at every keyframe instead of in extradata.
00490 #define CODEC_FLAG2_BPYRAMID      0x00000010 ///< H.264 allow B-frames to be used as references.
00491 #define CODEC_FLAG2_WPRED         0x00000020 ///< H.264 weighted biprediction for B-frames
00492 #define CODEC_FLAG2_MIXED_REFS    0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
00493 #define CODEC_FLAG2_8X8DCT        0x00000080 ///< H.264 high profile 8x8 transform
00494 #define CODEC_FLAG2_FASTPSKIP     0x00000100 ///< H.264 fast pskip
00495 #define CODEC_FLAG2_AUD           0x00000200 ///< H.264 access unit delimiters
00496 #define CODEC_FLAG2_BRDO          0x00000400 ///< B-frame rate-distortion optimization
00497 #define CODEC_FLAG2_INTRA_VLC     0x00000800 ///< Use MPEG-2 intra VLC table.
00498 #define CODEC_FLAG2_MEMC_ONLY     0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
00499 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
00500 #define CODEC_FLAG2_SKIP_RD       0x00004000 ///< RD optimal MB level residual skipping
00501 #define CODEC_FLAG2_CHUNKS        0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
00502 #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
00503 #define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
00504 #define CODEC_FLAG2_MBTREE        0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
00505 
00506 /* Unsupported options :
00507  *              Syntax Arithmetic coding (SAC)
00508  *              Reference Picture Selection
00509  *              Independent Segment Decoding */
00510 /* /Fx */
00511 /* codec capabilities */
00512 
00513 #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
00514 
00518 #define CODEC_CAP_DR1             0x0002
00519 /* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
00520 #define CODEC_CAP_PARSE_ONLY      0x0004
00521 #define CODEC_CAP_TRUNCATED       0x0008
00522 /* Codec can export data for HW decoding (XvMC). */
00523 #define CODEC_CAP_HWACCEL         0x0010
00524 
00528 #define CODEC_CAP_DELAY           0x0020
00529 
00533 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
00534 
00537 #define CODEC_CAP_HWACCEL_VDPAU    0x0080
00538 
00539 //The following defines may change, don't expect compatibility if you use them.
00540 #define MB_TYPE_INTRA4x4   0x0001
00541 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
00542 #define MB_TYPE_INTRA_PCM  0x0004 //FIXME H.264-specific
00543 #define MB_TYPE_16x16      0x0008
00544 #define MB_TYPE_16x8       0x0010
00545 #define MB_TYPE_8x16       0x0020
00546 #define MB_TYPE_8x8        0x0040
00547 #define MB_TYPE_INTERLACED 0x0080
00548 #define MB_TYPE_DIRECT2    0x0100 //FIXME
00549 #define MB_TYPE_ACPRED     0x0200
00550 #define MB_TYPE_GMC        0x0400
00551 #define MB_TYPE_SKIP       0x0800
00552 #define MB_TYPE_P0L0       0x1000
00553 #define MB_TYPE_P1L0       0x2000
00554 #define MB_TYPE_P0L1       0x4000
00555 #define MB_TYPE_P1L1       0x8000
00556 #define MB_TYPE_L0         (MB_TYPE_P0L0 | MB_TYPE_P1L0)
00557 #define MB_TYPE_L1         (MB_TYPE_P0L1 | MB_TYPE_P1L1)
00558 #define MB_TYPE_L0L1       (MB_TYPE_L0   | MB_TYPE_L1)
00559 #define MB_TYPE_QUANT      0x00010000
00560 #define MB_TYPE_CBP        0x00020000
00561 //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
00562 
00568 typedef struct AVPanScan{
00574     int id;
00575 
00581     int width;
00582     int height;
00583 
00589     int16_t position[3][2];
00590 }AVPanScan;
00591 
00592 #define FF_COMMON_FRAME \
00593 \
00599     uint8_t *data[4];\
00600     int linesize[4];\
00601 \
00607     uint8_t *base[4];\
00608 \
00613     int key_frame;\
00614 \
00615 \
00620     int pict_type;\
00621 \
00622 \
00628     int64_t pts;\
00629 \
00630 \
00635     int coded_picture_number;\
00636 \
00641     int display_picture_number;\
00642 \
00643 \
00648     int quality; \
00649 \
00650 \
00656     int age;\
00657 \
00658 \
00666     int reference;\
00667 \
00668 \
00673     int8_t *qscale_table;\
00674 \
00679     int qstride;\
00680 \
00681 \
00687     uint8_t *mbskip_table;\
00688 \
00689 \
00701     int16_t (*motion_val[2])[2];\
00702 \
00703 \
00709     uint32_t *mb_type;\
00710 \
00711 \
00717     uint8_t motion_subsample_log2;\
00718 \
00719 \
00724     void *opaque;\
00725 \
00726 \
00731     uint64_t error[4];\
00732 \
00733 \
00739     int type;\
00740     \
00741 \
00747     int repeat_pict;\
00748     \
00749 \
00752     int qscale_type;\
00753     \
00754 \
00759     int interlaced_frame;\
00760     \
00761 \
00766     int top_field_first;\
00767     \
00768 \
00773     AVPanScan *pan_scan;\
00774     \
00775 \
00780     int palette_has_changed;\
00781     \
00782 \
00787     int buffer_hints;\
00788 \
00789 \
00794     short *dct_coeff;\
00795 \
00796 \
00801     int8_t *ref_index[2];\
00802 \
00803 \
00809     int64_t reordered_opaque;\
00810 
00811 
00812 #define FF_QSCALE_TYPE_MPEG1 0
00813 #define FF_QSCALE_TYPE_MPEG2 1
00814 #define FF_QSCALE_TYPE_H264  2
00815 
00816 #define FF_BUFFER_TYPE_INTERNAL 1
00817 #define FF_BUFFER_TYPE_USER     2 ///< direct rendering buffers (image is (de)allocated by user)
00818 #define FF_BUFFER_TYPE_SHARED   4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
00819 #define FF_BUFFER_TYPE_COPY     8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
00820 
00821 
00822 #define FF_I_TYPE  1 ///< Intra
00823 #define FF_P_TYPE  2 ///< Predicted
00824 #define FF_B_TYPE  3 ///< Bi-dir predicted
00825 #define FF_S_TYPE  4 ///< S(GMC)-VOP MPEG4
00826 #define FF_SI_TYPE 5 ///< Switching Intra
00827 #define FF_SP_TYPE 6 ///< Switching Predicted
00828 #define FF_BI_TYPE 7
00829 
00830 #define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore).
00831 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
00832 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
00833 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
00834 
00844 typedef struct AVFrame {
00845     FF_COMMON_FRAME
00846 } AVFrame;
00847 
00855 typedef struct AVCodecContext {
00860     const AVClass *av_class;
00866     int bit_rate;
00867 
00874     int bit_rate_tolerance;
00875 
00881     int flags;
00882 
00891     int sub_id;
00892 
00900     int me_method;
00901 
00913     uint8_t *extradata;
00914     int extradata_size;
00915 
00924     AVRational time_base;
00925 
00926     /* video only */
00934     int width, height;
00935 
00936 #define FF_ASPECT_EXTENDED 15
00937 
00943     int gop_size;
00944 
00950     enum PixelFormat pix_fmt;
00951 
00958     int rate_emu;
00959 
00979     void (*draw_horiz_band)(struct AVCodecContext *s,
00980                             const AVFrame *src, int offset[4],
00981                             int y, int type, int height);
00982 
00983     /* audio only */
00984     int sample_rate; 
00985     int channels;    
00986 
00992     enum SampleFormat sample_fmt;  
00993 
00994     /* The following data should not be initialized. */
00998     int frame_size;
00999     int frame_number;   
01000     int real_pict_num;  
01001 
01008     int delay;
01009 
01010     /* - encoding parameters */
01011     float qcompress;  
01012     float qblur;      
01013 
01019     int qmin;
01020 
01026     int qmax;
01027 
01033     int max_qdiff;
01034 
01041     int max_b_frames;
01042 
01050     float b_quant_factor;
01051 
01053     int rc_strategy;
01054 #define FF_RC_STRATEGY_XVID 1
01055 
01056     int b_frame_strategy;
01057 
01064     int hurry_up;
01065 
01066     struct AVCodec *codec;
01067 
01068     void *priv_data;
01069 
01070     int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
01071                             /* do its best to deliver a chunk with size     */
01072                             /* below rtp_payload_size, the chunk will start */
01073                             /* with a start code on some codecs like H.263. */
01074                             /* This doesn't take account of any particular  */
01075                             /* headers inside the transmitted RTP payload.  */
01076 
01077 
01078     /* The RTP callback: This function is called    */
01079     /* every time the encoder has a packet to send. */
01080     /* It depends on the encoder if the data starts */
01081     /* with a Start Code (it should). H.263 does.   */
01082     /* mb_nb contains the number of macroblocks     */
01083     /* encoded in the RTP payload.                  */
01084     void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
01085 
01086     /* statistics, used for 2-pass encoding */
01087     int mv_bits;
01088     int header_bits;
01089     int i_tex_bits;
01090     int p_tex_bits;
01091     int i_count;
01092     int p_count;
01093     int skip_count;
01094     int misc_bits;
01095 
01101     int frame_bits;
01102 
01108     void *opaque;
01109 
01110     char codec_name[32];
01111     enum CodecType codec_type; /* see CODEC_TYPE_xxx */
01112     enum CodecID codec_id; /* see CODEC_ID_xxx */
01113 
01127     unsigned int codec_tag;
01128 
01134     int workaround_bugs;
01135 #define FF_BUG_AUTODETECT       1  ///< autodetection
01136 #define FF_BUG_OLD_MSMPEG4      2
01137 #define FF_BUG_XVID_ILACE       4
01138 #define FF_BUG_UMP4             8
01139 #define FF_BUG_NO_PADDING       16
01140 #define FF_BUG_AMV              32
01141 #define FF_BUG_AC_VLC           0  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
01142 #define FF_BUG_QPEL_CHROMA      64
01143 #define FF_BUG_STD_QPEL         128
01144 #define FF_BUG_QPEL_CHROMA2     256
01145 #define FF_BUG_DIRECT_BLOCKSIZE 512
01146 #define FF_BUG_EDGE             1024
01147 #define FF_BUG_HPEL_CHROMA      2048
01148 #define FF_BUG_DC_CLIP          4096
01149 #define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
01150 //#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
01151 
01157     int luma_elim_threshold;
01158 
01164     int chroma_elim_threshold;
01165 
01178     int strict_std_compliance;
01179 #define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to a older more strict version of the spec or reference software.
01180 #define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
01181 #define FF_COMPLIANCE_NORMAL        0
01182 #define FF_COMPLIANCE_INOFFICIAL   -1 ///< Allow inofficial extensions.
01183 #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
01184 
01190     float b_quant_offset;
01191 
01198     int error_recognition;
01199 #define FF_ER_CAREFUL         1
01200 #define FF_ER_COMPLIANT       2
01201 #define FF_ER_AGGRESSIVE      3
01202 #define FF_ER_VERY_AGGRESSIVE 4
01203 
01212     int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
01213 
01221     void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
01222 
01229     int has_b_frames;
01230 
01235     int block_align;
01236 
01237     int parse_only; /* - decoding only: If true, only parsing is done
01238                        (function avcodec_parse_frame()). The frame
01239                        data is returned. Only MPEG codecs support this now. */
01240 
01246     int mpeg_quant;
01247 
01253     char *stats_out;
01254 
01261     char *stats_in;
01262 
01269     float rc_qsquish;
01270 
01271     float rc_qmod_amp;
01272     int rc_qmod_freq;
01273 
01279     RcOverride *rc_override;
01280     int rc_override_count;
01281 
01287     const char *rc_eq;
01288 
01294     int rc_max_rate;
01295 
01301     int rc_min_rate;
01302 
01308     int rc_buffer_size;
01309     float rc_buffer_aggressivity;
01310 
01318     float i_quant_factor;
01319 
01325     float i_quant_offset;
01326 
01332     float rc_initial_cplx;
01333 
01339     int dct_algo;
01340 #define FF_DCT_AUTO    0
01341 #define FF_DCT_FASTINT 1
01342 #define FF_DCT_INT     2
01343 #define FF_DCT_MMX     3
01344 #define FF_DCT_MLIB    4
01345 #define FF_DCT_ALTIVEC 5
01346 #define FF_DCT_FAAN    6
01347 
01353     float lumi_masking;
01354 
01360     float temporal_cplx_masking;
01361 
01367     float spatial_cplx_masking;
01368 
01374     float p_masking;
01375 
01381     float dark_masking;
01382 
01388     int idct_algo;
01389 #define FF_IDCT_AUTO          0
01390 #define FF_IDCT_INT           1
01391 #define FF_IDCT_SIMPLE        2
01392 #define FF_IDCT_SIMPLEMMX     3
01393 #define FF_IDCT_LIBMPEG2MMX   4
01394 #define FF_IDCT_PS2           5
01395 #define FF_IDCT_MLIB          6
01396 #define FF_IDCT_ARM           7
01397 #define FF_IDCT_ALTIVEC       8
01398 #define FF_IDCT_SH4           9
01399 #define FF_IDCT_SIMPLEARM     10
01400 #define FF_IDCT_H264          11
01401 #define FF_IDCT_VP3           12
01402 #define FF_IDCT_IPP           13
01403 #define FF_IDCT_XVIDMMX       14
01404 #define FF_IDCT_CAVS          15
01405 #define FF_IDCT_SIMPLEARMV5TE 16
01406 #define FF_IDCT_SIMPLEARMV6   17
01407 #define FF_IDCT_SIMPLEVIS     18
01408 #define FF_IDCT_WMV2          19
01409 #define FF_IDCT_FAAN          20
01410 #define FF_IDCT_EA            21
01411 #define FF_IDCT_SIMPLENEON    22
01412 #define FF_IDCT_SIMPLEALPHA   23
01413 
01419     int slice_count;
01425     int *slice_offset;
01426 
01432     int error_concealment;
01433 #define FF_EC_GUESS_MVS   1
01434 #define FF_EC_DEBLOCK     2
01435 
01444     unsigned dsp_mask;
01445 #define FF_MM_FORCE    0x80000000 /* Force usage of selected flags (OR) */
01446     /* lower 16 bits - CPU features */
01447 #define FF_MM_MMX      0x0001 ///< standard MMX
01448 #define FF_MM_3DNOW    0x0004 ///< AMD 3DNOW
01449 #define FF_MM_MMXEXT   0x0002 ///< SSE integer functions or AMD MMX ext
01450 #define FF_MM_SSE      0x0008 ///< SSE functions
01451 #define FF_MM_SSE2     0x0010 ///< PIV SSE2 functions
01452 #define FF_MM_3DNOWEXT 0x0020 ///< AMD 3DNowExt
01453 #define FF_MM_SSE3     0x0040 ///< Prescott SSE3 functions
01454 #define FF_MM_SSSE3    0x0080 ///< Conroe SSSE3 functions
01455 #define FF_MM_IWMMXT   0x0100 ///< XScale IWMMXT
01456 #define FF_MM_ALTIVEC  0x0001 ///< standard AltiVec
01457 
01463      int bits_per_coded_sample;
01464 
01470      int prediction_method;
01471 #define FF_PRED_LEFT   0
01472 #define FF_PRED_PLANE  1
01473 #define FF_PRED_MEDIAN 2
01474 
01482     AVRational sample_aspect_ratio;
01483 
01489     AVFrame *coded_frame;
01490 
01496     int debug;
01497 #define FF_DEBUG_PICT_INFO   1
01498 #define FF_DEBUG_RC          2
01499 #define FF_DEBUG_BITSTREAM   4
01500 #define FF_DEBUG_MB_TYPE     8
01501 #define FF_DEBUG_QP          16
01502 #define FF_DEBUG_MV          32
01503 #define FF_DEBUG_DCT_COEFF   0x00000040
01504 #define FF_DEBUG_SKIP        0x00000080
01505 #define FF_DEBUG_STARTCODE   0x00000100
01506 #define FF_DEBUG_PTS         0x00000200
01507 #define FF_DEBUG_ER          0x00000400
01508 #define FF_DEBUG_MMCO        0x00000800
01509 #define FF_DEBUG_BUGS        0x00001000
01510 #define FF_DEBUG_VIS_QP      0x00002000
01511 #define FF_DEBUG_VIS_MB_TYPE 0x00004000
01512 #define FF_DEBUG_BUFFERS     0x00008000
01513 
01519     int debug_mv;
01520 #define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
01521 #define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
01522 #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
01523 
01529     uint64_t error[4];
01530 
01536     int mb_qmin;
01537 
01543     int mb_qmax;
01544 
01550     int me_cmp;
01556     int me_sub_cmp;
01562     int mb_cmp;
01568     int ildct_cmp;
01569 #define FF_CMP_SAD    0
01570 #define FF_CMP_SSE    1
01571 #define FF_CMP_SATD   2
01572 #define FF_CMP_DCT    3
01573 #define FF_CMP_PSNR   4
01574 #define FF_CMP_BIT    5
01575 #define FF_CMP_RD     6
01576 #define FF_CMP_ZERO   7
01577 #define FF_CMP_VSAD   8
01578 #define FF_CMP_VSSE   9
01579 #define FF_CMP_NSSE   10
01580 #define FF_CMP_W53    11
01581 #define FF_CMP_W97    12
01582 #define FF_CMP_DCTMAX 13
01583 #define FF_CMP_DCT264 14
01584 #define FF_CMP_CHROMA 256
01585 
01591     int dia_size;
01592 
01598     int last_predictor_count;
01599 
01605     int pre_me;
01606 
01612     int me_pre_cmp;
01613 
01619     int pre_dia_size;
01620 
01626     int me_subpel_quality;
01627 
01637     enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
01638 
01647     int dtg_active_format;
01648 #define FF_DTG_AFD_SAME         8
01649 #define FF_DTG_AFD_4_3          9
01650 #define FF_DTG_AFD_16_9         10
01651 #define FF_DTG_AFD_14_9         11
01652 #define FF_DTG_AFD_4_3_SP_14_9  13
01653 #define FF_DTG_AFD_16_9_SP_14_9 14
01654 #define FF_DTG_AFD_SP_4_3       15
01655 
01663     int me_range;
01664 
01670     int intra_quant_bias;
01671 #define FF_DEFAULT_QUANT_BIAS 999999
01672 
01678     int inter_quant_bias;
01679 
01686     int color_table_id;
01687 
01692     int internal_buffer_count;
01693 
01698     void *internal_buffer;
01699 
01700 #define FF_LAMBDA_SHIFT 7
01701 #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
01702 #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
01703 #define FF_LAMBDA_MAX (256*128-1)
01704 
01705 #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
01706 
01712     int global_quality;
01713 
01714 #define FF_CODER_TYPE_VLC       0
01715 #define FF_CODER_TYPE_AC        1
01716 #define FF_CODER_TYPE_RAW       2
01717 #define FF_CODER_TYPE_RLE       3
01718 #define FF_CODER_TYPE_DEFLATE   4
01719 
01724     int coder_type;
01725 
01731     int context_model;
01732 #if 0
01733 
01738     uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
01739 #endif
01740 
01746     int slice_flags;
01747 #define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
01748 #define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
01749 #define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
01750 
01756     int xvmc_acceleration;
01757 
01763     int mb_decision;
01764 #define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
01765 #define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
01766 #define FF_MB_DECISION_RD     2        ///< rate distortion
01767 
01773     uint16_t *intra_matrix;
01774 
01780     uint16_t *inter_matrix;
01781 
01788     unsigned int stream_codec_tag;
01789 
01796     int scenechange_threshold;
01797 
01803     int lmin;
01804 
01810     int lmax;
01811 
01817     struct AVPaletteControl *palctrl;
01818 
01824     int noise_reduction;
01825 
01835     int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
01836 
01842     int rc_initial_buffer_occupancy;
01843 
01849     int inter_threshold;
01850 
01856     int flags2;
01857 
01863     int error_rate;
01864 
01870     int antialias_algo;
01871 #define FF_AA_AUTO    0
01872 #define FF_AA_FASTINT 1 //not implemented yet
01873 #define FF_AA_INT     2
01874 #define FF_AA_FLOAT   3
01875 
01880     int quantizer_noise_shaping;
01881 
01888     int thread_count;
01889 
01899     int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
01900 
01907     void *thread_opaque;
01908 
01916      int me_threshold;
01917 
01923      int mb_threshold;
01924 
01930      int intra_dc_precision;
01931 
01937      int nsse_weight;
01938 
01944      int skip_top;
01945 
01951      int skip_bottom;
01952 
01958      int profile;
01959 #define FF_PROFILE_UNKNOWN -99
01960 #define FF_PROFILE_AAC_MAIN 0
01961 #define FF_PROFILE_AAC_LOW  1
01962 #define FF_PROFILE_AAC_SSR  2
01963 #define FF_PROFILE_AAC_LTP  3
01964 
01970      int level;
01971 #define FF_LEVEL_UNKNOWN -99
01972 
01978      int lowres;
01979 
01986     int coded_width, coded_height;
01987 
01993     int frame_skip_threshold;
01994 
02000     int frame_skip_factor;
02001 
02007     int frame_skip_exp;
02008 
02014     int frame_skip_cmp;
02015 
02022     float border_masking;
02023 
02029     int mb_lmin;
02030 
02036     int mb_lmax;
02037 
02043     int me_penalty_compensation;
02044 
02050     enum AVDiscard skip_loop_filter;
02051 
02057     enum AVDiscard skip_idct;
02058 
02064     enum AVDiscard skip_frame;
02065 
02071     int bidir_refine;
02072 
02078     int brd_scale;
02079 
02085     float crf;
02086 
02092     int cqp;
02093 
02099     int keyint_min;
02100 
02106     int refs;
02107 
02113     int chromaoffset;
02114 
02120     int bframebias;
02121 
02127     int trellis;
02128 
02134     float complexityblur;
02135 
02142     int deblockalpha;
02143 
02150     int deblockbeta;
02151 
02157     int partitions;
02158 #define X264_PART_I4X4 0x001  /* Analyze i4x4 */
02159 #define X264_PART_I8X8 0x002  /* Analyze i8x8 (requires 8x8 transform) */
02160 #define X264_PART_P8X8 0x010  /* Analyze p16x8, p8x16 and p8x8 */
02161 #define X264_PART_P4X4 0x020  /* Analyze p8x4, p4x8, p4x4 */
02162 #define X264_PART_B8X8 0x100  /* Analyze b16x8, b8x16 and b8x8 */
02163 
02169     int directpred;
02170 
02176     int cutoff;
02177 
02183     int scenechange_factor;
02184 
02191     int mv0_threshold;
02192 
02198     int b_sensitivity;
02199 
02204     int compression_level;
02205 #define FF_COMPRESSION_DEFAULT -1
02206 
02212     int use_lpc;
02213 
02219     int lpc_coeff_precision;
02220 
02225     int min_prediction_order;
02226 
02231     int max_prediction_order;
02232 
02238     int prediction_order_method;
02239 
02244     int min_partition_order;
02245 
02250     int max_partition_order;
02251 
02257     int64_t timecode_frame_start;
02258 
02259 #if LIBAVCODEC_VERSION_MAJOR < 53
02260 
02266     int request_channels;
02267 #endif
02268 
02275     float drc_scale;
02276 
02283     int64_t reordered_opaque;
02284 
02291     int bits_per_raw_sample;
02292 
02298     int64_t channel_layout;
02299 
02305     int64_t request_channel_layout;
02306 
02312     float rc_max_available_vbv_use;
02313 
02319     float rc_min_vbv_overflow_use;
02320 
02326     struct AVHWAccel *hwaccel;
02327 
02335     int ticks_per_frame;
02336 
02345     int weighted_p_pred;
02346 } AVCodecContext;
02347 
02351 typedef struct AVCodec {
02358     const char *name;
02359     enum CodecType type;
02360     enum CodecID id;
02361     int priv_data_size;
02362     int (*init)(AVCodecContext *);
02363     int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
02364     int (*close)(AVCodecContext *);
02365     int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
02366                   const uint8_t *buf, int buf_size);
02371     int capabilities;
02372     struct AVCodec *next;
02377     void (*flush)(AVCodecContext *);
02378     const AVRational *supported_framerates; 
02379     const enum PixelFormat *pix_fmts;       
02380 
02384     const char *long_name;
02385     const int *supported_samplerates;       
02386     const enum SampleFormat *sample_fmts;   
02387     const int64_t *channel_layouts;         
02388 } AVCodec;
02389 
02393 typedef struct AVHWAccel {
02399     const char *name;
02400 
02406     enum CodecType type;
02407 
02413     enum CodecID id;
02414 
02420     enum PixelFormat pix_fmt;
02421 
02426     int capabilities;
02427 
02428     struct AVHWAccel *next;
02429 
02444     int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
02445 
02457     int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
02458 
02468     int (*end_frame)(AVCodecContext *avctx);
02469 } AVHWAccel;
02470 
02475 typedef struct AVPicture {
02476     uint8_t *data[4];
02477     int linesize[4];       
02478 } AVPicture;
02479 
02488 #define AVPALETTE_SIZE 1024
02489 #define AVPALETTE_COUNT 256
02490 typedef struct AVPaletteControl {
02491 
02492     /* Demuxer sets this to 1 to indicate the palette has changed;
02493      * decoder resets to 0. */
02494     int palette_changed;
02495 
02496     /* 4-byte ARGB palette entries, stored in native byte order; note that
02497      * the individual palette components should be on a 8-bit scale; if
02498      * the palette data comes from an IBM VGA native format, the component
02499      * data is probably 6 bits in size and needs to be scaled. */
02500     unsigned int palette[AVPALETTE_COUNT];
02501 
02502 } AVPaletteControl attribute_deprecated;
02503 
02504 enum AVSubtitleType {
02505     SUBTITLE_NONE,
02506 
02507     SUBTITLE_BITMAP,                
02508 
02513     SUBTITLE_TEXT,
02514 
02519     SUBTITLE_ASS,
02520 };
02521 
02522 typedef struct AVSubtitleRect {
02523     int x;         
02524     int y;         
02525     int w;         
02526     int h;         
02527     int nb_colors; 
02528 
02533     AVPicture pict;
02534     enum AVSubtitleType type;
02535 
02536     char *text;                     
02537 
02543     char *ass;
02544 } AVSubtitleRect;
02545 
02546 typedef struct AVSubtitle {
02547     uint16_t format; /* 0 = graphics */
02548     uint32_t start_display_time; /* relative to packet pts, in ms */
02549     uint32_t end_display_time; /* relative to packet pts, in ms */
02550     unsigned num_rects;
02551     AVSubtitleRect **rects;
02552 } AVSubtitle;
02553 
02554 
02555 /* resample.c */
02556 
02557 struct ReSampleContext;
02558 struct AVResampleContext;
02559 
02560 typedef struct ReSampleContext ReSampleContext;
02561 
02562 #if LIBAVCODEC_VERSION_MAJOR < 53
02563 
02566 attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels,
02567                                                           int output_rate, int input_rate);
02568 #endif
02569 
02585 ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
02586                                         int output_rate, int input_rate,
02587                                         enum SampleFormat sample_fmt_out,
02588                                         enum SampleFormat sample_fmt_in,
02589                                         int filter_length, int log2_phase_count,
02590                                         int linear, double cutoff);
02591 
02592 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
02593 void audio_resample_close(ReSampleContext *s);
02594 
02595 
02605 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
02606 
02616 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
02617 
02618 
02631 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
02632 void av_resample_close(struct AVResampleContext *c);
02633 
02643 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
02644 
02650 void avpicture_free(AVPicture *picture);
02651 
02668 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
02669                    int pix_fmt, int width, int height);
02670 int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
02671                      unsigned char *dest, int dest_size);
02672 
02682 int avpicture_get_size(int pix_fmt, int width, int height);
02683 void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
02684 const char *avcodec_get_pix_fmt_name(int pix_fmt);
02685 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
02686 enum PixelFormat avcodec_get_pix_fmt(const char* name);
02687 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
02688 
02689 #define FF_LOSS_RESOLUTION  0x0001 
02690 #define FF_LOSS_DEPTH       0x0002 
02691 #define FF_LOSS_COLORSPACE  0x0004 
02692 #define FF_LOSS_ALPHA       0x0008 
02693 #define FF_LOSS_COLORQUANT  0x0010 
02694 #define FF_LOSS_CHROMA      0x0020 
02713 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
02714                              int has_alpha);
02715 
02738 int avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, int src_pix_fmt,
02739                               int has_alpha, int *loss_ptr);
02740 
02741 
02752 void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt);
02753 
02754 #define FF_ALPHA_TRANSP       0x0001 /* image has some totally transparent pixels */
02755 #define FF_ALPHA_SEMI_TRANSP  0x0002 /* image has some transparent pixels */
02756 
02761 int img_get_alpha_info(const AVPicture *src,
02762                        int pix_fmt, int width, int height);
02763 
02764 /* deinterlace a picture */
02765 /* deinterlace - if not supported return -1 */
02766 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
02767                           int pix_fmt, int width, int height);
02768 
02769 /* external high level API */
02770 
02776 AVCodec *av_codec_next(AVCodec *c);
02777 
02781 unsigned avcodec_version(void);
02782 
02789 void avcodec_init(void);
02790 
02791 #if LIBAVCODEC_VERSION_MAJOR < 53
02792 
02795 attribute_deprecated void register_avcodec(AVCodec *codec);
02796 #endif
02797 
02803 void avcodec_register(AVCodec *codec);
02804 
02811 AVCodec *avcodec_find_encoder(enum CodecID id);
02812 
02819 AVCodec *avcodec_find_encoder_by_name(const char *name);
02820 
02827 AVCodec *avcodec_find_decoder(enum CodecID id);
02828 
02835 AVCodec *avcodec_find_decoder_by_name(const char *name);
02836 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
02837 
02843 void avcodec_get_context_defaults(AVCodecContext *s);
02844 
02847 void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType);
02848 
02856 AVCodecContext *avcodec_alloc_context(void);
02857 
02860 AVCodecContext *avcodec_alloc_context2(enum CodecType);
02861 
02867 void avcodec_get_frame_defaults(AVFrame *pic);
02868 
02876 AVFrame *avcodec_alloc_frame(void);
02877 
02878 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
02879 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
02880 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
02881 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
02882 
02891 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
02892 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
02893 
02894 int avcodec_thread_init(AVCodecContext *s, int thread_count);
02895 void avcodec_thread_free(AVCodecContext *s);
02896 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
02897 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
02898 //FIXME func typedef
02899 
02927 int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
02928 
02965 int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
02966                          int *frame_size_ptr,
02967                          const uint8_t *buf, int buf_size);
02968 
03003 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
03004                          int *got_picture_ptr,
03005                          const uint8_t *buf, int buf_size);
03006 
03007 /* Decode a subtitle message. Return -1 if error, otherwise return the
03008  * number of bytes used. If no subtitle could be decompressed,
03009  * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */
03010 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
03011                             int *got_sub_ptr,
03012                             const uint8_t *buf, int buf_size);
03013 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
03014                         int *data_size_ptr,
03015                         uint8_t *buf, int buf_size);
03016 
03037 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
03038                          const short *samples);
03039 
03055 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
03056                          const AVFrame *pict);
03057 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
03058                             const AVSubtitle *sub);
03059 
03060 int avcodec_close(AVCodecContext *avctx);
03061 
03072 void avcodec_register_all(void);
03073 
03077 void avcodec_flush_buffers(AVCodecContext *avctx);
03078 
03079 void avcodec_default_free_buffers(AVCodecContext *s);
03080 
03081 /* misc useful functions */
03082 
03089 char av_get_pict_type_char(int pict_type);
03090 
03097 int av_get_bits_per_sample(enum CodecID codec_id);
03098 
03105 int av_get_bits_per_sample_format(enum SampleFormat sample_fmt);
03106 
03107 /* frame parsing */
03108 typedef struct AVCodecParserContext {
03109     void *priv_data;
03110     struct AVCodecParser *parser;
03111     int64_t frame_offset; /* offset of the current frame */
03112     int64_t cur_offset; /* current offset
03113                            (incremented by each av_parser_parse()) */
03114     int64_t next_frame_offset; /* offset of the next frame */
03115     /* video info */
03116     int pict_type; /* XXX: Put it back in AVCodecContext. */
03126     int repeat_pict; /* XXX: Put it back in AVCodecContext. */
03127     int64_t pts;     /* pts of the current frame */
03128     int64_t dts;     /* dts of the current frame */
03129 
03130     /* private data */
03131     int64_t last_pts;
03132     int64_t last_dts;
03133     int fetch_timestamp;
03134 
03135 #define AV_PARSER_PTS_NB 4
03136     int cur_frame_start_index;
03137     int64_t cur_frame_offset[AV_PARSER_PTS_NB];
03138     int64_t cur_frame_pts[AV_PARSER_PTS_NB];
03139     int64_t cur_frame_dts[AV_PARSER_PTS_NB];
03140 
03141     int flags;
03142 #define PARSER_FLAG_COMPLETE_FRAMES           0x0001
03143 
03144     int64_t offset;      
03145     int64_t cur_frame_end[AV_PARSER_PTS_NB];
03146 
03153     int key_frame;
03154 
03170     int64_t convergence_duration;
03171 
03172     // Timestamp generation support:
03182     int dts_sync_point;
03183 
03197     int dts_ref_dts_delta;
03198 
03211     int pts_dts_delta;
03212 } AVCodecParserContext;
03213 
03214 typedef struct AVCodecParser {
03215     int codec_ids[5]; /* several codec IDs are permitted */
03216     int priv_data_size;
03217     int (*parser_init)(AVCodecParserContext *s);
03218     int (*parser_parse)(AVCodecParserContext *s,
03219                         AVCodecContext *avctx,
03220                         const uint8_t **poutbuf, int *poutbuf_size,
03221                         const uint8_t *buf, int buf_size);
03222     void (*parser_close)(AVCodecParserContext *s);
03223     int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
03224     struct AVCodecParser *next;
03225 } AVCodecParser;
03226 
03227 AVCodecParser *av_parser_next(AVCodecParser *c);
03228 
03229 void av_register_codec_parser(AVCodecParser *parser);
03230 AVCodecParserContext *av_parser_init(int codec_id);
03231 int av_parser_parse(AVCodecParserContext *s,
03232                     AVCodecContext *avctx,
03233                     uint8_t **poutbuf, int *poutbuf_size,
03234                     const uint8_t *buf, int buf_size,
03235                     int64_t pts, int64_t dts);
03236 int av_parser_change(AVCodecParserContext *s,
03237                      AVCodecContext *avctx,
03238                      uint8_t **poutbuf, int *poutbuf_size,
03239                      const uint8_t *buf, int buf_size, int keyframe);
03240 void av_parser_close(AVCodecParserContext *s);
03241 
03242 
03243 typedef struct AVBitStreamFilterContext {
03244     void *priv_data;
03245     struct AVBitStreamFilter *filter;
03246     AVCodecParserContext *parser;
03247     struct AVBitStreamFilterContext *next;
03248 } AVBitStreamFilterContext;
03249 
03250 
03251 typedef struct AVBitStreamFilter {
03252     const char *name;
03253     int priv_data_size;
03254     int (*filter)(AVBitStreamFilterContext *bsfc,
03255                   AVCodecContext *avctx, const char *args,
03256                   uint8_t **poutbuf, int *poutbuf_size,
03257                   const uint8_t *buf, int buf_size, int keyframe);
03258     void (*close)(AVBitStreamFilterContext *bsfc);
03259     struct AVBitStreamFilter *next;
03260 } AVBitStreamFilter;
03261 
03262 void av_register_bitstream_filter(AVBitStreamFilter *bsf);
03263 AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
03264 int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
03265                                AVCodecContext *avctx, const char *args,
03266                                uint8_t **poutbuf, int *poutbuf_size,
03267                                const uint8_t *buf, int buf_size, int keyframe);
03268 void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
03269 
03270 AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
03271 
03272 /* memory */
03273 
03280 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
03281 
03285 void av_picture_copy(AVPicture *dst, const AVPicture *src,
03286               int pix_fmt, int width, int height);
03287 
03291 int av_picture_crop(AVPicture *dst, const AVPicture *src,
03292              int pix_fmt, int top_band, int left_band);
03293 
03297 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt,
03298             int padtop, int padbottom, int padleft, int padright, int *color);
03299 
03300 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
03301 
03313 int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
03314 
03324 int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
03325 
03326 /* error handling */
03327 #if EINVAL > 0
03328 #define AVERROR(e) (-(e)) 
03329 #define AVUNERROR(e) (-(e)) 
03330 #else
03331 /* Some platforms have E* and errno already negated. */
03332 #define AVERROR(e) (e)
03333 #define AVUNERROR(e) (e)
03334 #endif
03335 #define AVERROR_UNKNOWN     AVERROR(EINVAL)  
03336 #define AVERROR_IO          AVERROR(EIO)     
03337 #define AVERROR_NUMEXPECTED AVERROR(EDOM)    
03338 #define AVERROR_INVALIDDATA AVERROR(EINVAL)  
03339 #define AVERROR_NOMEM       AVERROR(ENOMEM)  
03340 #define AVERROR_NOFMT       AVERROR(EILSEQ)  
03341 #define AVERROR_NOTSUPP     AVERROR(ENOSYS)  
03342 #define AVERROR_NOENT       AVERROR(ENOENT)  
03343 #define AVERROR_EOF         AVERROR(EPIPE)   
03344 #define AVERROR_PATCHWELCOME    -MKTAG('P','A','W','E') 
03349 void av_register_hwaccel(AVHWAccel *hwaccel);
03350 
03356 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
03357 
03358 
03362 enum AVLockOp {
03363   AV_LOCK_CREATE,  
03364   AV_LOCK_OBTAIN,  
03365   AV_LOCK_RELEASE, 
03366   AV_LOCK_DESTROY, 
03367 };
03368 
03382 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
03383 
03384 #endif /* AVCODEC_AVCODEC_H */

Generated on Tue Nov 4 2014 12:59:21 for ffmpeg by  doxygen 1.7.1