全部博文(2005)
分类:
2009-07-13 20:49:58
:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://kware.blogbus.com/logs/17629629.html
1. WMA 解码器调用图
Avcodec.h //
wmav1_decoder: AVCodec, wmadec.c //
wma_decode_superframe() // 解码超帧
wma_decode_frame() // 解码帧
wma_decode_block() // 解码块
av_log2() //
decode_exp_lsp() // 解码指数 lsp
get_bits() //
get_bits_trace() //
av_log() //
wma_lsp_to_curve() //
pow_m1_4() //
decode_exp_vlc() // 解码指数变长编码 vlc
get_bits() //
get_vlc() //
ff_imdct_calc() // 快速解修饰离散余弦变换计算
CMUL() //
MUL16 //
ff_fft_calc() //
main(int argc, char **argv), Apiexample.c
av_register_all(void), Allformats.c
avcodec_register_all(void), Allcodecs.c
register_avcodec(&wmav1_decoder);
2. 音视频编解码器 AVCodec 的数据结构
typedef struct AVCodec {
const char *name; // 编解码器名字:"wmav1"
enum CodecType type; // 编解码器类型:Audio, Video, Data
enum CodecID id; // 编解码器标识:CODEC_ID_WMAV1
int priv_data_size; // 私有数据尺寸:sizeof(WMADecodeContext)
int (*init)(AVCodecContext *); // 编解码器初始化例程:wma_decode_init
int (*encode)(AVCodecContext *, // 编解码器编码例程:NULL
uint8_t *buf, int buf_size, void *data);
int (*close)(AVCodecContext *); // 编解码器关闭例程:wma_decode_end
int (*decode)(AVCodecContext *, // 编解码器解码例程:wma_decode_superframe
void *outdata, int *outdata_size, uint8_t *buf, int buf_size);
int capabilities; // 缺省值 NULL
void *dummy; // FIXME remove next time we break binary compatibility
struct AVCodec *next; // 缺省值 NULL
void (*flush)(AVCodecContext *); // 缺省值 NULL
const AVRational *supported_framerates; // 支持的帧率数组, 数组以 {0, 0} 结束
const enum PixelFormat *pix_fmts; // 支持的像素格式数组, 数组以 -1 结束
} AVCodec;
AVCodec wmav1_decoder = { "wmav1",
CODEC_TYPE_AUDIO,
CODEC_ID_WMAV1,
sizeof(WMADecodeContext),
wma_decode_init,
NULL,
wma_decode_end,
wma_decode_superframe,
};
3. 编码器种类分析
enum CodecType { // Defined in Avcodec.h file
CODEC_TYPE_UNKNOWN = -1,
CODEC_TYPE_VIDEO,
CODEC_TYPE_AUDIO,
CODEC_TYPE_DATA,
};
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_H261, CODEC_ID_H263,
CODEC_ID_RV10, CODEC_ID_RV20,
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_HUFFYUV,
CODEC_ID_CYUV, CODEC_ID_H264,
CODEC_ID_INDEO3, CODEC_ID_VP3,
CODEC_ID_THEORA,
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,
CODEC_ID_FLIC, CODEC_ID_TRUEMOTION1,
CODEC_ID_VMDVIDEO, CODEC_ID_MSZH,
CODEC_ID_ZLIB, CODEC_ID_QTRLE,
CODEC_ID_SNOW, CODEC_ID_TSCC,
CODEC_ID_ULTI, CODEC_ID_QDRAW,
CODEC_ID_VIXL, CODEC_ID_QPEG,
CODEC_ID_XVID, CODEC_ID_PNG,
CODEC_ID_PPM, CODEC_ID_PBM,
CODEC_ID_PGM, CODEC_ID_PGMYUV,
CODEC_ID_PAM, CODEC_ID_FFVHUFF,
CODEC_ID_RV30, CODEC_ID_RV40,
CODEC_ID_VC9, CODEC_ID_WMV3,
CODEC_ID_LOCO, CODEC_ID_WNV1,
CODEC_ID_AASC,
/* various pcm "codecs" */
CODEC_ID_PCM_S16LE= 0x10000, 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= 0x11000,
CODEC_ID_ADPCM_IMA_WAV,
CODEC_ID_ADPCM_IMA_DK3, CODEC_ID_ADPCM_IMA_DK4,
CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_IMA_SMJPEG,
CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_4XM,
CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_ADX,
CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_G726,
CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_SWF,
/* AMR */
CODEC_ID_AMR_NB= 0x12000, CODEC_ID_AMR_WB,
/* RealAudio codecs*/
CODEC_ID_RA_144= 0x13000, CODEC_ID_RA_288,
/* various DPCM codecs */
CODEC_ID_ROQ_DPCM= 0x14000,
CODEC_ID_INTERPLAY_DPCM,
CODEC_ID_XAN_DPCM, CODEC_ID_SOL_DPCM,
CODEC_ID_MP2= 0x15000,
CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */
CODEC_ID_AAC, CODEC_ID_MPEG4AAC,
CODEC_ID_AC3, CODEC_ID_DTS,
CODEC_ID_VORBIS, CODEC_ID_DVAUDIO,
CODEC_ID_WMAV1, CODEC_ID_WMAV2,
CODEC_ID_MACE3, CODEC_ID_MACE6,
CODEC_ID_VMDAUDIO, CODEC_ID_SONIC,
CODEC_ID_SONIC_LS, CODEC_ID_FLAC,
CODEC_ID_MP3ADU, CODEC_ID_MP3ON4,
CODEC_ID_SHORTEN, CODEC_ID_ALAC,
CODEC_ID_WESTWOOD_SND1,
CODEC_ID_OGGTHEORA= 0x16000,
CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG2 transport stream (only
used by libavformat) */
};
#define CODEC_ID_MP3LAME CODEC_ID_MP3 /* CODEC_ID_MP3LAME is absolete */