codectypes.h
资源名称:111.rar [点击查看]
上传用户:mony888
上传日期:2022-07-26
资源大小:1247k
文件大小:7k
源码类别:
Windows CE
开发平台:
Visual C++
- /*************************************************************************/
- /* */
- /* Copyright (c) 2000-2004 Linuos Design */
- /* 领驰设计中心 版权所有 2000-2004 */
- /* */
- /* PROPRIETARY RIGHTS of Linuos Design are involved in the subject */
- /* matter of this material. All manufacturing, reproduction, use, and */
- /* sales rights pertaining to this subject matter are governed by the */
- /* license agreement. The recipient of this software implicitly accepts */
- /* the terms of the license. */
- /* 本软件文档资料是领驰设计中心的资产,任何人士阅读和使用本资料必须获得 */
- /* 相应的书面授权,承担保密责任和接受相应的法律约束. */
- /* */
- /*************************************************************************/
- /*************************************************************************
- CODECTYPES.h
- Author gaowei
- date 2004.12.7
- Note:
- History:
- *************************************************************************/
- #ifndef _CODECTYPES_H_
- #define _CODECTYPES_H_
- 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
- };
- enum CodecType {
- CODEC_TYPE_UNKNOWN = -1,
- CODEC_TYPE_VIDEO,
- CODEC_TYPE_AUDIO,
- CODEC_TYPE_DATA
- };
- /*************************************************************************
- 以下是通用便解码器模型,与播放器接口。
- *************************************************************************/
- typedef struct CodecContext{
- DWORD magic_code; //例如 "AAC!" -> ('!'<<24) + ('C'<<16) + ('A'<<8) + 'A').
- //由编解码器自己填写,进行参数合法性判断
- void *priv_data; //一般用来存放编解码器句柄
- /********************* common part*********************************/
- enum CodecType codec_type; /* i.e CODEC_TYPE_AUDIO */
- INT32 codec_id; /* i.e CODEC_ID_AAC */
- void *extradata; //mpeg4: global headers (they can be in the bitstream or here)
- INT32 extradata_size; //size of extradata
- INT32 bit_rate; //the average bitrate.
- INT32 dts; //decompression time stamp in AV_TIME_BASE units (or
- //pts_den units in muxers or demuxers)
- INT32 pts; //presentation time stamp in AV_TIME_BASE units (or
- //pts_den units in muxers or demuxers)
- INT32 duration; //presentation duration (0 if not available)
- INT32 totle_frame_count;
- INT32 time_base_den; //for rescale
- INT32 time_base_num; //for rescale
- INT32 frame_index;
- //UInt8* outbuf;
- //INT32 one_frame_size;
- /********************* audio only *********************************/
- INT32 bits_per_sample;
- INT32 sample_rate; //采样率
- INT32 channels; //通道
- INT32 sample_fmt; //采样格式
- /********************* video only *********************************/
- //Frame rate
- INT32 frame_rate; //frames per sec multiplied by frame_rate_base.
- INT32 frame_rate_base; //(frame_rate_f) = frame_rate * 1.0 / frame_rate_base
- INT32 width, height; //width / height.
- INT32 csp; // color space, output format
- void* dec_stats;
- /********************* encode only *********************************/
- INT32 rate_emu; //编码使用 Frame rate emulation.
- INT32 delay;
- INT32 qmin; // maximum quantizer. 通过控制量化来控制码率!
- INT32 qmax; // minimum quantizer.
- INT32 max_qdiff; // maximum quantizer difference etween frames.
- INT32 max_b_frames; // maximum number of b frames between non b frames.
- // note: the output will be delayed by max_b_frames+1 relative to the input
- INT32 frame_bits; // number of bits used for the previously encoded frame.
- INT32 luma_elim_threshold; //luma single coeff elimination threshold.
- INT32 chroma_elim_threshold; //chroma single coeff elimination threshold.
- INT32 has_b_frames;
- INT32 mpeg_quant;
- float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
- float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
- float b_quant_factor; // qscale factor between ip and b frames.
- float b_quant_offset; //qscale offset between ip and b frames.
- }CodecContext;
- /*************************************************************************
- 通用解码器接口函数集
- *************************************************************************/
- typedef struct CodecInterfaceType {
- CHAR* name;
- enum CodecType codec_type; /* i.e CODEC_TYPE_AUDIO */
- INT32 codec_id; /* i.e CODEC_ID_AAC */
- INT32 priv_data_size;
- /********************* 必须实现部分 *********************************/
- INT32 (*init) (CodecContext *Data);
- INT32 (*close) (CodecContext *Data);
- /********************* 可选实现部分 *********************************/
- INT32 (*decode)(CodecContext *pData, void *pDecData, INT32 *pcbDecDataSize,
- UINT8 *pInbuf, INT32* pcbInbufSize, INT32 skip);
- INT32 (*encode)(CodecContext *pData, void **ppEncdata, INT32 *pcbEncDataSize,
- UINT8 *pInbuf, INT32* pcbInbufSize);
- void (*flush)(CodecContext *Data);
- struct CodecInterfaceType *next;
- } CodecInterfaceType;
- #endif //_CODECTYPES_H_