Commit fbf0f635 by xiongziliang

1、getMediaList接入添加tracks、readerCount字段

2、添加getMediaInfo接口
parent 89b8d461
......@@ -411,6 +411,14 @@ void installWebApi() {
item["vhost"] = media->getVhost();
item["app"] = media->getApp();
item["stream"] = media->getId();
item["readerCount"] = media->readerCount();
for(auto &track : media->getTracks()){
Value obj;
obj["codec_id"] = track->getCodecId();
obj["codec_type"] = track->getTrackType();
obj["ready"] = track->ready();
item["tracks"].append(obj);
}
val["data"].append(item);
});
});
......@@ -422,6 +430,26 @@ void installWebApi() {
val["online"] = (bool) (MediaSource::find(allArgs["schema"],allArgs["vhost"],allArgs["app"],allArgs["stream"],false));
});
//测试url http://127.0.0.1/index/api/getMediaInfo?schema=rtsp&vhost=__defaultVhost__&app=live&stream=obs
API_REGIST(api,getMediaInfo,{
CHECK_SECRET();
CHECK_ARGS("schema","vhost","app","stream");
auto src = MediaSource::find(allArgs["schema"],allArgs["vhost"],allArgs["app"],allArgs["stream"],false);
if(!src){
val["online"] = false;
return;
}
val["online"] = true;
val["readerCount"] = src->readerCount();
for(auto &track : src->getTracks()){
Value obj;
obj["codec_id"] = track->getCodecId();
obj["codec_type"] = track->getTrackType();
obj["ready"] = track->ready();
val["tracks"].append(obj);
}
});
//主动关断流,包括关断拉流、推流
//测试url http://127.0.0.1/index/api/close_stream?schema=rtsp&vhost=__defaultVhost__&app=live&stream=obs&force=1
API_REGIST(api,close_stream,{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论