📄 avcodec.h
字号:
/************************************************************************ Copyright (C) 2000-2005 Trolltech AS and its licensors.** All rights reserved.**** This file is part of the Qtopia Environment.**** This file may be distributed and/or modified under the terms of the** GNU General Public License version 2 as published by the Free Software** Foundation and appearing in the file LICENSE.GPL included in the** packaging of this file.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.**** See http://www.trolltech.com/gpl/ for GPL licensing information.** See below for additional copyright and license information**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#ifndef AVCODEC_H#define AVCODEC_H/** * @file avcodec.h * external api header. */#ifdef __cplusplusextern "C" {#endif#include "common.h"#include "rational.h"#define FFMPEG_VERSION_INT 0x000408#define FFMPEG_VERSION "0.4.8"#define LIBAVCODEC_BUILD 4691#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT#define LIBAVCODEC_VERSION FFMPEG_VERSION#define AV_STRINGIFY(s) AV_TOSTRING(s)#define AV_TOSTRING(s) #s#define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)enum CodecID { CODEC_ID_NONE, CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */ CODEC_ID_MPEG2VIDEO_XVMC, CODEC_ID_H263, CODEC_ID_RV10, CODEC_ID_MP2, CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */ CODEC_ID_VORBIS, CODEC_ID_AC3, CODEC_ID_MJPEG, CODEC_ID_MJPEGB, CODEC_ID_LJPEG, CODEC_ID_SP5X, CODEC_ID_MPEG4, CODEC_ID_RAWVIDEO, CODEC_ID_MSMPEG4V1, CODEC_ID_MSMPEG4V2, CODEC_ID_MSMPEG4V3, CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_H263P, CODEC_ID_H263I, CODEC_ID_FLV1, CODEC_ID_SVQ1, CODEC_ID_SVQ3, CODEC_ID_DVVIDEO, CODEC_ID_DVAUDIO, CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MACE3, CODEC_ID_MACE6, CODEC_ID_HUFFYUV, CODEC_ID_CYUV, CODEC_ID_H264, CODEC_ID_INDEO3, CODEC_ID_VP3, CODEC_ID_THEORA, CODEC_ID_AAC, CODEC_ID_MPEG4AAC, CODEC_ID_ASV1, CODEC_ID_ASV2, CODEC_ID_FFV1, CODEC_ID_4XM, CODEC_ID_VCR1, CODEC_ID_CLJR, CODEC_ID_MDEC, CODEC_ID_ROQ, CODEC_ID_INTERPLAY_VIDEO, CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, CODEC_ID_RPZA, CODEC_ID_CINEPAK, CODEC_ID_WS_VQA, CODEC_ID_MSRLE, CODEC_ID_MSVIDEO1, CODEC_ID_IDCIN, CODEC_ID_8BPS, CODEC_ID_SMC, /* various pcm "codecs" */ CODEC_ID_PCM_S16LE, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_U16LE, CODEC_ID_PCM_U16BE, CODEC_ID_PCM_S8, CODEC_ID_PCM_U8, CODEC_ID_PCM_MULAW, CODEC_ID_PCM_ALAW, /* various adpcm codecs */ CODEC_ID_ADPCM_IMA_QT, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_DK3, CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX, /* AMR */ CODEC_ID_AMR_NB, CODEC_ID_AMR_WB, /* RealAudio codecs*/ CODEC_ID_RA_144, CODEC_ID_RA_288, /* various DPCM codecs */ CODEC_ID_ROQ_DPCM, CODEC_ID_INTERPLAY_DPCM, CODEC_ID_XAN_DPCM, CODEC_ID_MPEG2TS, /* _FAKE_ codec to indicate a raw MPEG2 transport stream (only used by libavformat) */};/* CODEC_ID_MP3LAME is absolete */#define CODEC_ID_MP3LAME CODEC_ID_MP3enum CodecType { CODEC_TYPE_UNKNOWN = -1, CODEC_TYPE_VIDEO, CODEC_TYPE_AUDIO, CODEC_TYPE_DATA,};/** * Pixel format. Notes: * * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA * color is put together as: * (A << 24) | (R << 16) | (G << 8) | B * This is stored as BGRA on little endian CPU architectures and ARGB on * big endian CPUs. * * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized * image data is stored in AVFrame.data[0]. The palette is transported in * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is * also endian-specific). Note also that the individual RGB palette * components stored in AVFrame.data[1] should be in the range 0..255. * This is important as many custom PAL8 video codecs that were designed * to run on the IBM VGA graphics adapter use 6-bit palette components. */enum PixelFormat { PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) PIX_FMT_YUV422, PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB... PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR... PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples) PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples) PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples) PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples) PIX_FMT_RGB565, ///< always stored in cpu endianness PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1 PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, ///< 0 is white PIX_FMT_MONOBLACK, ///< 0 is black PIX_FMT_PAL8, ///< 8 bit with RGBA palette PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg) PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg) PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg) PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_NB,};/* currently unused, may be used if 24/32 bits samples ever supported */enum SampleFormat { SAMPLE_FMT_S16 = 0, ///< signed 16 bits };/* in bytes */#define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072/** * Required number of additionally allocated bytes at the end of the input bitstream for decoding. * this is mainly needed because some optimized bitstream readers read * 32 or 64 bit at once and could read over the end<br> * Note, if the first 23 bits of the additional bytes are not 0 then damaged * MPEG bitstreams could cause overread and segfault */#define FF_INPUT_BUFFER_PADDING_SIZE 8/* motion estimation type, EPZS by default */enum Motion_Est_ID { ME_ZERO = 1, ME_FULL, ME_LOG, ME_PHODS, ME_EPZS, ME_X1};typedef struct RcOverride{ int start_frame; int end_frame; int qscale; // if this is 0 then quality_factor will be used instead float quality_factor;} RcOverride;/* only for ME compatiblity with old apps */extern int motion_estimation_method;/* ME algos sorted by quality *///FIXME remove IMHOstatic const __attribute__((unused)) int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG, ME_X1, ME_EPZS, ME_FULL };#define FF_MAX_B_FRAMES 8/* encoding support these flags can be passed in AVCodecContext.flags before initing Note: note not everything is supported yet */#define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC #define CODEC_FLAG_GMC 0x0020 ///< use GMC #define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0> #define CODEC_FLAG_PART 0x0080 ///< use data partitioning /* parent program gurantees that the input for b-frame containing streams is not written to for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */#define CODEC_FLAG_INPUT_PRESERVED 0x0100#define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg) #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale #define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead of only at frame boundaries */#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay#define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct) /* Fx : Flag for h263+ extra options */#define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this)#define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction#define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector #define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp/* For advanced prediction mode, we reuse the 4MV flag *//* Unsupported options : * Syntax Arithmetic coding (SAC) * Deblocking filter internal loop * Slice structured * Reference Picture Selection * Independant Segment Decoding * Alternative Inter * VLC * Modified Quantization *//* /Fx *//* codec capabilities */#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback /** * Codec uses get_buffer() for allocating buffers. * direct rendering method 1 */#define CODEC_CAP_DR1 0x0002/* if 'parse_only' field is true, then avcodec_parse_frame() can be used */#define CODEC_CAP_PARSE_ONLY 0x0004#define CODEC_CAP_TRUNCATED 0x0008/* * Codec can use conditional replenishment if available. */#define CODEC_CAP_CR 0x0010/** * Pan Scan area. * this specifies the area which should be displayed. Note there may be multiple such areas for one frame */typedef struct AVPanScan{ /** * id. * - encoding: set by user. * - decoding: set by lavc */ int id; /** * width and height in 1/16 pel * - encoding: set by user. * - decoding: set by lavc */ int width; int height; /** * position of the top left corner in 1/16 pel for up to 3 fields/frames. * - encoding: set by user. * - decoding: set by lavc */ int16_t position[3][2];}AVPanScan;#define FF_COMMON_FRAME \ /**\ * pointer to the picture planes.\ * this might be different from the first allocated byte\ * - encoding: \ * - decoding: \ */\ uint8_t *data[4];\ int linesize[4];\ /**\ * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\ * this isnt used by lavc unless the default get/release_buffer() is used\ * - encoding: \ * - decoding: \ */\ uint8_t *base[4];\ /**\ * 1 -> keyframe, 0-> not\ * - encoding: set by lavc\ * - decoding: set by lavc\ */\ int key_frame;\\ /**\ * picture type of the frame, see ?_TYPE below.\ * - encoding: set by lavc for coded_picture (and set by user for input)\ * - decoding: set by lavc\ */\ int pict_type;\\ /**\ * presentation timestamp in micro seconds (time when frame should be shown to user)\ * if 0 then the frame_rate will be used as reference\ * - encoding: MUST be set by user\ * - decoding: set by lavc\ */\ int64_t pts;\\ /**\ * picture number in bitstream order.\ * - encoding: set by\ * - decoding: set by lavc\ */\ int coded_picture_number;\ /**\ * picture number in display order.\ * - encoding: set by\ * - decoding: set by lavc\ */\ int display_picture_number;\\ /**\ * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \ * - encoding: set by lavc for coded_picture (and set by user for input)\ * - decoding: set by lavc\ */\ int quality; \\ /**\ * buffer age (1->was last buffer and dint change, 2->..., ...).\ * set to INT_MAX if the buffer has not been used yet \ * - encoding: unused\ * - decoding: MUST be set by get_buffer()\ */\ int age;\\ /**\ * is this picture used as reference\ * - encoding: unused\ * - decoding: set by lavc (before get_buffer() call))\ */\ int reference;\\ /**\ * QP table\ * - encoding: unused\ * - decoding: set by lavc\ */\ int8_t *qscale_table;\ /**\ * QP store stride\ * - encoding: unused\ * - decoding: set by lavc\ */\ int qstride;\\ /**\ * mbskip_table[mb]>=1 if MB didnt change\ * stride= mb_width = (width+15)>>4\ * - encoding: unused\ * - decoding: set by lavc\ */\ uint8_t *mbskip_table;\\ /**\ * for some private data of the user\ * - encoding: unused\ * - decoding: set by user\ */\ void *opaque;\\ /**\ * error\ * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\ * - decoding: unused\ */\ uint64_t error[4];\\ /**\ * type of the buffer (to keep track of who has to dealloc data[*])\ * - encoding: set by the one who allocs it\ * - decoding: set by the one who allocs it\ * Note: user allocated (direct rendering) & internal buffers can not coexist currently\ */\ int type;\ \ /**\ * when decoding, this signal how much the picture must be delayed.\ * extra_delay = repeat_pict / (2*fps)\ * - encoding: unused\ * - decoding: set by lavc\ */\ int repeat_pict;\ \ /**\ * \ */\ int qscale_type;\ \ /**\ * The content of the picture is interlaced.\ * - encoding: set by user\ * - decoding: set by lavc (default 0)\ */\ int interlaced_frame;\ \ /**\ * if the content is interlaced, is top field displayed first.\ * - encoding: set by user\ * - decoding: set by lavc\ */\ int top_field_first;\ \ /**\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -