Răsfoiți Sursa

V0.7.2
1、完成了对Linux的兼容

Apple 1 lună în urmă
părinte
comite
401c3be9e6

+ 34 - 25
CPlayer/HKSDKAPI/hksdkapi.cpp

@@ -29,21 +29,22 @@ using pNET_DVR_SetExceptionCallBack_V30 =  BOOL(*)(UINT reserved1, void* reserve
 using pPlayM4_GetPort = BOOL(*)(LONG* nPort);
 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_Play = BOOL(*)(LONG nPort, HWND hWnd);
+using pPlayM4_CloseStream = BOOL(*)(LONG nPort);
 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_Play = BOOL(*)(LONG nPort, HWND hWnd);
+using pPlayM4_OpenStream = BOOL(*)(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
 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_Play = int(*)(int nPort, PLAYM4_HWND hWnd);
+using pPlayM4_OpenStream = int(*)(int nPort,unsigned char * pFileHeadBuf,unsigned int nSize,unsigned int nBufPoolSize);
 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;
 pNET_DVR_Cleanup g_NET_DVR_Cleanup = nullptr;
@@ -277,16 +278,6 @@ bool PlayM4_Stop(LONG nPort)
     return g_PlayM4_Stop(nPort);
 }
 
-bool PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize)
-{
-    if(g_PlayM4_OpenStream == nullptr)
-    {
-        LH_WRITE_ERROR("PlayM4_OpenStream is nullptr");
-        return false;
-    }
-    return g_PlayM4_OpenStream(nPort, pFileHeadBuf, nSize, nBufPoolSize);
-}
-
 bool PlayM4_CloseStream(LONG nPort)
 {
     if(g_PlayM4_CloseStream == nullptr)
@@ -298,16 +289,6 @@ bool PlayM4_CloseStream(LONG nPort)
 }
 
 
-bool PlayM4_Play(LONG nPort, HWND hWnd)
-{
-    if(g_PlayM4_Play == nullptr)
-    {
-        LH_WRITE_ERROR("PlayM4_Play is nullptr");
-        return false;
-    }
-    return g_PlayM4_Play(nPort, hWnd);
-}
-
 bool PlayM4_PlaySound(LONG nPort)
 {
     if(g_PlayM4_PlaySound == nullptr)
@@ -338,10 +319,38 @@ DWORD PlayM4_GetLastError(LONG nPort)
     return g_PlayM4_GetLastError(nPort);
 }
 
+#if defined (Q_OS_WIN)
+bool PlayM4_Play(LONG nPort, HWND hWnd)
+#elif defined (Q_OS_LINUX)
+int PlayM4_Play(int nPort, PLAYM4_HWND hWnd)
+#endif
+{
+    if(g_PlayM4_Play == nullptr)
+    {
+        LH_WRITE_ERROR("PlayM4_Play is nullptr");
+        return false;
+    }
+    return g_PlayM4_Play(nPort, hWnd);
+}
+
+#if defined (Q_OS_WIN)
+bool PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize)
+#elif defined (Q_OS_LINUX)
+int PlayM4_OpenStream(int nPort,unsigned char * pFileHeadBuf,unsigned int nSize,unsigned int nBufPoolSize)
+#endif
+{
+    if(g_PlayM4_OpenStream == nullptr)
+    {
+        LH_WRITE_ERROR("PlayM4_OpenStream is nullptr");
+        return false;
+    }
+    return g_PlayM4_OpenStream(nPort, pFileHeadBuf, nSize, nBufPoolSize);
+}
+
 #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)
+int 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)

+ 5 - 3
CPlayer/HKSDKAPI/hksdkapi.h

@@ -34,17 +34,19 @@ bool NET_DVR_SetExceptionCallBack_V30(UINT reserved1, void* reserved2, void (CAL
 bool PlayM4_GetPort(LONG* nPort);
 bool PlayM4_FreePort(LONG nPort);
 bool PlayM4_Stop(LONG nPort);
-bool PlayM4_OpenStream(LONG nPort, PBYTE pFileHeadBuf, DWORD nSize, DWORD nBufPoolSize);
 bool PlayM4_CloseStream(LONG nPort);
-bool PlayM4_Play(LONG nPort, HWND hWnd);
 bool PlayM4_PlaySound(LONG nPort);
 bool PlayM4_InputData(LONG nPort, PBYTE pBuf, DWORD nSize);
 DWORD PlayM4_GetLastError(LONG nPort);
 
 #if defined (Q_OS_WIN)
+bool PlayM4_Play(LONG nPort, HWND hWnd);
+bool PlayM4_OpenStream(LONG nPort, PBYTE pFileHeadBuf, DWORD nSize, DWORD nBufPoolSize);
 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);
+int PlayM4_Play(int nPort, PLAYM4_HWND hWnd);
+int PlayM4_OpenStream(int nPort, unsigned char* pFileHeadBuf, unsigned int nSize, unsigned int nBufPoolSize);
+int PlayM4_SetDecCallBackMend(int nPort, void (CALLBACK* DecCBFun)(int nPort, char* pBuf, int nSize, FRAME_INFO* pFrameInfo, void* nUser, int nReserved2), void* nUser);
 #endif
 
 

+ 18 - 0
CPlayer/HKSDKAPI/hksdkdefine.h

@@ -71,6 +71,10 @@
         int uWidth; 
         int uHeight; 
     }INITINFO; 
+
+typedef unsigned int PLAYM4_HWND;
+typedef void * PLAYM4_HWNDEX;
+typedef void * PLAYM4_HDC;
 #endif
 
 /* ========================================================================
@@ -321,6 +325,7 @@ typedef void (CALLBACK *REALDATACALLBACK) (LONG lPlayHandle, DWORD dwDataType, B
  * ********************** 海康SDK播放相关的宏定义 ***************************
  * ======================================================================== */
 
+#if defined (_WIN32)
 //Frame Info
 typedef struct{
     long nWidth;
@@ -330,6 +335,19 @@ typedef struct{
     long nFrameRate;
     DWORD dwFrameNum;
 }FRAME_INFO;
+#elif defined (__linux__)
+//Frame Info
+typedef struct
+{
+    int nWidth;
+    int nHeight;
+    int nStamp;
+    int nType;
+    int nFrameRate;
+    unsigned int dwFrameNum;
+}FRAME_INFO;
+#endif
+
 
 //Error code
 #define  PLAYM4_NOERROR                         0   //no error

+ 0 - 5
show1/CMakeLists.txt

@@ -73,13 +73,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
 
 elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
     target_link_libraries(${execName} PRIVATE
-        # HCCore
         # hcnetsdk
-        # libssl.so.1.1
-        # libcrypto.so.1.1
-        # AudioRender
         # PlayCtrl
-        # SuperRender
     )
     target_link_libraries(${execName} PRIVATE
         GL