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

📄 hbplaysdk.h

📁 用vc写的一个插件例子
💻 H
字号:
#ifndef	_HBPLAYSDK_H_
#define	_HBPLAYSDK_H_

#include "HBxCommon.h"
//#include "windef.h"
//#include "Multimon.H"

#define  HBAPI	extern"C"

/* *****************************************************************
   SDK功能描述:

   1. 文件播放功能
	  a) 支持文件播放、暂停、快速播放、慢速播放、单帧进退功能.
	  b) 支持文件信息获取、快速定位、码流信息获取
	  c) 支持回调/文件抓帧、支持解码时回调、支持索引回调
	  d) 支持overlay、非overlay模式显示(多窗口显示),支持局部放大功能
	  e) 支持音频播放,音量调节.
	  f) 支持文件剪切,支持文件合并.	  
	  g) 支持动态帧率,动态尺寸播放.

      如何支持任意文件的拼接回放?
	  a) 在建立索引的时刻,校验文件的有效性.

   2. 流播放功能
	  a) 支持实时流解码,文件流解码,支持播放速率调节.	
	  b) 支持支持回调/文件抓帧、支持解码时回调.
	  c) 支持支持overlay、非overlay模式显示(多窗口显示),支持局部放大功能
	  d) 支持音频播放,音量调节.
	  e) 支持动态帧率,动态尺寸播放.

 *******************************************************************/

HBAPI	BOOL	__stdcall	HB_PLAY_InitDDraw(HWND hWnd);

HBAPI	BOOL	__stdcall	HB_PLAY_RealeseDDraw();

HBAPI	BOOL	__stdcall	HB_PLAY_OpenFile(long nChl, char *sFile);

