mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 03:31:45 +08:00
Merge branch 'feature/on-record-ts' of https://github.com/wasphin/ZLMediaKit into pr
This commit is contained in:
@@ -53,6 +53,7 @@ const string kOnRtspAuth = HOOK_FIELD"on_rtsp_auth";
|
||||
const string kOnStreamChanged = HOOK_FIELD"on_stream_changed";
|
||||
const string kOnStreamNotFound = HOOK_FIELD"on_stream_not_found";
|
||||
const string kOnRecordMp4 = HOOK_FIELD"on_record_mp4";
|
||||
const string kOnRecordTs = HOOK_FIELD"on_record_ts";
|
||||
const string kOnShellLogin = HOOK_FIELD"on_shell_login";
|
||||
const string kOnStreamNoneReader = HOOK_FIELD"on_stream_none_reader";
|
||||
const string kOnHttpAccess = HOOK_FIELD"on_http_access";
|
||||
@@ -70,6 +71,7 @@ onceToken token([](){
|
||||
mINI::Instance()[kOnStreamChanged] = "https://127.0.0.1/index/hook/on_stream_changed";
|
||||
mINI::Instance()[kOnStreamNotFound] = "https://127.0.0.1/index/hook/on_stream_not_found";
|
||||
mINI::Instance()[kOnRecordMp4] = "https://127.0.0.1/index/hook/on_record_mp4";
|
||||
mINI::Instance()[kOnRecordTs] = "https://127.0.0.1/index/hook/on_record_ts";
|
||||
mINI::Instance()[kOnShellLogin] = "https://127.0.0.1/index/hook/on_shell_login";
|
||||
mINI::Instance()[kOnStreamNoneReader] = "https://127.0.0.1/index/hook/on_stream_none_reader";
|
||||
mINI::Instance()[kOnHttpAccess] = "https://127.0.0.1/index/hook/on_http_access";
|
||||
@@ -190,6 +192,7 @@ void installWebHook(){
|
||||
GET_CONFIG(string,hook_stream_chaned,Hook::kOnStreamChanged);
|
||||
GET_CONFIG(string,hook_stream_not_found,Hook::kOnStreamNotFound);
|
||||
GET_CONFIG(string,hook_record_mp4,Hook::kOnRecordMp4);
|
||||
GET_CONFIG(string,hook_record_ts,Hook::kOnRecordTs);
|
||||
GET_CONFIG(string,hook_shell_login,Hook::kOnShellLogin);
|
||||
GET_CONFIG(string,hook_stream_none_reader,Hook::kOnStreamNoneReader);
|
||||
GET_CONFIG(string,hook_http_access,Hook::kOnHttpAccess);
|
||||
@@ -361,6 +364,25 @@ void installWebHook(){
|
||||
});
|
||||
#endif //ENABLE_MP4
|
||||
|
||||
NoticeCenter::Instance().addListener(nullptr, Broadcast::kBroadcastRecordTs, [](BroadcastRecordTsArgs) {
|
||||
if (!hook_enable || hook_record_ts.empty()) {
|
||||
return;
|
||||
}
|
||||
ArgsType body;
|
||||
body["start_time"] = (Json::UInt64)info.ui64StartedTime;
|
||||
body["time_len"] = (Json::UInt64)info.ui64TimeLen;
|
||||
body["file_size"] = (Json::UInt64)info.ui64FileSize;
|
||||
body["file_path"] = info.strFilePath;
|
||||
body["file_name"] = info.strFileName;
|
||||
body["folder"] = info.strFolder;
|
||||
body["url"] = info.strUrl;
|
||||
body["app"] = info.strAppName;
|
||||
body["stream"] = info.strStreamId;
|
||||
body["vhost"] = info.strVhost;
|
||||
// 执行 hook
|
||||
do_http_hook(hook_record_ts, body, nullptr);
|
||||
});
|
||||
|
||||
NoticeCenter::Instance().addListener(nullptr,Broadcast::kBroadcastShellLogin,[](BroadcastShellLoginArgs){
|
||||
if(!hook_enable || hook_shell_login.empty() || sender.get_peer_ip() == "127.0.0.1"){
|
||||
invoker("");
|
||||
|
||||
Reference in New Issue
Block a user