Fix compile error when config with -DENABLE_SRT=OFF (#4132)

This commit is contained in:
yanggs 2025-02-11 13:23:24 +08:00 committed by GitHub
parent a27e9459f5
commit 69e4c127bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 4 deletions

View File

@ -66,9 +66,18 @@ update_cached_list(MK_LINK_LIBRARIES ZLMediaKit::MediaKit)
# 使 # 使
if(ENABLE_CXX_API) if(ENABLE_CXX_API)
# #
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ if(ENABLE_SRT)
DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
REGEX ".*[.](md|cpp)$" EXCLUDE) DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit
FILES_MATCHING
PATTERN "*.h")
else()
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${INSTALL_PATH_INCLUDE}/ZLMediaKit
FILES_MATCHING
REGEX ".*/Srt.*" EXCLUDE
PATTERN "*.h")
endif()
install(TARGETS zlmediakit install(TARGETS zlmediakit
DESTINATION ${INSTALL_PATH_LIB}) DESTINATION ${INSTALL_PATH_LIB})
endif () endif ()

View File

@ -128,7 +128,6 @@ public:
/* /*
* *
/*
* Get additional data * Get additional data
* [AUTO-TRANSLATED:e277d75d] * [AUTO-TRANSLATED:e277d75d]

View File

@ -37,12 +37,14 @@ static bool checkMediaSourceAndUrlMatch(const MediaSource::Ptr &src, const std::
} }
} }
#ifdef ENABLE_SRT
if (strcasecmp("srt", prefix.data()) == 0) { if (strcasecmp("srt", prefix.data()) == 0) {
auto ts_src = std::dynamic_pointer_cast<TSMediaSource>(src); auto ts_src = std::dynamic_pointer_cast<TSMediaSource>(src);
if (!ts_src) { if (!ts_src) {
return false; return false;
} }
} }
#endif // ENABLE_SRT
return true; return true;
} }