浏览代码

Z991240-735 #comment module: 协助通道win和linux编译全部通过

胡琛80272472 5 年之前
父节点
当前提交
ad86622f81

+ 9 - 0
Module/mod_assistantchannel/CMakeLists.txt

@@ -22,6 +22,15 @@ BASIC_SETUP CMAKE_TARGETS
 BUILD missing)
 endif(WIN32)
 
+# ÒÀÀµlibbizchan
+target_include_directories(${MODULE_NAME} PRIVATE
+	${RVC_FRAMEWORK_INCLUDES_DIR}
+	${CONAN_RVCFRAMEWORK_ROOT}/include
+    ${MODULE_BASE_DIR}
+    ${OTHER_LIB_BASE_DIR}/libbizchan
+    )
+
+
 target_link_directories(${MODULE_NAME} PRIVATE ${CONAN_LIB_DIRS_OPENJPEG} ${CONAN_LIB_DIRS_ZLIB})
 set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_LIBS})
 target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} libbizchan ${CONAN_PKG_LIBS_OPENJPEG} ${CONAN_PKG_LIBS_ZLIB})  

+ 4 - 5
Module/mod_assistantchannel/mod_assistantchannel.cpp

@@ -1,15 +1,14 @@
 #include "stdafx.h"
 #include "SpBase.h"
-#include "ListEntry.h"
+#include "Common/ListEntry.h"
 #include "VideoDesc.h"
 #include "AssistantChannel_server_g.h"
-
-#include "..\..\Other\libbizchan\bizchan.h"
+#include "bizchan.h"
 #include "rec_common.h"
 #include "chan_protocol.h"
-#include "..\include\EventCode.h"
+#include "EventCode.h"
 
-#include "..\mod_counterconnector\CallType.h"
+#include "mod_counterconnector/CallType.h"
 
 using namespace AssistantChannel;
 

+ 1 - 1
Module/mod_localmediaplay/CMakeLists.txt

@@ -8,7 +8,7 @@ set(${MODULE_PREFIX}_SRCS
 	AdvertManage/BaseFun.h
 	AdvertManage/BaseFun.cpp
 	AdvertManage/mediaManage.h
-	AdvertManage/mediaManage.cpp
+	AdvertManage/MediaManage.cpp
 	AdvertManage/resourceIniParse.h
 	AdvertManage/resourceIniParse.cpp
 	mod_localmediaplay.h

+ 13 - 8
Other/CMakeLists.txt

@@ -2,12 +2,17 @@ if(SIMULATE_ON)
 	rvc_set_library_output_dir("${RVC_INSTALL_PREFIX}${RVC_RUNTIME_PATH}")
 endif(SIMULATE_ON)
 
-file(GLOB all_valid_subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/CMakeLists.txt")
+add_subdirectory("libscreencodec")
+add_subdirectory("acmstrenc")
+add_subdirectory("acmstrdec")
+add_subdirectory("libbizchan")
 
-foreach(dir ${all_valid_subdirs})
-	if(${dir} MATCHES "^([^/]*)/+CMakeLists.txt")
-		string(REGEX REPLACE "^([^/]*)/+CMakeLists.txt" "\\1" dir_trimmed ${dir})
-		message(STATUS "Adding other component ${dir_trimmed}")
-		add_subdirectory(${dir_trimmed})
-	endif()
-endforeach(dir)
+#file(GLOB all_valid_subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/CMakeLists.txt")
+
+#foreach(dir ${all_valid_subdirs})
+#	if(${dir} MATCHES "^([^/]*)/+CMakeLists.txt")
+#		string(REGEX REPLACE "^([^/]*)/+CMakeLists.txt" "\\1" dir_trimmed ${dir})
+#		message(STATUS "Adding other component ${dir_trimmed}")
+#		add_subdirectory(${dir_trimmed})
+#	endif()
+#endforeach(dir)

+ 9 - 2
Other/libbizchan/CMakeLists.txt

@@ -26,19 +26,26 @@ BASIC_SETUP CMAKE_TARGETS
 BUILD missing)
 endif(WIN32)
 
-# 依赖libscreencodec
+# 依赖libscreencodec、acmstrdec、acmstrenc
 target_include_directories(${MODULE_NAME} PRIVATE
 	"${CONAN_RVCFRAMEWORK_ROOT}/include"
 	${RVC_COMMON_INCLUDE_DIR}
     ${CONAN_INCLUDE_DIRS_OPENJPEG}
     ${OTHER_LIB_BASE_DIR}/libscreencodec
+    ${OTHER_LIB_BASE_DIR}/acmstrdec
+    ${OTHER_LIB_BASE_DIR}/acmstrenc
+    ${MODULE_BASE_DIR}/mod_assistantchannel
     )
 
 target_compile_definitions(${MODULE_NAME} PUBLIC "LIBBIZCHAN_EXPORTS")
 
 # 添加需要依赖的其他共享库(包括系统库)
 target_link_directories(${MODULE_NAME} PRIVATE ${CONAN_LIB_DIRS_OPENJPEG} ${CONAN_LIB_DIRS_ZLIB})
+if(WIN32)
 target_link_libraries(${MODULE_NAME} libscreencodec ${CONAN_PKG_LIBS_OPENJPEG} ${CONAN_PKG_LIBS_ZLIB} CONAN_PKG::OpenSSL ws2_32)
+else()
+target_link_libraries(${MODULE_NAME} libscreencodec ${CONAN_PKG_LIBS_OPENJPEG} ${CONAN_PKG_LIBS_ZLIB} CONAN_PKG::OpenSSL)
+endif(WIN32)
 
 if(MSVC)
 	install(TARGETS ${MODULE_NAME} 
@@ -46,7 +53,7 @@ if(MSVC)
     ARCHIVE DESTINATION "${RVC_LIBRARY_PATH}" COMPONENT develops EXCLUDE_FROM_ALL
     LIBRARY DESTINATION "${RVC_LIBRARY_PATH}" COMPONENT libraries
     )
-else()
+else(MSVC)
 install(TARGETS ${MODULE_NAME} 
     RUNTIME DESTINATION "${RVC_RUNTIME_PATH}"
     ARCHIVE DESTINATION "${RVC_LIBRARY_PATH}"

+ 0 - 94
Other/libbizchan/ListEntry.h

@@ -1,94 +0,0 @@
-#ifndef LISTENTRY_H
-#define LISTENTRY_H
-
-#pragma once
-
-static __inline void ListEntry_InitNode(PLIST_ENTRY node)
-{
-	node->Flink = node->Blink = NULL;
-}
-
-static __inline void ListEntry_InitHead(PLIST_ENTRY head)
-{
-	head->Blink = head;
-	head->Flink = head;
-}
-
-static __inline void ListEntry_DeleteNode(PLIST_ENTRY node)
-{
-	PLIST_ENTRY prev = node->Blink;
-	PLIST_ENTRY next = node->Flink;
-	prev->Flink = next;
-	next->Blink = prev;
-	node->Flink = node->Blink = NULL;
-}
-
-static __inline void ListEntry_Insert(PLIST_ENTRY prev, PLIST_ENTRY next, PLIST_ENTRY node)
-{
-	prev->Flink = node;
-	node->Blink = prev;
-	node->Flink = next;
-	next->Blink = node;
-}
-
-static __inline void ListEntry_InsertBefore(PLIST_ENTRY pos, PLIST_ENTRY node)
-{
-	ListEntry_Insert(pos->Blink, pos, node);
-}
-
-static __inline void ListEntry_InsertAfter(PLIST_ENTRY pos, PLIST_ENTRY node)
-{
-	ListEntry_Insert(pos, pos->Flink, node);
-}
-
-static __inline void ListEntry_AddTail(PLIST_ENTRY head, PLIST_ENTRY node)
-{
-	ListEntry_Insert(head->Blink, head, node);
-}
-
-static __inline void ListEntry_AddHead(PLIST_ENTRY head, PLIST_ENTRY node)
-{
-	ListEntry_Insert(head, head->Flink, node);
-}
-
-static __inline PLIST_ENTRY ListEntry_RemoveListHead(PLIST_ENTRY head)
-{
-	PLIST_ENTRY t = head->Flink;
-	ListEntry_DeleteNode(t);
-	return t;
-}
-
-static __inline PLIST_ENTRY ListEntry_RemoveListTail(PLIST_ENTRY head)
-{
-	PLIST_ENTRY t = head->Blink;
-	ListEntry_DeleteNode(t);
-	return t;
-}
-
-static __inline int ListEntry_IsEmpty(PLIST_ENTRY head)
-{
-	return head->Blink == head;
-}
-
-static __inline PLIST_ENTRY ListEntry_GetHead(PLIST_ENTRY head)
-{
-	return head->Flink;
-}
-
-static __inline PLIST_ENTRY ListEntry_GetTail(PLIST_ENTRY head)
-{
-	return head->Blink;
-}
-
-#define ListEntry_ForEachSafe(pos, n, head, type, member) \
-	for (pos = CONTAINING_RECORD((head)->Flink, type, member),	\
-	n = CONTAINING_RECORD(pos->member.Flink, type, member);	\
-	&pos->member != (head); 					\
-	pos = n, n = CONTAINING_RECORD(n->member.Flink, type, member))
-
-#define ListEntry_ForEach(pos, head, type, member) \
-	for (pos = CONTAINING_RECORD((head)->Flink, type, member);  \
-		&pos->member != head;  \
-		pos = CONTAINING_RECORD(pos->member.Flink, type, member))
-
-#endif // LISTENTRY_H

+ 76 - 8
Other/libbizchan/bizchan.c

@@ -1,29 +1,33 @@
 #include "bizchan.h"
 #include "quicklz.h"
 
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
-#include <WinSock2.h>
-#include <WinSock.h>
+//#define WIN32_LEAN_AND_MEAN
+//#include <Windows.h>
+//#include <WinSock2.h>
+//#include <WinSock.h>
+//#include <process.h>
+#include "SpBase.h"
+#include <winpr/file.h>
+#include <winpr/winsock.h>
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <process.h>
 #include <assert.h>
 
-#include "..\..\Module\mod_assistantchannel\chan_protocol.h"
+#include "chan_protocol.h"
 
 //#include "acmstrdec.h"
 //#include "acmstrenc.h"
-#include "openssl\\rc4.h"
+#include "openssl/rc4.h"
 
 #include "ListEntry.h"
 #include <screencodec.h>
 #include "jpeg2k.h"
 
+#ifdef RVC_OS_WIN
 #include <DbgHelp.h>
-
 #pragma comment(lib, "dbghelp.lib")
+#endif
 
 #define PING_INTERVAL	10000 // 10s
 #define MAX_TIMEOUT 60000     //超时时间60S,20170313修改,解决排队机闪呼的问题
@@ -137,6 +141,7 @@ static __inline int check_hash(char *key, int size, int hash_code)
 
 static __inline void GetTick(LARGE_INTEGER *last, LARGE_INTEGER *lt)
 {
+#ifdef RVC_OS_WIN
 	DWORD dwNow = GetTickCount();
 	if (last->LowPart > dwNow) {
 		lt->LowPart = dwNow;
@@ -145,6 +150,17 @@ static __inline void GetTick(LARGE_INTEGER *last, LARGE_INTEGER *lt)
 		lt->LowPart = dwNow;
 		lt->HighPart = last->HighPart;
 	}
+#else
+	DWORD dwNow = GetTickCount();
+	if (last->u.LowPart > dwNow) {
+		lt->u.LowPart = dwNow;
+		lt->u.HighPart = last->u.HighPart + 1;
+	}
+	else {
+		lt->u.LowPart = dwNow;
+		lt->u.HighPart = last->u.HighPart;
+	}
+#endif
 }
 
 BIZCHAN_API(int) bizchan_lib_init()
@@ -494,6 +510,7 @@ static int prepare_socket(SOCKET s, HANDLE evt)
 	return rc;
 }
 
+#ifdef RVC_OS_WIN
 static void dump_exception(PEXCEPTION_POINTERS ExceptionInfo)
 {
 	char tmp[MAX_PATH];
@@ -518,6 +535,7 @@ static void dump_exception(PEXCEPTION_POINTERS ExceptionInfo)
 		CloseHandle( hDumpFile ); 
 	}
 }
