From 3dcd0ed46399b15cde86d4a77e498f4386b47b16 Mon Sep 17 00:00:00 2001 From: Aven Date: Sat, 13 Apr 2024 20:35:59 +0800 Subject: [PATCH] Enable video stack individually (#3469) --- CMakeLists.txt | 5 +++-- server/VideoStack.cpp | 2 +- server/VideoStack.h | 2 +- server/WebApi.cpp | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72a4544e..d4b2519a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,8 @@ option(ENABLE_SCTP "Enable SCTP" ON) option(ENABLE_WEBRTC "Enable WebRTC" ON) option(ENABLE_X264 "Enable x264" OFF) option(ENABLE_WEPOLL "Enable wepoll" ON) -option(DISABLE_REPORT "Disable report to report.zlmediakit.com" off) +option(ENABLE_VIDEOSTACK "Enable video stack" OFF) +option(DISABLE_REPORT "Disable report to report.zlmediakit.com" OFF) option(USE_SOLUTION_FOLDERS "Enable solution dir supported" ON) ############################################################################## # 设置socket默认缓冲区大小为256k.如果设置为0则不设置socket的默认缓冲区大小,使用系统内核默认值(设置为0仅对linux有效) @@ -535,6 +536,6 @@ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/default.pem" DESTINATION ${EXECUTABLE_OUT # 拷贝VideoStack 无视频流时默认填充的背景图片 # Copy the default background image used by VideoStack when there is no video stream -if (ENABLE_FFMPEG AND ENABLE_X264) +if (ENABLE_VIDEOSTACK AND ENABLE_FFMPEG AND ENABLE_X264) file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/conf/novideo.yuv" DESTINATION ${EXECUTABLE_OUTPUT_PATH}) endif () diff --git a/server/VideoStack.cpp b/server/VideoStack.cpp index d5168147..21cb7ff6 100644 --- a/server/VideoStack.cpp +++ b/server/VideoStack.cpp @@ -1,4 +1,4 @@ -#if defined(ENABLE_X264) && defined(ENABLE_FFMPEG) +#if defined(ENABLE_VIDEOSTACK) && defined(ENABLE_X264) && defined(ENABLE_FFMPEG) #include "VideoStack.h" #include "Codec/Transcode.h" #include "Common/Device.h" diff --git a/server/VideoStack.h b/server/VideoStack.h index 99455b40..cc0bfaa8 100644 --- a/server/VideoStack.h +++ b/server/VideoStack.h @@ -1,5 +1,5 @@ #pragma once -#if defined(ENABLE_X264) && defined(ENABLE_FFMPEG) +#if defined(ENABLE_VIDEOSTACK) && defined(ENABLE_X264) && defined(ENABLE_FFMPEG) #include "Codec/Transcode.h" #include "Common/Device.h" #include "Player/MediaPlayer.h" diff --git a/server/WebApi.cpp b/server/WebApi.cpp index a1ef1f65..091db922 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -62,7 +62,7 @@ #include "ZLMVersion.h" #endif -#if defined(ENABLE_X264) && defined (ENABLE_FFMPEG) +#if defined(ENABLE_VIDEOSTACK) && defined(ENABLE_X264) && defined (ENABLE_FFMPEG) #include "VideoStack.h" #endif @@ -1910,7 +1910,7 @@ void installWebApi() { } }); -#if defined(ENABLE_X264) && defined(ENABLE_FFMPEG) +#if defined(ENABLE_VIDEOSTACK) && defined(ENABLE_X264) && defined(ENABLE_FFMPEG) VideoStackManager::Instance().loadBgImg("novideo.yuv"); NoticeCenter::Instance().addListener(nullptr, Broadcast::kBroadcastStreamNoneReader, [](BroadcastStreamNoneReaderArgs) { auto id = sender.getMediaTuple().stream;