yading@10: /* yading@10: * copyright (c) 2001 Fabrice Bellard yading@10: * yading@10: * This file is part of FFmpeg. yading@10: * yading@10: * FFmpeg is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * FFmpeg is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with FFmpeg; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: #ifndef AVCODEC_AVCODEC_H yading@10: #define AVCODEC_AVCODEC_H yading@10: yading@10: /** yading@10: * @file yading@10: * external API header yading@10: */ yading@10: yading@10: #include yading@10: #include "libavutil/samplefmt.h" yading@10: #include "libavutil/avutil.h" yading@10: #include "libavutil/buffer.h" yading@10: #include "libavutil/cpu.h" yading@10: #include "libavutil/channel_layout.h" yading@10: #include "libavutil/dict.h" yading@10: #include "libavutil/frame.h" yading@10: #include "libavutil/log.h" yading@10: #include "libavutil/pixfmt.h" yading@10: #include "libavutil/rational.h" yading@10: yading@10: #include "libavcodec/version.h" yading@10: /** yading@10: * @defgroup libavc Encoding/Decoding Library yading@10: * @{ yading@10: * yading@10: * @defgroup lavc_decoding Decoding yading@10: * @{ yading@10: * @} yading@10: * yading@10: * @defgroup lavc_encoding Encoding yading@10: * @{ yading@10: * @} yading@10: * yading@10: * @defgroup lavc_codec Codecs yading@10: * @{ yading@10: * @defgroup lavc_codec_native Native Codecs yading@10: * @{ yading@10: * @} yading@10: * @defgroup lavc_codec_wrappers External library wrappers yading@10: * @{ yading@10: * @} yading@10: * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge yading@10: * @{ yading@10: * @} yading@10: * @} yading@10: * @defgroup lavc_internal Internal yading@10: * @{ yading@10: * @} yading@10: * @} yading@10: * yading@10: */ yading@10: yading@10: /** yading@10: * @defgroup lavc_core Core functions/structures. yading@10: * @ingroup libavc yading@10: * yading@10: * Basic definitions, functions for querying libavcodec capabilities, yading@10: * allocating core structures, etc. yading@10: * @{ yading@10: */ yading@10: yading@10: yading@10: /** yading@10: * Identify the syntax and semantics of the bitstream. yading@10: * The principle is roughly: yading@10: * Two decoders with the same ID can decode the same streams. yading@10: * Two encoders with the same ID can encode compatible streams. yading@10: * There may be slight deviations from the principle due to implementation yading@10: * details. yading@10: * yading@10: * If you add a codec ID to this list, add it so that yading@10: * 1. no value of a existing codec ID changes (that would break ABI), yading@10: * 2. Give it a value which when taken as ASCII is recognized uniquely by a human as this specific codec. yading@10: * This ensures that 2 forks can independently add AVCodecIDs without producing conflicts. yading@10: * yading@10: * After adding new codec IDs, do not forget to add an entry to the codec yading@10: * descriptor list and bump libavcodec minor version. yading@10: */ yading@10: enum AVCodecID { yading@10: AV_CODEC_ID_NONE, yading@10: yading@10: /* video codecs */ yading@10: AV_CODEC_ID_MPEG1VIDEO, yading@10: AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding yading@10: AV_CODEC_ID_MPEG2VIDEO_XVMC, yading@10: AV_CODEC_ID_H261, yading@10: AV_CODEC_ID_H263, yading@10: AV_CODEC_ID_RV10, yading@10: AV_CODEC_ID_RV20, yading@10: AV_CODEC_ID_MJPEG, yading@10: AV_CODEC_ID_MJPEGB, yading@10: AV_CODEC_ID_LJPEG, yading@10: AV_CODEC_ID_SP5X, yading@10: AV_CODEC_ID_JPEGLS, yading@10: AV_CODEC_ID_MPEG4, yading@10: AV_CODEC_ID_RAWVIDEO, yading@10: AV_CODEC_ID_MSMPEG4V1, yading@10: AV_CODEC_ID_MSMPEG4V2, yading@10: AV_CODEC_ID_MSMPEG4V3, yading@10: AV_CODEC_ID_WMV1, yading@10: AV_CODEC_ID_WMV2, yading@10: AV_CODEC_ID_H263P, yading@10: AV_CODEC_ID_H263I, yading@10: AV_CODEC_ID_FLV1, yading@10: AV_CODEC_ID_SVQ1, yading@10: AV_CODEC_ID_SVQ3, yading@10: AV_CODEC_ID_DVVIDEO, yading@10: AV_CODEC_ID_HUFFYUV, yading@10: AV_CODEC_ID_CYUV, yading@10: AV_CODEC_ID_H264, yading@10: AV_CODEC_ID_INDEO3, yading@10: AV_CODEC_ID_VP3, yading@10: AV_CODEC_ID_THEORA, yading@10: AV_CODEC_ID_ASV1, yading@10: AV_CODEC_ID_ASV2, yading@10: AV_CODEC_ID_FFV1, yading@10: AV_CODEC_ID_4XM, yading@10: AV_CODEC_ID_VCR1, yading@10: AV_CODEC_ID_CLJR, yading@10: AV_CODEC_ID_MDEC, yading@10: AV_CODEC_ID_ROQ, yading@10: AV_CODEC_ID_INTERPLAY_VIDEO, yading@10: AV_CODEC_ID_XAN_WC3, yading@10: AV_CODEC_ID_XAN_WC4, yading@10: AV_CODEC_ID_RPZA, yading@10: AV_CODEC_ID_CINEPAK, yading@10: AV_CODEC_ID_WS_VQA, yading@10: AV_CODEC_ID_MSRLE, yading@10: AV_CODEC_ID_MSVIDEO1, yading@10: AV_CODEC_ID_IDCIN, yading@10: AV_CODEC_ID_8BPS, yading@10: AV_CODEC_ID_SMC, yading@10: AV_CODEC_ID_FLIC, yading@10: AV_CODEC_ID_TRUEMOTION1, yading@10: AV_CODEC_ID_VMDVIDEO, yading@10: AV_CODEC_ID_MSZH, yading@10: AV_CODEC_ID_ZLIB, yading@10: AV_CODEC_ID_QTRLE, yading@10: AV_CODEC_ID_TSCC, yading@10: AV_CODEC_ID_ULTI, yading@10: AV_CODEC_ID_QDRAW, yading@10: AV_CODEC_ID_VIXL, yading@10: AV_CODEC_ID_QPEG, yading@10: AV_CODEC_ID_PNG, yading@10: AV_CODEC_ID_PPM, yading@10: AV_CODEC_ID_PBM, yading@10: AV_CODEC_ID_PGM, yading@10: AV_CODEC_ID_PGMYUV, yading@10: AV_CODEC_ID_PAM, yading@10: AV_CODEC_ID_FFVHUFF, yading@10: AV_CODEC_ID_RV30, yading@10: AV_CODEC_ID_RV40, yading@10: AV_CODEC_ID_VC1, yading@10: AV_CODEC_ID_WMV3, yading@10: AV_CODEC_ID_LOCO, yading@10: AV_CODEC_ID_WNV1, yading@10: AV_CODEC_ID_AASC, yading@10: AV_CODEC_ID_INDEO2, yading@10: AV_CODEC_ID_FRAPS, yading@10: AV_CODEC_ID_TRUEMOTION2, yading@10: AV_CODEC_ID_BMP, yading@10: AV_CODEC_ID_CSCD, yading@10: AV_CODEC_ID_MMVIDEO, yading@10: AV_CODEC_ID_ZMBV, yading@10: AV_CODEC_ID_AVS, yading@10: AV_CODEC_ID_SMACKVIDEO, yading@10: AV_CODEC_ID_NUV, yading@10: AV_CODEC_ID_KMVC, yading@10: AV_CODEC_ID_FLASHSV, yading@10: AV_CODEC_ID_CAVS, yading@10: AV_CODEC_ID_JPEG2000, yading@10: AV_CODEC_ID_VMNC, yading@10: AV_CODEC_ID_VP5, yading@10: AV_CODEC_ID_VP6, yading@10: AV_CODEC_ID_VP6F, yading@10: AV_CODEC_ID_TARGA, yading@10: AV_CODEC_ID_DSICINVIDEO, yading@10: AV_CODEC_ID_TIERTEXSEQVIDEO, yading@10: AV_CODEC_ID_TIFF, yading@10: AV_CODEC_ID_GIF, yading@10: AV_CODEC_ID_DXA, yading@10: AV_CODEC_ID_DNXHD, yading@10: AV_CODEC_ID_THP, yading@10: AV_CODEC_ID_SGI, yading@10: AV_CODEC_ID_C93, yading@10: AV_CODEC_ID_BETHSOFTVID, yading@10: AV_CODEC_ID_PTX, yading@10: AV_CODEC_ID_TXD, yading@10: AV_CODEC_ID_VP6A, yading@10: AV_CODEC_ID_AMV, yading@10: AV_CODEC_ID_VB, yading@10: AV_CODEC_ID_PCX, yading@10: AV_CODEC_ID_SUNRAST, yading@10: AV_CODEC_ID_INDEO4, yading@10: AV_CODEC_ID_INDEO5, yading@10: AV_CODEC_ID_MIMIC, yading@10: AV_CODEC_ID_RL2, yading@10: AV_CODEC_ID_ESCAPE124, yading@10: AV_CODEC_ID_DIRAC, yading@10: AV_CODEC_ID_BFI, yading@10: AV_CODEC_ID_CMV, yading@10: AV_CODEC_ID_MOTIONPIXELS, yading@10: AV_CODEC_ID_TGV, yading@10: AV_CODEC_ID_TGQ, yading@10: AV_CODEC_ID_TQI, yading@10: AV_CODEC_ID_AURA, yading@10: AV_CODEC_ID_AURA2, yading@10: AV_CODEC_ID_V210X, yading@10: AV_CODEC_ID_TMV, yading@10: AV_CODEC_ID_V210, yading@10: AV_CODEC_ID_DPX, yading@10: AV_CODEC_ID_MAD, yading@10: AV_CODEC_ID_FRWU, yading@10: AV_CODEC_ID_FLASHSV2, yading@10: AV_CODEC_ID_CDGRAPHICS, yading@10: AV_CODEC_ID_R210, yading@10: AV_CODEC_ID_ANM, yading@10: AV_CODEC_ID_BINKVIDEO, yading@10: AV_CODEC_ID_IFF_ILBM, yading@10: AV_CODEC_ID_IFF_BYTERUN1, yading@10: AV_CODEC_ID_KGV1, yading@10: AV_CODEC_ID_YOP, yading@10: AV_CODEC_ID_VP8, yading@10: AV_CODEC_ID_PICTOR, yading@10: AV_CODEC_ID_ANSI, yading@10: AV_CODEC_ID_A64_MULTI, yading@10: AV_CODEC_ID_A64_MULTI5, yading@10: AV_CODEC_ID_R10K, yading@10: AV_CODEC_ID_MXPEG, yading@10: AV_CODEC_ID_LAGARITH, yading@10: AV_CODEC_ID_PRORES, yading@10: AV_CODEC_ID_JV, yading@10: AV_CODEC_ID_DFA, yading@10: AV_CODEC_ID_WMV3IMAGE, yading@10: AV_CODEC_ID_VC1IMAGE, yading@10: AV_CODEC_ID_UTVIDEO, yading@10: AV_CODEC_ID_BMV_VIDEO, yading@10: AV_CODEC_ID_VBLE, yading@10: AV_CODEC_ID_DXTORY, yading@10: AV_CODEC_ID_V410, yading@10: AV_CODEC_ID_XWD, yading@10: AV_CODEC_ID_CDXL, yading@10: AV_CODEC_ID_XBM, yading@10: AV_CODEC_ID_ZEROCODEC, yading@10: AV_CODEC_ID_MSS1, yading@10: AV_CODEC_ID_MSA1, yading@10: AV_CODEC_ID_TSCC2, yading@10: AV_CODEC_ID_MTS2, yading@10: AV_CODEC_ID_CLLC, yading@10: AV_CODEC_ID_MSS2, yading@10: AV_CODEC_ID_VP9, yading@10: AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'), yading@10: AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), yading@10: AV_CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'), yading@10: AV_CODEC_ID_EXR = MKBETAG('0','E','X','R'), yading@10: AV_CODEC_ID_AVRP = MKBETAG('A','V','R','P'), yading@10: yading@10: AV_CODEC_ID_012V = MKBETAG('0','1','2','V'), yading@10: AV_CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), yading@10: AV_CODEC_ID_AVUI = MKBETAG('A','V','U','I'), yading@10: AV_CODEC_ID_AYUV = MKBETAG('A','Y','U','V'), yading@10: AV_CODEC_ID_TARGA_Y216 = MKBETAG('T','2','1','6'), yading@10: AV_CODEC_ID_V308 = MKBETAG('V','3','0','8'), yading@10: AV_CODEC_ID_V408 = MKBETAG('V','4','0','8'), yading@10: AV_CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'), yading@10: AV_CODEC_ID_SANM = MKBETAG('S','A','N','M'), yading@10: AV_CODEC_ID_PAF_VIDEO = MKBETAG('P','A','F','V'), yading@10: AV_CODEC_ID_AVRN = MKBETAG('A','V','R','n'), yading@10: AV_CODEC_ID_CPIA = MKBETAG('C','P','I','A'), yading@10: AV_CODEC_ID_XFACE = MKBETAG('X','F','A','C'), yading@10: AV_CODEC_ID_SGIRLE = MKBETAG('S','G','I','R'), yading@10: AV_CODEC_ID_MVC1 = MKBETAG('M','V','C','1'), yading@10: AV_CODEC_ID_MVC2 = MKBETAG('M','V','C','2'), yading@10: AV_CODEC_ID_SNOW = MKBETAG('S','N','O','W'), yading@10: AV_CODEC_ID_WEBP = MKBETAG('W','E','B','P'), yading@10: yading@10: /* various PCM "codecs" */ yading@10: AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs yading@10: AV_CODEC_ID_PCM_S16LE = 0x10000, yading@10: AV_CODEC_ID_PCM_S16BE, yading@10: AV_CODEC_ID_PCM_U16LE, yading@10: AV_CODEC_ID_PCM_U16BE, yading@10: AV_CODEC_ID_PCM_S8, yading@10: AV_CODEC_ID_PCM_U8, yading@10: AV_CODEC_ID_PCM_MULAW, yading@10: AV_CODEC_ID_PCM_ALAW, yading@10: AV_CODEC_ID_PCM_S32LE, yading@10: AV_CODEC_ID_PCM_S32BE, yading@10: AV_CODEC_ID_PCM_U32LE, yading@10: AV_CODEC_ID_PCM_U32BE, yading@10: AV_CODEC_ID_PCM_S24LE, yading@10: AV_CODEC_ID_PCM_S24BE, yading@10: AV_CODEC_ID_PCM_U24LE, yading@10: AV_CODEC_ID_PCM_U24BE, yading@10: AV_CODEC_ID_PCM_S24DAUD, yading@10: AV_CODEC_ID_PCM_ZORK, yading@10: AV_CODEC_ID_PCM_S16LE_PLANAR, yading@10: AV_CODEC_ID_PCM_DVD, yading@10: AV_CODEC_ID_PCM_F32BE, yading@10: AV_CODEC_ID_PCM_F32LE, yading@10: AV_CODEC_ID_PCM_F64BE, yading@10: AV_CODEC_ID_PCM_F64LE, yading@10: AV_CODEC_ID_PCM_BLURAY, yading@10: AV_CODEC_ID_PCM_LXF, yading@10: AV_CODEC_ID_S302M, yading@10: AV_CODEC_ID_PCM_S8_PLANAR, yading@10: AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24,'P','S','P'), yading@10: AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32,'P','S','P'), yading@10: AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P','S','P',16), yading@10: yading@10: /* various ADPCM codecs */ yading@10: AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, yading@10: AV_CODEC_ID_ADPCM_IMA_WAV, yading@10: AV_CODEC_ID_ADPCM_IMA_DK3, yading@10: AV_CODEC_ID_ADPCM_IMA_DK4, yading@10: AV_CODEC_ID_ADPCM_IMA_WS, yading@10: AV_CODEC_ID_ADPCM_IMA_SMJPEG, yading@10: AV_CODEC_ID_ADPCM_MS, yading@10: AV_CODEC_ID_ADPCM_4XM, yading@10: AV_CODEC_ID_ADPCM_XA, yading@10: AV_CODEC_ID_ADPCM_ADX, yading@10: AV_CODEC_ID_ADPCM_EA, yading@10: AV_CODEC_ID_ADPCM_G726, yading@10: AV_CODEC_ID_ADPCM_CT, yading@10: AV_CODEC_ID_ADPCM_SWF, yading@10: AV_CODEC_ID_ADPCM_YAMAHA, yading@10: AV_CODEC_ID_ADPCM_SBPRO_4, yading@10: AV_CODEC_ID_ADPCM_SBPRO_3, yading@10: AV_CODEC_ID_ADPCM_SBPRO_2, yading@10: AV_CODEC_ID_ADPCM_THP, yading@10: AV_CODEC_ID_ADPCM_IMA_AMV, yading@10: AV_CODEC_ID_ADPCM_EA_R1, yading@10: AV_CODEC_ID_ADPCM_EA_R3, yading@10: AV_CODEC_ID_ADPCM_EA_R2, yading@10: AV_CODEC_ID_ADPCM_IMA_EA_SEAD, yading@10: AV_CODEC_ID_ADPCM_IMA_EA_EACS, yading@10: AV_CODEC_ID_ADPCM_EA_XAS, yading@10: AV_CODEC_ID_ADPCM_EA_MAXIS_XA, yading@10: AV_CODEC_ID_ADPCM_IMA_ISS, yading@10: AV_CODEC_ID_ADPCM_G722, yading@10: AV_CODEC_ID_ADPCM_IMA_APC, yading@10: AV_CODEC_ID_VIMA = MKBETAG('V','I','M','A'), yading@10: AV_CODEC_ID_ADPCM_AFC = MKBETAG('A','F','C',' '), yading@10: AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O','K','I',' '), yading@10: yading@10: /* AMR */ yading@10: AV_CODEC_ID_AMR_NB = 0x12000, yading@10: AV_CODEC_ID_AMR_WB, yading@10: yading@10: /* RealAudio codecs*/ yading@10: AV_CODEC_ID_RA_144 = 0x13000, yading@10: AV_CODEC_ID_RA_288, yading@10: yading@10: /* various DPCM codecs */ yading@10: AV_CODEC_ID_ROQ_DPCM = 0x14000, yading@10: AV_CODEC_ID_INTERPLAY_DPCM, yading@10: AV_CODEC_ID_XAN_DPCM, yading@10: AV_CODEC_ID_SOL_DPCM, yading@10: yading@10: /* audio codecs */ yading@10: AV_CODEC_ID_MP2 = 0x15000, yading@10: AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 yading@10: AV_CODEC_ID_AAC, yading@10: AV_CODEC_ID_AC3, yading@10: AV_CODEC_ID_DTS, yading@10: AV_CODEC_ID_VORBIS, yading@10: AV_CODEC_ID_DVAUDIO, yading@10: AV_CODEC_ID_WMAV1, yading@10: AV_CODEC_ID_WMAV2, yading@10: AV_CODEC_ID_MACE3, yading@10: AV_CODEC_ID_MACE6, yading@10: AV_CODEC_ID_VMDAUDIO, yading@10: AV_CODEC_ID_FLAC, yading@10: AV_CODEC_ID_MP3ADU, yading@10: AV_CODEC_ID_MP3ON4, yading@10: AV_CODEC_ID_SHORTEN, yading@10: AV_CODEC_ID_ALAC, yading@10: AV_CODEC_ID_WESTWOOD_SND1, yading@10: AV_CODEC_ID_GSM, ///< as in Berlin toast format yading@10: AV_CODEC_ID_QDM2, yading@10: AV_CODEC_ID_COOK, yading@10: AV_CODEC_ID_TRUESPEECH, yading@10: AV_CODEC_ID_TTA, yading@10: AV_CODEC_ID_SMACKAUDIO, yading@10: AV_CODEC_ID_QCELP, yading@10: AV_CODEC_ID_WAVPACK, yading@10: AV_CODEC_ID_DSICINAUDIO, yading@10: AV_CODEC_ID_IMC, yading@10: AV_CODEC_ID_MUSEPACK7, yading@10: AV_CODEC_ID_MLP, yading@10: AV_CODEC_ID_GSM_MS, /* as found in WAV */ yading@10: AV_CODEC_ID_ATRAC3, yading@10: AV_CODEC_ID_VOXWARE, yading@10: AV_CODEC_ID_APE, yading@10: AV_CODEC_ID_NELLYMOSER, yading@10: AV_CODEC_ID_MUSEPACK8, yading@10: AV_CODEC_ID_SPEEX, yading@10: AV_CODEC_ID_WMAVOICE, yading@10: AV_CODEC_ID_WMAPRO, yading@10: AV_CODEC_ID_WMALOSSLESS, yading@10: AV_CODEC_ID_ATRAC3P, yading@10: AV_CODEC_ID_EAC3, yading@10: AV_CODEC_ID_SIPR, yading@10: AV_CODEC_ID_MP1, yading@10: AV_CODEC_ID_TWINVQ, yading@10: AV_CODEC_ID_TRUEHD, yading@10: AV_CODEC_ID_MP4ALS, yading@10: AV_CODEC_ID_ATRAC1, yading@10: AV_CODEC_ID_BINKAUDIO_RDFT, yading@10: AV_CODEC_ID_BINKAUDIO_DCT, yading@10: AV_CODEC_ID_AAC_LATM, yading@10: AV_CODEC_ID_QDMC, yading@10: AV_CODEC_ID_CELT, yading@10: AV_CODEC_ID_G723_1, yading@10: AV_CODEC_ID_G729, yading@10: AV_CODEC_ID_8SVX_EXP, yading@10: AV_CODEC_ID_8SVX_FIB, yading@10: AV_CODEC_ID_BMV_AUDIO, yading@10: AV_CODEC_ID_RALF, yading@10: AV_CODEC_ID_IAC, yading@10: AV_CODEC_ID_ILBC, yading@10: AV_CODEC_ID_OPUS_DEPRECATED, yading@10: AV_CODEC_ID_COMFORT_NOISE, yading@10: AV_CODEC_ID_TAK_DEPRECATED, yading@10: AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'), yading@10: AV_CODEC_ID_SONIC = MKBETAG('S','O','N','C'), yading@10: AV_CODEC_ID_SONIC_LS = MKBETAG('S','O','N','L'), yading@10: AV_CODEC_ID_PAF_AUDIO = MKBETAG('P','A','F','A'), yading@10: AV_CODEC_ID_OPUS = MKBETAG('O','P','U','S'), yading@10: AV_CODEC_ID_TAK = MKBETAG('t','B','a','K'), yading@10: AV_CODEC_ID_EVRC = MKBETAG('s','e','v','c'), yading@10: AV_CODEC_ID_SMV = MKBETAG('s','s','m','v'), yading@10: yading@10: /* subtitle codecs */ yading@10: AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. yading@10: AV_CODEC_ID_DVD_SUBTITLE = 0x17000, yading@10: AV_CODEC_ID_DVB_SUBTITLE, yading@10: AV_CODEC_ID_TEXT, ///< raw UTF-8 text yading@10: AV_CODEC_ID_XSUB, yading@10: AV_CODEC_ID_SSA, yading@10: AV_CODEC_ID_MOV_TEXT, yading@10: AV_CODEC_ID_HDMV_PGS_SUBTITLE, yading@10: AV_CODEC_ID_DVB_TELETEXT, yading@10: AV_CODEC_ID_SRT, yading@10: AV_CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'), yading@10: AV_CODEC_ID_EIA_608 = MKBETAG('c','6','0','8'), yading@10: AV_CODEC_ID_JACOSUB = MKBETAG('J','S','U','B'), yading@10: AV_CODEC_ID_SAMI = MKBETAG('S','A','M','I'), yading@10: AV_CODEC_ID_REALTEXT = MKBETAG('R','T','X','T'), yading@10: AV_CODEC_ID_SUBVIEWER1 = MKBETAG('S','b','V','1'), yading@10: AV_CODEC_ID_SUBVIEWER = MKBETAG('S','u','b','V'), yading@10: AV_CODEC_ID_SUBRIP = MKBETAG('S','R','i','p'), yading@10: AV_CODEC_ID_WEBVTT = MKBETAG('W','V','T','T'), yading@10: AV_CODEC_ID_MPL2 = MKBETAG('M','P','L','2'), yading@10: AV_CODEC_ID_VPLAYER = MKBETAG('V','P','l','r'), yading@10: AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), yading@10: AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska yading@10: yading@10: /* other specific kind of codecs (generally used for attachments) */ yading@10: AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. yading@10: AV_CODEC_ID_TTF = 0x18000, yading@10: AV_CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'), yading@10: AV_CODEC_ID_XBIN = MKBETAG('X','B','I','N'), yading@10: AV_CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'), yading@10: AV_CODEC_ID_OTF = MKBETAG( 0 ,'O','T','F'), yading@10: AV_CODEC_ID_SMPTE_KLV = MKBETAG('K','L','V','A'), yading@10: AV_CODEC_ID_DVD_NAV = MKBETAG('D','N','A','V'), yading@10: yading@10: yading@10: AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it yading@10: yading@10: AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS yading@10: * stream (only used by libavformat) */ yading@10: AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems yading@10: * stream (only used by libavformat) */ yading@10: AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. yading@10: yading@10: #if FF_API_CODEC_ID yading@10: #include "old_codec_ids.h" yading@10: #endif yading@10: }; yading@10: yading@10: /** yading@10: * This struct describes the properties of a single codec described by an yading@10: * AVCodecID. yading@10: * @see avcodec_get_descriptor() yading@10: */ yading@10: typedef struct AVCodecDescriptor { yading@10: enum AVCodecID id; yading@10: enum AVMediaType type; yading@10: /** yading@10: * Name of the codec described by this descriptor. It is non-empty and yading@10: * unique for each codec descriptor. It should contain alphanumeric yading@10: * characters and '_' only. yading@10: */ yading@10: const char *name; yading@10: /** yading@10: * A more descriptive name for this codec. May be NULL. yading@10: */ yading@10: const char *long_name; yading@10: /** yading@10: * Codec properties, a combination of AV_CODEC_PROP_* flags. yading@10: */ yading@10: int props; yading@10: } AVCodecDescriptor; yading@10: yading@10: /** yading@10: * Codec uses only intra compression. yading@10: * Video codecs only. yading@10: */ yading@10: #define AV_CODEC_PROP_INTRA_ONLY (1 << 0) yading@10: /** yading@10: * Codec supports lossy compression. Audio and video codecs only. yading@10: * @note a codec may support both lossy and lossless yading@10: * compression modes yading@10: */ yading@10: #define AV_CODEC_PROP_LOSSY (1 << 1) yading@10: /** yading@10: * Codec supports lossless compression. Audio and video codecs only. yading@10: */ yading@10: #define AV_CODEC_PROP_LOSSLESS (1 << 2) yading@10: /** yading@10: * Subtitle codec is bitmap based yading@10: * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. yading@10: */ yading@10: #define AV_CODEC_PROP_BITMAP_SUB (1 << 16) yading@10: /** yading@10: * Subtitle codec is text based. yading@10: * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field. yading@10: */ yading@10: #define AV_CODEC_PROP_TEXT_SUB (1 << 17) yading@10: yading@10: /** yading@10: * @ingroup lavc_decoding yading@10: * Required number of additionally allocated bytes at the end of the input bitstream for decoding. yading@10: * This is mainly needed because some optimized bitstream readers read yading@10: * 32 or 64 bit at once and could read over the end.
yading@10: * Note: If the first 23 bits of the additional bytes are not 0, then damaged yading@10: * MPEG bitstreams could cause overread and segfault. yading@10: */ yading@10: #define FF_INPUT_BUFFER_PADDING_SIZE 16 yading@10: yading@10: /** yading@10: * @ingroup lavc_encoding yading@10: * minimum encoding buffer size yading@10: * Used to avoid some checks during header writing. yading@10: */ yading@10: #define FF_MIN_BUFFER_SIZE 16384 yading@10: yading@10: yading@10: /** yading@10: * @ingroup lavc_encoding yading@10: * motion estimation type. yading@10: */ yading@10: enum Motion_Est_ID { yading@10: ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed yading@10: ME_FULL, yading@10: ME_LOG, yading@10: ME_PHODS, yading@10: ME_EPZS, ///< enhanced predictive zonal search yading@10: ME_X1, ///< reserved for experiments yading@10: ME_HEX, ///< hexagon based search yading@10: ME_UMH, ///< uneven multi-hexagon search yading@10: ME_TESA, ///< transformed exhaustive search algorithm yading@10: ME_ITER=50, ///< iterative search yading@10: }; yading@10: yading@10: /** yading@10: * @ingroup lavc_decoding yading@10: */ yading@10: enum AVDiscard{ yading@10: /* We leave some space between them for extensions (drop some yading@10: * keyframes for intra-only or drop just some bidir frames). */ yading@10: AVDISCARD_NONE =-16, ///< discard nothing yading@10: AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi yading@10: AVDISCARD_NONREF = 8, ///< discard all non reference yading@10: AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames yading@10: AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes yading@10: AVDISCARD_ALL = 48, ///< discard all yading@10: }; yading@10: yading@10: enum AVColorPrimaries{ yading@10: AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B yading@10: AVCOL_PRI_UNSPECIFIED = 2, yading@10: AVCOL_PRI_BT470M = 4, yading@10: AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM yading@10: AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC yading@10: AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above yading@10: AVCOL_PRI_FILM = 8, yading@10: AVCOL_PRI_NB , ///< Not part of ABI yading@10: }; yading@10: yading@10: enum AVColorTransferCharacteristic{ yading@10: AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 yading@10: AVCOL_TRC_UNSPECIFIED = 2, yading@10: AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM yading@10: AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG yading@10: AVCOL_TRC_SMPTE240M = 7, yading@10: AVCOL_TRC_NB , ///< Not part of ABI yading@10: }; yading@10: yading@10: enum AVColorSpace{ yading@10: AVCOL_SPC_RGB = 0, yading@10: AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B yading@10: AVCOL_SPC_UNSPECIFIED = 2, yading@10: AVCOL_SPC_FCC = 4, yading@10: AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 yading@10: AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above yading@10: AVCOL_SPC_SMPTE240M = 7, yading@10: AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 yading@10: AVCOL_SPC_NB , ///< Not part of ABI yading@10: }; yading@10: #define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG yading@10: yading@10: enum AVColorRange{ yading@10: AVCOL_RANGE_UNSPECIFIED = 0, yading@10: AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges yading@10: AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges yading@10: AVCOL_RANGE_NB , ///< Not part of ABI yading@10: }; yading@10: yading@10: /** yading@10: * X X 3 4 X X are luma samples, yading@10: * 1 2 1-6 are possible chroma positions yading@10: * X X 5 6 X 0 is undefined/unknown position yading@10: */ yading@10: enum AVChromaLocation{ yading@10: AVCHROMA_LOC_UNSPECIFIED = 0, yading@10: AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default yading@10: AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 yading@10: AVCHROMA_LOC_TOPLEFT = 3, ///< DV yading@10: AVCHROMA_LOC_TOP = 4, yading@10: AVCHROMA_LOC_BOTTOMLEFT = 5, yading@10: AVCHROMA_LOC_BOTTOM = 6, yading@10: AVCHROMA_LOC_NB , ///< Not part of ABI yading@10: }; yading@10: yading@10: enum AVAudioServiceType { yading@10: AV_AUDIO_SERVICE_TYPE_MAIN = 0, yading@10: AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, yading@10: AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, yading@10: AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, yading@10: AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, yading@10: AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, yading@10: AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, yading@10: AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, yading@10: AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, yading@10: AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI yading@10: }; yading@10: yading@10: /** yading@10: * @ingroup lavc_encoding yading@10: */ yading@10: typedef struct RcOverride{ yading@10: int start_frame; yading@10: int end_frame; yading@10: int qscale; // If this is 0 then quality_factor will be used instead. yading@10: float quality_factor; yading@10: } RcOverride; yading@10: yading@10: #define FF_MAX_B_FRAMES 16 yading@10: yading@10: /* encoding support yading@10: These flags can be passed in AVCodecContext.flags before initialization. yading@10: Note: Not everything is supported yet. yading@10: */ yading@10: yading@10: /** yading@10: * Allow decoders to produce frames with data planes that are not aligned yading@10: * to CPU requirements (e.g. due to cropping). yading@10: */ yading@10: #define CODEC_FLAG_UNALIGNED 0x0001 yading@10: #define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. yading@10: #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. yading@10: #define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. yading@10: #define CODEC_FLAG_GMC 0x0020 ///< Use GMC. yading@10: #define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>. yading@10: /** yading@10: * The parent program guarantees that the input for B-frames containing yading@10: * streams is not written to for at least s->max_b_frames+1 frames, if yading@10: * this is not set the input will be copied. yading@10: */ yading@10: #define CODEC_FLAG_INPUT_PRESERVED 0x0100 yading@10: #define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. yading@10: #define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. yading@10: #define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. yading@10: #define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges. yading@10: #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. yading@10: #define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random yading@10: location instead of only at frame boundaries. */ yading@10: #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization. yading@10: #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. yading@10: #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. yading@10: #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. yading@10: #define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). yading@10: /* Fx : Flag for h263+ extra options */ yading@10: #define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction yading@10: #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter yading@10: #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation yading@10: #define CODEC_FLAG_CLOSED_GOP 0x80000000 yading@10: #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. yading@10: #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. yading@10: #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. yading@10: #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. DEPRECATED!!!! yading@10: #define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS. yading@10: yading@10: #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. yading@10: #define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe yading@10: yading@10: /* Unsupported options : yading@10: * Syntax Arithmetic coding (SAC) yading@10: * Reference Picture Selection yading@10: * Independent Segment Decoding */ yading@10: /* /Fx */ yading@10: /* codec capabilities */ yading@10: yading@10: #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. yading@10: /** yading@10: * Codec uses get_buffer() for allocating buffers and supports custom allocators. yading@10: * If not set, it might not use get_buffer() at all or use operations that yading@10: * assume the buffer was allocated by avcodec_default_get_buffer. yading@10: */ yading@10: #define CODEC_CAP_DR1 0x0002 yading@10: #define CODEC_CAP_TRUNCATED 0x0008 yading@10: /* Codec can export data for HW decoding (XvMC). */ yading@10: #define CODEC_CAP_HWACCEL 0x0010 yading@10: /** yading@10: * Encoder or decoder requires flushing with NULL input at the end in order to yading@10: * give the complete and correct output. yading@10: * yading@10: * NOTE: If this flag is not set, the codec is guaranteed to never be fed with yading@10: * with NULL data. The user can still send NULL data to the public encode yading@10: * or decode function, but libavcodec will not pass it along to the codec yading@10: * unless this flag is set. yading@10: * yading@10: * Decoders: yading@10: * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, yading@10: * avpkt->size=0 at the end to get the delayed data until the decoder no longer yading@10: * returns frames. yading@10: * yading@10: * Encoders: yading@10: * The encoder needs to be fed with NULL data at the end of encoding until the yading@10: * encoder no longer returns data. yading@10: * yading@10: * NOTE: For encoders implementing the AVCodec.encode2() function, setting this yading@10: * flag also means that the encoder must set the pts and duration for yading@10: * each output packet. If this flag is not set, the pts and duration will yading@10: * be determined by libavcodec from the input frame. yading@10: */ yading@10: #define CODEC_CAP_DELAY 0x0020 yading@10: /** yading@10: * Codec can be fed a final frame with a smaller size. yading@10: * This can be used to prevent truncation of the last audio samples. yading@10: */ yading@10: #define CODEC_CAP_SMALL_LAST_FRAME 0x0040 yading@10: /** yading@10: * Codec can export data for HW decoding (VDPAU). yading@10: */ yading@10: #define CODEC_CAP_HWACCEL_VDPAU 0x0080 yading@10: /** yading@10: * Codec can output multiple frames per AVPacket yading@10: * Normally demuxers return one frame at a time, demuxers which do not do yading@10: * are connected to a parser to split what they return into proper frames. yading@10: * This flag is reserved to the very rare category of codecs which have a yading@10: * bitstream that cannot be split into frames without timeconsuming yading@10: * operations like full decoding. Demuxers carring such bitstreams thus yading@10: * may return multiple frames in a packet. This has many disadvantages like yading@10: * prohibiting stream copy in many cases thus it should only be considered yading@10: * as a last resort. yading@10: */ yading@10: #define CODEC_CAP_SUBFRAMES 0x0100 yading@10: /** yading@10: * Codec is experimental and is thus avoided in favor of non experimental yading@10: * encoders yading@10: */ yading@10: #define CODEC_CAP_EXPERIMENTAL 0x0200 yading@10: /** yading@10: * Codec should fill in channel configuration and samplerate instead of container yading@10: */ yading@10: #define CODEC_CAP_CHANNEL_CONF 0x0400 yading@10: yading@10: /** yading@10: * Codec is able to deal with negative linesizes yading@10: */ yading@10: #define CODEC_CAP_NEG_LINESIZES 0x0800 yading@10: yading@10: /** yading@10: * Codec supports frame-level multithreading. yading@10: */ yading@10: #define CODEC_CAP_FRAME_THREADS 0x1000 yading@10: /** yading@10: * Codec supports slice-based (or partition-based) multithreading. yading@10: */ yading@10: #define CODEC_CAP_SLICE_THREADS 0x2000 yading@10: /** yading@10: * Codec supports changed parameters at any point. yading@10: */ yading@10: #define CODEC_CAP_PARAM_CHANGE 0x4000 yading@10: /** yading@10: * Codec supports avctx->thread_count == 0 (auto). yading@10: */ yading@10: #define CODEC_CAP_AUTO_THREADS 0x8000 yading@10: /** yading@10: * Audio encoder supports receiving a different number of samples in each call. yading@10: */ yading@10: #define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 yading@10: /** yading@10: * Codec is intra only. yading@10: */ yading@10: #define CODEC_CAP_INTRA_ONLY 0x40000000 yading@10: /** yading@10: * Codec is lossless. yading@10: */ yading@10: #define CODEC_CAP_LOSSLESS 0x80000000 yading@10: yading@10: //The following defines may change, don't expect compatibility if you use them. yading@10: #define MB_TYPE_INTRA4x4 0x0001 yading@10: #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific yading@10: #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific yading@10: #define MB_TYPE_16x16 0x0008 yading@10: #define MB_TYPE_16x8 0x0010 yading@10: #define MB_TYPE_8x16 0x0020 yading@10: #define MB_TYPE_8x8 0x0040 yading@10: #define MB_TYPE_INTERLACED 0x0080 yading@10: #define MB_TYPE_DIRECT2 0x0100 //FIXME yading@10: #define MB_TYPE_ACPRED 0x0200 yading@10: #define MB_TYPE_GMC 0x0400 yading@10: #define MB_TYPE_SKIP 0x0800 yading@10: #define MB_TYPE_P0L0 0x1000 yading@10: #define MB_TYPE_P1L0 0x2000 yading@10: #define MB_TYPE_P0L1 0x4000 yading@10: #define MB_TYPE_P1L1 0x8000 yading@10: #define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) yading@10: #define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) yading@10: #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) yading@10: #define MB_TYPE_QUANT 0x00010000 yading@10: #define MB_TYPE_CBP 0x00020000 yading@10: //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) yading@10: yading@10: /** yading@10: * Pan Scan area. yading@10: * This specifies the area which should be displayed. yading@10: * Note there may be multiple such areas for one frame. yading@10: */ yading@10: typedef struct AVPanScan{ yading@10: /** yading@10: * id yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int id; yading@10: yading@10: /** yading@10: * width and height in 1/16 pel yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int width; yading@10: int height; yading@10: yading@10: /** yading@10: * position of the top left corner in 1/16 pel for up to 3 fields/frames yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int16_t position[3][2]; yading@10: }AVPanScan; yading@10: yading@10: #define FF_QSCALE_TYPE_MPEG1 0 yading@10: #define FF_QSCALE_TYPE_MPEG2 1 yading@10: #define FF_QSCALE_TYPE_H264 2 yading@10: #define FF_QSCALE_TYPE_VP56 3 yading@10: yading@10: #if FF_API_GET_BUFFER yading@10: #define FF_BUFFER_TYPE_INTERNAL 1 yading@10: #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) yading@10: #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. yading@10: #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. yading@10: yading@10: #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). yading@10: #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. yading@10: #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. yading@10: #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). yading@10: #endif yading@10: yading@10: /** yading@10: * The decoder will keep a reference to the frame and may reuse it later. yading@10: */ yading@10: #define AV_GET_BUFFER_FLAG_REF (1 << 0) yading@10: yading@10: /** yading@10: * @defgroup lavc_packet AVPacket yading@10: * yading@10: * Types and functions for working with AVPacket. yading@10: * @{ yading@10: */ yading@10: enum AVPacketSideDataType { yading@10: AV_PKT_DATA_PALETTE, yading@10: AV_PKT_DATA_NEW_EXTRADATA, yading@10: yading@10: /** yading@10: * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: yading@10: * @code yading@10: * u32le param_flags yading@10: * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) yading@10: * s32le channel_count yading@10: * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) yading@10: * u64le channel_layout yading@10: * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) yading@10: * s32le sample_rate yading@10: * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) yading@10: * s32le width yading@10: * s32le height yading@10: * @endcode yading@10: */ yading@10: AV_PKT_DATA_PARAM_CHANGE, yading@10: yading@10: /** yading@10: * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of yading@10: * structures with info about macroblocks relevant to splitting the yading@10: * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). yading@10: * That is, it does not necessarily contain info about all macroblocks, yading@10: * as long as the distance between macroblocks in the info is smaller yading@10: * than the target payload size. yading@10: * Each MB info structure is 12 bytes, and is laid out as follows: yading@10: * @code yading@10: * u32le bit offset from the start of the packet yading@10: * u8 current quantizer at the start of the macroblock yading@10: * u8 GOB number yading@10: * u16le macroblock address within the GOB yading@10: * u8 horizontal MV predictor yading@10: * u8 vertical MV predictor yading@10: * u8 horizontal MV predictor for block number 3 yading@10: * u8 vertical MV predictor for block number 3 yading@10: * @endcode yading@10: */ yading@10: AV_PKT_DATA_H263_MB_INFO, yading@10: yading@10: /** yading@10: * Recommmends skipping the specified number of samples yading@10: * @code yading@10: * u32le number of samples to skip from start of this packet yading@10: * u32le number of samples to skip from end of this packet yading@10: * u8 reason for start skip yading@10: * u8 reason for end skip (0=padding silence, 1=convergence) yading@10: * @endcode yading@10: */ yading@10: AV_PKT_DATA_SKIP_SAMPLES=70, yading@10: yading@10: /** yading@10: * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that yading@10: * the packet may contain "dual mono" audio specific to Japanese DTV yading@10: * and if it is true, recommends only the selected channel to be used. yading@10: * @code yading@10: * u8 selected channels (0=mail/left, 1=sub/right, 2=both) yading@10: * @endcode yading@10: */ yading@10: AV_PKT_DATA_JP_DUALMONO, yading@10: yading@10: /** yading@10: * A list of zero terminated key/value strings. There is no end marker for yading@10: * the list, so it is required to rely on the side data size to stop. yading@10: */ yading@10: AV_PKT_DATA_STRINGS_METADATA, yading@10: yading@10: /** yading@10: * Subtitle event position yading@10: * @code yading@10: * u32le x1 yading@10: * u32le y1 yading@10: * u32le x2 yading@10: * u32le y2 yading@10: * @endcode yading@10: */ yading@10: AV_PKT_DATA_SUBTITLE_POSITION, yading@10: yading@10: /** yading@10: * Data found in BlockAdditional element of matroska container. There is yading@10: * no end marker for the data, so it is required to rely on the side data yading@10: * size to recognize the end. 8 byte id (as found in BlockAddId) followed yading@10: * by data. yading@10: */ yading@10: AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, yading@10: }; yading@10: yading@10: /** yading@10: * This structure stores compressed data. It is typically exported by demuxers yading@10: * and then passed as input to decoders, or received as output from encoders and yading@10: * then passed to muxers. yading@10: * yading@10: * For video, it should typically contain one compressed frame. For audio it may yading@10: * contain several compressed frames. yading@10: * yading@10: * AVPacket is one of the few structs in FFmpeg, whose size is a part of public yading@10: * ABI. Thus it may be allocated on stack and no new fields can be added to it yading@10: * without libavcodec and libavformat major bump. yading@10: * yading@10: * The semantics of data ownership depends on the buf or destruct (deprecated) yading@10: * fields. If either is set, the packet data is dynamically allocated and is yading@10: * valid indefinitely until av_free_packet() is called (which in turn calls yading@10: * av_buffer_unref()/the destruct callback to free the data). If neither is set, yading@10: * the packet data is typically backed by some static buffer somewhere and is yading@10: * only valid for a limited time (e.g. until the next read call when demuxing). yading@10: * yading@10: * The side data is always allocated with av_malloc() and is freed in yading@10: * av_free_packet(). yading@10: */ yading@10: typedef struct AVPacket { yading@10: /** yading@10: * A reference to the reference-counted buffer where the packet data is yading@10: * stored. yading@10: * May be NULL, then the packet data is not reference-counted. yading@10: */ yading@10: AVBufferRef *buf; yading@10: /** yading@10: * Presentation timestamp in AVStream->time_base units; the time at which yading@10: * the decompressed packet will be presented to the user. yading@10: * Can be AV_NOPTS_VALUE if it is not stored in the file. yading@10: * pts MUST be larger or equal to dts as presentation cannot happen before yading@10: * decompression, unless one wants to view hex dumps. Some formats misuse yading@10: * the terms dts and pts/cts to mean something different. Such timestamps yading@10: * must be converted to true pts/dts before they are stored in AVPacket. yading@10: */ yading@10: int64_t pts; yading@10: /** yading@10: * Decompression timestamp in AVStream->time_base units; the time at which yading@10: * the packet is decompressed. yading@10: * Can be AV_NOPTS_VALUE if it is not stored in the file. yading@10: */ yading@10: int64_t dts; yading@10: uint8_t *data; yading@10: int size; yading@10: int stream_index; yading@10: /** yading@10: * A combination of AV_PKT_FLAG values yading@10: */ yading@10: int flags; yading@10: /** yading@10: * Additional packet data that can be provided by the container. yading@10: * Packet can contain several types of side information. yading@10: */ yading@10: struct { yading@10: uint8_t *data; yading@10: int size; yading@10: enum AVPacketSideDataType type; yading@10: } *side_data; yading@10: int side_data_elems; yading@10: yading@10: /** yading@10: * Duration of this packet in AVStream->time_base units, 0 if unknown. yading@10: * Equals next_pts - this_pts in presentation order. yading@10: */ yading@10: int duration; yading@10: #if FF_API_DESTRUCT_PACKET yading@10: attribute_deprecated yading@10: void (*destruct)(struct AVPacket *); yading@10: attribute_deprecated yading@10: void *priv; yading@10: #endif yading@10: int64_t pos; ///< byte position in stream, -1 if unknown yading@10: yading@10: /** yading@10: * Time difference in AVStream->time_base units from the pts of this yading@10: * packet to the point at which the output from the decoder has converged yading@10: * independent from the availability of previous frames. That is, the yading@10: * frames are virtually identical no matter if decoding started from yading@10: * the very first frame or from this keyframe. yading@10: * Is AV_NOPTS_VALUE if unknown. yading@10: * This field is not the display duration of the current packet. yading@10: * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY yading@10: * set. yading@10: * yading@10: * The purpose of this field is to allow seeking in streams that have no yading@10: * keyframes in the conventional sense. It corresponds to the yading@10: * recovery point SEI in H.264 and match_time_delta in NUT. It is also yading@10: * essential for some types of subtitle streams to ensure that all yading@10: * subtitles are correctly displayed after seeking. yading@10: */ yading@10: int64_t convergence_duration; yading@10: } AVPacket; yading@10: #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe yading@10: #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted yading@10: yading@10: enum AVSideDataParamChangeFlags { yading@10: AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, yading@10: AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, yading@10: AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, yading@10: AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, yading@10: }; yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: struct AVCodecInternal; yading@10: yading@10: enum AVFieldOrder { yading@10: AV_FIELD_UNKNOWN, yading@10: AV_FIELD_PROGRESSIVE, yading@10: AV_FIELD_TT, //< Top coded_first, top displayed first yading@10: AV_FIELD_BB, //< Bottom coded first, bottom displayed first yading@10: AV_FIELD_TB, //< Top coded first, bottom displayed first yading@10: AV_FIELD_BT, //< Bottom coded first, top displayed first yading@10: }; yading@10: yading@10: /** yading@10: * main external API structure. yading@10: * New fields can be added to the end with minor version bumps. yading@10: * Removal, reordering and changes to existing fields require a major yading@10: * version bump. yading@10: * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user yading@10: * applications. yading@10: * sizeof(AVCodecContext) must not be used outside libav*. yading@10: */ yading@10: typedef struct AVCodecContext { yading@10: /** yading@10: * information on struct for av_log yading@10: * - set by avcodec_alloc_context3 yading@10: */ yading@10: const AVClass *av_class; yading@10: int log_level_offset; yading@10: yading@10: enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ yading@10: const struct AVCodec *codec; yading@10: char codec_name[32]; yading@10: enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ yading@10: yading@10: /** yading@10: * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). yading@10: * This is used to work around some encoder bugs. yading@10: * A demuxer should set this to what is stored in the field used to identify the codec. yading@10: * If there are multiple such fields in a container then the demuxer should choose the one yading@10: * which maximizes the information about the used codec. yading@10: * If the codec tag field in a container is larger than 32 bits then the demuxer should yading@10: * remap the longer ID to 32 bits with a table or other structure. Alternatively a new yading@10: * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated yading@10: * first. yading@10: * - encoding: Set by user, if not then the default based on codec_id will be used. yading@10: * - decoding: Set by user, will be converted to uppercase by libavcodec during init. yading@10: */ yading@10: unsigned int codec_tag; yading@10: yading@10: /** yading@10: * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). yading@10: * This is used to work around some encoder bugs. yading@10: * - encoding: unused yading@10: * - decoding: Set by user, will be converted to uppercase by libavcodec during init. yading@10: */ yading@10: unsigned int stream_codec_tag; yading@10: yading@10: void *priv_data; yading@10: yading@10: /** yading@10: * Private context used for internal data. yading@10: * yading@10: * Unlike priv_data, this is not codec-specific. It is used in general yading@10: * libavcodec functions. yading@10: */ yading@10: struct AVCodecInternal *internal; yading@10: yading@10: /** yading@10: * Private data of the user, can be used to carry app specific stuff. yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: void *opaque; yading@10: yading@10: /** yading@10: * the average bitrate yading@10: * - encoding: Set by user; unused for constant quantizer encoding. yading@10: * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. yading@10: */ yading@10: int bit_rate; yading@10: yading@10: /** yading@10: * number of bits the bitstream is allowed to diverge from the reference. yading@10: * the reference can be CBR (for CBR pass1) or VBR (for pass2) yading@10: * - encoding: Set by user; unused for constant quantizer encoding. yading@10: * - decoding: unused yading@10: */ yading@10: int bit_rate_tolerance; yading@10: yading@10: /** yading@10: * Global quality for codecs which cannot change it per frame. yading@10: * This should be proportional to MPEG-1/2/4 qscale. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int global_quality; yading@10: yading@10: /** yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int compression_level; yading@10: #define FF_COMPRESSION_DEFAULT -1 yading@10: yading@10: /** yading@10: * CODEC_FLAG_*. yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int flags; yading@10: yading@10: /** yading@10: * CODEC_FLAG2_* yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int flags2; yading@10: yading@10: /** yading@10: * some codecs need / can use extradata like Huffman tables. yading@10: * mjpeg: Huffman tables yading@10: * rv10: additional flags yading@10: * mpeg4: global headers (they can be in the bitstream or here) yading@10: * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger yading@10: * than extradata_size to avoid prolems if it is read with the bitstream reader. yading@10: * The bytewise contents of extradata must not depend on the architecture or CPU endianness. yading@10: * - encoding: Set/allocated/freed by libavcodec. yading@10: * - decoding: Set/allocated/freed by user. yading@10: */ yading@10: uint8_t *extradata; yading@10: int extradata_size; yading@10: yading@10: /** yading@10: * This is the fundamental unit of time (in seconds) in terms yading@10: * of which frame timestamps are represented. For fixed-fps content, yading@10: * timebase should be 1/framerate and timestamp increments should be yading@10: * identically 1. yading@10: * - encoding: MUST be set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: AVRational time_base; yading@10: yading@10: /** yading@10: * For some codecs, the time base is closer to the field rate than the frame rate. yading@10: * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration yading@10: * if no telecine is used ... yading@10: * yading@10: * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. yading@10: */ yading@10: int ticks_per_frame; yading@10: yading@10: /** yading@10: * Codec delay. yading@10: * yading@10: * Encoding: Number of frames delay there will be from the encoder input to yading@10: * the decoder output. (we assume the decoder matches the spec) yading@10: * Decoding: Number of frames delay in addition to what a standard decoder yading@10: * as specified in the spec would produce. yading@10: * yading@10: * Video: yading@10: * Number of frames the decoded output will be delayed relative to the yading@10: * encoded input. yading@10: * yading@10: * Audio: yading@10: * For encoding, this is the number of "priming" samples added to the yading@10: * beginning of the stream. The decoded output will be delayed by this yading@10: * many samples relative to the input to the encoder. Note that this yading@10: * field is purely informational and does not directly affect the pts yading@10: * output by the encoder, which should always be based on the actual yading@10: * presentation time, including any delay. yading@10: * For decoding, this is the number of samples the decoder needs to yading@10: * output before the decoder's output is valid. When seeking, you should yading@10: * start decoding this many samples prior to your desired seek point. yading@10: * yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int delay; yading@10: yading@10: yading@10: /* video only */ yading@10: /** yading@10: * picture width / height. yading@10: * - encoding: MUST be set by user. yading@10: * - decoding: May be set by the user before opening the decoder if known e.g. yading@10: * from the container. Some decoders will require the dimensions yading@10: * to be set by the caller. During decoding, the decoder may yading@10: * overwrite those values as required. yading@10: */ yading@10: int width, height; yading@10: yading@10: /** yading@10: * Bitstream width / height, may be different from width/height e.g. when yading@10: * the decoded frame is cropped before being output or lowres is enabled. yading@10: * - encoding: unused yading@10: * - decoding: May be set by the user before opening the decoder if known yading@10: * e.g. from the container. During decoding, the decoder may yading@10: * overwrite those values as required. yading@10: */ yading@10: int coded_width, coded_height; yading@10: yading@10: #define FF_ASPECT_EXTENDED 15 yading@10: yading@10: /** yading@10: * the number of pictures in a group of pictures, or 0 for intra_only yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int gop_size; yading@10: yading@10: /** yading@10: * Pixel format, see AV_PIX_FMT_xxx. yading@10: * May be set by the demuxer if known from headers. yading@10: * May be overridden by the decoder if it knows better. yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user if known, overridden by libavcodec if known yading@10: */ yading@10: enum AVPixelFormat pix_fmt; yading@10: yading@10: /** yading@10: * Motion estimation algorithm used for video coding. yading@10: * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), yading@10: * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific] yading@10: * - encoding: MUST be set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_method; yading@10: yading@10: /** yading@10: * If non NULL, 'draw_horiz_band' is called by the libavcodec yading@10: * decoder to draw a horizontal band. It improves cache usage. Not yading@10: * all codecs can do that. You must check the codec capabilities yading@10: * beforehand. yading@10: * When multithreading is used, it may be called from multiple threads yading@10: * at the same time; threads might draw different parts of the same AVFrame, yading@10: * or multiple AVFrames, and there is no guarantee that slices will be drawn yading@10: * in order. yading@10: * The function is also used by hardware acceleration APIs. yading@10: * It is called at least once during frame decoding to pass yading@10: * the data needed for hardware render. yading@10: * In that mode instead of pixel data, AVFrame points to yading@10: * a structure specific to the acceleration API. The application yading@10: * reads the structure and can change some fields to indicate progress yading@10: * or mark state. yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: * @param height the height of the slice yading@10: * @param y the y position of the slice yading@10: * @param type 1->top field, 2->bottom field, 3->frame yading@10: * @param offset offset into the AVFrame.data from which the slice should be read yading@10: */ yading@10: void (*draw_horiz_band)(struct AVCodecContext *s, yading@10: const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], yading@10: int y, int type, int height); yading@10: yading@10: /** yading@10: * callback to negotiate the pixelFormat yading@10: * @param fmt is the list of formats which are supported by the codec, yading@10: * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. yading@10: * The first is always the native one. yading@10: * @return the chosen format yading@10: * - encoding: unused yading@10: * - decoding: Set by user, if not set the native format will be chosen. yading@10: */ yading@10: enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); yading@10: yading@10: /** yading@10: * maximum number of B-frames between non-B-frames yading@10: * Note: The output will be delayed by max_b_frames+1 relative to the input. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int max_b_frames; yading@10: yading@10: /** yading@10: * qscale factor between IP and B-frames yading@10: * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). yading@10: * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float b_quant_factor; yading@10: yading@10: /** obsolete FIXME remove */ yading@10: int rc_strategy; yading@10: #define FF_RC_STRATEGY_XVID 1 yading@10: yading@10: int b_frame_strategy; yading@10: yading@10: /** yading@10: * qscale offset between IP and B-frames yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float b_quant_offset; yading@10: yading@10: /** yading@10: * Size of the frame reordering buffer in the decoder. yading@10: * For MPEG-2 it is 1 IPB or 0 low delay IP. yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int has_b_frames; yading@10: yading@10: /** yading@10: * 0-> h263 quant 1-> mpeg quant yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int mpeg_quant; yading@10: yading@10: /** yading@10: * qscale factor between P and I-frames yading@10: * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset). yading@10: * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float i_quant_factor; yading@10: yading@10: /** yading@10: * qscale offset between P and I-frames yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float i_quant_offset; yading@10: yading@10: /** yading@10: * luminance masking (0-> disabled) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float lumi_masking; yading@10: yading@10: /** yading@10: * temporary complexity masking (0-> disabled) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float temporal_cplx_masking; yading@10: yading@10: /** yading@10: * spatial complexity masking (0-> disabled) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float spatial_cplx_masking; yading@10: yading@10: /** yading@10: * p block masking (0-> disabled) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float p_masking; yading@10: yading@10: /** yading@10: * darkness masking (0-> disabled) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float dark_masking; yading@10: yading@10: /** yading@10: * slice count yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: Set by user (or 0). yading@10: */ yading@10: int slice_count; yading@10: /** yading@10: * prediction method (needed for huffyuv) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int prediction_method; yading@10: #define FF_PRED_LEFT 0 yading@10: #define FF_PRED_PLANE 1 yading@10: #define FF_PRED_MEDIAN 2 yading@10: yading@10: /** yading@10: * slice offsets in the frame in bytes yading@10: * - encoding: Set/allocated by libavcodec. yading@10: * - decoding: Set/allocated by user (or NULL). yading@10: */ yading@10: int *slice_offset; yading@10: yading@10: /** yading@10: * sample aspect ratio (0 if unknown) yading@10: * That is the width of a pixel divided by the height of the pixel. yading@10: * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: AVRational sample_aspect_ratio; yading@10: yading@10: /** yading@10: * motion estimation comparison function yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_cmp; yading@10: /** yading@10: * subpixel motion estimation comparison function yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_sub_cmp; yading@10: /** yading@10: * macroblock comparison function (not supported yet) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int mb_cmp; yading@10: /** yading@10: * interlaced DCT comparison function yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int ildct_cmp; yading@10: #define FF_CMP_SAD 0 yading@10: #define FF_CMP_SSE 1 yading@10: #define FF_CMP_SATD 2 yading@10: #define FF_CMP_DCT 3 yading@10: #define FF_CMP_PSNR 4 yading@10: #define FF_CMP_BIT 5 yading@10: #define FF_CMP_RD 6 yading@10: #define FF_CMP_ZERO 7 yading@10: #define FF_CMP_VSAD 8 yading@10: #define FF_CMP_VSSE 9 yading@10: #define FF_CMP_NSSE 10 yading@10: #define FF_CMP_W53 11 yading@10: #define FF_CMP_W97 12 yading@10: #define FF_CMP_DCTMAX 13 yading@10: #define FF_CMP_DCT264 14 yading@10: #define FF_CMP_CHROMA 256 yading@10: yading@10: /** yading@10: * ME diamond size & shape yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int dia_size; yading@10: yading@10: /** yading@10: * amount of previous MV predictors (2a+1 x 2a+1 square) yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int last_predictor_count; yading@10: yading@10: /** yading@10: * prepass for motion estimation yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int pre_me; yading@10: yading@10: /** yading@10: * motion estimation prepass comparison function yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_pre_cmp; yading@10: yading@10: /** yading@10: * ME prepass diamond size & shape yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int pre_dia_size; yading@10: yading@10: /** yading@10: * subpel ME quality yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_subpel_quality; yading@10: yading@10: /** yading@10: * DTG active format information (additional aspect ratio yading@10: * information only used in DVB MPEG-2 transport streams) yading@10: * 0 if not set. yading@10: * yading@10: * - encoding: unused yading@10: * - decoding: Set by decoder. yading@10: */ yading@10: int dtg_active_format; yading@10: #define FF_DTG_AFD_SAME 8 yading@10: #define FF_DTG_AFD_4_3 9 yading@10: #define FF_DTG_AFD_16_9 10 yading@10: #define FF_DTG_AFD_14_9 11 yading@10: #define FF_DTG_AFD_4_3_SP_14_9 13 yading@10: #define FF_DTG_AFD_16_9_SP_14_9 14 yading@10: #define FF_DTG_AFD_SP_4_3 15 yading@10: yading@10: /** yading@10: * maximum motion estimation search range in subpel units yading@10: * If 0 then no limit. yading@10: * yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_range; yading@10: yading@10: /** yading@10: * intra quantizer bias yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int intra_quant_bias; yading@10: #define FF_DEFAULT_QUANT_BIAS 999999 yading@10: yading@10: /** yading@10: * inter quantizer bias yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int inter_quant_bias; yading@10: yading@10: /** yading@10: * slice flags yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: int slice_flags; yading@10: #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display yading@10: #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) yading@10: #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) yading@10: yading@10: /** yading@10: * XVideo Motion Acceleration yading@10: * - encoding: forbidden yading@10: * - decoding: set by decoder yading@10: */ yading@10: int xvmc_acceleration; yading@10: yading@10: /** yading@10: * macroblock decision mode yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int mb_decision; yading@10: #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp yading@10: #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits yading@10: #define FF_MB_DECISION_RD 2 ///< rate distortion yading@10: yading@10: /** yading@10: * custom intra quantization matrix yading@10: * - encoding: Set by user, can be NULL. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: uint16_t *intra_matrix; yading@10: yading@10: /** yading@10: * custom inter quantization matrix yading@10: * - encoding: Set by user, can be NULL. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: uint16_t *inter_matrix; yading@10: yading@10: /** yading@10: * scene change detection threshold yading@10: * 0 is default, larger means fewer detected scene changes. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int scenechange_threshold; yading@10: yading@10: /** yading@10: * noise reduction strength yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int noise_reduction; yading@10: yading@10: /** yading@10: * Motion estimation threshold below which no motion estimation is yading@10: * performed, but instead the user specified motion vectors are used. yading@10: * yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_threshold; yading@10: yading@10: /** yading@10: * Macroblock threshold below which the user specified macroblock types will be used. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int mb_threshold; yading@10: yading@10: /** yading@10: * precision of the intra DC coefficient - 8 yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int intra_dc_precision; yading@10: yading@10: /** yading@10: * Number of macroblock rows at the top which are skipped. yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: int skip_top; yading@10: yading@10: /** yading@10: * Number of macroblock rows at the bottom which are skipped. yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: int skip_bottom; yading@10: yading@10: /** yading@10: * Border processing masking, raises the quantizer for mbs on the borders yading@10: * of the picture. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float border_masking; yading@10: yading@10: /** yading@10: * minimum MB lagrange multipler yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int mb_lmin; yading@10: yading@10: /** yading@10: * maximum MB lagrange multipler yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int mb_lmax; yading@10: yading@10: /** yading@10: * yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int me_penalty_compensation; yading@10: yading@10: /** yading@10: * yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int bidir_refine; yading@10: yading@10: /** yading@10: * yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int brd_scale; yading@10: yading@10: /** yading@10: * minimum GOP size yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int keyint_min; yading@10: yading@10: /** yading@10: * number of reference frames yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by lavc. yading@10: */ yading@10: int refs; yading@10: yading@10: /** yading@10: * chroma qp offset from luma yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int chromaoffset; yading@10: yading@10: /** yading@10: * Multiplied by qscale for each frame and added to scene_change_score. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int scenechange_factor; yading@10: yading@10: /** yading@10: * yading@10: * Note: Value depends upon the compare function used for fullpel ME. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int mv0_threshold; yading@10: yading@10: /** yading@10: * Adjust sensitivity of b_frame_strategy 1. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int b_sensitivity; yading@10: yading@10: /** yading@10: * Chromaticity coordinates of the source primaries. yading@10: * - encoding: Set by user yading@10: * - decoding: Set by libavcodec yading@10: */ yading@10: enum AVColorPrimaries color_primaries; yading@10: yading@10: /** yading@10: * Color Transfer Characteristic. yading@10: * - encoding: Set by user yading@10: * - decoding: Set by libavcodec yading@10: */ yading@10: enum AVColorTransferCharacteristic color_trc; yading@10: yading@10: /** yading@10: * YUV colorspace type. yading@10: * - encoding: Set by user yading@10: * - decoding: Set by libavcodec yading@10: */ yading@10: enum AVColorSpace colorspace; yading@10: yading@10: /** yading@10: * MPEG vs JPEG YUV range. yading@10: * - encoding: Set by user yading@10: * - decoding: Set by libavcodec yading@10: */ yading@10: enum AVColorRange color_range; yading@10: yading@10: /** yading@10: * This defines the location of chroma samples. yading@10: * - encoding: Set by user yading@10: * - decoding: Set by libavcodec yading@10: */ yading@10: enum AVChromaLocation chroma_sample_location; yading@10: yading@10: /** yading@10: * Number of slices. yading@10: * Indicates number of picture subdivisions. Used for parallelized yading@10: * decoding. yading@10: * - encoding: Set by user yading@10: * - decoding: unused yading@10: */ yading@10: int slices; yading@10: yading@10: /** Field order yading@10: * - encoding: set by libavcodec yading@10: * - decoding: Set by user. yading@10: */ yading@10: enum AVFieldOrder field_order; yading@10: yading@10: /* audio only */ yading@10: int sample_rate; ///< samples per second yading@10: int channels; ///< number of audio channels yading@10: yading@10: /** yading@10: * audio sample format yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: enum AVSampleFormat sample_fmt; ///< sample format yading@10: yading@10: /* The following data should not be initialized. */ yading@10: /** yading@10: * Number of samples per channel in an audio frame. yading@10: * yading@10: * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame yading@10: * except the last must contain exactly frame_size samples per channel. yading@10: * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the yading@10: * frame size is not restricted. yading@10: * - decoding: may be set by some decoders to indicate constant frame size yading@10: */ yading@10: int frame_size; yading@10: yading@10: /** yading@10: * Frame counter, set by libavcodec. yading@10: * yading@10: * - decoding: total number of frames returned from the decoder so far. yading@10: * - encoding: total number of frames passed to the encoder so far. yading@10: * yading@10: * @note the counter is not incremented if encoding/decoding resulted in yading@10: * an error. yading@10: */ yading@10: int frame_number; yading@10: yading@10: /** yading@10: * number of bytes per packet if constant and known or 0 yading@10: * Used by some WAV based audio codecs. yading@10: */ yading@10: int block_align; yading@10: yading@10: /** yading@10: * Audio cutoff bandwidth (0 means "automatic") yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int cutoff; yading@10: yading@10: #if FF_API_REQUEST_CHANNELS yading@10: /** yading@10: * Decoder should decode to this many channels if it can (0 for default) yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: * @deprecated Deprecated in favor of request_channel_layout. yading@10: */ yading@10: int request_channels; yading@10: #endif yading@10: yading@10: /** yading@10: * Audio channel layout. yading@10: * - encoding: set by user. yading@10: * - decoding: set by user, may be overwritten by libavcodec. yading@10: */ yading@10: uint64_t channel_layout; yading@10: yading@10: /** yading@10: * Request decoder to use this channel layout if it can (0 for default) yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: uint64_t request_channel_layout; yading@10: yading@10: /** yading@10: * Type of service that the audio stream conveys. yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: enum AVAudioServiceType audio_service_type; yading@10: yading@10: /** yading@10: * desired sample format yading@10: * - encoding: Not used. yading@10: * - decoding: Set by user. yading@10: * Decoder will decode to this format if it can. yading@10: */ yading@10: enum AVSampleFormat request_sample_fmt; yading@10: yading@10: #if FF_API_GET_BUFFER yading@10: /** yading@10: * Called at the beginning of each frame to get a buffer for it. yading@10: * yading@10: * The function will set AVFrame.data[], AVFrame.linesize[]. yading@10: * AVFrame.extended_data[] must also be set, but it should be the same as yading@10: * AVFrame.data[] except for planar audio with more channels than can fit yading@10: * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as yading@10: * many data pointers as it can hold. yading@10: * yading@10: * if CODEC_CAP_DR1 is not set then get_buffer() must call yading@10: * avcodec_default_get_buffer() instead of providing buffers allocated by yading@10: * some other means. yading@10: * yading@10: * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't yading@10: * need it. avcodec_default_get_buffer() aligns the output buffer properly, yading@10: * but if get_buffer() is overridden then alignment considerations should yading@10: * be taken into account. yading@10: * yading@10: * @see avcodec_default_get_buffer() yading@10: * yading@10: * Video: yading@10: * yading@10: * If pic.reference is set then the frame will be read later by libavcodec. yading@10: * avcodec_align_dimensions2() should be used to find the required width and yading@10: * height, as they normally need to be rounded up to the next multiple of 16. yading@10: * yading@10: * If frame multithreading is used and thread_safe_callbacks is set, yading@10: * it may be called from a different thread, but not from more than one at yading@10: * once. Does not need to be reentrant. yading@10: * yading@10: * @see release_buffer(), reget_buffer() yading@10: * @see avcodec_align_dimensions2() yading@10: * yading@10: * Audio: yading@10: * yading@10: * Decoders request a buffer of a particular size by setting yading@10: * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, yading@10: * however, utilize only part of the buffer by setting AVFrame.nb_samples yading@10: * to a smaller value in the output frame. yading@10: * yading@10: * Decoders cannot use the buffer after returning from yading@10: * avcodec_decode_audio4(), so they will not call release_buffer(), as it yading@10: * is assumed to be released immediately upon return. In some rare cases, yading@10: * a decoder may need to call get_buffer() more than once in a single yading@10: * call to avcodec_decode_audio4(). In that case, when get_buffer() is yading@10: * called again after it has already been called once, the previously yading@10: * acquired buffer is assumed to be released at that time and may not be yading@10: * reused by the decoder. yading@10: * yading@10: * As a convenience, av_samples_get_buffer_size() and yading@10: * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() yading@10: * functions to find the required data size and to fill data pointers and yading@10: * linesize. In AVFrame.linesize, only linesize[0] may be set for audio yading@10: * since all planes must be the same size. yading@10: * yading@10: * @see av_samples_get_buffer_size(), av_samples_fill_arrays() yading@10: * yading@10: * - encoding: unused yading@10: * - decoding: Set by libavcodec, user can override. yading@10: * yading@10: * @deprecated use get_buffer2() yading@10: */ yading@10: attribute_deprecated yading@10: int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); yading@10: yading@10: /** yading@10: * Called to release buffers which were allocated with get_buffer. yading@10: * A released buffer can be reused in get_buffer(). yading@10: * pic.data[*] must be set to NULL. yading@10: * May be called from a different thread if frame multithreading is used, yading@10: * but not by more than one thread at once, so does not need to be reentrant. yading@10: * - encoding: unused yading@10: * - decoding: Set by libavcodec, user can override. yading@10: * yading@10: * @deprecated custom freeing callbacks should be set from get_buffer2() yading@10: */ yading@10: attribute_deprecated yading@10: void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); yading@10: yading@10: /** yading@10: * Called at the beginning of a frame to get cr buffer for it. yading@10: * Buffer type (size, hints) must be the same. libavcodec won't check it. yading@10: * libavcodec will pass previous buffer in pic, function should return yading@10: * same buffer or new buffer with old frame "painted" into it. yading@10: * If pic.data[0] == NULL must behave like get_buffer(). yading@10: * if CODEC_CAP_DR1 is not set then reget_buffer() must call yading@10: * avcodec_default_reget_buffer() instead of providing buffers allocated by yading@10: * some other means. yading@10: * - encoding: unused yading@10: * - decoding: Set by libavcodec, user can override. yading@10: */ yading@10: attribute_deprecated yading@10: int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); yading@10: #endif yading@10: yading@10: /** yading@10: * This callback is called at the beginning of each frame to get data yading@10: * buffer(s) for it. There may be one contiguous buffer for all the data or yading@10: * there may be a buffer per each data plane or anything in between. Each yading@10: * buffer must be reference-counted using the AVBuffer API. yading@10: * yading@10: * The following fields will be set in the frame before this callback is yading@10: * called: yading@10: * - format yading@10: * - width, height (video only) yading@10: * - sample_rate, channel_layout, nb_samples (audio only) yading@10: * Their values may differ from the corresponding values in yading@10: * AVCodecContext. This callback must use the frame values, not the codec yading@10: * context values, to calculate the required buffer size. yading@10: * yading@10: * This callback must fill the following fields in the frame: yading@10: * - data[] yading@10: * - linesize[] yading@10: * - extended_data: yading@10: * * if the data is planar audio with more than 8 channels, then this yading@10: * callback must allocate and fill extended_data to contain all pointers yading@10: * to all data planes. data[] must hold as many pointers as it can. yading@10: * extended_data must be allocated with av_malloc() and will be freed in yading@10: * av_frame_unref(). yading@10: * * otherwise exended_data must point to data yading@10: * - buf[] must contain references to the buffers that contain the frame yading@10: * data. yading@10: * - extended_buf and nb_extended_buf must be allocated with av_malloc() by yading@10: * this callback and filled with the extra buffers if there are more yading@10: * buffers than buf[] can hold. extended_buf will be freed in yading@10: * av_frame_unref(). yading@10: * yading@10: * If CODEC_CAP_DR1 is not set then get_buffer2() must call yading@10: * avcodec_default_get_buffer2() instead of providing buffers allocated by yading@10: * some other means. yading@10: * yading@10: * Each data plane must be aligned to the maximum required by the target yading@10: * CPU. yading@10: * yading@10: * @see avcodec_default_get_buffer2() yading@10: * yading@10: * Video: yading@10: * yading@10: * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused yading@10: * (read and/or written to if it is writable) later by libavcodec. yading@10: * yading@10: * If CODEC_FLAG_EMU_EDGE is not set in s->flags, the buffer must contain an yading@10: * edge of the size returned by avcodec_get_edge_width() on all sides. yading@10: * yading@10: * avcodec_align_dimensions2() should be used to find the required width and yading@10: * height, as they normally need to be rounded up to the next multiple of 16. yading@10: * yading@10: * If frame multithreading is used and thread_safe_callbacks is set, yading@10: * this callback may be called from a different thread, but not from more yading@10: * than one at once. Does not need to be reentrant. yading@10: * yading@10: * @see avcodec_align_dimensions2() yading@10: * yading@10: * Audio: yading@10: * yading@10: * Decoders request a buffer of a particular size by setting yading@10: * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, yading@10: * however, utilize only part of the buffer by setting AVFrame.nb_samples yading@10: * to a smaller value in the output frame. yading@10: * yading@10: * As a convenience, av_samples_get_buffer_size() and yading@10: * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() yading@10: * functions to find the required data size and to fill data pointers and yading@10: * linesize. In AVFrame.linesize, only linesize[0] may be set for audio yading@10: * since all planes must be the same size. yading@10: * yading@10: * @see av_samples_get_buffer_size(), av_samples_fill_arrays() yading@10: * yading@10: * - encoding: unused yading@10: * - decoding: Set by libavcodec, user can override. yading@10: */ yading@10: int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); yading@10: yading@10: /** yading@10: * If non-zero, the decoded audio and video frames returned from yading@10: * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted yading@10: * and are valid indefinitely. The caller must free them with yading@10: * av_frame_unref() when they are not needed anymore. yading@10: * Otherwise, the decoded frames must not be freed by the caller and are yading@10: * only valid until the next decode call. yading@10: * yading@10: * - encoding: unused yading@10: * - decoding: set by the caller before avcodec_open2(). yading@10: */ yading@10: int refcounted_frames; yading@10: yading@10: /* - encoding parameters */ yading@10: float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) yading@10: float qblur; ///< amount of qscale smoothing over time (0.0-1.0) yading@10: yading@10: /** yading@10: * minimum quantizer yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int qmin; yading@10: yading@10: /** yading@10: * maximum quantizer yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int qmax; yading@10: yading@10: /** yading@10: * maximum quantizer difference between frames yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int max_qdiff; yading@10: yading@10: /** yading@10: * ratecontrol qmin qmax limiting method yading@10: * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float rc_qsquish; yading@10: yading@10: float rc_qmod_amp; yading@10: int rc_qmod_freq; yading@10: yading@10: /** yading@10: * decoder bitstream buffer size yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int rc_buffer_size; yading@10: yading@10: /** yading@10: * ratecontrol override, see RcOverride yading@10: * - encoding: Allocated/set/freed by user. yading@10: * - decoding: unused yading@10: */ yading@10: int rc_override_count; yading@10: RcOverride *rc_override; yading@10: yading@10: /** yading@10: * rate control equation yading@10: * - encoding: Set by user yading@10: * - decoding: unused yading@10: */ yading@10: const char *rc_eq; yading@10: yading@10: /** yading@10: * maximum bitrate yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int rc_max_rate; yading@10: yading@10: /** yading@10: * minimum bitrate yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int rc_min_rate; yading@10: yading@10: float rc_buffer_aggressivity; yading@10: yading@10: /** yading@10: * initial complexity for pass1 ratecontrol yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: float rc_initial_cplx; yading@10: yading@10: /** yading@10: * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused. yading@10: */ yading@10: float rc_max_available_vbv_use; yading@10: yading@10: /** yading@10: * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused. yading@10: */ yading@10: float rc_min_vbv_overflow_use; yading@10: yading@10: /** yading@10: * Number of bits which should be loaded into the rc buffer before decoding starts. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int rc_initial_buffer_occupancy; yading@10: yading@10: #define FF_CODER_TYPE_VLC 0 yading@10: #define FF_CODER_TYPE_AC 1 yading@10: #define FF_CODER_TYPE_RAW 2 yading@10: #define FF_CODER_TYPE_RLE 3 yading@10: #define FF_CODER_TYPE_DEFLATE 4 yading@10: /** yading@10: * coder type yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int coder_type; yading@10: yading@10: /** yading@10: * context model yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int context_model; yading@10: yading@10: /** yading@10: * minimum Lagrange multipler yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int lmin; yading@10: yading@10: /** yading@10: * maximum Lagrange multipler yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int lmax; yading@10: yading@10: /** yading@10: * frame skip threshold yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int frame_skip_threshold; yading@10: yading@10: /** yading@10: * frame skip factor yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int frame_skip_factor; yading@10: yading@10: /** yading@10: * frame skip exponent yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int frame_skip_exp; yading@10: yading@10: /** yading@10: * frame skip comparison function yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int frame_skip_cmp; yading@10: yading@10: /** yading@10: * trellis RD quantization yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int trellis; yading@10: yading@10: /** yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int min_prediction_order; yading@10: yading@10: /** yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int max_prediction_order; yading@10: yading@10: /** yading@10: * GOP timecode frame start number yading@10: * - encoding: Set by user, in non drop frame format yading@10: * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset) yading@10: */ yading@10: int64_t timecode_frame_start; yading@10: yading@10: /* The RTP callback: This function is called */ yading@10: /* every time the encoder has a packet to send. */ yading@10: /* It depends on the encoder if the data starts */ yading@10: /* with a Start Code (it should). H.263 does. */ yading@10: /* mb_nb contains the number of macroblocks */ yading@10: /* encoded in the RTP payload. */ yading@10: void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); yading@10: yading@10: int rtp_payload_size; /* The size of the RTP payload: the coder will */ yading@10: /* do its best to deliver a chunk with size */ yading@10: /* below rtp_payload_size, the chunk will start */ yading@10: /* with a start code on some codecs like H.263. */ yading@10: /* This doesn't take account of any particular */ yading@10: /* headers inside the transmitted RTP payload. */ yading@10: yading@10: /* statistics, used for 2-pass encoding */ yading@10: int mv_bits; yading@10: int header_bits; yading@10: int i_tex_bits; yading@10: int p_tex_bits; yading@10: int i_count; yading@10: int p_count; yading@10: int skip_count; yading@10: int misc_bits; yading@10: yading@10: /** yading@10: * number of bits used for the previously encoded frame yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: unused yading@10: */ yading@10: int frame_bits; yading@10: yading@10: /** yading@10: * pass1 encoding statistics output buffer yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: unused yading@10: */ yading@10: char *stats_out; yading@10: yading@10: /** yading@10: * pass2 encoding statistics input buffer yading@10: * Concatenated stuff from stats_out of pass1 should be placed here. yading@10: * - encoding: Allocated/set/freed by user. yading@10: * - decoding: unused yading@10: */ yading@10: char *stats_in; yading@10: yading@10: /** yading@10: * Work around bugs in encoders which sometimes cannot be detected automatically. yading@10: * - encoding: Set by user yading@10: * - decoding: Set by user yading@10: */ yading@10: int workaround_bugs; yading@10: #define FF_BUG_AUTODETECT 1 ///< autodetection yading@10: #define FF_BUG_OLD_MSMPEG4 2 yading@10: #define FF_BUG_XVID_ILACE 4 yading@10: #define FF_BUG_UMP4 8 yading@10: #define FF_BUG_NO_PADDING 16 yading@10: #define FF_BUG_AMV 32 yading@10: #define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. yading@10: #define FF_BUG_QPEL_CHROMA 64 yading@10: #define FF_BUG_STD_QPEL 128 yading@10: #define FF_BUG_QPEL_CHROMA2 256 yading@10: #define FF_BUG_DIRECT_BLOCKSIZE 512 yading@10: #define FF_BUG_EDGE 1024 yading@10: #define FF_BUG_HPEL_CHROMA 2048 yading@10: #define FF_BUG_DC_CLIP 4096 yading@10: #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. yading@10: #define FF_BUG_TRUNCATED 16384 yading@10: yading@10: /** yading@10: * strictly follow the standard (MPEG4, ...). yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: * Setting this to STRICT or higher means the encoder and decoder will yading@10: * generally do stupid things, whereas setting it to unofficial or lower yading@10: * will mean the encoder might produce output that is not supported by all yading@10: * spec-compliant decoders. Decoders don't differentiate between normal, yading@10: * unofficial and experimental (that is, they always try to decode things yading@10: * when they can) unless they are explicitly asked to behave stupidly yading@10: * (=strictly conform to the specs) yading@10: */ yading@10: int strict_std_compliance; yading@10: #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. yading@10: #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. yading@10: #define FF_COMPLIANCE_NORMAL 0 yading@10: #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions yading@10: #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. yading@10: yading@10: /** yading@10: * error concealment flags yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: int error_concealment; yading@10: #define FF_EC_GUESS_MVS 1 yading@10: #define FF_EC_DEBLOCK 2 yading@10: yading@10: /** yading@10: * debug yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int debug; yading@10: #define FF_DEBUG_PICT_INFO 1 yading@10: #define FF_DEBUG_RC 2 yading@10: #define FF_DEBUG_BITSTREAM 4 yading@10: #define FF_DEBUG_MB_TYPE 8 yading@10: #define FF_DEBUG_QP 16 yading@10: #define FF_DEBUG_MV 32 yading@10: #define FF_DEBUG_DCT_COEFF 0x00000040 yading@10: #define FF_DEBUG_SKIP 0x00000080 yading@10: #define FF_DEBUG_STARTCODE 0x00000100 yading@10: #define FF_DEBUG_PTS 0x00000200 yading@10: #define FF_DEBUG_ER 0x00000400 yading@10: #define FF_DEBUG_MMCO 0x00000800 yading@10: #define FF_DEBUG_BUGS 0x00001000 yading@10: #define FF_DEBUG_VIS_QP 0x00002000 yading@10: #define FF_DEBUG_VIS_MB_TYPE 0x00004000 yading@10: #define FF_DEBUG_BUFFERS 0x00008000 yading@10: #define FF_DEBUG_THREADS 0x00010000 yading@10: yading@10: /** yading@10: * debug yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int debug_mv; yading@10: #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames yading@10: #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames yading@10: #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames yading@10: yading@10: /** yading@10: * Error recognition; may misdetect some more or less valid parts as errors. yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: int err_recognition; yading@10: #define AV_EF_CRCCHECK (1<<0) yading@10: #define AV_EF_BITSTREAM (1<<1) yading@10: #define AV_EF_BUFFER (1<<2) yading@10: #define AV_EF_EXPLODE (1<<3) yading@10: yading@10: #define AV_EF_CAREFUL (1<<16) yading@10: #define AV_EF_COMPLIANT (1<<17) yading@10: #define AV_EF_AGGRESSIVE (1<<18) yading@10: yading@10: yading@10: /** yading@10: * opaque 64bit number (generally a PTS) that will be reordered and yading@10: * output in AVFrame.reordered_opaque yading@10: * @deprecated in favor of pkt_pts yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: int64_t reordered_opaque; yading@10: yading@10: /** yading@10: * Hardware accelerator in use yading@10: * - encoding: unused. yading@10: * - decoding: Set by libavcodec yading@10: */ yading@10: struct AVHWAccel *hwaccel; yading@10: yading@10: /** yading@10: * Hardware accelerator context. yading@10: * For some hardware accelerators, a global context needs to be yading@10: * provided by the user. In that case, this holds display-dependent yading@10: * data FFmpeg cannot instantiate itself. Please refer to the yading@10: * FFmpeg HW accelerator documentation to know how to fill this yading@10: * is. e.g. for VA API, this is a struct vaapi_context. yading@10: * - encoding: unused yading@10: * - decoding: Set by user yading@10: */ yading@10: void *hwaccel_context; yading@10: yading@10: /** yading@10: * error yading@10: * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. yading@10: * - decoding: unused yading@10: */ yading@10: uint64_t error[AV_NUM_DATA_POINTERS]; yading@10: yading@10: /** yading@10: * DCT algorithm, see FF_DCT_* below yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int dct_algo; yading@10: #define FF_DCT_AUTO 0 yading@10: #define FF_DCT_FASTINT 1 yading@10: #define FF_DCT_INT 2 yading@10: #define FF_DCT_MMX 3 yading@10: #define FF_DCT_ALTIVEC 5 yading@10: #define FF_DCT_FAAN 6 yading@10: yading@10: /** yading@10: * IDCT algorithm, see FF_IDCT_* below. yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int idct_algo; yading@10: #define FF_IDCT_AUTO 0 yading@10: #define FF_IDCT_INT 1 yading@10: #define FF_IDCT_SIMPLE 2 yading@10: #define FF_IDCT_SIMPLEMMX 3 yading@10: #define FF_IDCT_ARM 7 yading@10: #define FF_IDCT_ALTIVEC 8 yading@10: #define FF_IDCT_SH4 9 yading@10: #define FF_IDCT_SIMPLEARM 10 yading@10: #define FF_IDCT_IPP 13 yading@10: #define FF_IDCT_XVIDMMX 14 yading@10: #define FF_IDCT_SIMPLEARMV5TE 16 yading@10: #define FF_IDCT_SIMPLEARMV6 17 yading@10: #define FF_IDCT_SIMPLEVIS 18 yading@10: #define FF_IDCT_FAAN 20 yading@10: #define FF_IDCT_SIMPLENEON 22 yading@10: #define FF_IDCT_SIMPLEALPHA 23 yading@10: yading@10: /** yading@10: * bits per sample/pixel from the demuxer (needed for huffyuv). yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int bits_per_coded_sample; yading@10: yading@10: /** yading@10: * Bits per sample/pixel of internal libavcodec pixel/sample format. yading@10: * - encoding: set by user. yading@10: * - decoding: set by libavcodec. yading@10: */ yading@10: int bits_per_raw_sample; yading@10: yading@10: /** yading@10: * low resolution decoding, 1-> 1/2 size, 2->1/4 size yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: int lowres; yading@10: yading@10: /** yading@10: * the picture in the bitstream yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: AVFrame *coded_frame; yading@10: yading@10: /** yading@10: * thread count yading@10: * is used to decide how many independent tasks should be passed to execute() yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int thread_count; yading@10: yading@10: /** yading@10: * Which multithreading methods to use. yading@10: * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, yading@10: * so clients which cannot provide future frames should not use it. yading@10: * yading@10: * - encoding: Set by user, otherwise the default is used. yading@10: * - decoding: Set by user, otherwise the default is used. yading@10: */ yading@10: int thread_type; yading@10: #define FF_THREAD_FRAME 1 ///< Decode more than one frame at once yading@10: #define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once yading@10: yading@10: /** yading@10: * Which multithreading methods are in use by the codec. yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int active_thread_type; yading@10: yading@10: /** yading@10: * Set by the client if its custom get_buffer() callback can be called yading@10: * synchronously from another thread, which allows faster multithreaded decoding. yading@10: * draw_horiz_band() will be called from other threads regardless of this setting. yading@10: * Ignored if the default get_buffer() is used. yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by user. yading@10: */ yading@10: int thread_safe_callbacks; yading@10: yading@10: /** yading@10: * The codec may call this to execute several independent things. yading@10: * It will return only after finishing all tasks. yading@10: * The user may replace this with some multithreaded implementation, yading@10: * the default implementation will execute the parts serially. yading@10: * @param count the number of things to execute yading@10: * - encoding: Set by libavcodec, user can override. yading@10: * - decoding: Set by libavcodec, user can override. yading@10: */ yading@10: int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); yading@10: yading@10: /** yading@10: * The codec may call this to execute several independent things. yading@10: * It will return only after finishing all tasks. yading@10: * The user may replace this with some multithreaded implementation, yading@10: * the default implementation will execute the parts serially. yading@10: * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. yading@10: * @param c context passed also to func yading@10: * @param count the number of things to execute yading@10: * @param arg2 argument passed unchanged to func yading@10: * @param ret return values of executed functions, must have space for "count" values. May be NULL. yading@10: * @param func function that will be called count times, with jobnr from 0 to count-1. yading@10: * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no yading@10: * two instances of func executing at the same time will have the same threadnr. yading@10: * @return always 0 currently, but code should handle a future improvement where when any call to func yading@10: * returns < 0 no further calls to func may be done and < 0 is returned. yading@10: * - encoding: Set by libavcodec, user can override. yading@10: * - decoding: Set by libavcodec, user can override. yading@10: */ yading@10: int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); yading@10: yading@10: /** yading@10: * thread opaque yading@10: * Can be used by execute() to store some per AVCodecContext stuff. yading@10: * - encoding: set by execute() yading@10: * - decoding: set by execute() yading@10: */ yading@10: void *thread_opaque; yading@10: yading@10: /** yading@10: * noise vs. sse weight for the nsse comparsion function yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int nsse_weight; yading@10: yading@10: /** yading@10: * profile yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int profile; yading@10: #define FF_PROFILE_UNKNOWN -99 yading@10: #define FF_PROFILE_RESERVED -100 yading@10: yading@10: #define FF_PROFILE_AAC_MAIN 0 yading@10: #define FF_PROFILE_AAC_LOW 1 yading@10: #define FF_PROFILE_AAC_SSR 2 yading@10: #define FF_PROFILE_AAC_LTP 3 yading@10: #define FF_PROFILE_AAC_HE 4 yading@10: #define FF_PROFILE_AAC_HE_V2 28 yading@10: #define FF_PROFILE_AAC_LD 22 yading@10: #define FF_PROFILE_AAC_ELD 38 yading@10: yading@10: #define FF_PROFILE_DTS 20 yading@10: #define FF_PROFILE_DTS_ES 30 yading@10: #define FF_PROFILE_DTS_96_24 40 yading@10: #define FF_PROFILE_DTS_HD_HRA 50 yading@10: #define FF_PROFILE_DTS_HD_MA 60 yading@10: yading@10: #define FF_PROFILE_MPEG2_422 0 yading@10: #define FF_PROFILE_MPEG2_HIGH 1 yading@10: #define FF_PROFILE_MPEG2_SS 2 yading@10: #define FF_PROFILE_MPEG2_SNR_SCALABLE 3 yading@10: #define FF_PROFILE_MPEG2_MAIN 4 yading@10: #define FF_PROFILE_MPEG2_SIMPLE 5 yading@10: yading@10: #define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag yading@10: #define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag yading@10: yading@10: #define FF_PROFILE_H264_BASELINE 66 yading@10: #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) yading@10: #define FF_PROFILE_H264_MAIN 77 yading@10: #define FF_PROFILE_H264_EXTENDED 88 yading@10: #define FF_PROFILE_H264_HIGH 100 yading@10: #define FF_PROFILE_H264_HIGH_10 110 yading@10: #define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) yading@10: #define FF_PROFILE_H264_HIGH_422 122 yading@10: #define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) yading@10: #define FF_PROFILE_H264_HIGH_444 144 yading@10: #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 yading@10: #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) yading@10: #define FF_PROFILE_H264_CAVLC_444 44 yading@10: yading@10: #define FF_PROFILE_VC1_SIMPLE 0 yading@10: #define FF_PROFILE_VC1_MAIN 1 yading@10: #define FF_PROFILE_VC1_COMPLEX 2 yading@10: #define FF_PROFILE_VC1_ADVANCED 3 yading@10: yading@10: #define FF_PROFILE_MPEG4_SIMPLE 0 yading@10: #define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 yading@10: #define FF_PROFILE_MPEG4_CORE 2 yading@10: #define FF_PROFILE_MPEG4_MAIN 3 yading@10: #define FF_PROFILE_MPEG4_N_BIT 4 yading@10: #define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 yading@10: #define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 yading@10: #define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 yading@10: #define FF_PROFILE_MPEG4_HYBRID 8 yading@10: #define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 yading@10: #define FF_PROFILE_MPEG4_CORE_SCALABLE 10 yading@10: #define FF_PROFILE_MPEG4_ADVANCED_CODING 11 yading@10: #define FF_PROFILE_MPEG4_ADVANCED_CORE 12 yading@10: #define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 yading@10: #define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 yading@10: #define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 yading@10: yading@10: /** yading@10: * level yading@10: * - encoding: Set by user. yading@10: * - decoding: Set by libavcodec. yading@10: */ yading@10: int level; yading@10: #define FF_LEVEL_UNKNOWN -99 yading@10: yading@10: /** yading@10: * Skip loop filtering for selected frames. yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: enum AVDiscard skip_loop_filter; yading@10: yading@10: /** yading@10: * Skip IDCT/dequantization for selected frames. yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: enum AVDiscard skip_idct; yading@10: yading@10: /** yading@10: * Skip decoding for selected frames. yading@10: * - encoding: unused yading@10: * - decoding: Set by user. yading@10: */ yading@10: enum AVDiscard skip_frame; yading@10: yading@10: /** yading@10: * Header containing style information for text subtitles. yading@10: * For SUBTITLE_ASS subtitle type, it should contain the whole ASS yading@10: * [Script Info] and [V4+ Styles] section, plus the [Events] line and yading@10: * the Format line following. It shouldn't include any Dialogue line. yading@10: * - encoding: Set/allocated/freed by user (before avcodec_open2()) yading@10: * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) yading@10: */ yading@10: uint8_t *subtitle_header; yading@10: int subtitle_header_size; yading@10: yading@10: /** yading@10: * Simulates errors in the bitstream to test error concealment. yading@10: * - encoding: Set by user. yading@10: * - decoding: unused yading@10: */ yading@10: int error_rate; yading@10: yading@10: /** yading@10: * Current packet as passed into the decoder, to avoid having yading@10: * to pass the packet into every function. Currently only valid yading@10: * inside lavc and get/release_buffer callbacks. yading@10: * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts yading@10: * - encoding: unused yading@10: */ yading@10: AVPacket *pkt; yading@10: yading@10: /** yading@10: * VBV delay coded in the last frame (in periods of a 27 MHz clock). yading@10: * Used for compliant TS muxing. yading@10: * - encoding: Set by libavcodec. yading@10: * - decoding: unused. yading@10: */ yading@10: uint64_t vbv_delay; yading@10: yading@10: /** yading@10: * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. yading@10: * Code outside libavcodec should access this field using: yading@10: * av_codec_{get,set}_pkt_timebase(avctx) yading@10: * - encoding unused. yading@10: * - decodimg set by user yading@10: */ yading@10: AVRational pkt_timebase; yading@10: yading@10: /** yading@10: * AVCodecDescriptor yading@10: * Code outside libavcodec should access this field using: yading@10: * av_codec_{get,set}_codec_descriptor(avctx) yading@10: * - encoding: unused. yading@10: * - decoding: set by libavcodec. yading@10: */ yading@10: const AVCodecDescriptor *codec_descriptor; yading@10: yading@10: /** yading@10: * Current statistics for PTS correction. yading@10: * - decoding: maintained and used by libavcodec, not intended to be used by user apps yading@10: * - encoding: unused yading@10: */ yading@10: int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far yading@10: int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far yading@10: int64_t pts_correction_last_pts; /// PTS of the last frame yading@10: int64_t pts_correction_last_dts; /// DTS of the last frame yading@10: yading@10: /** yading@10: * Character encoding of the input subtitles file. yading@10: * - decoding: set by user yading@10: * - encoding: unused yading@10: */ yading@10: char *sub_charenc; yading@10: yading@10: /** yading@10: * Subtitles character encoding mode. Formats or codecs might be adjusting yading@10: * this setting (if they are doing the conversion themselves for instance). yading@10: * - decoding: set by libavcodec yading@10: * - encoding: unused yading@10: */ yading@10: int sub_charenc_mode; yading@10: #define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance) yading@10: #define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself yading@10: #define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv yading@10: } AVCodecContext; yading@10: yading@10: AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); yading@10: void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); yading@10: yading@10: const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); yading@10: void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); yading@10: yading@10: /** yading@10: * AVProfile. yading@10: */ yading@10: typedef struct AVProfile { yading@10: int profile; yading@10: const char *name; ///< short name for the profile yading@10: } AVProfile; yading@10: yading@10: typedef struct AVCodecDefault AVCodecDefault; yading@10: yading@10: struct AVSubtitle; yading@10: yading@10: /** yading@10: * AVCodec. yading@10: */ yading@10: typedef struct AVCodec { yading@10: /** yading@10: * Name of the codec implementation. yading@10: * The name is globally unique among encoders and among decoders (but an yading@10: * encoder and a decoder can share the same name). yading@10: * This is the primary way to find a codec from the user perspective. yading@10: */ yading@10: const char *name; yading@10: /** yading@10: * Descriptive name for the codec, meant to be more human readable than name. yading@10: * You should use the NULL_IF_CONFIG_SMALL() macro to define it. yading@10: */ yading@10: const char *long_name; yading@10: enum AVMediaType type; yading@10: enum AVCodecID id; yading@10: /** yading@10: * Codec capabilities. yading@10: * see CODEC_CAP_* yading@10: */ yading@10: int capabilities; yading@10: const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} yading@10: const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 yading@10: const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 yading@10: const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 yading@10: const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 yading@10: uint8_t max_lowres; ///< maximum value for lowres supported by the decoder yading@10: const AVClass *priv_class; ///< AVClass for the private context yading@10: const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} yading@10: yading@10: /***************************************************************** yading@10: * No fields below this line are part of the public API. They yading@10: * may not be used outside of libavcodec and can be changed and yading@10: * removed at will. yading@10: * New public fields should be added right above. yading@10: ***************************************************************** yading@10: */ yading@10: int priv_data_size; yading@10: struct AVCodec *next; yading@10: /** yading@10: * @name Frame-level threading support functions yading@10: * @{ yading@10: */ yading@10: /** yading@10: * If defined, called on thread contexts when they are created. yading@10: * If the codec allocates writable tables in init(), re-allocate them here. yading@10: * priv_data will be set to a copy of the original. yading@10: */ yading@10: int (*init_thread_copy)(AVCodecContext *); yading@10: /** yading@10: * Copy necessary context variables from a previous thread context to the current one. yading@10: * If not defined, the next thread will start automatically; otherwise, the codec yading@10: * must call ff_thread_finish_setup(). yading@10: * yading@10: * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. yading@10: */ yading@10: int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); yading@10: /** @} */ yading@10: yading@10: /** yading@10: * Private codec-specific defaults. yading@10: */ yading@10: const AVCodecDefault *defaults; yading@10: yading@10: /** yading@10: * Initialize codec static data, called from avcodec_register(). yading@10: */ yading@10: void (*init_static_data)(struct AVCodec *codec); yading@10: yading@10: int (*init)(AVCodecContext *); yading@10: int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, yading@10: const struct AVSubtitle *sub); yading@10: /** yading@10: * Encode data to an AVPacket. yading@10: * yading@10: * @param avctx codec context yading@10: * @param avpkt output AVPacket (may contain a user-provided buffer) yading@10: * @param[in] frame AVFrame containing the raw data to be encoded yading@10: * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a yading@10: * non-empty packet was returned in avpkt. yading@10: * @return 0 on success, negative error code on failure yading@10: */ yading@10: int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, yading@10: int *got_packet_ptr); yading@10: int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); yading@10: int (*close)(AVCodecContext *); yading@10: /** yading@10: * Flush buffers. yading@10: * Will be called when seeking yading@10: */ yading@10: void (*flush)(AVCodecContext *); yading@10: } AVCodec; yading@10: yading@10: /** yading@10: * AVHWAccel. yading@10: */ yading@10: typedef struct AVHWAccel { yading@10: /** yading@10: * Name of the hardware accelerated codec. yading@10: * The name is globally unique among encoders and among decoders (but an yading@10: * encoder and a decoder can share the same name). yading@10: */ yading@10: const char *name; yading@10: yading@10: /** yading@10: * Type of codec implemented by the hardware accelerator. yading@10: * yading@10: * See AVMEDIA_TYPE_xxx yading@10: */ yading@10: enum AVMediaType type; yading@10: yading@10: /** yading@10: * Codec implemented by the hardware accelerator. yading@10: * yading@10: * See AV_CODEC_ID_xxx yading@10: */ yading@10: enum AVCodecID id; yading@10: yading@10: /** yading@10: * Supported pixel format. yading@10: * yading@10: * Only hardware accelerated formats are supported here. yading@10: */ yading@10: enum AVPixelFormat pix_fmt; yading@10: yading@10: /** yading@10: * Hardware accelerated codec capabilities. yading@10: * see FF_HWACCEL_CODEC_CAP_* yading@10: */ yading@10: int capabilities; yading@10: yading@10: struct AVHWAccel *next; yading@10: yading@10: /** yading@10: * Called at the beginning of each frame or field picture. yading@10: * yading@10: * Meaningful frame information (codec specific) is guaranteed to yading@10: * be parsed at this point. This function is mandatory. yading@10: * yading@10: * Note that buf can be NULL along with buf_size set to 0. yading@10: * Otherwise, this means the whole frame is available at this point. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param buf the frame data buffer base yading@10: * @param buf_size the size of the frame in bytes yading@10: * @return zero if successful, a negative value otherwise yading@10: */ yading@10: int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); yading@10: yading@10: /** yading@10: * Callback for each slice. yading@10: * yading@10: * Meaningful slice information (codec specific) is guaranteed to yading@10: * be parsed at this point. This function is mandatory. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param buf the slice data buffer base yading@10: * @param buf_size the size of the slice in bytes yading@10: * @return zero if successful, a negative value otherwise yading@10: */ yading@10: int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); yading@10: yading@10: /** yading@10: * Called at the end of each frame or field picture. yading@10: * yading@10: * The whole picture is parsed at this point and can now be sent yading@10: * to the hardware accelerator. This function is mandatory. yading@10: * yading@10: * @param avctx the codec context yading@10: * @return zero if successful, a negative value otherwise yading@10: */ yading@10: int (*end_frame)(AVCodecContext *avctx); yading@10: yading@10: /** yading@10: * Size of HW accelerator private data. yading@10: * yading@10: * Private data is allocated with av_mallocz() before yading@10: * AVCodecContext.get_buffer() and deallocated after yading@10: * AVCodecContext.release_buffer(). yading@10: */ yading@10: int priv_data_size; yading@10: } AVHWAccel; yading@10: yading@10: /** yading@10: * @defgroup lavc_picture AVPicture yading@10: * yading@10: * Functions for working with AVPicture yading@10: * @{ yading@10: */ yading@10: yading@10: /** yading@10: * four components are given, that's all. yading@10: * the last component is alpha yading@10: */ yading@10: typedef struct AVPicture { yading@10: uint8_t *data[AV_NUM_DATA_POINTERS]; yading@10: int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line yading@10: } AVPicture; yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: enum AVSubtitleType { yading@10: SUBTITLE_NONE, yading@10: yading@10: SUBTITLE_BITMAP, ///< A bitmap, pict will be set yading@10: yading@10: /** yading@10: * Plain text, the text field must be set by the decoder and is yading@10: * authoritative. ass and pict fields may contain approximations. yading@10: */ yading@10: SUBTITLE_TEXT, yading@10: yading@10: /** yading@10: * Formatted text, the ass field must be set by the decoder and is yading@10: * authoritative. pict and text fields may contain approximations. yading@10: */ yading@10: SUBTITLE_ASS, yading@10: }; yading@10: yading@10: #define AV_SUBTITLE_FLAG_FORCED 0x00000001 yading@10: yading@10: typedef struct AVSubtitleRect { yading@10: int x; ///< top left corner of pict, undefined when pict is not set yading@10: int y; ///< top left corner of pict, undefined when pict is not set yading@10: int w; ///< width of pict, undefined when pict is not set yading@10: int h; ///< height of pict, undefined when pict is not set yading@10: int nb_colors; ///< number of colors in pict, undefined when pict is not set yading@10: yading@10: /** yading@10: * data+linesize for the bitmap of this subtitle. yading@10: * can be set for text/ass as well once they where rendered yading@10: */ yading@10: AVPicture pict; yading@10: enum AVSubtitleType type; yading@10: yading@10: char *text; ///< 0 terminated plain UTF-8 text yading@10: yading@10: /** yading@10: * 0 terminated ASS/SSA compatible event line. yading@10: * The presentation of this is unaffected by the other values in this yading@10: * struct. yading@10: */ yading@10: char *ass; yading@10: yading@10: int flags; yading@10: } AVSubtitleRect; yading@10: yading@10: typedef struct AVSubtitle { yading@10: uint16_t format; /* 0 = graphics */ yading@10: uint32_t start_display_time; /* relative to packet pts, in ms */ yading@10: uint32_t end_display_time; /* relative to packet pts, in ms */ yading@10: unsigned num_rects; yading@10: AVSubtitleRect **rects; yading@10: int64_t pts; ///< Same as packet pts, in AV_TIME_BASE yading@10: } AVSubtitle; yading@10: yading@10: /** yading@10: * If c is NULL, returns the first registered codec, yading@10: * if c is non-NULL, returns the next registered codec after c, yading@10: * or NULL if c is the last one. yading@10: */ yading@10: AVCodec *av_codec_next(const AVCodec *c); yading@10: yading@10: /** yading@10: * Return the LIBAVCODEC_VERSION_INT constant. yading@10: */ yading@10: unsigned avcodec_version(void); yading@10: yading@10: /** yading@10: * Return the libavcodec build-time configuration. yading@10: */ yading@10: const char *avcodec_configuration(void); yading@10: yading@10: /** yading@10: * Return the libavcodec license. yading@10: */ yading@10: const char *avcodec_license(void); yading@10: yading@10: /** yading@10: * Register the codec codec and initialize libavcodec. yading@10: * yading@10: * @warning either this function or avcodec_register_all() must be called yading@10: * before any other libavcodec functions. yading@10: * yading@10: * @see avcodec_register_all() yading@10: */ yading@10: void avcodec_register(AVCodec *codec); yading@10: yading@10: /** yading@10: * Register all the codecs, parsers and bitstream filters which were enabled at yading@10: * configuration time. If you do not call this function you can select exactly yading@10: * which formats you want to support, by using the individual registration yading@10: * functions. yading@10: * yading@10: * @see avcodec_register yading@10: * @see av_register_codec_parser yading@10: * @see av_register_bitstream_filter yading@10: */ yading@10: void avcodec_register_all(void); yading@10: yading@10: yading@10: #if FF_API_ALLOC_CONTEXT yading@10: /** yading@10: * Allocate an AVCodecContext and set its fields to default values. The yading@10: * resulting struct can be deallocated by simply calling av_free(). yading@10: * yading@10: * @return An AVCodecContext filled with default values or NULL on failure. yading@10: * @see avcodec_get_context_defaults yading@10: * yading@10: * @deprecated use avcodec_alloc_context3() yading@10: */ yading@10: attribute_deprecated yading@10: AVCodecContext *avcodec_alloc_context(void); yading@10: yading@10: /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! yading@10: * we WILL change its arguments and name a few times! */ yading@10: attribute_deprecated yading@10: AVCodecContext *avcodec_alloc_context2(enum AVMediaType); yading@10: yading@10: /** yading@10: * Set the fields of the given AVCodecContext to default values. yading@10: * yading@10: * @param s The AVCodecContext of which the fields should be set to default values. yading@10: * @deprecated use avcodec_get_context_defaults3 yading@10: */ yading@10: attribute_deprecated yading@10: void avcodec_get_context_defaults(AVCodecContext *s); yading@10: yading@10: /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! yading@10: * we WILL change its arguments and name a few times! */ yading@10: attribute_deprecated yading@10: void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); yading@10: #endif yading@10: yading@10: /** yading@10: * Allocate an AVCodecContext and set its fields to default values. The yading@10: * resulting struct can be deallocated by calling avcodec_close() on it followed yading@10: * by av_free(). yading@10: * yading@10: * @param codec if non-NULL, allocate private data and initialize defaults yading@10: * for the given codec. It is illegal to then call avcodec_open2() yading@10: * with a different codec. yading@10: * If NULL, then the codec-specific defaults won't be initialized, yading@10: * which may result in suboptimal default settings (this is yading@10: * important mainly for encoders, e.g. libx264). yading@10: * yading@10: * @return An AVCodecContext filled with default values or NULL on failure. yading@10: * @see avcodec_get_context_defaults yading@10: */ yading@10: AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); yading@10: yading@10: /** yading@10: * Set the fields of the given AVCodecContext to default values corresponding yading@10: * to the given codec (defaults may be codec-dependent). yading@10: * yading@10: * Do not call this function if a non-NULL codec has been passed yading@10: * to avcodec_alloc_context3() that allocated this AVCodecContext. yading@10: * If codec is non-NULL, it is illegal to call avcodec_open2() with a yading@10: * different codec on this AVCodecContext. yading@10: */ yading@10: int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); yading@10: yading@10: /** yading@10: * Get the AVClass for AVCodecContext. It can be used in combination with yading@10: * AV_OPT_SEARCH_FAKE_OBJ for examining options. yading@10: * yading@10: * @see av_opt_find(). yading@10: */ yading@10: const AVClass *avcodec_get_class(void); yading@10: yading@10: /** yading@10: * Get the AVClass for AVFrame. It can be used in combination with yading@10: * AV_OPT_SEARCH_FAKE_OBJ for examining options. yading@10: * yading@10: * @see av_opt_find(). yading@10: */ yading@10: const AVClass *avcodec_get_frame_class(void); yading@10: yading@10: /** yading@10: * Get the AVClass for AVSubtitleRect. It can be used in combination with yading@10: * AV_OPT_SEARCH_FAKE_OBJ for examining options. yading@10: * yading@10: * @see av_opt_find(). yading@10: */ yading@10: const AVClass *avcodec_get_subtitle_rect_class(void); yading@10: yading@10: /** yading@10: * Copy the settings of the source AVCodecContext into the destination yading@10: * AVCodecContext. The resulting destination codec context will be yading@10: * unopened, i.e. you are required to call avcodec_open2() before you yading@10: * can use this AVCodecContext to decode/encode video/audio data. yading@10: * yading@10: * @param dest target codec context, should be initialized with yading@10: * avcodec_alloc_context3(), but otherwise uninitialized yading@10: * @param src source codec context yading@10: * @return AVERROR() on error (e.g. memory allocation error), 0 on success yading@10: */ yading@10: int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); yading@10: yading@10: /** yading@10: * Allocate an AVFrame and set its fields to default values. The resulting yading@10: * struct must be freed using avcodec_free_frame(). yading@10: * yading@10: * @return An AVFrame filled with default values or NULL on failure. yading@10: * @see avcodec_get_frame_defaults yading@10: */ yading@10: AVFrame *avcodec_alloc_frame(void); yading@10: yading@10: /** yading@10: * Set the fields of the given AVFrame to default values. yading@10: * yading@10: * @param frame The AVFrame of which the fields should be set to default values. yading@10: */ yading@10: void avcodec_get_frame_defaults(AVFrame *frame); yading@10: yading@10: /** yading@10: * Free the frame and any dynamically allocated objects in it, yading@10: * e.g. extended_data. yading@10: * yading@10: * @param frame frame to be freed. The pointer will be set to NULL. yading@10: * yading@10: * @warning this function does NOT free the data buffers themselves yading@10: * (it does not know how, since they might have been allocated with yading@10: * a custom get_buffer()). yading@10: */ yading@10: void avcodec_free_frame(AVFrame **frame); yading@10: yading@10: #if FF_API_AVCODEC_OPEN yading@10: /** yading@10: * Initialize the AVCodecContext to use the given AVCodec. Prior to using this yading@10: * function the context has to be allocated. yading@10: * yading@10: * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), yading@10: * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for yading@10: * retrieving a codec. yading@10: * yading@10: * @warning This function is not thread safe! yading@10: * yading@10: * @code yading@10: * avcodec_register_all(); yading@10: * codec = avcodec_find_decoder(AV_CODEC_ID_H264); yading@10: * if (!codec) yading@10: * exit(1); yading@10: * yading@10: * context = avcodec_alloc_context3(codec); yading@10: * yading@10: * if (avcodec_open(context, codec) < 0) yading@10: * exit(1); yading@10: * @endcode yading@10: * yading@10: * @param avctx The context which will be set up to use the given codec. yading@10: * @param codec The codec to use within the context. yading@10: * @return zero on success, a negative value on error yading@10: * @see avcodec_alloc_context3, avcodec_find_decoder, avcodec_find_encoder, avcodec_close yading@10: * yading@10: * @deprecated use avcodec_open2 yading@10: */ yading@10: attribute_deprecated yading@10: int avcodec_open(AVCodecContext *avctx, AVCodec *codec); yading@10: #endif yading@10: yading@10: /** yading@10: * Initialize the AVCodecContext to use the given AVCodec. Prior to using this yading@10: * function the context has to be allocated with avcodec_alloc_context3(). yading@10: * yading@10: * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), yading@10: * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for yading@10: * retrieving a codec. yading@10: * yading@10: * @warning This function is not thread safe! yading@10: * yading@10: * @code yading@10: * avcodec_register_all(); yading@10: * av_dict_set(&opts, "b", "2.5M", 0); yading@10: * codec = avcodec_find_decoder(AV_CODEC_ID_H264); yading@10: * if (!codec) yading@10: * exit(1); yading@10: * yading@10: * context = avcodec_alloc_context3(codec); yading@10: * yading@10: * if (avcodec_open2(context, codec, opts) < 0) yading@10: * exit(1); yading@10: * @endcode yading@10: * yading@10: * @param avctx The context to initialize. yading@10: * @param codec The codec to open this context for. If a non-NULL codec has been yading@10: * previously passed to avcodec_alloc_context3() or yading@10: * avcodec_get_context_defaults3() for this context, then this yading@10: * parameter MUST be either NULL or equal to the previously passed yading@10: * codec. yading@10: * @param options A dictionary filled with AVCodecContext and codec-private options. yading@10: * On return this object will be filled with options that were not found. yading@10: * yading@10: * @return zero on success, a negative value on error yading@10: * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), yading@10: * av_dict_set(), av_opt_find(). yading@10: */ yading@10: int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); yading@10: yading@10: /** yading@10: * Close a given AVCodecContext and free all the data associated with it yading@10: * (but not the AVCodecContext itself). yading@10: * yading@10: * Calling this function on an AVCodecContext that hasn't been opened will free yading@10: * the codec-specific data allocated in avcodec_alloc_context3() / yading@10: * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will yading@10: * do nothing. yading@10: */ yading@10: int avcodec_close(AVCodecContext *avctx); yading@10: yading@10: /** yading@10: * Free all allocated data in the given subtitle struct. yading@10: * yading@10: * @param sub AVSubtitle to free. yading@10: */ yading@10: void avsubtitle_free(AVSubtitle *sub); yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: /** yading@10: * @addtogroup lavc_packet yading@10: * @{ yading@10: */ yading@10: yading@10: #if FF_API_DESTRUCT_PACKET yading@10: /** yading@10: * Default packet destructor. yading@10: * @deprecated use the AVBuffer API instead yading@10: */ yading@10: attribute_deprecated yading@10: void av_destruct_packet(AVPacket *pkt); yading@10: #endif yading@10: yading@10: /** yading@10: * Initialize optional fields of a packet with default values. yading@10: * yading@10: * Note, this does not touch the data and size members, which have to be yading@10: * initialized separately. yading@10: * yading@10: * @param pkt packet yading@10: */ yading@10: void av_init_packet(AVPacket *pkt); yading@10: yading@10: /** yading@10: * Allocate the payload of a packet and initialize its fields with yading@10: * default values. yading@10: * yading@10: * @param pkt packet yading@10: * @param size wanted payload size yading@10: * @return 0 if OK, AVERROR_xxx otherwise yading@10: */ yading@10: int av_new_packet(AVPacket *pkt, int size); yading@10: yading@10: /** yading@10: * Reduce packet size, correctly zeroing padding yading@10: * yading@10: * @param pkt packet yading@10: * @param size new size yading@10: */ yading@10: void av_shrink_packet(AVPacket *pkt, int size); yading@10: yading@10: /** yading@10: * Increase packet size, correctly zeroing padding yading@10: * yading@10: * @param pkt packet yading@10: * @param grow_by number of bytes by which to increase the size of the packet yading@10: */ yading@10: int av_grow_packet(AVPacket *pkt, int grow_by); yading@10: yading@10: /** yading@10: * Initialize a reference-counted packet from av_malloc()ed data. yading@10: * yading@10: * @param pkt packet to be initialized. This function will set the data, size, yading@10: * buf and destruct fields, all others are left untouched. yading@10: * @param data Data allocated by av_malloc() to be used as packet data. If this yading@10: * function returns successfully, the data is owned by the underlying AVBuffer. yading@10: * The caller may not access the data through other means. yading@10: * @param size size of data in bytes, without the padding. I.e. the full buffer yading@10: * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. yading@10: * yading@10: * @return 0 on success, a negative AVERROR on error yading@10: */ yading@10: int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); yading@10: yading@10: /** yading@10: * @warning This is a hack - the packet memory allocation stuff is broken. The yading@10: * packet is allocated if it was not really allocated. yading@10: */ yading@10: int av_dup_packet(AVPacket *pkt); yading@10: yading@10: /** yading@10: * Copy packet, including contents yading@10: * yading@10: * @return 0 on success, negative AVERROR on fail yading@10: */ yading@10: int av_copy_packet(AVPacket *dst, AVPacket *src); yading@10: yading@10: /** yading@10: * Free a packet. yading@10: * yading@10: * @param pkt packet to free yading@10: */ yading@10: void av_free_packet(AVPacket *pkt); yading@10: yading@10: /** yading@10: * Allocate new information of a packet. yading@10: * yading@10: * @param pkt packet yading@10: * @param type side information type yading@10: * @param size side information size yading@10: * @return pointer to fresh allocated data or NULL otherwise yading@10: */ yading@10: uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, yading@10: int size); yading@10: yading@10: /** yading@10: * Shrink the already allocated side data buffer yading@10: * yading@10: * @param pkt packet yading@10: * @param type side information type yading@10: * @param size new side information size yading@10: * @return 0 on success, < 0 on failure yading@10: */ yading@10: int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, yading@10: int size); yading@10: yading@10: /** yading@10: * Get side information from packet. yading@10: * yading@10: * @param pkt packet yading@10: * @param type desired side information type yading@10: * @param size pointer for side information size to store (optional) yading@10: * @return pointer to data if present or NULL otherwise yading@10: */ yading@10: uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, yading@10: int *size); yading@10: yading@10: int av_packet_merge_side_data(AVPacket *pkt); yading@10: yading@10: int av_packet_split_side_data(AVPacket *pkt); yading@10: yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: /** yading@10: * @addtogroup lavc_decoding yading@10: * @{ yading@10: */ yading@10: yading@10: /** yading@10: * Find a registered decoder with a matching codec ID. yading@10: * yading@10: * @param id AVCodecID of the requested decoder yading@10: * @return A decoder if one was found, NULL otherwise. yading@10: */ yading@10: AVCodec *avcodec_find_decoder(enum AVCodecID id); yading@10: yading@10: /** yading@10: * Find a registered decoder with the specified name. yading@10: * yading@10: * @param name name of the requested decoder yading@10: * @return A decoder if one was found, NULL otherwise. yading@10: */ yading@10: AVCodec *avcodec_find_decoder_by_name(const char *name); yading@10: yading@10: #if FF_API_GET_BUFFER yading@10: attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); yading@10: attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); yading@10: attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); yading@10: #endif yading@10: yading@10: /** yading@10: * The default callback for AVCodecContext.get_buffer2(). It is made public so yading@10: * it can be called by custom get_buffer2() implementations for decoders without yading@10: * CODEC_CAP_DR1 set. yading@10: */ yading@10: int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); yading@10: yading@10: /** yading@10: * Return the amount of padding in pixels which the get_buffer callback must yading@10: * provide around the edge of the image for codecs which do not have the yading@10: * CODEC_FLAG_EMU_EDGE flag. yading@10: * yading@10: * @return Required padding in pixels. yading@10: */ yading@10: unsigned avcodec_get_edge_width(void); yading@10: yading@10: /** yading@10: * Modify width and height values so that they will result in a memory yading@10: * buffer that is acceptable for the codec if you do not use any horizontal yading@10: * padding. yading@10: * yading@10: * May only be used if a codec with CODEC_CAP_DR1 has been opened. yading@10: * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased yading@10: * according to avcodec_get_edge_width() before. yading@10: */ yading@10: void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); yading@10: yading@10: /** yading@10: * Modify width and height values so that they will result in a memory yading@10: * buffer that is acceptable for the codec if you also ensure that all yading@10: * line sizes are a multiple of the respective linesize_align[i]. yading@10: * yading@10: * May only be used if a codec with CODEC_CAP_DR1 has been opened. yading@10: * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased yading@10: * according to avcodec_get_edge_width() before. yading@10: */ yading@10: void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, yading@10: int linesize_align[AV_NUM_DATA_POINTERS]); yading@10: yading@10: #if FF_API_OLD_DECODE_AUDIO yading@10: /** yading@10: * Wrapper function which calls avcodec_decode_audio4. yading@10: * yading@10: * @deprecated Use avcodec_decode_audio4 instead. yading@10: * yading@10: * Decode the audio frame of size avpkt->size from avpkt->data into samples. yading@10: * Some decoders may support multiple frames in a single AVPacket, such yading@10: * decoders would then just decode the first frame. In this case, yading@10: * avcodec_decode_audio3 has to be called again with an AVPacket that contains yading@10: * the remaining data in order to decode the second frame etc. yading@10: * If no frame yading@10: * could be outputted, frame_size_ptr is zero. Otherwise, it is the yading@10: * decompressed frame size in bytes. yading@10: * yading@10: * @warning You must set frame_size_ptr to the allocated size of the yading@10: * output buffer before calling avcodec_decode_audio3(). yading@10: * yading@10: * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than yading@10: * the actual read bytes because some optimized bitstream readers read 32 or 64 yading@10: * bits at once and could read over the end. yading@10: * yading@10: * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that yading@10: * no overreading happens for damaged MPEG streams. yading@10: * yading@10: * @warning You must not provide a custom get_buffer() when using yading@10: * avcodec_decode_audio3(). Doing so will override it with yading@10: * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead, yading@10: * which does allow the application to provide a custom get_buffer(). yading@10: * yading@10: * @note You might have to align the input buffer avpkt->data and output buffer yading@10: * samples. The alignment requirements depend on the CPU: On some CPUs it isn't yading@10: * necessary at all, on others it won't work at all if not aligned and on others yading@10: * it will work but it will have an impact on performance. yading@10: * yading@10: * In practice, avpkt->data should have 4 byte alignment at minimum and yading@10: * samples should be 16 byte aligned unless the CPU doesn't need it yading@10: * (AltiVec and SSE do). yading@10: * yading@10: * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay yading@10: * between input and output, these need to be fed with avpkt->data=NULL, yading@10: * avpkt->size=0 at the end to return the remaining frames. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param[out] samples the output buffer, sample type in avctx->sample_fmt yading@10: * If the sample format is planar, each channel plane will yading@10: * be the same size, with no padding between channels. yading@10: * @param[in,out] frame_size_ptr the output buffer size in bytes yading@10: * @param[in] avpkt The input AVPacket containing the input buffer. yading@10: * You can create such packet with av_init_packet() and by then setting yading@10: * data and size, some decoders might in addition need other fields. yading@10: * All decoders are designed to use the least fields possible though. yading@10: * @return On error a negative value is returned, otherwise the number of bytes yading@10: * used or zero if no frame data was decompressed (used) from the input AVPacket. yading@10: */ yading@10: attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, yading@10: int *frame_size_ptr, yading@10: AVPacket *avpkt); yading@10: #endif yading@10: yading@10: /** yading@10: * Decode the audio frame of size avpkt->size from avpkt->data into frame. yading@10: * yading@10: * Some decoders may support multiple frames in a single AVPacket. Such yading@10: * decoders would then just decode the first frame. In this case, yading@10: * avcodec_decode_audio4 has to be called again with an AVPacket containing yading@10: * the remaining data in order to decode the second frame, etc... yading@10: * Even if no frames are returned, the packet needs to be fed to the decoder yading@10: * with remaining data until it is completely consumed or an error occurs. yading@10: * yading@10: * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE yading@10: * larger than the actual read bytes because some optimized bitstream yading@10: * readers read 32 or 64 bits at once and could read over the end. yading@10: * yading@10: * @note You might have to align the input buffer. The alignment requirements yading@10: * depend on the CPU and the decoder. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param[out] frame The AVFrame in which to store decoded audio samples. yading@10: * The decoder will allocate a buffer for the decoded frame by yading@10: * calling the AVCodecContext.get_buffer2() callback. yading@10: * When AVCodecContext.refcounted_frames is set to 1, the frame is yading@10: * reference counted and the returned reference belongs to the yading@10: * caller. The caller must release the frame using av_frame_unref() yading@10: * when the frame is no longer needed. The caller may safely write yading@10: * to the frame if av_frame_is_writable() returns 1. yading@10: * When AVCodecContext.refcounted_frames is set to 0, the returned yading@10: * reference belongs to the decoder and is valid only until the yading@10: * next call to this function or until closing the decoder. yading@10: * The caller may not write to it. yading@10: * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is yading@10: * non-zero. yading@10: * @param[in] avpkt The input AVPacket containing the input buffer. yading@10: * At least avpkt->data and avpkt->size should be set. Some yading@10: * decoders might also require additional fields to be set. yading@10: * @return A negative error code is returned if an error occurred during yading@10: * decoding, otherwise the number of bytes consumed from the input yading@10: * AVPacket is returned. yading@10: */ yading@10: int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, yading@10: int *got_frame_ptr, const AVPacket *avpkt); yading@10: yading@10: /** yading@10: * Decode the video frame of size avpkt->size from avpkt->data into picture. yading@10: * Some decoders may support multiple frames in a single AVPacket, such yading@10: * decoders would then just decode the first frame. yading@10: * yading@10: * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than yading@10: * the actual read bytes because some optimized bitstream readers read 32 or 64 yading@10: * bits at once and could read over the end. yading@10: * yading@10: * @warning The end of the input buffer buf should be set to 0 to ensure that yading@10: * no overreading happens for damaged MPEG streams. yading@10: * yading@10: * @note You might have to align the input buffer avpkt->data. yading@10: * The alignment requirements depend on the CPU: on some CPUs it isn't yading@10: * necessary at all, on others it won't work at all if not aligned and on others yading@10: * it will work but it will have an impact on performance. yading@10: * yading@10: * In practice, avpkt->data should have 4 byte alignment at minimum. yading@10: * yading@10: * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay yading@10: * between input and output, these need to be fed with avpkt->data=NULL, yading@10: * avpkt->size=0 at the end to return the remaining frames. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param[out] picture The AVFrame in which the decoded video frame will be stored. yading@10: * Use av_frame_alloc() to get an AVFrame. The codec will yading@10: * allocate memory for the actual bitmap by calling the yading@10: * AVCodecContext.get_buffer2() callback. yading@10: * When AVCodecContext.refcounted_frames is set to 1, the frame is yading@10: * reference counted and the returned reference belongs to the yading@10: * caller. The caller must release the frame using av_frame_unref() yading@10: * when the frame is no longer needed. The caller may safely write yading@10: * to the frame if av_frame_is_writable() returns 1. yading@10: * When AVCodecContext.refcounted_frames is set to 0, the returned yading@10: * reference belongs to the decoder and is valid only until the yading@10: * next call to this function or until closing the decoder. The yading@10: * caller may not write to it. yading@10: * yading@10: * @param[in] avpkt The input AVpacket containing the input buffer. yading@10: * You can create such packet with av_init_packet() and by then setting yading@10: * data and size, some decoders might in addition need other fields like yading@10: * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least yading@10: * fields possible. yading@10: * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. yading@10: * @return On error a negative value is returned, otherwise the number of bytes yading@10: * used or zero if no frame could be decompressed. yading@10: */ yading@10: int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, yading@10: int *got_picture_ptr, yading@10: const AVPacket *avpkt); yading@10: yading@10: /** yading@10: * Decode a subtitle message. yading@10: * Return a negative value on error, otherwise return the number of bytes used. yading@10: * If no subtitle could be decompressed, got_sub_ptr is zero. yading@10: * Otherwise, the subtitle is stored in *sub. yading@10: * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for yading@10: * simplicity, because the performance difference is expect to be negligible yading@10: * and reusing a get_buffer written for video codecs would probably perform badly yading@10: * due to a potentially very different allocation pattern. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be yading@10: freed with avsubtitle_free if *got_sub_ptr is set. yading@10: * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. yading@10: * @param[in] avpkt The input AVPacket containing the input buffer. yading@10: */ yading@10: int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, yading@10: int *got_sub_ptr, yading@10: AVPacket *avpkt); yading@10: yading@10: /** yading@10: * @defgroup lavc_parsing Frame parsing yading@10: * @{ yading@10: */ yading@10: yading@10: typedef struct AVCodecParserContext { yading@10: void *priv_data; yading@10: struct AVCodecParser *parser; yading@10: int64_t frame_offset; /* offset of the current frame */ yading@10: int64_t cur_offset; /* current offset yading@10: (incremented by each av_parser_parse()) */ yading@10: int64_t next_frame_offset; /* offset of the next frame */ yading@10: /* video info */ yading@10: int pict_type; /* XXX: Put it back in AVCodecContext. */ yading@10: /** yading@10: * This field is used for proper frame duration computation in lavf. yading@10: * It signals, how much longer the frame duration of the current frame yading@10: * is compared to normal frame duration. yading@10: * yading@10: * frame_duration = (1 + repeat_pict) * time_base yading@10: * yading@10: * It is used by codecs like H.264 to display telecined material. yading@10: */ yading@10: int repeat_pict; /* XXX: Put it back in AVCodecContext. */ yading@10: int64_t pts; /* pts of the current frame */ yading@10: int64_t dts; /* dts of the current frame */ yading@10: yading@10: /* private data */ yading@10: int64_t last_pts; yading@10: int64_t last_dts; yading@10: int fetch_timestamp; yading@10: yading@10: #define AV_PARSER_PTS_NB 4 yading@10: int cur_frame_start_index; yading@10: int64_t cur_frame_offset[AV_PARSER_PTS_NB]; yading@10: int64_t cur_frame_pts[AV_PARSER_PTS_NB]; yading@10: int64_t cur_frame_dts[AV_PARSER_PTS_NB]; yading@10: yading@10: int flags; yading@10: #define PARSER_FLAG_COMPLETE_FRAMES 0x0001 yading@10: #define PARSER_FLAG_ONCE 0x0002 yading@10: /// Set if the parser has a valid file offset yading@10: #define PARSER_FLAG_FETCHED_OFFSET 0x0004 yading@10: #define PARSER_FLAG_USE_CODEC_TS 0x1000 yading@10: yading@10: int64_t offset; ///< byte offset from starting packet start yading@10: int64_t cur_frame_end[AV_PARSER_PTS_NB]; yading@10: yading@10: /** yading@10: * Set by parser to 1 for key frames and 0 for non-key frames. yading@10: * It is initialized to -1, so if the parser doesn't set this flag, yading@10: * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames yading@10: * will be used. yading@10: */ yading@10: int key_frame; yading@10: yading@10: /** yading@10: * Time difference in stream time base units from the pts of this yading@10: * packet to the point at which the output from the decoder has converged yading@10: * independent from the availability of previous frames. That is, the yading@10: * frames are virtually identical no matter if decoding started from yading@10: * the very first frame or from this keyframe. yading@10: * Is AV_NOPTS_VALUE if unknown. yading@10: * This field is not the display duration of the current frame. yading@10: * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY yading@10: * set. yading@10: * yading@10: * The purpose of this field is to allow seeking in streams that have no yading@10: * keyframes in the conventional sense. It corresponds to the yading@10: * recovery point SEI in H.264 and match_time_delta in NUT. It is also yading@10: * essential for some types of subtitle streams to ensure that all yading@10: * subtitles are correctly displayed after seeking. yading@10: */ yading@10: int64_t convergence_duration; yading@10: yading@10: // Timestamp generation support: yading@10: /** yading@10: * Synchronization point for start of timestamp generation. yading@10: * yading@10: * Set to >0 for sync point, 0 for no sync point and <0 for undefined yading@10: * (default). yading@10: * yading@10: * For example, this corresponds to presence of H.264 buffering period yading@10: * SEI message. yading@10: */ yading@10: int dts_sync_point; yading@10: yading@10: /** yading@10: * Offset of the current timestamp against last timestamp sync point in yading@10: * units of AVCodecContext.time_base. yading@10: * yading@10: * Set to INT_MIN when dts_sync_point unused. Otherwise, it must yading@10: * contain a valid timestamp offset. yading@10: * yading@10: * Note that the timestamp of sync point has usually a nonzero yading@10: * dts_ref_dts_delta, which refers to the previous sync point. Offset of yading@10: * the next frame after timestamp sync point will be usually 1. yading@10: * yading@10: * For example, this corresponds to H.264 cpb_removal_delay. yading@10: */ yading@10: int dts_ref_dts_delta; yading@10: yading@10: /** yading@10: * Presentation delay of current frame in units of AVCodecContext.time_base. yading@10: * yading@10: * Set to INT_MIN when dts_sync_point unused. Otherwise, it must yading@10: * contain valid non-negative timestamp delta (presentation time of a frame yading@10: * must not lie in the past). yading@10: * yading@10: * This delay represents the difference between decoding and presentation yading@10: * time of the frame. yading@10: * yading@10: * For example, this corresponds to H.264 dpb_output_delay. yading@10: */ yading@10: int pts_dts_delta; yading@10: yading@10: /** yading@10: * Position of the packet in file. yading@10: * yading@10: * Analogous to cur_frame_pts/dts yading@10: */ yading@10: int64_t cur_frame_pos[AV_PARSER_PTS_NB]; yading@10: yading@10: /** yading@10: * Byte position of currently parsed frame in stream. yading@10: */ yading@10: int64_t pos; yading@10: yading@10: /** yading@10: * Previous frame byte position. yading@10: */ yading@10: int64_t last_pos; yading@10: yading@10: /** yading@10: * Duration of the current frame. yading@10: * For audio, this is in units of 1 / AVCodecContext.sample_rate. yading@10: * For all other types, this is in units of AVCodecContext.time_base. yading@10: */ yading@10: int duration; yading@10: } AVCodecParserContext; yading@10: yading@10: typedef struct AVCodecParser { yading@10: int codec_ids[5]; /* several codec IDs are permitted */ yading@10: int priv_data_size; yading@10: int (*parser_init)(AVCodecParserContext *s); yading@10: int (*parser_parse)(AVCodecParserContext *s, yading@10: AVCodecContext *avctx, yading@10: const uint8_t **poutbuf, int *poutbuf_size, yading@10: const uint8_t *buf, int buf_size); yading@10: void (*parser_close)(AVCodecParserContext *s); yading@10: int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); yading@10: struct AVCodecParser *next; yading@10: } AVCodecParser; yading@10: yading@10: AVCodecParser *av_parser_next(AVCodecParser *c); yading@10: yading@10: void av_register_codec_parser(AVCodecParser *parser); yading@10: AVCodecParserContext *av_parser_init(int codec_id); yading@10: yading@10: /** yading@10: * Parse a packet. yading@10: * yading@10: * @param s parser context. yading@10: * @param avctx codec context. yading@10: * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. yading@10: * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. yading@10: * @param buf input buffer. yading@10: * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output). yading@10: * @param pts input presentation timestamp. yading@10: * @param dts input decoding timestamp. yading@10: * @param pos input byte position in stream. yading@10: * @return the number of bytes of the input bitstream used. yading@10: * yading@10: * Example: yading@10: * @code yading@10: * while(in_len){ yading@10: * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, yading@10: * in_data, in_len, yading@10: * pts, dts, pos); yading@10: * in_data += len; yading@10: * in_len -= len; yading@10: * yading@10: * if(size) yading@10: * decode_frame(data, size); yading@10: * } yading@10: * @endcode yading@10: */ yading@10: int av_parser_parse2(AVCodecParserContext *s, yading@10: AVCodecContext *avctx, yading@10: uint8_t **poutbuf, int *poutbuf_size, yading@10: const uint8_t *buf, int buf_size, yading@10: int64_t pts, int64_t dts, yading@10: int64_t pos); yading@10: yading@10: /** yading@10: * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed yading@10: * @deprecated use AVBitStreamFilter yading@10: */ yading@10: int av_parser_change(AVCodecParserContext *s, yading@10: AVCodecContext *avctx, yading@10: uint8_t **poutbuf, int *poutbuf_size, yading@10: const uint8_t *buf, int buf_size, int keyframe); yading@10: void av_parser_close(AVCodecParserContext *s); yading@10: yading@10: /** yading@10: * @} yading@10: * @} yading@10: */ yading@10: yading@10: /** yading@10: * @addtogroup lavc_encoding yading@10: * @{ yading@10: */ yading@10: yading@10: /** yading@10: * Find a registered encoder with a matching codec ID. yading@10: * yading@10: * @param id AVCodecID of the requested encoder yading@10: * @return An encoder if one was found, NULL otherwise. yading@10: */ yading@10: AVCodec *avcodec_find_encoder(enum AVCodecID id); yading@10: yading@10: /** yading@10: * Find a registered encoder with the specified name. yading@10: * yading@10: * @param name name of the requested encoder yading@10: * @return An encoder if one was found, NULL otherwise. yading@10: */ yading@10: AVCodec *avcodec_find_encoder_by_name(const char *name); yading@10: yading@10: #if FF_API_OLD_ENCODE_AUDIO yading@10: /** yading@10: * Encode an audio frame from samples into buf. yading@10: * yading@10: * @deprecated Use avcodec_encode_audio2 instead. yading@10: * yading@10: * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. yading@10: * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user yading@10: * will know how much space is needed because it depends on the value passed yading@10: * in buf_size as described below. In that case a lower value can be used. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param[out] buf the output buffer yading@10: * @param[in] buf_size the output buffer size yading@10: * @param[in] samples the input buffer containing the samples yading@10: * The number of samples read from this buffer is frame_size*channels, yading@10: * both of which are defined in avctx. yading@10: * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of yading@10: * samples read from samples is equal to: yading@10: * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id)) yading@10: * This also implies that av_get_bits_per_sample() must not return 0 for these yading@10: * codecs. yading@10: * @return On error a negative value is returned, on success zero or the number yading@10: * of bytes used to encode the data read from the input buffer. yading@10: */ yading@10: int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, yading@10: uint8_t *buf, int buf_size, yading@10: const short *samples); yading@10: #endif yading@10: yading@10: /** yading@10: * Encode a frame of audio. yading@10: * yading@10: * Takes input samples from frame and writes the next output packet, if yading@10: * available, to avpkt. The output packet does not necessarily contain data for yading@10: * the most recent frame, as encoders can delay, split, and combine input frames yading@10: * internally as needed. yading@10: * yading@10: * @param avctx codec context yading@10: * @param avpkt output AVPacket. yading@10: * The user can supply an output buffer by setting yading@10: * avpkt->data and avpkt->size prior to calling the yading@10: * function, but if the size of the user-provided data is not yading@10: * large enough, encoding will fail. If avpkt->data and yading@10: * avpkt->size are set, avpkt->destruct must also be set. All yading@10: * other AVPacket fields will be reset by the encoder using yading@10: * av_init_packet(). If avpkt->data is NULL, the encoder will yading@10: * allocate it. The encoder will set avpkt->size to the size yading@10: * of the output packet. yading@10: * yading@10: * If this function fails or produces no output, avpkt will be yading@10: * freed using av_free_packet() (i.e. avpkt->destruct will be yading@10: * called to free the user supplied buffer). yading@10: * @param[in] frame AVFrame containing the raw audio data to be encoded. yading@10: * May be NULL when flushing an encoder that has the yading@10: * CODEC_CAP_DELAY capability set. yading@10: * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame yading@10: * can have any number of samples. yading@10: * If it is not set, frame->nb_samples must be equal to yading@10: * avctx->frame_size for all frames except the last. yading@10: * The final frame may be smaller than avctx->frame_size. yading@10: * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the yading@10: * output packet is non-empty, and to 0 if it is yading@10: * empty. If the function returns an error, the yading@10: * packet can be assumed to be invalid, and the yading@10: * value of got_packet_ptr is undefined and should yading@10: * not be used. yading@10: * @return 0 on success, negative error code on failure yading@10: */ yading@10: int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, yading@10: const AVFrame *frame, int *got_packet_ptr); yading@10: yading@10: #if FF_API_OLD_ENCODE_VIDEO yading@10: /** yading@10: * @deprecated use avcodec_encode_video2() instead. yading@10: * yading@10: * Encode a video frame from pict into buf. yading@10: * The input picture should be yading@10: * stored using a specific format, namely avctx.pix_fmt. yading@10: * yading@10: * @param avctx the codec context yading@10: * @param[out] buf the output buffer for the bitstream of encoded frame yading@10: * @param[in] buf_size the size of the output buffer in bytes yading@10: * @param[in] pict the input picture to encode yading@10: * @return On error a negative value is returned, on success zero or the number yading@10: * of bytes used from the output buffer. yading@10: */ yading@10: attribute_deprecated yading@10: int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, yading@10: const AVFrame *pict); yading@10: #endif yading@10: yading@10: /** yading@10: * Encode a frame of video. yading@10: * yading@10: * Takes input raw video data from frame and writes the next output packet, if yading@10: * available, to avpkt. The output packet does not necessarily contain data for yading@10: * the most recent frame, as encoders can delay and reorder input frames yading@10: * internally as needed. yading@10: * yading@10: * @param avctx codec context yading@10: * @param avpkt output AVPacket. yading@10: * The user can supply an output buffer by setting yading@10: * avpkt->data and avpkt->size prior to calling the yading@10: * function, but if the size of the user-provided data is not yading@10: * large enough, encoding will fail. All other AVPacket fields yading@10: * will be reset by the encoder using av_init_packet(). If yading@10: * avpkt->data is NULL, the encoder will allocate it. yading@10: * The encoder will set avpkt->size to the size of the yading@10: * output packet. The returned data (if any) belongs to the yading@10: * caller, he is responsible for freeing it. yading@10: * yading@10: * If this function fails or produces no output, avpkt will be yading@10: * freed using av_free_packet() (i.e. avpkt->destruct will be yading@10: * called to free the user supplied buffer). yading@10: * @param[in] frame AVFrame containing the raw video data to be encoded. yading@10: * May be NULL when flushing an encoder that has the yading@10: * CODEC_CAP_DELAY capability set. yading@10: * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the yading@10: * output packet is non-empty, and to 0 if it is yading@10: * empty. If the function returns an error, the yading@10: * packet can be assumed to be invalid, and the yading@10: * value of got_packet_ptr is undefined and should yading@10: * not be used. yading@10: * @return 0 on success, negative error code on failure yading@10: */ yading@10: int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, yading@10: const AVFrame *frame, int *got_packet_ptr); yading@10: yading@10: int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, yading@10: const AVSubtitle *sub); yading@10: yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: #if FF_API_AVCODEC_RESAMPLE yading@10: /** yading@10: * @defgroup lavc_resample Audio resampling yading@10: * @ingroup libavc yading@10: * @deprecated use libswresample instead yading@10: * yading@10: * @{ yading@10: */ yading@10: struct ReSampleContext; yading@10: struct AVResampleContext; yading@10: yading@10: typedef struct ReSampleContext ReSampleContext; yading@10: yading@10: /** yading@10: * Initialize audio resampling context. yading@10: * yading@10: * @param output_channels number of output channels yading@10: * @param input_channels number of input channels yading@10: * @param output_rate output sample rate yading@10: * @param input_rate input sample rate yading@10: * @param sample_fmt_out requested output sample format yading@10: * @param sample_fmt_in input sample format yading@10: * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency yading@10: * @param log2_phase_count log2 of the number of entries in the polyphase filterbank yading@10: * @param linear if 1 then the used FIR filter will be linearly interpolated yading@10: between the 2 closest, if 0 the closest will be used yading@10: * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate yading@10: * @return allocated ReSampleContext, NULL if error occurred yading@10: */ yading@10: attribute_deprecated yading@10: ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, yading@10: int output_rate, int input_rate, yading@10: enum AVSampleFormat sample_fmt_out, yading@10: enum AVSampleFormat sample_fmt_in, yading@10: int filter_length, int log2_phase_count, yading@10: int linear, double cutoff); yading@10: yading@10: attribute_deprecated yading@10: int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); yading@10: yading@10: /** yading@10: * Free resample context. yading@10: * yading@10: * @param s a non-NULL pointer to a resample context previously yading@10: * created with av_audio_resample_init() yading@10: */ yading@10: attribute_deprecated yading@10: void audio_resample_close(ReSampleContext *s); yading@10: yading@10: yading@10: /** yading@10: * Initialize an audio resampler. yading@10: * Note, if either rate is not an integer then simply scale both rates up so they are. yading@10: * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq yading@10: * @param log2_phase_count log2 of the number of entries in the polyphase filterbank yading@10: * @param linear If 1 then the used FIR filter will be linearly interpolated yading@10: between the 2 closest, if 0 the closest will be used yading@10: * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate yading@10: */ yading@10: attribute_deprecated yading@10: struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); yading@10: yading@10: /** yading@10: * Resample an array of samples using a previously configured context. yading@10: * @param src an array of unconsumed samples yading@10: * @param consumed the number of samples of src which have been consumed are returned here yading@10: * @param src_size the number of unconsumed samples available yading@10: * @param dst_size the amount of space in samples available in dst yading@10: * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. yading@10: * @return the number of samples written in dst or -1 if an error occurred yading@10: */ yading@10: attribute_deprecated yading@10: int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); yading@10: yading@10: yading@10: /** yading@10: * Compensate samplerate/timestamp drift. The compensation is done by changing yading@10: * the resampler parameters, so no audible clicks or similar distortions occur yading@10: * @param compensation_distance distance in output samples over which the compensation should be performed yading@10: * @param sample_delta number of output samples which should be output less yading@10: * yading@10: * example: av_resample_compensate(c, 10, 500) yading@10: * here instead of 510 samples only 500 samples would be output yading@10: * yading@10: * note, due to rounding the actual compensation might be slightly different, yading@10: * especially if the compensation_distance is large and the in_rate used during init is small yading@10: */ yading@10: attribute_deprecated yading@10: void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); yading@10: attribute_deprecated yading@10: void av_resample_close(struct AVResampleContext *c); yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: #endif yading@10: yading@10: /** yading@10: * @addtogroup lavc_picture yading@10: * @{ yading@10: */ yading@10: yading@10: /** yading@10: * Allocate memory for a picture. Call avpicture_free() to free it. yading@10: * yading@10: * @see avpicture_fill() yading@10: * yading@10: * @param picture the picture to be filled in yading@10: * @param pix_fmt the format of the picture yading@10: * @param width the width of the picture yading@10: * @param height the height of the picture yading@10: * @return zero if successful, a negative value if not yading@10: */ yading@10: int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); yading@10: yading@10: /** yading@10: * Free a picture previously allocated by avpicture_alloc(). yading@10: * The data buffer used by the AVPicture is freed, but the AVPicture structure yading@10: * itself is not. yading@10: * yading@10: * @param picture the AVPicture to be freed yading@10: */ yading@10: void avpicture_free(AVPicture *picture); yading@10: yading@10: /** yading@10: * Fill in the AVPicture fields, always assume a linesize alignment of yading@10: * 1. yading@10: * yading@10: * @see av_image_fill_arrays() yading@10: */ yading@10: int avpicture_fill(AVPicture *picture, const uint8_t *ptr, yading@10: enum AVPixelFormat pix_fmt, int width, int height); yading@10: yading@10: /** yading@10: * Copy pixel data from an AVPicture into a buffer, always assume a yading@10: * linesize alignment of 1. yading@10: * yading@10: * @see av_image_copy_to_buffer() yading@10: */ yading@10: int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, yading@10: int width, int height, yading@10: unsigned char *dest, int dest_size); yading@10: yading@10: /** yading@10: * Calculate the size in bytes that a picture of the given width and height yading@10: * would occupy if stored in the given picture format. yading@10: * Always assume a linesize alignment of 1. yading@10: * yading@10: * @see av_image_get_buffer_size(). yading@10: */ yading@10: int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); yading@10: yading@10: #if FF_API_DEINTERLACE yading@10: /** yading@10: * deinterlace - if not supported return -1 yading@10: * yading@10: * @deprecated - use yadif (in libavfilter) instead yading@10: */ yading@10: attribute_deprecated yading@10: int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, yading@10: enum AVPixelFormat pix_fmt, int width, int height); yading@10: #endif yading@10: /** yading@10: * Copy image src to dst. Wraps av_image_copy(). yading@10: */ yading@10: void av_picture_copy(AVPicture *dst, const AVPicture *src, yading@10: enum AVPixelFormat pix_fmt, int width, int height); yading@10: yading@10: /** yading@10: * Crop image top and left side. yading@10: */ yading@10: int av_picture_crop(AVPicture *dst, const AVPicture *src, yading@10: enum AVPixelFormat pix_fmt, int top_band, int left_band); yading@10: yading@10: /** yading@10: * Pad image. yading@10: */ yading@10: int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, yading@10: int padtop, int padbottom, int padleft, int padright, int *color); yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: /** yading@10: * @defgroup lavc_misc Utility functions yading@10: * @ingroup libavc yading@10: * yading@10: * Miscellaneous utility functions related to both encoding and decoding yading@10: * (or neither). yading@10: * @{ yading@10: */ yading@10: yading@10: /** yading@10: * @defgroup lavc_misc_pixfmt Pixel formats yading@10: * yading@10: * Functions for working with pixel formats. yading@10: * @{ yading@10: */ yading@10: yading@10: /** yading@10: * Utility function to access log2_chroma_w log2_chroma_h from yading@10: * the pixel format AVPixFmtDescriptor. yading@10: * yading@10: * This function asserts that pix_fmt is valid. See av_pix_fmt_get_chroma_sub_sample yading@10: * for one that returns a failure code and continues in case of invalid yading@10: * pix_fmts. yading@10: * yading@10: * @param[in] pix_fmt the pixel format yading@10: * @param[out] h_shift store log2_chroma_w yading@10: * @param[out] v_shift store log2_chroma_h yading@10: * yading@10: * @see av_pix_fmt_get_chroma_sub_sample yading@10: */ yading@10: yading@10: void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); yading@10: yading@10: /** yading@10: * Return a value representing the fourCC code associated to the yading@10: * pixel format pix_fmt, or 0 if no associated fourCC code can be yading@10: * found. yading@10: */ yading@10: unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); yading@10: yading@10: #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ yading@10: #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ yading@10: #define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ yading@10: #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ yading@10: #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ yading@10: #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ yading@10: yading@10: /** yading@10: * Compute what kind of losses will occur when converting from one specific yading@10: * pixel format to another. yading@10: * When converting from one pixel format to another, information loss may occur. yading@10: * For example, when converting from RGB24 to GRAY, the color information will yading@10: * be lost. Similarly, other losses occur when converting from some formats to yading@10: * other formats. These losses can involve loss of chroma, but also loss of yading@10: * resolution, loss of color depth, loss due to the color space conversion, loss yading@10: * of the alpha bits or loss due to color quantization. yading@10: * avcodec_get_fix_fmt_loss() informs you about the various types of losses yading@10: * which will occur when converting from one pixel format to another. yading@10: * yading@10: * @param[in] dst_pix_fmt destination pixel format yading@10: * @param[in] src_pix_fmt source pixel format yading@10: * @param[in] has_alpha Whether the source pixel format alpha channel is used. yading@10: * @return Combination of flags informing you what kind of losses will occur yading@10: * (maximum loss for an invalid dst_pix_fmt). yading@10: */ yading@10: int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, yading@10: int has_alpha); yading@10: yading@10: /** yading@10: * Find the best pixel format to convert to given a certain source pixel yading@10: * format. When converting from one pixel format to another, information loss yading@10: * may occur. For example, when converting from RGB24 to GRAY, the color yading@10: * information will be lost. Similarly, other losses occur when converting from yading@10: * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of yading@10: * the given pixel formats should be used to suffer the least amount of loss. yading@10: * The pixel formats from which it chooses one, are determined by the yading@10: * pix_fmt_list parameter. yading@10: * yading@10: * yading@10: * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from yading@10: * @param[in] src_pix_fmt source pixel format yading@10: * @param[in] has_alpha Whether the source pixel format alpha channel is used. yading@10: * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. yading@10: * @return The best pixel format to convert to or -1 if none was found. yading@10: */ yading@10: enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(enum AVPixelFormat *pix_fmt_list, yading@10: enum AVPixelFormat src_pix_fmt, yading@10: int has_alpha, int *loss_ptr); yading@10: yading@10: /** yading@10: * Find the best pixel format to convert to given a certain source pixel yading@10: * format and a selection of two destination pixel formats. When converting from yading@10: * one pixel format to another, information loss may occur. For example, when converting yading@10: * from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when yading@10: * converting from some formats to other formats. avcodec_find_best_pix_fmt_of_2() selects which of yading@10: * the given pixel formats should be used to suffer the least amount of loss. yading@10: * yading@10: * If one of the destination formats is AV_PIX_FMT_NONE the other pixel format (if valid) will be yading@10: * returned. yading@10: * yading@10: * @code yading@10: * src_pix_fmt = AV_PIX_FMT_YUV420P; yading@10: * dst_pix_fmt1= AV_PIX_FMT_RGB24; yading@10: * dst_pix_fmt2= AV_PIX_FMT_GRAY8; yading@10: * dst_pix_fmt3= AV_PIX_FMT_RGB8; yading@10: * loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored. yading@10: * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss); yading@10: * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss); yading@10: * @endcode yading@10: * yading@10: * @param[in] dst_pix_fmt1 One of the two destination pixel formats to choose from yading@10: * @param[in] dst_pix_fmt2 The other of the two destination pixel formats to choose from yading@10: * @param[in] src_pix_fmt Source pixel format yading@10: * @param[in] has_alpha Whether the source pixel format alpha channel is used. yading@10: * @param[in, out] loss_ptr Combination of loss flags. In: selects which of the losses to ignore, i.e. yading@10: * NULL or value of zero means we care about all losses. Out: the loss yading@10: * that occurs when converting from src to selected dst pixel format. yading@10: * @return The best pixel format to convert to or -1 if none was found. yading@10: */ yading@10: enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, yading@10: enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); yading@10: yading@10: attribute_deprecated yading@10: #if AV_HAVE_INCOMPATIBLE_FORK_ABI yading@10: enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list, yading@10: enum AVPixelFormat src_pix_fmt, yading@10: int has_alpha, int *loss_ptr); yading@10: #else yading@10: enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, yading@10: enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); yading@10: #endif yading@10: yading@10: yading@10: enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: void avcodec_set_dimensions(AVCodecContext *s, int width, int height); yading@10: yading@10: /** yading@10: * Put a string representing the codec tag codec_tag in buf. yading@10: * yading@10: * @param buf_size size in bytes of buf yading@10: * @return the length of the string that would have been generated if yading@10: * enough space had been available, excluding the trailing null yading@10: */ yading@10: size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); yading@10: yading@10: void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); yading@10: yading@10: /** yading@10: * Return a name for the specified profile, if available. yading@10: * yading@10: * @param codec the codec that is searched for the given profile yading@10: * @param profile the profile value for which a name is requested yading@10: * @return A name for the profile if found, NULL otherwise. yading@10: */ yading@10: const char *av_get_profile_name(const AVCodec *codec, int profile); yading@10: yading@10: int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); yading@10: int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); yading@10: //FIXME func typedef yading@10: yading@10: /** yading@10: * Fill AVFrame audio data and linesize pointers. yading@10: * yading@10: * The buffer buf must be a preallocated buffer with a size big enough yading@10: * to contain the specified samples amount. The filled AVFrame data yading@10: * pointers will point to this buffer. yading@10: * yading@10: * AVFrame extended_data channel pointers are allocated if necessary for yading@10: * planar audio. yading@10: * yading@10: * @param frame the AVFrame yading@10: * frame->nb_samples must be set prior to calling the yading@10: * function. This function fills in frame->data, yading@10: * frame->extended_data, frame->linesize[0]. yading@10: * @param nb_channels channel count yading@10: * @param sample_fmt sample format yading@10: * @param buf buffer to use for frame data yading@10: * @param buf_size size of buffer yading@10: * @param align plane size sample alignment (0 = default) yading@10: * @return >=0 on success, negative error code on failure yading@10: * @todo return the size in bytes required to store the samples in yading@10: * case of success, at the next libavutil bump yading@10: */ yading@10: int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, yading@10: enum AVSampleFormat sample_fmt, const uint8_t *buf, yading@10: int buf_size, int align); yading@10: yading@10: /** yading@10: * Flush buffers, should be called when seeking or when switching to a different stream. yading@10: */ yading@10: void avcodec_flush_buffers(AVCodecContext *avctx); yading@10: yading@10: /** yading@10: * Return codec bits per sample. yading@10: * yading@10: * @param[in] codec_id the codec yading@10: * @return Number of bits per sample or zero if unknown for the given codec. yading@10: */ yading@10: int av_get_bits_per_sample(enum AVCodecID codec_id); yading@10: yading@10: /** yading@10: * Return the PCM codec associated with a sample format. yading@10: * @param be endianness, 0 for little, 1 for big, yading@10: * -1 (or anything else) for native yading@10: * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE yading@10: */ yading@10: enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); yading@10: yading@10: /** yading@10: * Return codec bits per sample. yading@10: * Only return non-zero if the bits per sample is exactly correct, not an yading@10: * approximation. yading@10: * yading@10: * @param[in] codec_id the codec yading@10: * @return Number of bits per sample or zero if unknown for the given codec. yading@10: */ yading@10: int av_get_exact_bits_per_sample(enum AVCodecID codec_id); yading@10: yading@10: /** yading@10: * Return audio frame duration. yading@10: * yading@10: * @param avctx codec context yading@10: * @param frame_bytes size of the frame, or 0 if unknown yading@10: * @return frame duration, in samples, if known. 0 if not able to yading@10: * determine. yading@10: */ yading@10: int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); yading@10: yading@10: yading@10: typedef struct AVBitStreamFilterContext { yading@10: void *priv_data; yading@10: struct AVBitStreamFilter *filter; yading@10: AVCodecParserContext *parser; yading@10: struct AVBitStreamFilterContext *next; yading@10: } AVBitStreamFilterContext; yading@10: yading@10: yading@10: typedef struct AVBitStreamFilter { yading@10: const char *name; yading@10: int priv_data_size; yading@10: int (*filter)(AVBitStreamFilterContext *bsfc, yading@10: AVCodecContext *avctx, const char *args, yading@10: uint8_t **poutbuf, int *poutbuf_size, yading@10: const uint8_t *buf, int buf_size, int keyframe); yading@10: void (*close)(AVBitStreamFilterContext *bsfc); yading@10: struct AVBitStreamFilter *next; yading@10: } AVBitStreamFilter; yading@10: yading@10: void av_register_bitstream_filter(AVBitStreamFilter *bsf); yading@10: AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); yading@10: int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, yading@10: AVCodecContext *avctx, const char *args, yading@10: uint8_t **poutbuf, int *poutbuf_size, yading@10: const uint8_t *buf, int buf_size, int keyframe); yading@10: void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); yading@10: yading@10: AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); yading@10: yading@10: /* memory */ yading@10: yading@10: /** yading@10: * Reallocate the given block if it is not large enough, otherwise do nothing. yading@10: * yading@10: * @see av_realloc yading@10: */ yading@10: void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); yading@10: yading@10: /** yading@10: * Allocate a buffer, reusing the given one if large enough. yading@10: * yading@10: * Contrary to av_fast_realloc the current buffer contents might not be yading@10: * preserved and on error the old buffer is freed, thus no special yading@10: * handling to avoid memleaks is necessary. yading@10: * yading@10: * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer yading@10: * @param size size of the buffer *ptr points to yading@10: * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and yading@10: * *size 0 if an error occurred. yading@10: */ yading@10: void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); yading@10: yading@10: /** yading@10: * Same behaviour av_fast_malloc but the buffer has additional yading@10: * FF_INPUT_BUFFER_PADDING_SIZE at the end which will will always be 0. yading@10: * yading@10: * In addition the whole buffer will initially and after resizes yading@10: * be 0-initialized so that no uninitialized data will ever appear. yading@10: */ yading@10: void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); yading@10: yading@10: /** yading@10: * Same behaviour av_fast_padded_malloc except that buffer will always yading@10: * be 0-initialized after call. yading@10: */ yading@10: void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); yading@10: yading@10: /** yading@10: * Encode extradata length to a buffer. Used by xiph codecs. yading@10: * yading@10: * @param s buffer to write to; must be at least (v/255+1) bytes long yading@10: * @param v size of extradata in bytes yading@10: * @return number of bytes written to the buffer. yading@10: */ yading@10: unsigned int av_xiphlacing(unsigned char *s, unsigned int v); yading@10: yading@10: #if FF_API_MISSING_SAMPLE yading@10: /** yading@10: * Log a generic warning message about a missing feature. This function is yading@10: * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) yading@10: * only, and would normally not be used by applications. yading@10: * @param[in] avc a pointer to an arbitrary struct of which the first field is yading@10: * a pointer to an AVClass struct yading@10: * @param[in] feature string containing the name of the missing feature yading@10: * @param[in] want_sample indicates if samples are wanted which exhibit this feature. yading@10: * If want_sample is non-zero, additional verbage will be added to the log yading@10: * message which tells the user how to report samples to the development yading@10: * mailing list. yading@10: * @deprecated Use avpriv_report_missing_feature() instead. yading@10: */ yading@10: attribute_deprecated yading@10: void av_log_missing_feature(void *avc, const char *feature, int want_sample); yading@10: yading@10: /** yading@10: * Log a generic warning message asking for a sample. This function is yading@10: * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) yading@10: * only, and would normally not be used by applications. yading@10: * @param[in] avc a pointer to an arbitrary struct of which the first field is yading@10: * a pointer to an AVClass struct yading@10: * @param[in] msg string containing an optional message, or NULL if no message yading@10: * @deprecated Use avpriv_request_sample() instead. yading@10: */ yading@10: attribute_deprecated yading@10: void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); yading@10: #endif /* FF_API_MISSING_SAMPLE */ yading@10: yading@10: /** yading@10: * Register the hardware accelerator hwaccel. yading@10: */ yading@10: void av_register_hwaccel(AVHWAccel *hwaccel); yading@10: yading@10: /** yading@10: * If hwaccel is NULL, returns the first registered hardware accelerator, yading@10: * if hwaccel is non-NULL, returns the next registered hardware accelerator yading@10: * after hwaccel, or NULL if hwaccel is the last one. yading@10: */ yading@10: AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); yading@10: yading@10: yading@10: /** yading@10: * Lock operation used by lockmgr yading@10: */ yading@10: enum AVLockOp { yading@10: AV_LOCK_CREATE, ///< Create a mutex yading@10: AV_LOCK_OBTAIN, ///< Lock the mutex yading@10: AV_LOCK_RELEASE, ///< Unlock the mutex yading@10: AV_LOCK_DESTROY, ///< Free mutex resources yading@10: }; yading@10: yading@10: /** yading@10: * Register a user provided lock manager supporting the operations yading@10: * specified by AVLockOp. mutex points to a (void *) where the yading@10: * lockmgr should store/get a pointer to a user allocated mutex. It's yading@10: * NULL upon AV_LOCK_CREATE and != NULL for all other ops. yading@10: * yading@10: * @param cb User defined callback. Note: FFmpeg may invoke calls to this yading@10: * callback during the call to av_lockmgr_register(). yading@10: * Thus, the application must be prepared to handle that. yading@10: * If cb is set to NULL the lockmgr will be unregistered. yading@10: * Also note that during unregistration the previously registered yading@10: * lockmgr callback may also be invoked. yading@10: */ yading@10: int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); yading@10: yading@10: /** yading@10: * Get the type of the given codec. yading@10: */ yading@10: enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); yading@10: yading@10: /** yading@10: * Get the name of a codec. yading@10: * @return a static string identifying the codec; never NULL yading@10: */ yading@10: const char *avcodec_get_name(enum AVCodecID id); yading@10: yading@10: /** yading@10: * @return a positive value if s is open (i.e. avcodec_open2() was called on it yading@10: * with no corresponding avcodec_close()), 0 otherwise. yading@10: */ yading@10: int avcodec_is_open(AVCodecContext *s); yading@10: yading@10: /** yading@10: * @return a non-zero number if codec is an encoder, zero otherwise yading@10: */ yading@10: int av_codec_is_encoder(const AVCodec *codec); yading@10: yading@10: /** yading@10: * @return a non-zero number if codec is a decoder, zero otherwise yading@10: */ yading@10: int av_codec_is_decoder(const AVCodec *codec); yading@10: yading@10: /** yading@10: * @return descriptor for given codec ID or NULL if no descriptor exists. yading@10: */ yading@10: const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); yading@10: yading@10: /** yading@10: * Iterate over all codec descriptors known to libavcodec. yading@10: * yading@10: * @param prev previous descriptor. NULL to get the first descriptor. yading@10: * yading@10: * @return next descriptor or NULL after the last descriptor yading@10: */ yading@10: const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); yading@10: yading@10: /** yading@10: * @return codec descriptor with the given name or NULL if no such descriptor yading@10: * exists. yading@10: */ yading@10: const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); yading@10: yading@10: /** yading@10: * @} yading@10: */ yading@10: yading@10: #endif /* AVCODEC_AVCODEC_H */