⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codec.h

📁 播放被H264_AAC所压缩的avi文件的播放器。
💻 H
字号:
/*
 * H.264/AVC Streaming Server(HSS), ver 1.0
 * Copyright (c) KCC-Eoun Information Center										
 *																				
 * File: codec.h															
 * Description: Export function for H.264.
 *
 * The Initial Writer of Original Code is Yong Su.Han
 *
 * $Log: codec.h, v $
 * Revision 1.0 2006-8-20 Yong Su.Han
 * Initial version
*/

#ifndef _H264CODEC_H_
#define _H264CODEC_H_

#ifdef CODEC_EXPORTS
#define CODEC_API __declspec(dllexport)
#else
#define CODEC_API __declspec(dllimport)
#endif

/************************************************************************/
/* Defines                                                              */
/************************************************************************/
/* frame transmission mode for communication.
*/
#define DECODE_FLAG_COMPLETE		0x00000000 //we send complete frame
#define DECODE_FLAG_TRUNCATED		0x00010000	// input bitstream might be truncated at a random location

/* frame type
*/
#define CODEC_TYPE_IVOP     1 /* intra frame */
#define CODEC_TYPE_PVOP     2 /* predicted frame */
#define CODEC_TYPE_BVOP     3 /* bidirectionally encoded */
#define CODEC_TYPE_SVOP     4 /* predicted+sprite frame */

#define CODEC_CSP_PLANAR   (1<< 0) /* 4:2:0 planar (==I420, except for pointers/strides) */
#define CODEC_CSP_USER	  CODEC_CSP_PLANAR
#define CODEC_CSP_I420     (1<< 1) /* 4:2:0 planar */
#define CODEC_CSP_YV12     (1<< 2) /* 4:2:0 planar */
#define CODEC_CSP_YUY2     (1<< 3) /* 4:2:2 packed */
#define CODEC_CSP_UYVY     (1<< 4) /* 4:2:2 packed */
#define CODEC_CSP_YVYU     (1<< 5) /* 4:2:2 packed */
#define CODEC_CSP_BGRA     (1<< 6) /* 32-bit bgra packed */
#define CODEC_CSP_ABGR     (1<< 7) /* 32-bit abgr packed */
#define CODEC_CSP_RGBA     (1<< 8) /* 32-bit rgba packed */
#define CODEC_CSP_ARGB     (1<<15) /* 32-bit argb packed */
#define CODEC_CSP_BGR      (1<< 9) /* 24-bit bgr packed */
#define CODEC_CSP_RGB555   (1<<10) /* 16-bit rgb555 packed */
#define CODEC_CSP_RGB565   (1<<11) /* 16-bit rgb565 packed */
#define CODEC_CSP_SLICE    (1<<12) /* decoder only: 4:2:0 planar, per slice rendering */
#define CODEC_CSP_INTERNAL (1<<13) /* decoder only: 4:2:0 planar, returns ptrs to internal buffers */
#define CODEC_CSP_NULL     (1<<14) /* decoder only: dont output anything */
#define CODEC_CSP_VFLIP    (1<<31) /* vertical flip mask */

#define NOTHING_TYPE	0// Nothing
#define I_TYPE			1// Intra
#define P_TYPE			2// Predicted
#define B_TYPE			3// Bi-dir predicted
#define S_TYPE			4// S(GMC)-VOP MPEG4
#define SI_TYPE			5// Switching Intra
#define SP_TYPE			6// Switching Predicted

/* log level
*/
#define CODEC_LOG_NONE		0
#define CODEC_LOG_CRITICAL	1
#define CODEC_LOG_PROCESSING	2
#define CODEC_LOG_DETAIL		3

/* profile type
*/
#define	   PROFILE_BASELINE		66
#define    PROFILE_MAIN			77
#define    PROFILE_EXTENTED		88
#define    PROFILE_HIGH			100
#define    PROFILE_HIGH10		110
#define    PROFILE_HIGH422		122
#define    PROFILE_HIGH444		144

/************************************************************************/
/* Typedef                                                              */
/************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif

/* decoded data
*/
//##ModelId=4753B7EA0399
typedef struct
{
	unsigned char	*data[4];
    int				linesize[4];
	int				width;
	int				height;
	int				frame_num;
	int				poc;
    int				pict_type;
	unsigned int	pts;
}DEC_YUV;

/* decoding option
*/
//##ModelId=4753B7EA03A9
typedef struct
{
	unsigned char	*data;
	int				width;
	int				height;
	int				frame_num;
	int				poc;
	int				pict_type;
	unsigned int	pts;
}DEC_CSP;

/* H264 Decoder defines
*/
//##ModelId=4753B7EA03AB
typedef struct H264_DECPARAM
{
	unsigned char	nLogLevel;
	char			szLogFileName[256];
	int				flags;
}H264_DECPARAM;

/************************************************************************/
/* Export function.                                                     */
/************************************************************************/
/* Image stretch functions
*/
int  H264_StretchBlt_Init(int nNewWidth, int nNewHeight, int nSrcWidth, int nSrcHeight);
int  H264_StretchBltintoYUV(DEC_YUV *lpDstYUV, DEC_YUV *lpSrcYUV, int nNewWidth, int nNewHeight);
void H264_StretchBlt_Close();

int H264_DEC_AllocVideo(H264_DECPARAM *lpParam, int nReserved);
int H264_DEC_DecodeToRGB(int nVidIDX, DEC_CSP *lpCSP, unsigned char *lpEncoded, int *nEncLen, 
										int *pnBpp, int nVFlip);
int H264_DEC_DecodeToYUV(int nVidIDX, DEC_YUV *lpYuv, unsigned char *lpEncoded, int *nEncLen);
int H264_DEC_FreeVideo(int nVidIDX, int nReserved);
int H264_DEC_GetErrorDescription(int nVidIDX, char* lpszBuffer, int nBufSize, int nErrorCode);
int H264_DEC_ChangeParam(int nVidIDX, H264_DECPARAM *ParamNew, int nReserved);
int H264_DEC_DecodeToCSP(int nVidIDX, DEC_CSP *lpCSP, unsigned char *lpEncoded, int *nEncLen,
										int stride, int CSP, int nVFlip);

#ifdef __cplusplus
}
#endif

//
#endif //#ifndef _H264CODEC_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -