From a4233bdeb8c4a5e30f508be474aefabebc99af63 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Thu, 11 May 2017 18:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9mac=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 33 ++++++++++++++++++++++++++++++++- src/MediaFile/Mp4Maker.h | 2 +- tests/CMakeLists.txt | 14 +++++++------- tests/H264Decoder.h | 2 +- tests/test_server.cpp | 1 + 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index caae6ef5..23057c17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ endforeach(SUB_DIR ${SUB_DIR_LIST}) #查找openssl是否安装 -find_package(OpenSSL QUIET) +find_package(OPENSSL QUIET) if(OPENSSL_FOUND) message(STATUS "找到openssl库:\"${OPENSSL_INCLUDE_DIR}\",ENABLE_OPENSSL宏已打开") include_directories(${OPENSSL_INCLUDE_DIR}) @@ -90,6 +90,37 @@ if(NOT IOS) add_library(${CMAKE_PROJECT_NAME}_shared SHARED ${SRC_LIST}) set_target_properties(${CMAKE_PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}") install(TARGETS ${CMAKE_PROJECT_NAME}_shared LIBRARY DESTINATION lib) + +#查找mp4v2是否安装 +if(MP4V2_FOUND) +target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${MP4V2_LIBRARY}) +endif(MP4V2_FOUND) + +#查找x264是否安装 +if(X264_FOUND) +target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${X264_LIBRARIES}) +endif(X264_FOUND) + +#查找faac是否安装 +if(FAAC_FOUND) +target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${FAAC_LIBRARY}) +endif(FAAC_FOUND) + +#查找ZLToolKit是否安装 +if(ZLTOOLKIT_FOUND) +target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${ZLTOOLKIT_LIBRARY}) +endif(ZLTOOLKIT_FOUND) + +#查找openssl是否安装 +if(OPENSSL_FOUND) +target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${OPENSSL_LIBRARYS}) +endif(OPENSSL_FOUND) + +#查找mysql是否安装 +if(MYSQL_FOUND) +target_link_libraries(${CMAKE_PROJECT_NAME}_shared ${MYSQL_LIBRARYS}) +endif(MYSQL_FOUND) + endif(NOT IOS) #编译静态库 diff --git a/src/MediaFile/Mp4Maker.h b/src/MediaFile/Mp4Maker.h index 2cd971ec..39cd4226 100644 --- a/src/MediaFile/Mp4Maker.h +++ b/src/MediaFile/Mp4Maker.h @@ -31,7 +31,7 @@ class Mp4Info public: time_t ui64StartedTime; //GMT标准时间,单位秒 time_t ui64TimeLen;//录像长度,单位秒 - __off_t ui64FileSize;//文件大小,单位BYTE + off_t ui64FileSize;//文件大小,单位BYTE string strFilePath;//文件路径 string strFileName;//文件名称 string strFolder;//文件夹路径 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f018a86c..31fea221 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -39,37 +39,37 @@ target_link_libraries(${TEST_EXE_NAME} ${CMAKE_PROJECT_NAME}_shared pthread) #查找mp4v2是否安装 if(MP4V2_FOUND) -target_link_libraries(${TEST_EXE_NAME} mp4v2) +target_link_libraries(${TEST_EXE_NAME} ${MP4V2_LIBRARY}) endif(MP4V2_FOUND) #查找x264是否安装 if(X264_FOUND) -target_link_libraries(${TEST_EXE_NAME} x264) +target_link_libraries(${TEST_EXE_NAME} ${X264_LIBRARIES}) endif(X264_FOUND) #查找faac是否安装 if(FAAC_FOUND) -target_link_libraries(${TEST_EXE_NAME} faac) +target_link_libraries(${TEST_EXE_NAME} ${FAAC_LIBRARY}) endif(FAAC_FOUND) #查找ZLToolKit是否安装 if(ZLTOOLKIT_FOUND) -target_link_libraries(${TEST_EXE_NAME} ZLToolKit) +target_link_libraries(${TEST_EXE_NAME} ${ZLTOOLKIT_LIBRARY}) endif(ZLTOOLKIT_FOUND) #查找openssl是否安装 if(OPENSSL_FOUND) -target_link_libraries(${TEST_EXE_NAME} ssl) +target_link_libraries(${TEST_EXE_NAME} ${OPENSSL_LIBRARYS}) endif(OPENSSL_FOUND) #查找mysql是否安装 if(MYSQL_FOUND) -target_link_libraries(${TEST_EXE_NAME} mysqlclient) +target_link_libraries(${TEST_EXE_NAME} ${MYSQL_LIBRARYS}) endif(MYSQL_FOUND) #link test_player if(TEST_EXE_NAME STREQUAL test_player) -target_link_libraries(${TEST_EXE_NAME} SDL avcodec avutil) +target_link_libraries(${TEST_EXE_NAME} ${SDL_LIBRARY} ${AVCODEC_LIBRARIES} ${AVUTIL_LIBRARIES}) endif(TEST_EXE_NAME STREQUAL test_player) endforeach(TEST_SRC ${TEST_SRC_LIST}) diff --git a/tests/H264Decoder.h b/tests/H264Decoder.h index 354f55dd..7a857982 100644 --- a/tests/H264Decoder.h +++ b/tests/H264Decoder.h @@ -30,7 +30,7 @@ class H264Decoder public: H264Decoder(void){ avcodec_register_all(); - AVCodec *pCodec = avcodec_find_decoder(CODEC_ID_H264); + AVCodec *pCodec = avcodec_find_decoder(AV_CODEC_ID_H264); if (!pCodec) { throw std::runtime_error("未找到H264解码器"); } diff --git a/tests/test_server.cpp b/tests/test_server.cpp index b21358f5..e822eb32 100644 --- a/tests/test_server.cpp +++ b/tests/test_server.cpp @@ -42,6 +42,7 @@ void programExit(int arg) { EventPoller::Instance().shutdown(); } int main(int argc,char *argv[]){ + setExePath(argv[0]); signal(SIGINT, programExit); Logger::Instance().add(std::make_shared("stdout", LTrace)); Config::loaIniConfig();