降低第三方库头文件依赖性

This commit is contained in:
xiongziliang 2020-06-12 18:17:49 +08:00
parent f03351a71a
commit 5f50441f43
2 changed files with 17 additions and 5 deletions

View File

@ -39,10 +39,6 @@ set(MediaServer_Root ${CMAKE_CURRENT_SOURCE_DIR}/3rdpart/media-server)
# #
INCLUDE_DIRECTORIES(${ToolKit_Root}) INCLUDE_DIRECTORIES(${ToolKit_Root})
INCLUDE_DIRECTORIES(${MediaKit_Root}) INCLUDE_DIRECTORIES(${MediaKit_Root})
INCLUDE_DIRECTORIES(${MediaServer_Root}/libmpeg/include)
INCLUDE_DIRECTORIES(${MediaServer_Root}/libmov/include)
INCLUDE_DIRECTORIES(${MediaServer_Root}/libflv/include)
INCLUDE_DIRECTORIES(${MediaServer_Root}/librtp/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/3rdpart) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/3rdpart)
set(ENABLE_HLS true) set(ENABLE_HLS true)
@ -62,6 +58,8 @@ if (OPENSSL_FOUND AND ENABLE_OPENSSL)
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
add_definitions(-DENABLE_OPENSSL) add_definitions(-DENABLE_OPENSSL)
list(APPEND LINK_LIB_LIST ${OPENSSL_LIBRARIES}) list(APPEND LINK_LIB_LIST ${OPENSSL_LIBRARIES})
else()
message(WARNING "openssl未找到rtmp将不支持flash播放器https/wss/rtsps/rtmps也将失效")
endif () endif ()
#mysql #mysql
@ -109,6 +107,7 @@ if(ENABLE_HLS)
message(STATUS "ENABLE_HLS defined") message(STATUS "ENABLE_HLS defined")
add_definitions(-DENABLE_HLS) add_definitions(-DENABLE_HLS)
include_directories(${MediaServer_Root}/libmpeg/include)
aux_source_directory(${MediaServer_Root}/libmpeg/include src_mpeg) aux_source_directory(${MediaServer_Root}/libmpeg/include src_mpeg)
aux_source_directory(${MediaServer_Root}/libmpeg/source src_mpeg) aux_source_directory(${MediaServer_Root}/libmpeg/source src_mpeg)
@ -125,6 +124,9 @@ if(ENABLE_MP4)
message(STATUS "ENABLE_MP4 defined") message(STATUS "ENABLE_MP4 defined")
add_definitions(-DENABLE_MP4) add_definitions(-DENABLE_MP4)
include_directories(${MediaServer_Root}/libmov/include)
include_directories(${MediaServer_Root}/libflv/include)
aux_source_directory(${MediaServer_Root}/libmov/include src_mov) aux_source_directory(${MediaServer_Root}/libmov/include src_mov)
aux_source_directory(${MediaServer_Root}/libmov/source src_mov) aux_source_directory(${MediaServer_Root}/libmov/source src_mov)
@ -143,6 +145,8 @@ endif()
#rtprtpps/ts #rtprtpps/ts
if(ENABLE_RTPPROXY AND ENABLE_HLS) if(ENABLE_RTPPROXY AND ENABLE_HLS)
message(STATUS "ENABLE_RTPPROXY defined") message(STATUS "ENABLE_RTPPROXY defined")
include_directories(${MediaServer_Root}/librtp/include)
aux_source_directory(${MediaServer_Root}/librtp/include src_rtp) aux_source_directory(${MediaServer_Root}/librtp/include src_rtp)
aux_source_directory(${MediaServer_Root}/librtp/source src_rtp) aux_source_directory(${MediaServer_Root}/librtp/source src_rtp)
aux_source_directory(${MediaServer_Root}/librtp/payload src_rtp) aux_source_directory(${MediaServer_Root}/librtp/payload src_rtp)

View File

@ -11,12 +11,15 @@
#include "Decoder.h" #include "Decoder.h"
#include "PSDecoder.h" #include "PSDecoder.h"
#include "TSDecoder.h" #include "TSDecoder.h"
#include "mpeg-ts-proto.h"
#include "Extension/H264.h" #include "Extension/H264.h"
#include "Extension/H265.h" #include "Extension/H265.h"
#include "Extension/AAC.h" #include "Extension/AAC.h"
#include "Extension/G711.h" #include "Extension/G711.h"
#if defined(ENABLE_RTPPROXY) || defined(ENABLE_HLS)
#include "mpeg-ts-proto.h"
#endif
namespace mediakit { namespace mediakit {
static Decoder::Ptr createDecoder_l(DecoderImp::Type type) { static Decoder::Ptr createDecoder_l(DecoderImp::Type type) {
switch (type){ switch (type){
@ -62,6 +65,7 @@ DecoderImp::DecoderImp(const Decoder::Ptr &decoder, MediaSinkInterface *sink){
}); });
} }
#if defined(ENABLE_RTPPROXY) || defined(ENABLE_HLS)
#define SWITCH_CASE(codec_id) case codec_id : return #codec_id #define SWITCH_CASE(codec_id) case codec_id : return #codec_id
static const char *getCodecName(int codec_id) { static const char *getCodecName(int codec_id) {
switch (codec_id) { switch (codec_id) {
@ -198,6 +202,9 @@ void DecoderImp::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
break; break;
} }
} }
#else
void DecoderImp::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t dts,const void *data,int bytes) {}
#endif
void DecoderImp::onTrack(const Track::Ptr &track) { void DecoderImp::onTrack(const Track::Ptr &track) {
_sink->addTrack(track); _sink->addTrack(track);
@ -208,3 +215,4 @@ void DecoderImp::onFrame(const Frame::Ptr &frame) {
} }
}//namespace mediakit }//namespace mediakit