mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 12:05:58 +08:00
feat: VideoStack (#3373)
This commit is contained in:
@@ -62,6 +62,10 @@
|
||||
#include "version.h"
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_X264) && defined (ENABLE_FFMPEG)
|
||||
#include "VideoStack.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace Json;
|
||||
using namespace toolkit;
|
||||
@@ -1925,6 +1929,36 @@ void installWebApi() {
|
||||
invoker(401, StrCaseMap {}, "None http access event listener");
|
||||
}
|
||||
});
|
||||
|
||||
#if defined(ENABLE_X264) && defined(ENABLE_FFMPEG)
|
||||
VideoStackManager::Instance().loadBgImg("novideo.yuv");
|
||||
NoticeCenter::Instance().addListener(nullptr, Broadcast::kBroadcastStreamNoneReader, [](BroadcastStreamNoneReaderArgs) {
|
||||
auto id = sender.getMediaTuple().stream;
|
||||
VideoStackManager::Instance().stopVideoStack(id);
|
||||
InfoL << "VideoStack: " << id <<" stop";
|
||||
});
|
||||
|
||||
api_regist("/index/api/stack/start", [](API_ARGS_JSON_ASYNC) {
|
||||
CHECK_SECRET();
|
||||
auto ret = VideoStackManager::Instance().startVideoStack(allArgs.getArgs());
|
||||
if (!ret) {
|
||||
invoker(200, headerOut, "success");
|
||||
} else {
|
||||
invoker(200, headerOut, "failed");
|
||||
}
|
||||
});
|
||||
|
||||
api_regist("/index/api/stack/stop", [](API_ARGS_MAP_ASYNC) {
|
||||
CHECK_SECRET();
|
||||
CHECK_ARGS("id");
|
||||
auto ret = VideoStackManager::Instance().stopVideoStack(allArgs["id"]);
|
||||
if (!ret) {
|
||||
invoker(200, headerOut, "success");
|
||||
} else {
|
||||
invoker(200, headerOut, "failed");
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void unInstallWebApi(){
|
||||
|
||||
Reference in New Issue
Block a user