SfxDecoder.h 1.83 KB
#ifndef __SFX__SfxDecoder__MODULE__
#define __SFX__SfxDecoder__MODULE__
#include "SfxDecoder/SfxStreamHandlerInterface.h"
#include "DxDecoderInterface.h"


class SfxDecoder: public DxDecoderInterface
{
public:
	SfxDecoder( const DxDecoderConfig * cfg );
	virtual ~SfxDecoder();

	/**************************************************
	* 接口:OpenDecoder
	* 功能:打开一个解码器,开始解码
	* 参数:const char * uri 解码器数据源,以rtsp://为前
	*         缀指定为RTSP流,以gb28181://为前缀指定为国
	*         标流,其余则为文件流。
	* 返回:成功返回 0, 失败返回 < 0
	* 备注:RTSP流或国标流(历史流/实时流)都属于实时流
	*       本接口属于异步接口
	**************************************************/
	virtual int OpenDecoder( const char * uri );


	/**************************************************
	* 接口:CloseDecoder
	* 功能:关闭一个解码器,停止解码
	* 参数:无
	* 返回:成功返回 0, 失败返回 < 0
	* 备注:本接口内部会阻塞直到解码器正常关闭后退出
	**************************************************/
	virtual int CloseDecoder();

	virtual int GetFrameCount();

private:
	static sfx_32 sfx_stdcall SfxStreamCallback( 
												const sfx_void * userPtr,
												SfxFrameType type,
												const sfx_u8 * buf, 
												sfx_u32 segLen, 
												sfx_u32 len, 
												sfx_u32 timestamp 
												);
	
	static sfx_32 sfx_stdcall SfxLogDefaultHandler(
												   const sfx_void * userPtr,
												   SfxLogLevel level,
												   const sfx_8 * log,
												   sfx_u32 logLen
												   );

private:
	SfxStreamHandlerInterface * m_handler;
	DxVideoConfig m_video;
	DxDecoderConfig m_cfg;
	sfx_bool m_bRun;
};


#endif