+#endif
 
 static void process(bizchan_t *chan)
 {
@@ -748,14 +766,19 @@ on_error:
 static unsigned int __stdcall work_proc(void *arg)
 {
 	bizchan_t *chan = (bizchan_t *)arg;
+#ifdef RVC_OS_WIN
 	__try {
 		process(chan);
 	} __except(dump_exception(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) {
 		//....
 	}
+#else
+	process(chan);
+#endif
 	return 0;
 }
 
+#ifdef RVC_OS_WIN
 static int init_decode_func()
 {
 	int ret = -1;
@@ -799,6 +822,51 @@ static int init_decode_func()
 	return ret;
 }
 
+#else
+static int init_decode_func()
+{
+	int ret = -1;
+	if (!encodestring) {
+		HMODULE hInst = LoadLibraryA("acmstrenc.so");
+		if (hInst) {
+			encodestring = (lpfn_cryptionfun)GetProcAddress(hInst, "encodestring");
+		}
+		if (!encodestring)
+			return ret;
+	}
+	if (!decodestring) {
+		HMODULE hInst = LoadLibraryA("acmstrdec.so");
+		if (hInst) {
+			decodestring = (lpfn_cryptionfun)GetProcAddress(hInst, "decodestring");
+		}
+		if (!decodestring)
+			return ret;
+	}
+
+	if (!encodestring_mobile) {
+		HMODULE hInst = LoadLibraryA("acmstrenc_mobile.so");
+		if (hInst) {
+			encodestring_mobile = (lpfn_cryptionfun)GetProcAddress(hInst, "encodestring");
+		}
+		if (!encodestring_mobile)
+			return ret;
+	}
+	if (!decodestring_mobile) {
+		HMODULE hInst = LoadLibraryA("acmstrdec_mobile.so");
+		if (hInst) {
+			decodestring_mobile = (lpfn_cryptionfun)GetProcAddress(hInst, "decodestring");
+		}
+		if (!decodestring_mobile)
+			return ret;
+	}
+
+	if (encodestring && decodestring && encodestring_mobile && decodestring_mobile) {
+		ret = 0;
+	}
+	return ret;
+}
+#endif
+
 BIZCHAN_API(int) bizchan_create(const bizchan_config_t *config, const bizchan_callback_t *cb, bizchan_t **p_chan)
 {
 	bizchan_t *chan = NULL;

+ 5 - 0
Other/libbizchan/bizchan.h

@@ -7,11 +7,16 @@
 extern "C" {
 #endif
 
+
+#ifdef _WIN32
 #ifdef LIBBIZCHAN_EXPORTS
 #define BIZCHAN_API(type)	_declspec(dllexport) type __stdcall
 #else
 #define BIZCHAN_API(type)	_declspec(dllimport) type __stdcall
 #endif
+#else
+#define BIZCHAN_API(type)	type
+#endif
 
 typedef struct bizchan_t bizchan_t;
 

+ 7 - 1
Other/libbizchan/jpeg2k.c

@@ -1,8 +1,14 @@
-#include <Windows.h>
+
+
+//#include <Windows.h>
+#include "SpBase.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#ifdef RVC_OS_WIN
 #include <DbgHelp.h>
+#endif
 #include "jpeg2k.h"
 
 #include "openjpeg.h"

+ 0 - 1
Other/libscreencodec/CMakeLists.txt

@@ -28,7 +28,6 @@ target_include_directories(${MODULE_NAME} PRIVATE
 
 target_compile_definitions(${MODULE_NAME} PUBLIC "LIBSCREENCODEC_EXPORTS")
 
-
 # 添加需要依赖的其他共享库(包括系统库)
 target_link_directories(${MODULE_NAME} PRIVATE ${CONAN_LIB_DIRS_ZLIB})
 target_link_libraries(${MODULE_NAME} ${CONAN_PKG_LIBS_ZLIB})

+ 2 - 1
Other/libscreencodec/screencodec.c

@@ -2,7 +2,8 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <WinSock.h>
+//#include <WinSock.h>
+#include "SpBase.h"
 #include <assert.h>
 
 //#include <memutil.h>

+ 4 - 0
Other/libscreencodec/screencodec.h

@@ -7,11 +7,15 @@
 extern "C" {
 #endif
 
+#ifdef _WIN32
 #ifdef LIBSCREENCODEC_EXPORTS
 #define SCREENCODEC_API(type)	_declspec(dllexport) type __stdcall
 #else
 #define SCREENCODEC_API(type)	_declspec(dllimport) type __stdcall
 #endif
+#else
+#define SCREENCODEC_API(type)	type
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>