Commit 9527a2b1 by xiongziliang

addStreamProxy接口新增多种转协议相关参数

parent 8db01651
......@@ -486,6 +486,15 @@ void addStreamProxy(const string &vhost, const string &app, const string &stream
player->play(url);
};
template <typename Type>
static Type getArgsValue(const HttpAllArgs<ApiArgsType> &allArgs, const string &key, Type default_value) {
auto val = allArgs["key"];
if (val.empty()) {
return default_value;
}
return (Type)val;
}
/**
* 安装api接口
* 所有api都支持GET和POST两种方式
......@@ -906,9 +915,19 @@ void installWebApi() {
api_regist("/index/api/addStreamProxy",[](API_ARGS_MAP_ASYNC){
CHECK_SECRET();
CHECK_ARGS("vhost","app","stream","url");
ProtocolOption option;
option.enable_hls = allArgs["enable_hls"];
option.enable_mp4 = allArgs["enable_mp4"];
option.enable_hls = getArgsValue(allArgs, "enable_hls", option.enable_hls);
option.enable_mp4 = getArgsValue(allArgs, "enable_mp4", option.enable_mp4);
option.enable_rtsp = getArgsValue(allArgs, "enable_rtsp", option.enable_rtsp);
option.enable_rtmp = getArgsValue(allArgs, "enable_rtmp", option.enable_rtmp);
option.enable_ts = getArgsValue(allArgs, "enable_ts", option.enable_ts);
option.enable_fmp4 = getArgsValue(allArgs, "enable_mp4", option.enable_fmp4);
option.enable_audio = getArgsValue(allArgs, "enable_audio", option.enable_audio);
option.add_mute_audio = getArgsValue(allArgs, "add_mute_audio", option.add_mute_audio);
option.mp4_save_path = getArgsValue(allArgs, "mp4_save_path", option.mp4_save_path);
option.mp4_max_second = getArgsValue(allArgs, "mp4_max_second", option.mp4_max_second);
option.hls_save_path = getArgsValue(allArgs, "hls_save_path", option.hls_save_path);
addStreamProxy(allArgs["vhost"],
allArgs["app"],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论