mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 03:31:45 +08:00
Replace the tuple (vhost/app/stream) with MediaTuple. (#2560)
This commit is contained in:
@@ -184,9 +184,7 @@ void FFmpegSource::findAsync(int maxWaitMS, const function<void(const MediaSourc
|
||||
|
||||
if (!bRegist ||
|
||||
sender.getSchema() != strongSelf->_media_info.schema ||
|
||||
sender.getVhost() != strongSelf->_media_info.vhost ||
|
||||
sender.getApp() != strongSelf->_media_info.app ||
|
||||
sender.getId() != strongSelf->_media_info.stream) {
|
||||
!equalMediaTuple(sender.getMediaTuple(), strongSelf->_media_info)) {
|
||||
//不是自己感兴趣的事件,忽略之
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -321,12 +321,16 @@ static void fillSockInfo(Value& val, SockInfo* info) {
|
||||
val["identifier"] = info->getIdentifier();
|
||||
}
|
||||
|
||||
void dumpMediaTuple(const MediaTuple &tuple, Json::Value& item) {
|
||||
item[VHOST_KEY] = tuple.vhost;
|
||||
item["app"] = tuple.app;
|
||||
item["stream"] = tuple.stream;
|
||||
}
|
||||
|
||||
Value makeMediaSourceJson(MediaSource &media){
|
||||
Value item;
|
||||
item["schema"] = media.getSchema();
|
||||
item[VHOST_KEY] = media.getVhost();
|
||||
item["app"] = media.getApp();
|
||||
item["stream"] = media.getId();
|
||||
dumpMediaTuple(media.getMediaTuple(), item);
|
||||
item["createStamp"] = (Json::UInt64) media.getCreateStamp();
|
||||
item["aliveSecond"] = (Json::UInt64) media.getAliveSecond();
|
||||
item["bytesSpeed"] = media.getBytesSpeed();
|
||||
|
||||
@@ -213,12 +213,12 @@ void do_http_hook(const string &url, const ArgsType &body, const function<void(c
|
||||
do_http_hook(url, body, func, hook_retry);
|
||||
}
|
||||
|
||||
void dumpMediaTuple(const MediaTuple &tuple, Json::Value& item);
|
||||
|
||||
static ArgsType make_json(const MediaInfo &args) {
|
||||
ArgsType body;
|
||||
body["schema"] = args.schema;
|
||||
body[VHOST_KEY] = args.vhost;
|
||||
body["app"] = args.app;
|
||||
body["stream"] = args.stream;
|
||||
dumpMediaTuple(args, body);
|
||||
body["params"] = args.param_strs;
|
||||
return body;
|
||||
}
|
||||
@@ -437,9 +437,7 @@ void installWebHook() {
|
||||
body["regist"] = bRegist;
|
||||
} else {
|
||||
body["schema"] = sender.getSchema();
|
||||
body[VHOST_KEY] = sender.getVhost();
|
||||
body["app"] = sender.getApp();
|
||||
body["stream"] = sender.getId();
|
||||
dumpMediaTuple(sender.getMediaTuple(), body);
|
||||
body["regist"] = bRegist;
|
||||
}
|
||||
// 执行hook
|
||||
@@ -503,9 +501,7 @@ void installWebHook() {
|
||||
body["file_name"] = info.file_name;
|
||||
body["folder"] = info.folder;
|
||||
body["url"] = info.url;
|
||||
body["app"] = info.app;
|
||||
body["stream"] = info.stream;
|
||||
body[VHOST_KEY] = info.vhost;
|
||||
dumpMediaTuple(info, body);
|
||||
return body;
|
||||
};
|
||||
|
||||
@@ -561,9 +557,7 @@ void installWebHook() {
|
||||
|
||||
ArgsType body;
|
||||
body["schema"] = sender.getSchema();
|
||||
body[VHOST_KEY] = sender.getVhost();
|
||||
body["app"] = sender.getApp();
|
||||
body["stream"] = sender.getId();
|
||||
dumpMediaTuple(sender.getMediaTuple(), body);
|
||||
weak_ptr<MediaSource> weakSrc = sender.shared_from_this();
|
||||
// 执行hook
|
||||
do_http_hook(hook_stream_none_reader, body, [weakSrc](const Value &obj, const string &err) {
|
||||
@@ -584,9 +578,7 @@ void installWebHook() {
|
||||
}
|
||||
|
||||
ArgsType body;
|
||||
body[VHOST_KEY] = sender.getVhost();
|
||||
body["app"] = sender.getApp();
|
||||
body["stream"] = sender.getStreamId();
|
||||
dumpMediaTuple(sender.getMediaTuple(), body);
|
||||
body["ssrc"] = ssrc;
|
||||
body["originType"] = (int)sender.getOriginType(MediaSource::NullMediaSource());
|
||||
body["originTypeStr"] = getOriginTypeString(sender.getOriginType(MediaSource::NullMediaSource()));
|
||||
|
||||
Reference in New Issue
Block a user