|
@@ -2,7 +2,6 @@
|
|
|
|
|
|
#include "LHQLogAPI.h"
|
|
|
|
|
|
-#include <QString>
|
|
|
#include <QLibrary>
|
|
|
|
|
|
|
|
@@ -23,6 +22,8 @@ using pNET_DVR_GetLastError = DWORD(*)();
|
|
|
using pNET_DVR_RealPlay_V40 = LONG(*)(LONG lUserID, LPNET_DVR_PREVIEWINFO lpPreviewInfo, REALDATACALLBACK fRealDataCallBack_V30, void* pUser);
|
|
|
using pNET_DVR_StopRealPlay = bool(*)(LONG lRealHandle);
|
|
|
|
|
|
+using pNET_DVR_SetExceptionCallBack_V30 = BOOL(*)(UINT reserved1, void* reserved2, void (CALLBACK* fExceptionCallBack)(DWORD dwType, LONG lUserID, LONG lHandle, void *pUser), void *pUser);
|
|
|
+
|
|
|
|
|
|
/* 播放相关的函数指针 */
|
|
|
using pPlayM4_GetPort = BOOL(*)(LONG* nPort);
|
|
@@ -30,12 +31,18 @@ using pPlayM4_FreePort = BOOL(*)(LONG nPort);
|
|
|
using pPlayM4_Stop = BOOL(*)(LONG nPort);
|
|
|
using pPlayM4_OpenStream = BOOL(*)(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
|
|
|
using pPlayM4_CloseStream = BOOL(*)(LONG nPort);
|
|
|
-using pPlayM4_SetDecCallBackMend = BOOL(*)(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char * pBuf, long nSize, FRAME_INFO * pFrameInfo, void* nUser,void* nReserved2), void* nUser);
|
|
|
+
|
|
|
using pPlayM4_Play = BOOL(*)(LONG nPort, HWND hWnd);
|
|
|
using pPlayM4_PlaySound = BOOL(*)(LONG nPort);
|
|
|
using pPlayM4_InputData = BOOL(*)(LONG nPort,PBYTE pBuf,DWORD nSize);
|
|
|
using pPlayM4_GetLastError = DWORD(*)(LONG nPort);
|
|
|
|
|
|
+#if defined (Q_OS_WIN)
|
|
|
+using pPlayM4_SetDecCallBackMend = BOOL(*)(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char * pBuf, long nSize, FRAME_INFO * pFrameInfo, void* nUser,void* nReserved2), void* nUser);
|
|
|
+#elif defined (Q_OS_LINUX)
|
|
|
+using pPlayM4_SetDecCallBackMend = int(*)(int nPort,void (CALLBACK* DecCBFun)(int nPort,char * pBuf,int nSize,FRAME_INFO * pFrameInfo, void* nUser,int nReserved2), void* nUser);
|
|
|
+#endif
|
|
|
+
|
|
|
|
|
|
/* 网络登录相关的函数指针 */
|
|
|
pNet_DEV_Init g_NET_DVR_Init = nullptr;
|
|
@@ -49,6 +56,8 @@ pNET_DVR_GetLastError g_NET_DVR_GetLastError = nullptr;
|
|
|
pNET_DVR_RealPlay_V40 g_NET_DVR_RealPlay_V40 = nullptr;
|
|
|
pNET_DVR_StopRealPlay g_NET_DVR_StopRealPlay = nullptr;
|
|
|
|
|
|
+pNET_DVR_SetExceptionCallBack_V30 g_NET_DVR_SetExceptionCallBack_V30 = nullptr;
|
|
|
+
|
|
|
/* 播放相关的函数指针 */
|
|
|
pPlayM4_GetPort g_PlayM4_GetPort = nullptr;
|
|
|
pPlayM4_FreePort g_PlayM4_FreePort = nullptr;
|
|
@@ -96,10 +105,12 @@ bool load_HKSDK_Library(QString libPath)
|
|
|
g_NET_DVR_GetLastError = (pNET_DVR_GetLastError)libNet.resolve("NET_DVR_GetLastError");
|
|
|
g_NET_DVR_RealPlay_V40 = (pNET_DVR_RealPlay_V40)libNet.resolve("NET_DVR_RealPlay_V40");
|
|
|
g_NET_DVR_StopRealPlay = (pNET_DVR_StopRealPlay)libNet.resolve("NET_DVR_StopRealPlay");
|
|
|
+ g_NET_DVR_SetExceptionCallBack_V30 = (pNET_DVR_SetExceptionCallBack_V30)libNet.resolve("NET_DVR_SetExceptionCallBack_V30");
|
|
|
|
|
|
if(g_NET_DVR_Init == nullptr || g_NET_DVR_Cleanup == nullptr || g_NET_DVR_SetConnectTime == nullptr ||
|
|
|
g_NET_DVR_SetReconnect == nullptr || g_NET_DVR_Login_V40 == nullptr || g_NET_DVR_Logout == nullptr ||
|
|
|
- g_NET_DVR_GetLastError == nullptr || g_NET_DVR_RealPlay_V40 == nullptr || g_NET_DVR_StopRealPlay == nullptr)
|
|
|
+ g_NET_DVR_GetLastError == nullptr || g_NET_DVR_RealPlay_V40 == nullptr || g_NET_DVR_StopRealPlay == nullptr ||
|
|
|
+ g_NET_DVR_SetExceptionCallBack_V30 == nullptr)
|
|
|
{
|
|
|
LH_WRITE_ERROR("load HCNetSDK library failed, resolve function failed!");
|
|
|
return false;
|
|
@@ -226,6 +237,16 @@ bool NET_DVR_StopRealPlay(LONG lRealHandle)
|
|
|
return g_NET_DVR_StopRealPlay(lRealHandle);
|
|
|
}
|
|
|
|
|
|
+bool NET_DVR_SetExceptionCallBack_V30(UINT reserved1, void* reserved2, void (CALLBACK* fExceptionCallBack)(DWORD dwType, LONG lUserID, LONG lHandle, void* pUser), void* pUser)
|
|
|
+{
|
|
|
+ if(g_NET_DVR_SetExceptionCallBack_V30 == nullptr)
|
|
|
+ {
|
|
|
+ LH_WRITE_ERROR("NET_DVR_SetExceptionCallBack_V30 is nullptr");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return g_NET_DVR_SetExceptionCallBack_V30(reserved1, reserved2, fExceptionCallBack, pUser);
|
|
|
+}
|
|
|
+
|
|
|
bool PlayM4_GetPort(LONG* nPort)
|
|
|
{
|
|
|
if(g_PlayM4_GetPort == nullptr)
|
|
@@ -276,15 +297,6 @@ bool PlayM4_CloseStream(LONG nPort)
|
|
|
return g_PlayM4_CloseStream(nPort);
|
|
|
}
|
|
|
|
|
|
-bool PlayM4_SetDecCallBackMend(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char * pBuf, long nSize, FRAME_INFO * pFrameInfo, void* nUser,void* nReserved2), void* nUser)
|
|
|
-{
|
|
|
- if(g_PlayM4_SetDecCallBackMend == nullptr)
|
|
|
- {
|
|
|
- LH_WRITE_ERROR("PlayM4_SetDecCallBackMend is nullptr");
|
|
|
- return false;
|
|
|
- }
|
|
|
- return g_PlayM4_SetDecCallBackMend(nPort, DecCBFun, nUser);
|
|
|
-}
|
|
|
|
|
|
bool PlayM4_Play(LONG nPort, HWND hWnd)
|
|
|
{
|
|
@@ -325,3 +337,17 @@ DWORD PlayM4_GetLastError(LONG nPort)
|
|
|
}
|
|
|
return g_PlayM4_GetLastError(nPort);
|
|
|
}
|
|
|
+
|
|
|
+#if defined (Q_OS_WIN)
|
|
|
+bool PlayM4_SetDecCallBackMend(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char * pBuf, long nSize, FRAME_INFO * pFrameInfo, void* nUser,void* nReserved2), void* nUser)
|
|
|
+#elif defined (Q_OS_LINUX)
|
|
|
+bool PlayM4_SetDecCallBackMend(int nPort, void (CALLBACK* DecCBFun)(int nPort, char * pBuf, int nSize, FRAME_INFO * pFrameInfo, void* nUser, int nReserved2), void* nUser)
|
|
|
+#endif
|
|
|
+{
|
|
|
+ if(g_PlayM4_SetDecCallBackMend == nullptr)
|
|
|
+ {
|
|
|
+ LH_WRITE_ERROR("PlayM4_SetDecCallBackMend is nullptr");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return g_PlayM4_SetDecCallBackMend(nPort, DecCBFun, nUser);
|
|
|
+}
|