SfxStreamHandlerInterface.h 2.1 KB
#ifndef __SFX__SfxStreamHandlerInterface__MODULE__
#define __SFX__SfxStreamHandlerInterface__MODULE__
#include "SfxMediaStd.h"

#ifdef __cplusplus
extern "C"
{
#endif

#ifdef SFX_WIN
#ifdef SFX_EXPORT_SHARE_LIB
#define SFX_EXPORT_LIB __declspec(dllexport)
#else
#define SFX_EXPORT_LIB __declspec(dllimport)
#endif
#endif

#ifdef SFX_LINUX
#define SFX_EXPORT_LIB
#endif

#pragma pack(1)
typedef struct SfxStreamHandlerFlags
{
	sfx_u32 outFrameIndex:1;
	sfx_u32 preposeFrameCount:1;
	sfx_u32 useFastDecode:1;
	sfx_u32 skipFrame:6;
	sfx_u32 accelId:5;
	sfx_u32 frameNumber:1;
	sfx_u32 reserved:17;
	sfx_u8 fmt;                             // SfxVideoFormat
	sfx_u8 reserved1[63];
}SfxStreamHandlerFlags;

typedef struct SfxStreamHandlerConfig
{
	SfxLogHandler log;
	const sfx_void * userPtr;
	SfxElementaryStreamCallback escb; 
	SfxStreamHandlerFlags flags;
}SfxStreamHandlerConfig;

typedef struct SfxStreamHandlerStatistics
{
	sfx_u32 frameNumber;
	sfx_u32 frameCache;
	sfx_u8 reserved[504];
}SfxStreamHandlerStatistics;
#pragma pack()

#define SFX_STREAM_HANDLER_CONFIG_INTERFACE   1
class SfxStreamHandlerConfigInterface
{
public:
	SfxStreamHandlerConfigInterface(){};
	virtual ~SfxStreamHandlerConfigInterface(){};

	virtual sfx_void SfxSetupCachePath( const sfx_8 * path ) = 0;
	virtual sfx_u32 SfxGetFrameNumber() = 0;
};


class SFX_EXPORT_LIB SfxStreamHandlerInterface
{
public:
	SfxStreamHandlerInterface();
	virtual ~SfxStreamHandlerInterface();
	static sfx_32 SfxInitialize( sfx_u32 maxChannel );
	static sfx_void SfxUninitialize();
	static SfxStreamHandlerInterface * SfxGetInstance( const SfxStreamHandlerConfig * cfg );
	static sfx_void SfxReleaseInstance( SfxStreamHandlerInterface * ins );
	static sfx_bool SfxCheckCompatible( const sfx_8 * uri );
	virtual sfx_32 SfxOpenStreamHandler( const sfx_8 * uri ) = 0;
	virtual sfx_void SfxCloseStreamHandler() = 0;
	virtual sfx_void SfxGetStatistics( SfxStreamHandlerStatistics * statistics ) = 0;
	virtual sfx_32 SfxQueryInterface( sfx_u32 fid, sfx_void ** ptr ) = 0;
};

#ifdef __cplusplus
}
#endif

#endif