HBAPI	BOOL	__stdcall	HB_PLAY_CloseFile(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_Play(long nChl, HWND hWnd=NULL);

HBAPI	BOOL	__stdcall	HB_PLAY_Pause(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_Stop(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_Fast(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_Slow(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_PlayBySingleFrame(long nChl);
HBAPI	BOOL	__stdcall	HB_PLAY_OneByOne(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_PlayBySingleFrameBack(long nChl);
HBAPI	BOOL	__stdcall	HB_PLAY_OneByOneBack(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetFileTime(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetFileFrames(long nChl);
HBAPI	DWORD	__stdcall	HB_PLAY_GetFileTotalFrames(long nChl);

HBAPI	long	__stdcall	HB_PLAY_GetPlayedFrames(long nChl);
HBAPI	long	__stdcall	HB_PLAY_GetPlayedFrameNum(long nChl);

HBAPI	long	__stdcall	HB_PLAY_GetCurrFrameNum(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_SetPlayedTime(long nChl, DWORD dwTime);

HBAPI	BOOL	__stdcall	HB_PLAY_SetPlayPos(long nChl, float dPos);

HBAPI	float	__stdcall	HB_PLAY_GetPlayPos(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_SetFileEndMsg(long nChl, HWND hWnd, UINT nMsg);

HBAPI	BOOL	__stdcall	HB_PLAY_OpenSound(long nChl);
HBAPI	BOOL	__stdcall	HB_PLAY_PlaySound(long nChl);
HBAPI	BOOL	__stdcall	HB_PLAY_CloseSound(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_RefreshPlay(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_GetPictureSize(long nChl, long *pWidth, long *pHeight);

HBAPI  BOOL		__stdcall	HB_PLAY_SetDisplayCallBack(long nChl, void (CALLBACK *DisplayCBFun)(long nChl,  char *pBuf, long nSize, long nWidth, long hHeight, long nStamp, long nType, long nReserved));

HBAPI	BOOL	__stdcall	HB_PLAY_ConvertToBMPFile(long nChl, char *pBuf, long nSize, long nWidth, long nHeight, long nType,  char *sFileName);

HBAPI  BOOL		__stdcall	HB_PLAY_SetDecCallBack(long nChl, void (CALLBACK* DecCBFun)(long nPort, char * pBuf, long nSize, FRAME_INFO * pFrameInfo, long nReserved1, long nReserved2),long nOutFormat=0);

HBAPI	BOOL	__stdcall	HB_PLAY_SetPicQuality(long nChl, BOOL bHighQuality);

HBAPI	BOOL	__stdcall	HB_PLAY_GetPicQuality(long nChl, BOOL *bHighQuality);

HBAPI	BOOL	__stdcall	HB_PLAY_SetVolume(long nChl, WORD nVolume);

HBAPI	WORD	__stdcall	HB_PLAY_GetVolume(long nChl);
	
HBAPI	BOOL	__stdcall	HB_PLAY_SetOverlayMode(long nChl, BOOL bOverlayMode, COLORREF colorKey);

HBAPI	DWORD	__stdcall	HB_PLAY_GetColorKey(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_GetOverlayMode(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_SetPlayTime(long nChl, DWORD dwTime);
	
HBAPI	DWORD	__stdcall	HB_PLAY_GetPlayTime(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetCurrFrameRate(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetFileHeadLength(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetCurrentFrameNum(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_SetCurrentFrameNum(long nChl, DWORD dwFrameNum);

HBAPI	BOOL	__stdcall	HB_PLAY_GetKeyFramePos(long nChl, DWORD nValue, DWORD nType, PFRAME_POS pFramePos);

HBAPI	BOOL	__stdcall	HB_PLAY_GetPriorKeyFramePos(long nChl, DWORD nValue, DWORD nType, PFRAME_POS pFramePos);

HBAPI	BOOL	__stdcall	HB_PLAY_GetNextKeyFramePos(long nChl, DWORD nValue, DWORD nType, PFRAME_POS pFramePos);

HBAPI	BOOL	__stdcall	HB_PLAY_SetDisplayRegion(long nChl, DWORD nRegionNum, RECT *pSrcRect, HWND hDestWnd, BOOL bEnable);

HBAPI	BOOL	__stdcall	HB_PLAY_OpenStream(long nChl, char *pFileHeadBuf, DWORD nSize, DWORD nBufPoolSize);

HBAPI	BOOL	__stdcall	HB_PLAY_SetStreamOpenMode(long nChl, DWORD nMode);

HBAPI	BOOL	__stdcall	HB_PLAY_InputData(long nChl, char *pBuf, DWORD nSize, DWORD nDataType=0);

HBAPI	BOOL	__stdcall	HB_PLAY_InputVideoData(long nChl,char * pBuf,DWORD nSize);

HBAPI	BOOL	__stdcall	HB_PLAY_InputAudioData(long nChl,char * pBuf,DWORD nSize);

HBAPI	BOOL	__stdcall	HB_PLAY_CloseStream(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetStreamOpenMode(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetSourceBufferRemain(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_ResetSourceBuffer(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_SetSourceBufferCB(long nChl, DWORD nThreShold,void (CALLBACK * SourceBufCallBack)(long nPort,DWORD nBufSize,DWORD dwUser,void*pResvered),DWORD dwUser,void *pReserved);

HBAPI	BOOL	__stdcall	HB_PLAY_ResetSourceBufFlag(long nChl);
	
HBAPI	BOOL	__stdcall	HB_PLAY_SetMsgWnd(long nChl, HWND hWnd);

HBAPI	DWORD	__stdcall	HB_PLAY_GetLastError(long nChl);

HBAPI	DWORD	__stdcall	HB_PLAY_GetSdkVersion(long nChl);

HBAPI	BOOL	__stdcall	HB_PLAY_SetPlaySpeed(long nChl, long dwSpeed, BOOL bSlow=false);
HBAPI	BOOL	__stdcall	HB_PLAY_SnapShot(long nChl, char *sFile);
HBAPI	double	__stdcall	HB_PLAY_GetDynamicBPS(long nChl);
HBAPI	double	__stdcall	HB_PLAY_GetAverageBPS(long nChl);

// discarded.
HBAPI	void	__stdcall	HB_PLAY_SetSDKThreadPriority(int nPriority, int nChl=-1);
HBAPI	void	__stdcall	HB_PLAY_SetIndexThread(BOOL bEnable, int nPriority, int nChl=-1);

// 设置是否启用IndexThread
HBAPI	void	__stdcall	HB_PLAY_EnableIndexThread(BOOL bEnable);

HBAPI	BOOL	__stdcall	HB_PLAY_GetVideoColor(long nChl, long *pBrightness, long *pContrast, long *pSaturation , long *pHue, long nRegnum=0);

HBAPI	BOOL	__stdcall	HB_PLAY_SetVideoColor(long nChl, long nBrightness, long nContrast, long nSaturation , long nHue, long nRegnum=0);

HBAPI	BOOL	__stdcall	HB_PLAY_SearchPicture(char	*sInFile, char *sOutFile, DWORD	dwPos, BOOL	byTimeOrFrame);

HBAPI	BOOL	__stdcall	HB_PLAY_GetIndexInfo(long nChl, BYTE *pBuffer, DWORD *pSize);

HBAPI	BOOL	__stdcall	HB_PLAY_SetIndexInfo(long nChl, BYTE *pBuffer, DWORD nIndexSize);

HBAPI	BOOL	__stdcall	HB_PLAY_SetIndexInfoCallBack(long nChl, void (CALLBACK *IndexCBFunc)(long nChl, long nReserved), long nReserved);

HBAPI	BOOL	__stdcall	HB_PLAY_GetFileStartTime(long nChl, char *pSystemTime);
HBAPI	BOOL	__stdcall	HB_PLAY_SetStreamSpeed(long nChl, int iSpeed, BOOL bFast);
HBAPI	void	__stdcall	HB_PLAY_SetEndlessStream(long	nChl, BOOL	bEndless);

/*
HBAPI	BOOL	__stdcall	HB_PLAY_ShowKeyFrame( char *sFile, DWORD dwTime, HWND hWnd, FRAME_POS *pFramePos);
HBAPI	BOOL	__stdcall	HB_PLAY_ShowKeyFrameEx( char *sFile, DWORD dwFilePos, HWND hWnd);
HBAPI	BOOL	__stdcall	HB_PLAY_SetFilePos(long nChl, DWORD	dwFilePos);
*/
/************************************************************************************************************************
// for zhuan
typedef	void*	HDRAW;	 
typedef	void*	H_WAVE;

HBAPI	long	__stdcall	HB_PLAY_OpenFileEx(char *sFile);

HBAPI	void*	__stdcall	HB_PLAY_DecInit(int width,int height);
HBAPI	void*	__stdcall	HB_PLAY_DecInitEx(int width,int height,int out_fmt);
HBAPI	int		__stdcall	HB_PLAY_DecFrame(void* handle,void* stream,void* image);
HBAPI	int		__stdcall	HB_PLAY_DecFrameEx(void* handle,void* stream,void* image, int quality);
HBAPI	void	__stdcall	HB_PLAY_DecFree(void *handle);

// display
HBAPI	HDRAW	__stdcall	HB_PLAY_InitDirectDraw(long width, long height);
HBAPI	BOOL	__stdcall	HB_PLAY_ShowPicture(void *hdraw,long hwnd, unsigned char *image, long width, long height);
HBAPI	BOOL	__stdcall	HB_PLAY_ShowPictureEx(void *hdraw,unsigned char *image, long width,long height);
HBAPI	BOOL	__stdcall	HB_PLAY_AddWindow(void *hdraw, long hwnd, long x, long y, long cx, long cy);
HBAPI	BOOL	__stdcall	HB_PLAY_DelWindow(void *hdraw, long hwnd);

HBAPI	void	__stdcall	HB_PLAY_RestoreSurface(void *hdraw);
HBAPI	void	__stdcall	HB_PLAY_ReleaseDDraw(void *hdraw);

// audio
HBAPI	H_WAVE	__stdcall	HB_PLAY_WaveOpen();
// 0 <= volume <= 0xffff
HBAPI	void	__stdcall	HB_PLAY_WaveSetVolume(H_WAVE *h, long volume);
HBAPI	void	__stdcall	HB_PLAY_WaveGetVolume(H_WAVE *h, long &volume);
HBAPI	BOOL	__stdcall	HB_PLAY_WaveWrite(H_WAVE *h, char *buff, long size);
HBAPI	BOOL	__stdcall	HB_PLAY_WaveReset(H_WAVE *h);
HBAPI	BOOL	__stdcall	HB_PLAY_WaveClose(H_WAVE *h);
***********************************************************************************************************/

// for 九鼎 Technology
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// 获取某个时间点之后的关键帧位置和大小: 在HB_PLAY_OpenFile之后调用
////////////////////////////////////////
// lTime		: 时间,单位毫秒
// iFilePos		: 关键帧在文件中的起始位置
// iFrameSize	: 关键帧的位置	
// 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
HBAPI	BOOL	__stdcall	HB_PLAY_GetKeyFramePosJD(long nChl, long lTime, long *iFilePos, long *iFrameSize);

///////////////////////////////////////////////////////////////////////////////////////////////////////////
// 获取下一帧数据 : 必须在HB_PLAY_GetKeyFramePosJD之后调用.
//////////////////
// iFilePos		: 视频或音频帧在文件中的起始位置
// iType		: 帧类型: 1表示视频帧, 2表示音频帧
//        
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//
HBAPI	BOOL	__stdcall	HB_PLAY_GetNextFramePosJD(long nChl, long *iFilePos, long *iFrameSize, long *iType);


// for T1800
// no finished.
HBAPI	BOOL	__stdcall	HB_PLAY_MergeFile(char *filename1, char *filename2);
HBAPI	BOOL	__stdcall	HB_PLAY_MergeFiles(char *file[], int file_num);


HBAPI  long __stdcall HB_PLAY_OpenStreamEx(char *pFileHeadBuf, DWORD nSize, DWORD nBufPoolSize);
HBAPI	long __stdcall	HB_PLAY_OpenFileEx(char *sFile);

#endif // _HBPLAYSDK_H_

⌨️ 快捷键说明

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