From cf99ebf186dd5baeaf088aa1731a986f60edd037 Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 10 Oct 2021 10:23:27 +0800 Subject: [PATCH] Fix #2653: Remove HTTP RAW API. v4.0.170 --- trunk/doc/CHANGELOG.md | 1 + trunk/doc/Features.md | 2 +- trunk/research/console/en_index.html | 1 - trunk/research/console/js/srs.cn.js | 3 - trunk/research/console/js/srs.console.js | 292 ----- trunk/research/console/js/srs.en.js | 3 - trunk/research/console/ng_index.html | 1 - trunk/research/console/views/config.html | 1007 --------------- trunk/research/console/views/config_en.html | 1004 --------------- trunk/research/console/views/configs.html | 411 +------ trunk/research/console/views/configs_en.html | 411 +------ trunk/research/console/views/dvr.html | 62 - trunk/research/console/views/dvr_en.html | 62 - trunk/research/console/views/dvrs.html | 1 - trunk/research/console/views/dvrs_en.html | 1 - trunk/src/app/srs_app_config.cpp | 1162 +----------------- trunk/src/app/srs_app_config.hpp | 36 - trunk/src/app/srs_app_http_api.cpp | 308 +---- trunk/src/core/srs_core_version4.hpp | 2 +- 19 files changed, 18 insertions(+), 4752 deletions(-) delete mode 100644 trunk/research/console/views/config.html delete mode 100644 trunk/research/console/views/config_en.html delete mode 100644 trunk/research/console/views/dvr.html delete mode 100644 trunk/research/console/views/dvr_en.html delete mode 100644 trunk/research/console/views/dvrs.html delete mode 100644 trunk/research/console/views/dvrs_en.html diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 3f67213748..3e361380d7 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-10-10, Fix [#2653](https://github.com/ossrs/srs/issues/2653) Remove HTTP RAW API. v4.0.170 * v4.0, 2021-10-08, Merge [#2654](https://github.com/ossrs/srs/pull/2654): Parse width and width from SPS/PPS. v4.0.169 * v4.0, 2021-10-08, Default to log to console for docker. v4.0.168 * v4.0, 2021-10-07, Fix bugs #2648, #2415. v4.0.167 diff --git a/trunk/doc/Features.md b/trunk/doc/Features.md index 8942f2bdd4..bb99a231b2 100644 --- a/trunk/doc/Features.md +++ b/trunk/doc/Features.md @@ -52,13 +52,13 @@ The features of SRS. - [x] [Experimental] Support MPEG-DASH, the future live streaming protocol, read [#299][bug #299]. - [x] [Experimental] Support pushing MPEG-TS over UDP, please read [bug #250][bug #250]. - [x] [Experimental] Support pushing FLV over HTTP POST, please read wiki([CN][v4_CN_Streamer2], [EN][v4_EN_Streamer2]). -- [x] [Experimental] Support HTTP RAW API, please read [#459][bug #459], [#470][bug #470], [#319][bug #319]. - [x] [Experimental] Support SRT server, read [#1147][bug #1147]. - [x] [Experimental] Support transmux RTC to RTMP, [#2093][bug #2093]. - [x] [Deprecated] Support pushing RTSP, please read [bug #2304][bug #2304]. - [x] [Deprecated] Support Adobe HDS(f4m), please read wiki([CN][v4_CN_DeliveryHDS], [EN][v4_EN_DeliveryHDS]) and [#1535][bug #1535]. - [x] [Deprecated] Support bandwidth testing, please read [#1535][bug #1535]. - [x] [Deprecated] Support Adobe FMS/AMS token traverse([CN][v4_CN_DRM2], [EN][v4_EN_DRM2]) authentication, please read [#1535][bug #1535]. +- [x] [Removed] Support HTTP RAW API, please read [#2653](https://github.com/ossrs/srs/issues/2653). - [x] [Removed] Support RTMP client library: [srs-librtmp][srs-librtmp]. - [ ] Support Windows/Cygwin 64bits, [#2532](https://github.com/ossrs/srs/issues/2532). - [ ] Support push stream by GB28181, [#1500][bug #1500]. diff --git a/trunk/research/console/en_index.html b/trunk/research/console/en_index.html index 9c0c28169e..72f5058fac 100644 --- a/trunk/research/console/en_index.html +++ b/trunk/research/console/en_index.html @@ -32,7 +32,6 @@
  • Streams
  • Clients
  • Config
  • -
  • DVR
  • Chinese
  • diff --git a/trunk/research/console/js/srs.cn.js b/trunk/research/console/js/srs.cn.js index 68d14d603e..012afd574f 100644 --- a/trunk/research/console/js/srs.cn.js +++ b/trunk/research/console/js/srs.cn.js @@ -12,9 +12,6 @@ scApp.config(["$routeProvider", function($routeProvider){ .when("/clients", {templateUrl:"views/clients.html", controller:"CSCClients"}) .when("/clients/:id", {templateUrl:"views/client.html", controller:"CSCClient"}) .when("/configs", {templateUrl:"views/configs.html", controller:"CSCConfigs"}) - .when("/configs/:id", {templateUrl:"views/config.html", controller:"CSCConfig"}) - .when("/dvr", {templateUrl:"views/dvrs.html", controller:"CSCDvrs"}) - .when("/dvr/:vid/:sid/:app/:stream", {templateUrl:"views/dvr.html", controller:"CSCDvr"}) .when("/summaries", {templateUrl:"views/summary.html", controller:"CSCSummary"}); }]); diff --git a/trunk/research/console/js/srs.console.js b/trunk/research/console/js/srs.console.js index 08ca7b77f9..95c3a5d114 100644 --- a/trunk/research/console/js/srs.console.js +++ b/trunk/research/console/js/srs.console.js @@ -296,268 +296,18 @@ scApp.controller("CSCClient", ["$scope", "$routeParams", "MSCApi", "$sc_nav", "$ $sc_utility.log("trace", "Retrieve client info from SRS"); }]); -scApp.controller("CSCDvrs", ['$scope', '$routeParams', 'MSCApi', '$sc_nav', '$sc_utility', function($scope, $routeParams, MSCApi, $sc_nav, $sc_utility){ - $sc_nav.in_dvr(); - - $sc_utility.log("trace", "Please use DVR in streams."); -}]); - -scApp.controller("CSCDvr", ['$scope', '$routeParams', 'MSCApi', '$sc_nav', '$sc_utility', function($scope, $routeParams, MSCApi, $sc_nav, $sc_utility){ - $sc_nav.in_dvr(); - - $scope.vid = $routeParams.vid; - $scope.sid = $routeParams.sid; - $scope.app = $routeParams.app.replace('___', '/'); - $scope.stream = $routeParams.stream.replace('___', '/'); - - $sc_utility.refresh.stop(); - - $scope.dvr = function(conf) { - //console.log(apply); return; - - // submit to server. - $sc_utility.log("trace", "Submit to server for dvr apply=" + conf.value); - MSCApi.clients_update3("dvr", $scope.vid, $scope.app + '/' + $scope.stream, conf.value? 'enable':'disable', function(data){ - $sc_utility.log("trace", "Server accepted, dvr apply=" + conf.value); - conf.error = false; - }, function(){ - conf.error = true; - }); - - return true; - }; - - MSCApi.configs_get2($scope.vid, function(data){ - data.vhost.stream = $scope.stream; - data.vhost.app = $scope.app; - data.vhost.vid = $scope.vid; - data.vhost.sid = $scope.sid; - - var dvr = data.vhost.dvr; - if (!dvr) { - dvr = { - enabled: false - }; - } - if (dvr.dvr_apply) { - if (dvr.dvr_apply.length === 1 && dvr.dvr_apply[0] === "all") { - dvr.apply = true; - } else { - dvr.apply = system_array_contains(dvr.dvr_apply, $scope.app + '/' + $scope.stream); - } - } else { - dvr.apply = true; - } - console.log(data.vhost); - - $scope.global = $sc_utility.object2complex({}, data.vhost, null); - console.log($scope.global); - }); - - $sc_utility.log("trace", "Retrieve vhost config info from SRS"); -}]); - scApp.controller("CSCConfigs", ["$scope", "$location", "MSCApi", "$sc_nav", "$sc_utility", "$sc_server", function($scope, $location, MSCApi, $sc_nav, $sc_utility, $sc_server){ $sc_nav.in_configs(); $sc_utility.refresh.stop(); - $scope.support_raw_api = false; - $scope.warn_raw_api = false; - MSCApi.configs_raw(function(data){ $scope.http_api = data.http_api; - $scope.support_raw_api = $sc_utility.raw_api_enabled(data); - if (!$scope.support_raw_api) { - $scope.warn_raw_api = true; - return; - } - - MSCApi.configs_get(function(data){ - //console.log(data.global); - $scope.global = $sc_utility.object2complex({}, data.global, null); - //console.log($scope.global); - }); - }, function(data){ - $scope.warn_raw_api = true; }); - // operate vhost in client. - $scope.new_vhost = function() { - $scope.global.vhosts.push({ - editable: true - }); - }; - - $scope.edit_vhost = function(vhost) { - vhost.editable = true; - }; - - $scope.cancel_vhost = function(vhost) { - vhost.editable = false; - vhost.name = vhost.vid; - }; - - $scope.abort_vhost = function(vhost) { - system_array_remove($scope.global.vhosts, vhost); - }; - - // submit vhost to server - $scope.add_vhost = function(vhost) { - if (system_array_contains($scope.global.vhosts, function(e){ return vhost !== e && vhost.name === e.name; })) { - $sc_utility.log("warn", "vhost " + vhost.name + "已经存在"); - return; - } - - MSCApi.clients_update2("vhost", vhost.name, "create", function(data){ - $sc_utility.copy_object(vhost, data.data); - vhost.enabled = true; - vhost.editable = false; - - $sc_utility.log("trace", "创建vhost成功"); - }); - - $sc_utility.log("trace", "提交vhost到服务器"); - }; - - $scope.update_vhost = function(vhost) { - if (vhost.vid === vhost.name) { - $sc_utility.log("warn", "Vhost没有任何改变"); - return; - } - - MSCApi.clients_update3("vhost", vhost.vid, vhost.name, "update", function(data){ - vhost.vid = vhost.name; - vhost.editable = false; - $sc_utility.log("trace", "修改vhost成功"); - }); - $sc_utility.log("trace", "提交修改vhost请求到服务器"); - }; - - $scope.delete_vhost= function(vhost) { - MSCApi.clients_update2("vhost", vhost.vid, "delete", function(data){ - system_array_remove($scope.global.vhosts, vhost); - $sc_utility.log("trace", "删除vhost成功"); - }); - $sc_utility.log("trace", "提交删除vhost请求到服务器"); - }; - - $scope.disable_vhost = function(vhost) { - MSCApi.clients_update2("vhost", vhost.vid, "disable", function(data){ - vhost.enabled = false; - $sc_utility.log("trace", "禁用vhost成功"); - }); - $sc_utility.log("trace", "提交禁用vhost请求到服务器"); - }; - - $scope.enable_vhost = function(vhost) { - MSCApi.clients_update2("vhost", vhost.vid, "enable", function(data){ - vhost.enabled = true; - $sc_utility.log("trace", "启用vhost成功"); - }); - $sc_utility.log("trace", "提交启用vhost请求到服务器"); - }; - - // submit global config to server. - $scope.submit = function(conf) { - if (typeof conf.value !== "boolean" && !conf.value) { - $sc_utility.log("warn", "global." + conf.key + " should not be empty"); - return false; - } - - var v = conf.value; - if (conf.key === "listen") { - if (!system_array_foreach(v, function(e){ return e; })) { - $sc_utility.log("warn", "listen should not be empty"); - return false; - } - } else if (conf.key === "pid") { - if (!system_string_startswith(v, ['./', '/var/', '/tmp/'])) { - $sc_utility.log("warn", "pid should starts with ./, /var/ or /tmp/"); - return false; - } - if (!system_string_endswith(v, '.pid')) { - $sc_utility.log("warn", "pid should be *.pid"); - return false; - } - } else if (conf.key === "chunk_size") { - if (parseInt(v) < 128 || parseInt(v) > 65535) { - $sc_utility.log("warn", "chunk_size should in [128, 65535], value=" + v); - return false; - } - } else if (conf.key === "ff_log_dir") { - if (v !== '/dev/null' && !system_string_startswith(v, ['/var/', '/tmp/', './'])) { - $sc_utility.log("warn", "ff_log_dir should be /dev/null or in ./, /var/ or /tmp/"); - return false; - } - } else if (conf.key === "srs_log_tank") { - if (v !== "file" && v !== "console") { - $sc_utility.log("warn", "srs_log_tank should be file or console"); - return false; - } - } else if (conf.key === "srs_log_level") { - if (v !== "verbose" && v !== "info" && v !== "trace" && v !== "warn" && v !== "error") { - $sc_utility.log("warn", "srs_log_level should be verbose, info, trace, warn, error"); - return false; - } - } else if (conf.key === "srs_log_file") { - if (!system_string_startswith(v, ['./', '/var/', '/tmp/'])) { - $sc_utility.log("warn", "srs_log_file should be in ./, /var/ or /tmp/"); - return false; - } - if (!system_string_endswith(v, '.log')) { - $sc_utility.log("warn", "srs_log_file should be *.log"); - return false; - } - } else if (conf.key === "max_connections") { - if (parseInt(v) < 10 || parseInt(v) > 65535) { - $sc_utility.log("warn", "max_connections should in [10, 65535], value=" + v); - return false; - } - } else if (conf.key === "utc_time") { - if (v === undefined) { - $sc_utility.log("warn", "utc_time invalid"); - return false; - } - } else if (conf.key === "pithy_print_ms") { - if (parseInt(v) < 100 || parseInt(v) > 300000) { - $sc_utility.log("warn", "pithy_print_ms invalid"); - return false; - } - } - - // submit to server. - $sc_utility.log("trace", "Submit to server ok, " + conf.key + "=" + conf.value); - MSCApi.clients_update(conf.key, conf.value, function(data){ - $sc_utility.log("trace", "Server accepted, " + conf.key + "=" + conf.value); - conf.error = false; - - // reload the rtmp service port when port changed. - if (conf.key === "listen") { - $sc_server.init($location, MSCApi); - } - }, function(){ - conf.error = true; - }); - - return true; - }; - $sc_utility.log("trace", "Retrieve config info from SRS"); }]); -scApp.controller("CSCConfig", ["$scope", "$routeParams", "MSCApi", "$sc_nav", "$sc_utility", function($scope, $routeParams, MSCApi, $sc_nav, $sc_utility){ - $sc_nav.in_configs(); - - $sc_utility.refresh.stop(); - - MSCApi.configs_get2($routeParams.id, function(data){ - $scope.vhost = data.vhost; - }); - - $sc_utility.log("trace", "Retrieve vhost config info from SRS"); -}]); - scApp.factory("MSCApi", ["$http", "$sc_server", function($http, $sc_server){ return { versions_get: function(success) { @@ -607,38 +357,6 @@ scApp.factory("MSCApi", ["$http", "$sc_server", function($http, $sc_server){ var url = $sc_server.jsonp_query("/api/v1/raw", "rpc=query&scope=global"); $http.jsonp(url).success(success); }, - configs_get2: function(id, success) { - var url = $sc_server.jsonp_query("/api/v1/raw", "rpc=query&scope=vhost&vhost=" + id); - $http.jsonp(url).success(success); - }, - configs_get3: function(success) { - var url = $sc_server.jsonp_query("/api/v1/raw", "rpc=query&scope=minimal"); - $http.jsonp(url).success(success); - }, - clients_update: function(scope, value, success, error) { - var query = "rpc=update&scope=" + scope + "&value=" + value; - var url = $sc_server.jsonp_query("/api/v1/raw", query); - var obj = $http.jsonp(url).success(success); - if (error) { - obj.error(error); - } - }, - clients_update2: function(scope, value, param, success, error) { - var query = "rpc=update&scope=" + scope + "&value=" + value + "¶m=" + param; - var url = $sc_server.jsonp_query("/api/v1/raw", query); - var obj = $http.jsonp(url).success(success); - if (error) { - obj.error(error); - } - }, - clients_update3: function(scope, value, data, param, success, error) { - var query = "rpc=update&scope=" + scope + "&value=" + value + "¶m=" + param + "&data=" + data; - var url = $sc_server.jsonp_query("/api/v1/raw", query); - var obj = $http.jsonp(url).success(success); - if (error) { - obj.error(error); - } - } }; }]); @@ -883,9 +601,6 @@ scApp.provider("$sc_nav", function(){ in_configs: function(){ this.selected = "/configs"; }, - in_dvr: function(){ - this.selected = "/dvr"; - }, go_summary: function($location){ $location.path("/summaries"); }, @@ -970,13 +685,6 @@ scApp.provider("$sc_server", [function(){ } else { self.port = $location.port(); } - - // optional, init the rtmp port. - MSCApi.configs_get3(function(data){ - if (data.minimal) { - self.rtmp = data.minimal.listen; - } - }); } }; return self; diff --git a/trunk/research/console/js/srs.en.js b/trunk/research/console/js/srs.en.js index af9999165d..eb3e26f069 100644 --- a/trunk/research/console/js/srs.en.js +++ b/trunk/research/console/js/srs.en.js @@ -12,9 +12,6 @@ scApp.config(["$routeProvider", function($routeProvider){ .when("/clients", {templateUrl:"views/clients_en.html", controller:"CSCClients"}) .when("/clients/:id", {templateUrl:"views/client_en.html", controller:"CSCClient"}) .when("/configs", {templateUrl:"views/configs_en.html", controller:"CSCConfigs"}) - .when("/configs/:id", {templateUrl:"views/config_en.html", controller:"CSCConfig"}) - .when("/dvr", {templateUrl:"views/dvrs_en.html", controller:"CSCDvrs"}) - .when("/dvr/:vid/:sid/:app/:stream", {templateUrl:"views/dvr_en.html", controller:"CSCDvr"}) .when("/summaries", {templateUrl:"views/summary_en.html", controller:"CSCSummary"}); }]); diff --git a/trunk/research/console/ng_index.html b/trunk/research/console/ng_index.html index a7f3e16a4c..8776ab2ebd 100644 --- a/trunk/research/console/ng_index.html +++ b/trunk/research/console/ng_index.html @@ -32,7 +32,6 @@
  • 视频流
  • 客户端
  • 配置
  • -
  • DVR
  • English
  • diff --git a/trunk/research/console/views/config.html b/trunk/research/console/views/config.html deleted file mode 100644 index 503b52c05a..0000000000 --- a/trunk/research/console/views/config.html +++ /dev/null @@ -1,1007 +0,0 @@ -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.id{{vhost.id}}Vhost的统计信息,必须有访问时才会有数据.
    vhost.id{{vhost.id}}该Vhost没有任何访问客户端,无统计信息.
    vhost.enabled{{vhost.enabled| sc_filter_enabled}}Vhost是否启用。默认: {{true| sc_filter_enabled}}
    vhost.name{{vhost.name}}Vhost的名称,即客户的服务域名,或者虚拟主机名,服务器上不能重名。
    vhost.chunk_size{{vhost.chunk_size}}RTMP Chunk大小,即分包大小。默认: 全局的chunk_size
    vhost.min_latency{{vhost.min_latency| sc_filter_enabled}}是否开启最小延迟配置,将设置vhost.publish.mr=off。默认: {{false| sc_filter_enabled}}
    vhost.tcp_nodelay{{vhost.tcp_nodelay| sc_filter_enabled}}是否设置TCP_NODELAY,将包及时发送到客户端,但严重影响性能。默认: {{false| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.cluster.mode{{vhost.cluster.mode}}RTMP/FLV流集群模式的类型,local为源站,remote为边缘。默认: local
    vhost.cluster.origin{{vhost.cluster.origin}}边缘模式时,回源的源站服务器地址。
    vhost.cluster.token_traverse{{vhost.cluster.token_traverse| sc_filter_enabled}}RTMP Edge防盗链,将连接信息传递给Origin源站验证。默认: {{false| sc_filter_enabled}}
    vhost.cluster.vhost{{vhost.cluster.vhost}}边缘模式时,回源的vhost,可以改变vhost回源。
    vhost.cluster.debug_srs_upnode{{vhost.cluster.debug_srs_upnode| sc_filter_enabled}}连接上层节点时发送本节点信息,影响所有连接服务器的地方如回源。默认: {{true| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.forward.enabled{{vhost.forward.enabled| sc_filter_enabled}}是否开启Forward。默认: {{false| sc_filter_enabled}}
    vhost.forward.destination{{vhost.forward.destination}}转发的服务器列表,同时转发给这些服务器。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.play.gop_cache{{vhost.play.gop_cache| sc_filter_enabled}}是否开启GopCache,可快速启动播放。默认: {{true| sc_filter_enabled}}
    vhost.play.queue_length{{vhost.play.queue_length}}秒。队列的最大长度,超过后清空队列。默认: 30
    vhost.play.time_jitter{{vhost.play.time_jitter}}时间戳校正算法。full: 完全校正;zero: 零校正;off: 关闭。默认: full
    vhost.play.mix_correct{{vhost.play.mix_correct| sc_filter_enabled}}是否开启MixCorrect,混合单增校正算法。默认: {{false| sc_filter_enabled}}
    vhost.play.atc{{vhost.play.atc| sc_filter_enabled}}是否开启ATC,绝对时间戳。启用后将设置vhost.play.time_jitter为off。默认: {{false| sc_filter_enabled}}
    vhost.play.atc_auto{{vhost.play.atc_auto| sc_filter_enabled}}是否开启自动ATC。metadata中bravo_atc="true"时自动开启ATC。默认: {{false| sc_filter_enabled}}
    vhost.play.mw_latency{{vhost.play.mw_latency}}毫秒。合并写入延迟,同时将多少毫秒的包一次写入,writev高性能的关键配置。默认: 350
    vhost.play.send_min_interval{{vhost.play.send_min_interval}}毫秒。每个包发送的间隔。能控制发包间隔,但严重影响性能;0表示关闭。默认: 0
    vhost.play.reduce_sequence_header{{vhost.play.reduce_sequence_header| sc_filter_enabled}}是否去掉重复的SequenceHeader,有些编码器不能接收重复的sps/pps。默认: {{false| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.publish.mr{{vhost.publish.mr| sc_filter_enabled}}是否开启合并读,推流客户端较多时能提高性能。默认: {{false| sc_filter_enabled}}
    vhost.publish.mr_latency{{vhost.publish.mr_latency}}毫秒。合并读的延迟,即至少等一定毫秒才读包。默认: 350
    vhost.publish.firstpkt_timeout{{vhost.publish.firstpkt_timeout}}毫秒。发布客户端首包超时的时间。默认: 20000
    vhost.publish.normal_timeout{{vhost.publish.normal_timeout}}毫秒。发布客户端非首包超时的时间。默认: 5000
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.refer.enabled{{vhost.refer.enabled| sc_filter_enabled}}是否开启Referer防盗链机制。默认: {{false| sc_filter_enabled}}
    vhost.refer.all{{vhost.refer.all}}针对play和publish都有效的Referer设置。
    vhost.refer.play{{vhost.refer.play}}只针对play有效的Referer设置。
    vhost.refer.publish{{vhost.refer.publish}}只针对publish有效的Referer设置。
    vhost.cluster.token_traverse{{vhost.cluster.token_traverse| sc_filter_enabled}}RTMP Edge防盗链,将连接信息传递给Origin源站验证。默认: {{false| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.bandcheck.enabled{{vhost.bandcheck.enabled| sc_filter_enabled}}是否开启测速配置。默认: {{false| sc_filter_enabled}}。
    vhost.bandcheck.key{{vhost.bandcheck.key}}带宽测速的Key,客户端必须指定合法的Key才能测速。
    vhost.bandcheck.interval{{vhost.bandcheck.interval}}秒。带宽测速的间隔,低于这个间隔不提供服务。默认: 30。
    vhost.bandcheck.limit_kbps{{vhost.bandcheck.limit_kbps}}Kbps。带宽测速的上限速度。默认: 1000。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.security.enabled{{vhost.security.enabled| sc_filter_enabled}}是否开启安全设置。默认: {{false| sc_filter_enabled}}。
    vhost.security.{{allow.action}}{{allow.action}} {{allow.method}} {{allow.entry}}{{allow| sc_filter_security}}
    vhost.security.{{deny.action}}{{deny.action}} {{deny.method}} {{deny.entry}}{{deny| sc_filter_security}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.http_static.enabled{{vhost.http_static.enabled| sc_filter_enabled}}是否开启Vhost的HTTP静态配置。默认: {{false| sc_filter_enabled}}。
    vhost.http_static.mount{{vhost.http_static.mount}}Vhost特殊的挂载信息。默认: [vhost]/。
    vhost.http_static.dir{{vhost.http_static.dir}}Vhost的主目录。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.http_remux.enabled{{vhost.http_remux.enabled| sc_filter_enabled}}是否开启Vhost的HTTP流服务器配置。默认: {{false| sc_filter_enabled}}。
    vhost.http_remux.fast_cache{{vhost.http_remux.fast_cache}}秒。音频流的预缓存时间,只对aac/mp3等纯音频流有效。默认: 30。
    vhost.http_remux.mount{{vhost.http_remux.mount}}挂载点,即用户的访问路径。默认: [vhost]/[app]/[stream].flv。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.http_hooks.enabled{{vhost.http_hooks.enabled| sc_filter_enabled}}是否开启Vhost的HTTP回调配置。默认: {{false| sc_filter_enabled}}。
    vhost.http_hooks.on_connecthooks当RTMP客户端Connect时的回调,知道了tcUrl,但不知道Type和StreamName。
    vhost.http_hooks.on_closehooks当RTMP客户端Close时的回调,即断开连接时。
    vhost.http_hooks.on_publishhooks当RTMP客户端Publish时的回调,知道了类型和StreamName。
    vhost.http_hooks.on_unpublishhooks当RTMP客户端UnPublish时的回调,即停止推流。
    vhost.http_hooks.on_playhooks当RTMP客户端Play时的回调,知道了类型和StreamName。
    vhost.http_hooks.on_stophooks当RTMP客户端Stop时的回调,即停止播放时。
    vhost.http_hooks.on_dvrhooks当服务器DVR关闭文件时的回调。
    vhost.http_hooks.on_hlshooks当服务器HLS关闭TS切片文件时的回调,支持多个地址,通知系统HLS切片生成了。
    vhost.http_hooks.on_hls_notifyhooks当服务器HLS更新流信息(一般是关闭切片),只支持一个地址,可用来访问CDN做预取。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.exec.enabled{{vhost.exec.enabled| sc_filter_enabled}}是否开启Vhost的EXEC配置。默认: {{false| sc_filter_enabled}}。
    vhost.exec.publishEXEC发布流时的EXEC配置。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.hls.enabled{{vhost.hls.enabled| sc_filter_enabled}}是否支持HLS输出。默认: {{false| sc_filter_enabled}}。
    vhost.hls.hls_fragment{{vhost.hls.hls_fragment}}秒。HLS的TS切片的长度。默认: 10。
    vhost.hls.hls_td_ratio{{vhost.hls.hls_td_ratio}}HLS的#EXT-X-TARGETDURATION的值,为hls_fragment的默认倍数。默认: 1.5。
    vhost.hls.hls_aof_ratio{{vhost.hls.hls_aof_ratio}}纯音频的溢出倍数,当TS切片超过溢出时长时就生成切片。默认: 2.0。
    vhost.hls.hls_window{{vhost.hls.hls_window}}秒。HLS的TS切片的窗口,即m3u8中有多少个TS切片。默认: 60。
    vhost.hls.hls_on_error{{vhost.hls.hls_on_error}} - 错误时,ignore: 忽略并禁用HLS;disconnect: 断开推流连接; - continue: 继续再试。默认: ignore -
    vhost.hls.hls_path{{vhost.hls.hls_path}}HLS的存储目录。默认: ./objs/nginx/html。
    vhost.hls.hls_m3u8_file{{vhost.hls.hls_m3u8_file}}m3u8文件模板。默认: [app]/[stream].m3u8
    vhost.hls.hls_ts_file{{vhost.hls.hls_ts_file}}ts文件模板。默认: [app]/[stream]-[seq].ts
    vhost.hls.hls_ts_floor{{vhost.hls.hls_ts_floor| sc_filter_enabled}}是否开启TS文件名递增算法。默认: {{false| sc_filter_enabled}}
    vhost.hls.hls_entry_prefix{{vhost.hls.hls_entry_prefix}}HLS的TS切片的前缀。
    vhost.hls.hls_acodec{{vhost.hls.hls_acodec}}HLS默认的音频编码。默认: aac
    vhost.hls.hls_vcodec{{vhost.hls.hls_vcodec}}HLS默认的视频编码。默认: h264
    vhost.hls.hls_cleanup{{vhost.hls.hls_cleanup| sc_filter_enabled}}是否清理超过窗口的TS切片。默认: {{true| sc_filter_enabled}}
    vhost.hls.hls_dispose{{vhost.hls.hls_dispose}}秒。HLS没有收到数据时清理的超时时间。0表示禁用。默认: 0
    vhost.hls.hls_nb_notify{{vhost.hls.hls_nb_notify}}HLS请求on_hls_notify读取内容的最大长度。默认: 64
    vhost.hls.hls_wait_keyframe{{vhost.hls.hls_wait_keyframe| sc_filter_enabled}}关闭TS切片时是否等待关键帧。默认: {{true| sc_filter_enabled}}
    vhost.http_hooks.on_hlshooks当服务器HLS关闭TS切片文件时的回调,支持多个地址,通知系统HLS切片生成了。
    vhost.http_hooks.on_hls_notifyhooks当服务器HLS更新流信息(一般是关闭切片),只支持一个地址,可用来访问CDN做预取。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.hds.enabled{{vhost.hds.enabled| sc_filter_enabled}}是否分发HDS流。默认: {{false| sc_filter_enabled}}。
    vhost.hds.hds_fragment{{vhost.hds.hds_fragment}}秒。HDS的f4v切片的长度。默认: 10。
    vhost.hds.hds_window{{vhost.hds.hds_window}}秒。HDS的f4v切片的窗口,即f4m中有多少个f4v切片。默认: 60。
    vhost.hds.hds_path{{vhost.hds.hds_path}}HDS的存储目录。默认: ./objs/nginx/html。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.dvr.enabled{{vhost.dvr.enabled| sc_filter_enabled}}是否开启直播录制。默认: {{false| sc_filter_enabled}}。
    vhost.dvr.dvr_plan{{vhost.dvr.dvr_plan}}录制计划,session: 按Session;segment: 分段;append: 一个文件。默认: session
    vhost.dvr.dvr_applyFilters录制应用的目标,all表示所有流,app/stream指定特定的流。默认: all
    vhost.dvr.dvr_pathPATH录制文件的模板。默认: ./objs/nginx/html/[app]/[stream].[timestamp].flv
    vhost.dvr.dvr_duration{{vhost.dvr.dvr_duration}}秒。segment计划时,录制文件的时长。默认: 30
    vhost.dvr.dvr_wait_keyframe{{vhost.dvr.dvr_wait_keyframe| sc_filter_enabled}}segment计划时,关闭文件时是否等待关键帧。默认: {{true| sc_filter_enabled}}。
    vhost.dvr.time_jitter{{vhost.dvr.time_jitter}}时间戳校正算法。full: 完全校正;zero: 零校正;off: 关闭。默认: full
    vhost.http_hooks.on_dvrhooks当服务器DVR关闭文件时的回调。
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    ingest.enabled{{ingest.enabled| sc_filter_enabled}}是否开启采集。默认: {{false| sc_filter_enabled}}。
    ingest.input.type{{ingest.input.type}}采集的类型,file: 文件;stream: 流。默认: file
    ingest.input.urlURL采集的地址。
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    engine.enabled{{engine.enabled| sc_filter_enabled}}是否开启转码引擎。默认: {{false| sc_filter_enabled}}。
    engine.iformat{{engine.iformat}}引擎的输入格式,即"-i v"。默认: flv
    engine.vfilter

    -{{fk}} {{fv}}

    引擎的视频参数,譬如滤镜,在"-i"和"-vcodec"之间的参数。
    engine.vcodec{{engine.vcodec}}引擎的视频编码器,即"-vcodec v",可以是libx264,copy,vn
    engine.vbitrate{{engine.vbitrate}}Kbps。编码器输出的视频码率,即"-v:b v"。0表示跟随源。默认: 0
    engine.vfps{{engine.vfps}}fps。编码器输出的视频帧率,即"-r v"。0表示跟随源。默认: 0
    engine.vwidth{{engine.vwidth}}px。编码器输出的视频宽度,即"-s v"。0表示跟随源。默认: 0
    engine.vheight{{engine.vheight}}px。编码器输出的视频高度,即"-s v"。0表示跟随源。默认: 0
    engine.vthreads{{engine.vthreads}}编码器使用的最多线程数,即"-thread v"。默认: 1
    engine.vprofile{{engine.vprofile}}视频的编码profile,即"-profile:v v",可以是high,main,baseline
    engine.vpreset{{engine.vpreset}}视频的编码preset,即"-preset v",可以是medium,slow,slower,veryslow,placebo
    engine.vparams

    -{{fk}} {{fv}}

    引擎的视频转码参数,譬如264的参数,在"-vpreset"和"-acodec"之前的参数。
    engine.acodec{{engine.acodec}}音频编码器,即"-acodec v",可以是libfdk_aac,copy,an
    engine.abitrate{{engine.abitrate}}Kbps。编码器输出的音频码率,即"-b:a v"。0表示跟随源。默认: 0
    engine.asample_rate{{engine.asample_rate}}编码器输出的音频采样率,即"-ar v"。0表示跟随源。默认: 0
    engine.achannels{{engine.achannels}}编码器输出的音频声道,即"-ac v"。0表示跟随源。默认: 0
    engine.aparams

    -{{fk}} {{fv}}

    引擎的音频转码参数,譬如aac的参数,在"-ac"和"-f"/"-y"之前的参数。
    engine.oformat{{engine.oformat}}编码器输出的格式,可选。默认: flv
    engine.outputURL编码器输出的url,可以使用变量[vhost],[port],[app],[stream],[engine]
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    KeyValueDescription
    transcode.enabled{{transcode.enabled| sc_filter_enabled}}是否开启转码。默认: {{false| sc_filter_enabled}}。
    transcode.ffmpeg{{transcode.ffmpeg}}编码器的地址。
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    engine.enabled{{engine.enabled| sc_filter_enabled}}是否开启转码引擎。默认: {{false| sc_filter_enabled}}。
    engine.iformat{{engine.iformat}}引擎的输入格式,即"-i v"。默认: flv
    engine.vfilter

    -{{fk}} {{fv}}

    引擎的视频参数,譬如滤镜,在"-i"和"-vcodec"之间的参数。
    engine.vcodec{{engine.vcodec}}引擎的视频编码器,即"-vcodec v",可以是libx264,copy,vn
    engine.vbitrate{{engine.vbitrate}}Kbps。编码器输出的视频码率,即"-v:b v"。0表示跟随源。默认: 0
    engine.vfps{{engine.vfps}}fps。编码器输出的视频帧率,即"-r v"。0表示跟随源。默认: 0
    engine.vwidth{{engine.vwidth}}px。编码器输出的视频宽度,即"-s v"。0表示跟随源。默认: 0
    engine.vheight{{engine.vheight}}px。编码器输出的视频高度,即"-s v"。0表示跟随源。默认: 0
    engine.vthreads{{engine.vthreads}}编码器使用的最多线程数,即"-thread v"。默认: 1
    engine.vprofile{{engine.vprofile}}视频的编码profile,即"-profile:v v",可以是high,main,baseline
    engine.vpreset{{engine.vpreset}}视频的编码preset,即"-preset v",可以是medium,slow,slower,veryslow,placebo
    engine.vparams

    -{{fk}} {{fv}}

    引擎的视频转码参数,譬如264的参数,在"-vpreset"和"-acodec"之前的参数。
    engine.acodec{{engine.acodec}}音频编码器,即"-acodec v",可以是libfdk_aac,copy,an
    engine.abitrate{{engine.abitrate}}Kbps。编码器输出的音频码率,即"-b:a v"。0表示跟随源。默认: 0
    engine.asample_rate{{engine.asample_rate}}编码器输出的音频采样率,即"-ar v"。0表示跟随源。默认: 0
    engine.achannels{{engine.achannels}}编码器输出的音频声道,即"-ac v"。0表示跟随源。默认: 0
    engine.aparams

    -{{fk}} {{fv}}

    引擎的音频转码参数,譬如aac的参数,在"-ac"和"-f"/"-y"之前的参数。
    engine.oformat{{engine.oformat}}编码器输出的格式,可选。默认: flv
    engine.outputURL编码器输出的url,可以使用变量[vhost],[port],[app],[stream],[engine]
    -
    -
    -
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/trunk/research/console/views/config_en.html b/trunk/research/console/views/config_en.html deleted file mode 100644 index bbf0d0fcb1..0000000000 --- a/trunk/research/console/views/config_en.html +++ /dev/null @@ -1,1004 +0,0 @@ -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.id{{vhost.id}}Vhost statistic.
    vhost.id{{vhost.id}}No clients.
    vhost.enabled{{vhost.enabled| sc_filter_enabled}}Whether vhost is enabled. Default is {{true| sc_filter_enabled}}
    vhost.name{{vhost.name}}The name of vhost.
    vhost.chunk_size{{vhost.chunk_size}}The size of RTMP chunk. Default to global chunk size.
    vhost.min_latency{{vhost.min_latency| sc_filter_enabled}}Whether low latency enabled. Default is {{false| sc_filter_enabled}}
    vhost.tcp_nodelay{{vhost.tcp_nodelay| sc_filter_enabled}}Whether enable TCP_NODELAY. Default is {{false| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.cluster.mode{{vhost.cluster.mode}}The type of cluster, local is origin server, remote is edge. Default is local
    vhost.cluster.origin{{vhost.cluster.origin}}For edge, the upstream server address.
    vhost.cluster.token_traverse{{vhost.cluster.token_traverse| sc_filter_enabled}}For RTMP edge, traverse token to upstream to verify. Default is {{false| sc_filter_enabled}}
    vhost.cluster.vhost{{vhost.cluster.vhost}}For edge, the transform vhost to connect to upstream.
    vhost.cluster.debug_srs_upnode{{vhost.cluster.debug_srs_upnode| sc_filter_enabled}}For edge, local information to connect to upstream. Default is {{true| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.forward.enabled{{vhost.forward.enabled| sc_filter_enabled}}Whether enable forward. Default is {{false| sc_filter_enabled}}
    vhost.forward.destination{{vhost.forward.destination}}The server list to forward to.
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.play.gop_cache{{vhost.play.gop_cache| sc_filter_enabled}}Whether gop cache is enabled. Default is {{true| sc_filter_enabled}}
    vhost.play.queue_length{{vhost.play.queue_length}}The max queue length in seconds. Default is 30
    vhost.play.time_jitter{{vhost.play.time_jitter}}The time jitter algorithm, can be full, zero or off. Default is full
    vhost.play.mix_correct{{vhost.play.mix_correct| sc_filter_enabled}}Whether mix correct is enabled. Default is {{false| sc_filter_enabled}}
    vhost.play.atc{{vhost.play.atc| sc_filter_enabled}}Whether atc is enabled. Default is {{false| sc_filter_enabled}}
    vhost.play.atc_auto{{vhost.play.atc_auto| sc_filter_enabled}}Whether auto enable atc by metadata. Default is {{false| sc_filter_enabled}}
    vhost.play.mw_latency{{vhost.play.mw_latency}}Merge latency in ms. Default is 350
    vhost.play.send_min_interval{{vhost.play.send_min_interval}}Send interval in ms for each packet, 0 to disable it. Default is 0
    vhost.play.reduce_sequence_header{{vhost.play.reduce_sequence_header| sc_filter_enabled}}Whether reduce the sequence header. Default is {{false| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.publish.mr{{vhost.publish.mr| sc_filter_enabled}}Whether merged read is enabled. Default is {{false| sc_filter_enabled}}
    vhost.publish.mr_latency{{vhost.publish.mr_latency}}Merged read latency in ms. Default is 350
    vhost.publish.firstpkt_timeout{{vhost.publish.firstpkt_timeout}}The first packet timeout in ms for publisher. Default is 20000
    vhost.publish.normal_timeout{{vhost.publish.normal_timeout}}The read timeout in ms for publisher. Default is 5000
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.refer.enabled{{vhost.refer.enabled| sc_filter_enabled}}Whether referer DRM is enabled. Default is {{false| sc_filter_enabled}}
    vhost.refer.all{{vhost.refer.all}}The referer for both publisher player.
    vhost.refer.play{{vhost.refer.play}}The referer for player only.
    vhost.refer.publish{{vhost.refer.publish}}The referer for publisher only.
    vhost.cluster.token_traverse{{vhost.cluster.token_traverse| sc_filter_enabled}}The RTMP edge token tranverse, to verify token by upstream server. Default is {{false| sc_filter_enabled}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.bandcheck.enabled{{vhost.bandcheck.enabled| sc_filter_enabled}}Whether bandwidth test is enabled. Default is {{false| sc_filter_enabled}}
    vhost.bandcheck.key{{vhost.bandcheck.key}}The key for bandwidth test.
    vhost.bandcheck.interval{{vhost.bandcheck.interval}}The minimal interval in seconds. Default is 30
    vhost.bandcheck.limit_kbps{{vhost.bandcheck.limit_kbps}}The limit speed in Kbps. Default is 1000
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.security.enabled{{vhost.security.enabled| sc_filter_enabled}}Whether security is enabled. Default is {{false| sc_filter_enabled}}
    vhost.security.{{allow.action}}{{allow.action}} {{allow.method}} {{allow.entry}}{{allow| sc_filter_security}}
    vhost.security.{{deny.action}}{{deny.action}} {{deny.method}} {{deny.entry}}{{deny| sc_filter_security}}
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.http_static.enabled{{vhost.http_static.enabled| sc_filter_enabled}}Whether enable HTTP server. Default is {{false| sc_filter_enabled}}
    vhost.http_static.mount{{vhost.http_static.mount}}The HTTP mount for vhost. Default is [vhost]/
    vhost.http_static.dir{{vhost.http_static.dir}}The HTTP root directory for vhost.
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.http_remux.enabled{{vhost.http_remux.enabled| sc_filter_enabled}}Whether HTTP streaming is enabled. Default is {{false| sc_filter_enabled}}
    vhost.http_remux.fast_cache{{vhost.http_remux.fast_cache}}The pre cache for HTTP audio streaming, i.e. aac or mp3. Default is 30
    vhost.http_remux.mount{{vhost.http_remux.mount}}The mount point for HTTP streaming. Default is [vhost]/[app]/[stream].flv
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.http_hooks.enabled{{vhost.http_hooks.enabled| sc_filter_enabled}}Whether HTTP callback is enabled. Default is {{false| sc_filter_enabled}}。
    vhost.http_hooks.on_connecthooksThe callback for on_connect.
    vhost.http_hooks.on_closehooksThe callback for on_close.
    vhost.http_hooks.on_publishhooksThe callback for on_publisher.
    vhost.http_hooks.on_unpublishhooksThe callback for on_unpublish.
    vhost.http_hooks.on_playhooksThe callback for on_play.
    vhost.http_hooks.on_stophooksThe callback for on_stop.
    vhost.http_hooks.on_dvrhooksThe callback for on_dvr.
    vhost.http_hooks.on_hlshooksThe callback for on_hls.
    vhost.http_hooks.on_hls_notifyhooksThe callback for on_hls_notify.
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.exec.enabled{{vhost.exec.enabled| sc_filter_enabled}}Whether exec is enabled. Default is {{false| sc_filter_enabled}}
    vhost.exec.publishEXECThe exec config.
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.hls.enabled{{vhost.hls.enabled| sc_filter_enabled}}Whether HLS is enabled. Default is {{false| sc_filter_enabled}}
    vhost.hls.hls_fragment{{vhost.hls.hls_fragment}}The ts segment length in seconds. Default is 10
    vhost.hls.hls_td_ratio{{vhost.hls.hls_td_ratio}}The target duration, times hls_fragment. Default is 1.5
    vhost.hls.hls_aof_ratio{{vhost.hls.hls_aof_ratio}}The pure audio overflow ratio. Default is 2.0
    vhost.hls.hls_window{{vhost.hls.hls_window}}The ts segment window in seconds. Default is 60
    vhost.hls.hls_on_error{{vhost.hls.hls_on_error}}When error, SRS will ignore, disconnect or continue. Default is ignore
    vhost.hls.hls_path{{vhost.hls.hls_path}}The ts segment root directory. Default is ./objs/nginx/html
    vhost.hls.hls_m3u8_file{{vhost.hls.hls_m3u8_file}}The m3u8 file path template. Default is [app]/[stream].m3u8
    vhost.hls.hls_ts_file{{vhost.hls.hls_ts_file}}The ts segment file path template. Default is [app]/[stream]-[seq].ts
    vhost.hls.hls_ts_floor{{vhost.hls.hls_ts_floor| sc_filter_enabled}}Whether enable ts_floor algorithm. Default is {{false| sc_filter_enabled}}
    vhost.hls.hls_entry_prefix{{vhost.hls.hls_entry_prefix}}The ts segment prefix.
    vhost.hls.hls_acodec{{vhost.hls.hls_acodec}}The default audio codec. Default is aac
    vhost.hls.hls_vcodec{{vhost.hls.hls_vcodec}}The default video codec. Default is h264
    vhost.hls.hls_cleanup{{vhost.hls.hls_cleanup| sc_filter_enabled}}Whether cleanup ts segments not in window. Default is {{true| sc_filter_enabled}}
    vhost.hls.hls_dispose{{vhost.hls.hls_dispose}}The max timeout in seconds to dispose ts segments when no stream, 0 means never dispose. Default is 0
    vhost.hls.hls_nb_notify{{vhost.hls.hls_nb_notify}}The max reading size for on_hls_notify. Default is 64
    vhost.hls.hls_wait_keyframe{{vhost.hls.hls_wait_keyframe| sc_filter_enabled}}Whether wait keyframe when closing segment. Default is {{true| sc_filter_enabled}}
    vhost.http_hooks.on_hlshooksThe HTTP callback for on_hls.
    vhost.http_hooks.on_hls_notifyhooksThe HTTP callback for on_hls_notify, to pre cache HLS.
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.hds.enabled{{vhost.hds.enabled| sc_filter_enabled}}Whether HDS is enabled. Default is {{false| sc_filter_enabled}}
    vhost.hds.hds_fragment{{vhost.hds.hds_fragment}}The f4v segment length in seconds. Default is 10
    vhost.hds.hds_window{{vhost.hds.hds_window}}The f4v segment window in seconds. Default is 60
    vhost.hds.hds_path{{vhost.hds.hds_path}}The HDS root directory. Default is ./objs/nginx/html
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    vhost.dvr.enabled{{vhost.dvr.enabled| sc_filter_enabled}}Whether DVR is enabled. Default is {{false| sc_filter_enabled}}
    vhost.dvr.dvr_plan{{vhost.dvr.dvr_plan}}The record plan, can be session, segment or append. Default is session
    vhost.dvr.dvr_applyFiltersThe DVR plan apply to, all or app/stream. Default is all
    vhost.dvr.dvr_pathPATHThe DVR file path template. Default is ./objs/nginx/html/[app]/[stream].[timestamp].flv
    vhost.dvr.dvr_duration{{vhost.dvr.dvr_duration}}The record segment duration in seconds. Default is 30
    vhost.dvr.dvr_wait_keyframe{{vhost.dvr.dvr_wait_keyframe| sc_filter_enabled}}Whether wait for keyframe when closing record file. Default is {{true| sc_filter_enabled}}
    vhost.dvr.time_jitter{{vhost.dvr.time_jitter}}The time jitter algorithm for DVR, can be full, zero or off. Default is full
    vhost.http_hooks.on_dvrhooksThe HTTP callback for on_dvr.
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    ingest.enabled{{ingest.enabled| sc_filter_enabled}}Whether ingest is enabled. Default is {{false| sc_filter_enabled}}
    ingest.input.type{{ingest.input.type}}The ingest type, can be file or stream. Default is file
    ingest.input.urlURLThe url of ingest file or stream.
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    engine.enabled{{engine.enabled| sc_filter_enabled}}Whether transcode is enabled. Default is {{false| sc_filter_enabled}}
    engine.iformat{{engine.iformat}}The input format, ffmpeg params "-i v". Default is flv
    engine.vfilter

    -{{fk}} {{fv}}

    The video param, ffmpeg params between "-i" and "-vcodec".
    engine.vcodec{{engine.vcodec}}The video codec, ffmpeg params "-vcodec v", can be libx264, copy or vn.
    engine.vbitrate{{engine.vbitrate}}The video bitrate in Kbps, ffmpeg params "-v:b v", 0 to follow source. Default is 0
    engine.vfps{{engine.vfps}}The video fps, ffmpeg params "-r v", 0 to follow source. Default is 0
    engine.vwidth{{engine.vwidth}}The video width in px, ffmpeg params "-s v", 0 to follow source. Default is 0
    engine.vheight{{engine.vheight}}The video height in px, ffmpeg params "-s v", 0 to follow source. Default is 0
    engine.vthreads{{engine.vthreads}}The encode threads, ffmpeg params "-thread v". Default is 1
    engine.vprofile{{engine.vprofile}}The video profile, ffmpeg params "-profile:v v", can be high, main or baseline.
    engine.vpreset{{engine.vpreset}}The video preset, ffmpeg params "-preset v", can be medium, slow, slower, veryslow or placebo
    engine.vparams

    -{{fk}} {{fv}}

    The video transcode params, between ffmpeg params "-vpreset" and "-acodec".
    engine.acodec{{engine.acodec}}The audio encoder, ffmpeg params "-acodec v", can be libfdk_aac, copy or an
    engine.abitrate{{engine.abitrate}}The audio bitrate in Kbps, ffmepg params "-b:a v", 0 to follow source. Default is 0
    engine.asample_rate{{engine.asample_rate}}The audio sample rate, ffmpeg params "-ar v", 0 to follow source. Default is 0
    engine.achannels{{engine.achannels}}The audio channel count, ffmpeg params "-ac v", 0 to follow source. Default is 0
    engine.aparams

    -{{fk}} {{fv}}

    The audio transcode params, between ffmpeg params "-ac" and "-f"/"-y"
    engine.oformat{{engine.oformat}}The output format. Default is flv
    engine.outputURLThe output url, which may include variables [vhost], [port], [app], [stream], [engine]
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - -
    KeyValueDescription
    transcode.enabled{{transcode.enabled| sc_filter_enabled}}Whether transcode is enabled. Default is {{false| sc_filter_enabled}}
    transcode.ffmpeg{{transcode.ffmpeg}}The binary path of encoder.
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescription
    engine.enabled{{engine.enabled| sc_filter_enabled}}Whether transcode is enabled. Default is {{false| sc_filter_enabled}}
    engine.iformat{{engine.iformat}}The input format, ffmpeg params "-i v". Default is flv
    engine.vfilter

    -{{fk}} {{fv}}

    The video param, ffmpeg params between "-i" and "-vcodec".
    engine.vcodec{{engine.vcodec}}The video codec, ffmpeg params "-vcodec v", can be libx264, copy or vn.
    engine.vbitrate{{engine.vbitrate}}The video bitrate in Kbps, ffmpeg params "-v:b v", 0 to follow source. Default is 0
    engine.vfps{{engine.vfps}}The video fps, ffmpeg params "-r v", 0 to follow source. Default is 0
    engine.vwidth{{engine.vwidth}}The video width in px, ffmpeg params "-s v", 0 to follow source. Default is 0
    engine.vheight{{engine.vheight}}The video height in px, ffmpeg params "-s v", 0 to follow source. Default is 0
    engine.vthreads{{engine.vthreads}}The encode threads, ffmpeg params "-thread v". Default is 1
    engine.vprofile{{engine.vprofile}}The video profile, ffmpeg params "-profile:v v", can be high, main or baseline.
    engine.vpreset{{engine.vpreset}}The video preset, ffmpeg params "-preset v", can be medium, slow, slower, veryslow or placebo
    engine.vparams

    -{{fk}} {{fv}}

    The video transcode params, between ffmpeg params "-vpreset" and "-acodec".
    engine.acodec{{engine.acodec}}The audio encoder, ffmpeg params "-acodec v", can be libfdk_aac, copy or an
    engine.abitrate{{engine.abitrate}}The audio bitrate in Kbps, ffmepg params "-b:a v", 0 to follow source. Default is 0
    engine.asample_rate{{engine.asample_rate}}The audio sample rate, ffmpeg params "-ar v", 0 to follow source. Default is 0
    engine.achannels{{engine.achannels}}The audio channel count, ffmpeg params "-ac v", 0 to follow source. Default is 0
    engine.aparams

    -{{fk}} {{fv}}

    The audio transcode params, between ffmpeg params "-ac" and "-f"/"-y"
    engine.oformat{{engine.oformat}}The output format. Default is flv
    engine.outputURLThe output url, which may include variables [vhost], [port], [app], [stream], [engine]
    -
    -
    -
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/trunk/research/console/views/configs.html b/trunk/research/console/views/configs.html index 23b9dc390a..ce1bf6f5d2 100644 --- a/trunk/research/console/views/configs.html +++ b/trunk/research/console/views/configs.html @@ -8,10 +8,10 @@
    -
    - 该服务器不支持HTTP RAW API,或者配置中禁用了该功能。参考WIKI。 +
    + SRS 4.0不再支持HTTP RAW API。参考#2653
    - +
    @@ -43,410 +43,5 @@ -
    Key Value
    - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - 主机名称开启DVRHTTPFLVHLSHDS回调ExecBWT转发安全盗链MRRTCGOPTcpNoDelayMixCorrectTimeJitterATC转码采集 - 添加 -
    {{vhost.id}}无流 - {{vhost.name}} - -
    - 请输入vhost的名称。 -
    -
    {{vhost.enabled| sc_filter_yesno}}{{vhost.origin| sc_filter_yn}}{{vhost.dvr| sc_filter_yn}}{{vhost.http_static| sc_filter_yn}}{{vhost.http_remux| sc_filter_yn}}{{vhost.hls| sc_filter_yn}}{{vhost.hds| sc_filter_yn}}{{vhost.http_hooks| sc_filter_yn}}{{vhost.exec| sc_filter_yn}}{{vhost.bandcheck| sc_filter_yn}}{{vhost.forward| sc_filter_yn}}{{vhost.security| sc_filter_yn}}{{vhost.refer| sc_filter_yn}}{{vhost.mr| sc_filter_yn}}{{vhost.min_latency| sc_filter_yn}}{{vhost.gop_cache| sc_filter_yn}}{{vhost.tcp_nodelay| sc_filter_yn}}{{vhost.mix_correct| sc_filter_yn}}{{vhost.time_jitter| sc_filter_yn}}{{vhost.atc| sc_filter_yn}}{{vhost.transcode| sc_filter_yn}}{{vhost.ingest| sc_filter_yn}} - - - - - 提交 - - 放弃 - - - - - 提交 - - 放弃 - - - - - 编辑 - - 禁用 - - 删除 - - - 编辑 - - 启用 - - - 删除 - - - 详细 - -
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    \ No newline at end of file diff --git a/trunk/research/console/views/configs_en.html b/trunk/research/console/views/configs_en.html index a90d5514fb..61e6635641 100644 --- a/trunk/research/console/views/configs_en.html +++ b/trunk/research/console/views/configs_en.html @@ -8,10 +8,10 @@
    -
    - HTTP RAW API is not supported or disabled. Read WIKI。 +
    + HTTP RAW API is removed, please read #2653
    - +
    @@ -43,410 +43,5 @@ -
    Key Value
    - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - NameEODHFLVHLSHDSCBExecBWTFSRefererMRRTCGOPTcpNoDelayMixCorrectTimeJitterATCTI - Add -
    {{vhost.id}}No Stream - {{vhost.name}} - -
    - Please input vhost name. -
    -
    {{vhost.enabled| sc_filter_yesno}}{{vhost.origin| sc_filter_yn}}{{vhost.dvr| sc_filter_yn}}{{vhost.http_static| sc_filter_yn}}{{vhost.http_remux| sc_filter_yn}}{{vhost.hls| sc_filter_yn}}{{vhost.hds| sc_filter_yn}}{{vhost.http_hooks| sc_filter_yn}}{{vhost.exec| sc_filter_yn}}{{vhost.bandcheck| sc_filter_yn}}{{vhost.forward| sc_filter_yn}}{{vhost.security| sc_filter_yn}}{{vhost.refer| sc_filter_yn}}{{vhost.mr| sc_filter_yn}}{{vhost.min_latency| sc_filter_yn}}{{vhost.gop_cache| sc_filter_yn}}{{vhost.tcp_nodelay| sc_filter_yn}}{{vhost.mix_correct| sc_filter_yn}}{{vhost.time_jitter| sc_filter_yn}}{{vhost.atc| sc_filter_yn}}{{vhost.transcode| sc_filter_yn}}{{vhost.ingest| sc_filter_yn}} - - - - - Submit - - Cancel - - - - - Submit - - Cancel - - - - - Update - - Disable - - Delete - - - 编辑 - - Enable - - - Delete - - - Detail - -
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    \ No newline at end of file diff --git a/trunk/research/console/views/dvr.html b/trunk/research/console/views/dvr.html deleted file mode 100644 index 61f6a53255..0000000000 --- a/trunk/research/console/views/dvr.html +++ /dev/null @@ -1,62 +0,0 @@ -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/trunk/research/console/views/dvr_en.html b/trunk/research/console/views/dvr_en.html deleted file mode 100644 index cd4f5058ef..0000000000 --- a/trunk/research/console/views/dvr_en.html +++ /dev/null @@ -1,62 +0,0 @@ -
    -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyValueDescriptionOpt
    -
    -
    -
    -
    -
    \ No newline at end of file diff --git a/trunk/research/console/views/dvrs.html b/trunk/research/console/views/dvrs.html deleted file mode 100644 index 1eb6cf4afa..0000000000 --- a/trunk/research/console/views/dvrs.html +++ /dev/null @@ -1 +0,0 @@ -DVR信息请在每个Stream中单独配置, 请前往Streams配置。 \ No newline at end of file diff --git a/trunk/research/console/views/dvrs_en.html b/trunk/research/console/views/dvrs_en.html deleted file mode 100644 index df452625f2..0000000000 --- a/trunk/research/console/views/dvrs_en.html +++ /dev/null @@ -1 +0,0 @@ -Please config DVR in each stream by here. \ No newline at end of file diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 9d4fdbabff..030831a9ad 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -2056,1142 +2056,28 @@ srs_error_t SrsConfig::do_persistence(SrsFileWriter* fw) return err; } -srs_error_t SrsConfig::minimal_to_json(SrsJsonObject* obj) -{ - srs_error_t err = srs_success; - - for (int i = 0; i < (int)root->directives.size(); i++) { - SrsConfDirective* dir = root->directives.at(i); - if (dir->is_vhost()) { - continue; - } - - if (dir->name == "listen") { - obj->set(dir->name, dir->dumps_args()); - } - } - - return err; -} - -srs_error_t SrsConfig::global_to_json(SrsJsonObject* obj) -{ - srs_error_t err = srs_success; - - for (int i = 0; i < (int)root->directives.size(); i++) { - SrsConfDirective* dir = root->directives.at(i); - if (dir->is_vhost()) { - continue; - } - - if (dir->name == "listen") { - obj->set(dir->name, dir->dumps_args()); - } else if (dir->name == "pid") { - obj->set(dir->name, dir->dumps_arg0_to_str()); - } else if (dir->name == "chunk_size") { - obj->set(dir->name, dir->dumps_arg0_to_integer()); - } else if (dir->name == "ff_log_dir") { - obj->set(dir->name, dir->dumps_arg0_to_str()); - } else if (dir->name == "srs_log_tank") { - obj->set(dir->name, dir->dumps_arg0_to_str()); - } else if (dir->name == "srs_log_level") { - obj->set(dir->name, dir->dumps_arg0_to_str()); - } else if (dir->name == "srs_log_file") { - obj->set(dir->name, dir->dumps_arg0_to_str()); - } else if (dir->name == "max_connections") { - obj->set(dir->name, dir->dumps_arg0_to_integer()); - } else if (dir->name == "daemon") { - obj->set(dir->name, dir->dumps_arg0_to_boolean()); - } else if (dir->name == "utc_time") { - obj->set(dir->name, dir->dumps_arg0_to_boolean()); - } else if (dir->name == "pithy_print_ms") { - obj->set(dir->name, dir->dumps_arg0_to_integer()); - } else if (dir->name == "heartbeat") { - SrsJsonObject* sobj = SrsJsonAny::object(); - for (int j = 0; j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - if (sdir->name == "enabled") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "interval") { - sobj->set(sdir->name, sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "url") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "device_id") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "summaries") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } - } - obj->set(dir->name, sobj); - } else if (dir->name == "stats") { - SrsJsonObject* sobj = SrsJsonAny::object(); - for (int j = 0; j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - if (sdir->name == "network") { - sobj->set(sdir->name, sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "disk") { - sobj->set(sdir->name, sdir->dumps_args()); - } - } - obj->set(dir->name, sobj); - } else if (dir->name == "http_api") { - SrsJsonObject* sobj = SrsJsonAny::object(); - for (int j = 0; j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - if (sdir->name == "enabled") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "listen") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "crossdomain") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "raw_api") { - SrsJsonObject* ssobj = SrsJsonAny::object(); - sobj->set(sdir->name, ssobj); - - for (int j = 0; j < (int)sdir->directives.size(); j++) { - SrsConfDirective* ssdir = sdir->directives.at(j); - if (ssdir->name == "enabled") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); - } else if (ssdir->name == "allow_reload") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); - } else if (ssdir->name == "allow_query") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); - } else if (ssdir->name == "allow_update") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); - } - } - } - } - obj->set(dir->name, sobj); - } else if (dir->name == "http_server") { - SrsJsonObject* sobj = SrsJsonAny::object(); - for (int j = 0; j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - if (sdir->name == "enabled") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "listen") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "dir") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } - } - obj->set(dir->name, sobj); - } else if (dir->name == "stream_caster") { - SrsJsonObject* sobj = SrsJsonAny::object(); - for (int j = 0; j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - if (sdir->name == "enabled") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "caster") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "output") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "listen") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "rtp_port_min") { - sobj->set(sdir->name, sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "rtp_port_max") { - sobj->set(sdir->name, sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "rtp_idle_timeout") { - sobj->set(sdir->name, sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "audio_enable") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "jitterbuffer_enable") { - sobj->set(sdir->name, sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "host") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "wait_keyframe") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "auto_create_channel") { - sobj->set(sdir->name, sdir->dumps_arg0_to_str()); - } else if (sdir->name == "sip"){ - SrsJsonObject* ssobj = SrsJsonAny::object(); - sobj->set(sdir->name, ssobj); - - for (int j = 0; j < (int)sdir->directives.size(); j++) { - SrsConfDirective* ssdir = sdir->directives.at(j); - if (ssdir->name == "enabled") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); - } else if (ssdir->name == "listen") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_integer()); - } else if (ssdir->name == "serial") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_str()); - } else if (ssdir->name == "realm") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_str()); - } else if (ssdir->name == "ack_timeout") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_integer()); - } else if (ssdir->name == "keepalive_timeout") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_integer()); - } else if (ssdir->name == "auto_play") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); - } else if (ssdir->name == "invite_port_fixed") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); - } else if (ssdir->name == "query_catalog_interval") { - ssobj->set(ssdir->name, ssdir->dumps_arg0_to_integer()); - } - } - }//end if - }//end for - obj->set(dir->name, sobj); - } else { - continue; - } - } - - SrsJsonObject* sobjs = SrsJsonAny::object(); - int nb_vhosts = 0; - - SrsStatistic* stat = SrsStatistic::instance(); - for (int i = 0; i < (int)root->directives.size(); i++) { - SrsConfDirective* dir = root->directives.at(i); - if (!dir->is_vhost()) { - continue; - } - - nb_vhosts++; - SrsJsonObject* sobj = SrsJsonAny::object(); - sobjs->set(dir->arg0(), sobj); - - SrsStatisticVhost* svhost = stat->find_vhost_by_name(dir->arg0()); - if (!svhost) { - continue; - } - sobj->set("id", SrsJsonAny::str(svhost->id.c_str())); - sobj->set("name", dir->dumps_arg0_to_str()); - sobj->set("enabled", SrsJsonAny::boolean(get_vhost_enabled(dir->arg0()))); - - if (get_dvr_enabled(dir->arg0())) { - sobj->set("dvr", SrsJsonAny::boolean(true)); - } - if (get_vhost_http_enabled(dir->arg0())) { - sobj->set("http_static", SrsJsonAny::boolean(true)); - } - if (get_vhost_http_remux_enabled(dir->arg0())) { - sobj->set("http_remux", SrsJsonAny::boolean(true)); - } - if (get_hls_enabled(dir->arg0())) { - sobj->set("hls", SrsJsonAny::boolean(true)); - } - if (get_hds_enabled(dir->arg0())) { - sobj->set("hds", SrsJsonAny::boolean(true)); - } - if (get_vhost_http_hooks(dir->arg0())) { - sobj->set("http_hooks", SrsJsonAny::boolean(true)); - } - if (get_exec_enabled(dir->arg0())) { - sobj->set("exec", SrsJsonAny::boolean(true)); - } - if (get_bw_check_enabled(dir->arg0())) { - sobj->set("bandcheck", SrsJsonAny::boolean(true)); - } - if (!get_vhost_is_edge(dir->arg0())) { - sobj->set("origin", SrsJsonAny::boolean(true)); - } - if (get_forward_enabled(dir->arg0())) { - sobj->set("forward", SrsJsonAny::boolean(true)); - } - - if (get_security_enabled(dir->arg0())) { - sobj->set("security", SrsJsonAny::boolean(true)); - } - if (get_refer_enabled(dir->arg0())) { - sobj->set("refer", SrsJsonAny::boolean(true)); - } - - if (get_mr_enabled(dir->arg0())) { - sobj->set("mr", SrsJsonAny::boolean(true)); - } - if (get_realtime_enabled(dir->arg0())) { - sobj->set("min_latency", SrsJsonAny::boolean(true)); - } - if (get_gop_cache(dir->arg0())) { - sobj->set("gop_cache", SrsJsonAny::boolean(true)); - } - if (get_tcp_nodelay(dir->arg0())) { - sobj->set("tcp_nodelay", SrsJsonAny::boolean(true)); - } - - if (get_mix_correct(dir->arg0())) { - sobj->set("mix_correct", SrsJsonAny::boolean(true)); - } - if (get_time_jitter(dir->arg0()) != SrsRtmpJitterAlgorithmOFF) { - sobj->set("time_jitter", SrsJsonAny::boolean(true)); - } - if (get_atc(dir->arg0())) { - sobj->set("atc", SrsJsonAny::boolean(true)); - } - - bool has_transcode = false; - for (int j = 0; !has_transcode && j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - if (sdir->name != "transcode") { - continue; - } - - if (!get_transcode_enabled(sdir)) { - continue; - } - - for (int k = 0; !has_transcode && k < (int)sdir->directives.size(); k++) { - SrsConfDirective* ssdir = sdir->directives.at(k); - if (ssdir->name != "engine") { - continue; - } - - if (get_engine_enabled(ssdir)) { - has_transcode = true; - break; - } - } - } - if (has_transcode) { - sobj->set("transcode", SrsJsonAny::boolean(has_transcode)); - } - - bool has_ingest = false; - for (int j = 0; !has_ingest && j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - if (sdir->name != "ingest") { - continue; - } - - if (get_ingest_enabled(sdir)) { - has_ingest = true; - break; - } - } - if (has_ingest) { - sobj->set("ingest", SrsJsonAny::boolean(has_ingest)); - } - } - - obj->set("nb_vhosts", SrsJsonAny::integer(nb_vhosts)); - obj->set("vhosts", sobjs); - - return err; -} - -srs_error_t SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsJsonObject* obj) -{ - srs_error_t err = srs_success; - - SrsConfDirective* dir = NULL; - - // always present in vhost. - SrsStatistic* stat = SrsStatistic::instance(); - - SrsStatisticVhost* svhost = stat->find_vhost_by_name(vhost->arg0()); - if (!svhost) { - return err; - } - obj->set("id", SrsJsonAny::str(svhost->id.c_str())); - - obj->set("name", vhost->dumps_arg0_to_str()); - obj->set("enabled", SrsJsonAny::boolean(get_vhost_enabled(vhost))); - - // vhost scope configs. - if ((dir = vhost->get("chunk_size")) != NULL) { - obj->set("chunk_size", dir->dumps_arg0_to_integer()); - } - if ((dir = vhost->get("min_latency")) != NULL) { - obj->set("min_latency", dir->dumps_arg0_to_boolean()); - } - if ((dir = vhost->get("tcp_nodelay")) != NULL) { - obj->set("tcp_nodelay", dir->dumps_arg0_to_boolean()); - } - - // cluster. - if ((dir = vhost->get("cluster")) != NULL) { - SrsJsonObject* cluster = SrsJsonAny::object(); - obj->set("cluster", cluster); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "mode") { - cluster->set("mode", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "origin") { - cluster->set("origin", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "token_traverse") { - cluster->set("token_traverse", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "vhost") { - cluster->set("vhost", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "debug_srs_upnode") { - cluster->set("debug_srs_upnode", sdir->dumps_arg0_to_boolean()); - } - } - } - - // forward - if ((dir = vhost->get("forward")) != NULL) { - SrsJsonObject* forward = SrsJsonAny::object(); - obj->set("forward", forward); - - forward->set("enabled", SrsJsonAny::boolean(get_forward_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "destination") { - forward->set("destination", sdir->dumps_args()); - } - } - } - - // play - if ((dir = vhost->get("play")) != NULL) { - SrsJsonObject* play = SrsJsonAny::object(); - obj->set("play", play); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "time_jitter") { - play->set("time_jitter", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "mix_correct") { - play->set("mix_correct", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "atc") { - play->set("atc", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "atc_auto") { - play->set("atc_auto", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "mw_latency") { - play->set("mw_latency", sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "gop_cache") { - play->set("gop_cache", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "queue_length") { - play->set("queue_length", sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "reduce_sequence_header") { - play->set("reduce_sequence_header", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "send_min_interval") { - play->set("send_min_interval", sdir->dumps_arg0_to_integer()); - } - } - } - - // publish - if ((dir = vhost->get("publish")) != NULL) { - SrsJsonObject* publish = SrsJsonAny::object(); - obj->set("publish", publish); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "mr") { - publish->set("mr", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "mr_latency") { - publish->set("mr_latency", sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "firstpkt_timeout") { - publish->set("firstpkt_timeout", sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "normal_timeout") { - publish->set("normal_timeout", sdir->dumps_arg0_to_integer()); - } - } - } - - // refer - if ((dir = vhost->get("refer")) != NULL) { - SrsJsonObject* refer = SrsJsonAny::object(); - obj->set("refer", refer); - - refer->set("enabled", SrsJsonAny::boolean(get_refer_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "all") { - refer->set("all", sdir->dumps_args()); - } else if (sdir->name == "publish") { - refer->set("publish", sdir->dumps_args()); - } else if (sdir->name == "play") { - refer->set("play", sdir->dumps_args()); - } - } - } - - // bandcheck - if ((dir = vhost->get("bandcheck")) != NULL) { - SrsJsonObject* bandcheck = SrsJsonAny::object(); - obj->set("bandcheck", bandcheck); - - bandcheck->set("enabled", SrsJsonAny::boolean(get_bw_check_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "key") { - bandcheck->set("key", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "interval") { - bandcheck->set("interval", sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "limit_kbps") { - bandcheck->set("limit_kbps", sdir->dumps_arg0_to_integer()); - } - } - } - - // security - if ((dir = vhost->get("security")) != NULL) { - SrsJsonObject* security = SrsJsonAny::object(); - obj->set("security", security); - - security->set("enabled", SrsJsonAny::boolean(get_security_enabled(vhost->name))); - - SrsJsonArray* allows = SrsJsonAny::array(); - security->set("allows", allows); - - SrsJsonArray* denies = SrsJsonAny::array(); - security->set("denies", denies); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "allow") { - SrsJsonObject* allow = SrsJsonAny::object(); - allow->set("action", SrsJsonAny::str(sdir->name.c_str())); - allow->set("method", SrsJsonAny::str(sdir->arg0().c_str())); - allow->set("entry", SrsJsonAny::str(sdir->arg1().c_str())); - allows->append(allow); - } else if (sdir->name == "deny") { - SrsJsonObject* deny = SrsJsonAny::object(); - deny->set("action", SrsJsonAny::str(sdir->name.c_str())); - deny->set("method", SrsJsonAny::str(sdir->arg0().c_str())); - deny->set("entry", SrsJsonAny::str(sdir->arg1().c_str())); - denies->append(deny); - } - } - } - - // http_static - if ((dir = vhost->get("http_static")) != NULL) { - SrsJsonObject* http_static = SrsJsonAny::object(); - obj->set("http_static", http_static); - - http_static->set("enabled", SrsJsonAny::boolean(get_vhost_http_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "mount") { - http_static->set("mount", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "dir") { - http_static->set("dir", sdir->dumps_arg0_to_str()); - } - } - } - - // http_remux - if ((dir = vhost->get("http_remux")) != NULL) { - SrsJsonObject* http_remux = SrsJsonAny::object(); - obj->set("http_remux", http_remux); - - http_remux->set("enabled", SrsJsonAny::boolean(get_vhost_http_remux_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "fast_cache") { - http_remux->set("fast_cache", sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "mount") { - http_remux->set("mount", sdir->dumps_arg0_to_str()); - } - } - } - - // http_hooks - if ((dir = vhost->get("http_hooks")) != NULL) { - SrsJsonObject* http_hooks = SrsJsonAny::object(); - obj->set("http_hooks", http_hooks); - - http_hooks->set("enabled", SrsJsonAny::boolean(get_vhost_http_hooks_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "on_connect") { - http_hooks->set("on_connect", sdir->dumps_args()); - } else if (sdir->name == "on_close") { - http_hooks->set("on_close", sdir->dumps_args()); - } else if (sdir->name == "on_publish") { - http_hooks->set("on_publish", sdir->dumps_args()); - } else if (sdir->name == "on_unpublish") { - http_hooks->set("on_unpublish", sdir->dumps_args()); - } else if (sdir->name == "on_play") { - http_hooks->set("on_play", sdir->dumps_args()); - } else if (sdir->name == "on_stop") { - http_hooks->set("on_stop", sdir->dumps_args()); - } else if (sdir->name == "on_dvr") { - http_hooks->set("on_dvr", sdir->dumps_args()); - } else if (sdir->name == "on_hls") { - http_hooks->set("on_hls", sdir->dumps_args()); - } else if (sdir->name == "on_hls_notify") { - http_hooks->set("on_hls_notify", sdir->dumps_arg0_to_str()); - } - } - } - - // hls - if ((dir = vhost->get("hls")) != NULL) { - SrsJsonObject* hls = SrsJsonAny::object(); - obj->set("hls", hls); - - hls->set("enabled", SrsJsonAny::boolean(get_hls_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "hls_fragment") { - hls->set("hls_fragment", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hls_td_ratio") { - hls->set("hls_td_ratio", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hls_aof_ratio") { - hls->set("hls_aof_ratio", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hls_window") { - hls->set("hls_window", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hls_on_error") { - hls->set("hls_on_error", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_storage") { - hls->set("hls_storage", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_path") { - hls->set("hls_path", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_m3u8_file") { - hls->set("hls_m3u8_file", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_ts_file") { - hls->set("hls_ts_file", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_ts_floor") { - hls->set("hls_ts_floor", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "hls_entry_prefix") { - hls->set("hls_entry_prefix", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_mount") { - hls->set("hls_mount", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_acodec") { - hls->set("hls_acodec", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_vcodec") { - hls->set("hls_vcodec", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_cleanup") { - hls->set("hls_cleanup", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "hls_dispose") { - hls->set("hls_dispose", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hls_nb_notify") { - hls->set("hls_nb_notify", sdir->dumps_arg0_to_integer()); - } else if (sdir->name == "hls_dts_directly") { - hls->set("hls_dts_directly", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "hls_wait_keyframe") { - hls->set("hls_wait_keyframe", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "hls_keys") { - hls->set("hls_keys", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "hls_fragments_per_key") { - hls->set("hls_fragments_per_key", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hls_key_file") { - hls->set("hls_key_file", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_key_file_path") { - hls->set("hls_key_file_path", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "hls_key_url") { - hls->set("hls_key_url", sdir->dumps_arg0_to_str()); - } - } - } - - // hds - if ((dir = vhost->get("hds")) != NULL) { - SrsJsonObject* hds = SrsJsonAny::object(); - obj->set("hds", hds); - - hds->set("enabled", SrsJsonAny::boolean(get_hds_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "hds_fragment") { - hds->set("hds_fragment", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hds_window") { - hds->set("hds_window", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "hds_path") { - hds->set("hds_path", sdir->dumps_arg0_to_str()); - } - } - } - - // dvr - if ((dir = vhost->get("dvr")) != NULL) { - SrsJsonObject* dvr = SrsJsonAny::object(); - obj->set("dvr", dvr); - - dvr->set("enabled", SrsJsonAny::boolean(get_dvr_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "dvr_plan") { - dvr->set("dvr_plan", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "dvr_apply") { - dvr->set("dvr_apply", sdir->dumps_args()); - } else if (sdir->name == "dvr_path") { - dvr->set("dvr_path", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "dvr_duration") { - dvr->set("dvr_duration", sdir->dumps_arg0_to_number()); - } else if (sdir->name == "dvr_wait_keyframe") { - dvr->set("dvr_wait_keyframe", sdir->dumps_arg0_to_boolean()); - } else if (sdir->name == "time_jitter") { - dvr->set("time_jitter", sdir->dumps_arg0_to_str()); - } - } - } - - // exec - if ((dir = vhost->get("exec")) != NULL) { - SrsJsonObject* ng_exec = SrsJsonAny::object(); - obj->set("exec", ng_exec); - - ng_exec->set("enabled", SrsJsonAny::boolean(get_exec_enabled(vhost->name))); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "publish") { - ng_exec->set("publish", sdir->dumps_args()); - } - } - } - - // ingest - SrsJsonArray* ingests = NULL; - for (int i = 0; i < (int)vhost->directives.size(); i++) { - dir = vhost->directives.at(i); - if (dir->name != "ingest") { - continue; - } - - if (!ingests) { - ingests = SrsJsonAny::array(); - obj->set("ingests", ingests); - } - - SrsJsonObject* ingest = SrsJsonAny::object(); - ingest->set("id", dir->dumps_arg0_to_str()); - ingest->set("enabled", SrsJsonAny::boolean(get_ingest_enabled(dir))); - ingests->append(ingest); - - for (int j = 0; j < (int)dir->directives.size(); j++) { - SrsConfDirective* sdir = dir->directives.at(j); - - if (sdir->name == "input") { - SrsJsonObject* input = SrsJsonAny::object(); - ingest->set("input", input); - - SrsConfDirective* type = sdir->get("type"); - if (type) { - input->set("type", type->dumps_arg0_to_str()); - } - - SrsConfDirective* url = sdir->get("url"); - if (url) { - input->set("url", url->dumps_arg0_to_str()); - } - } else if (sdir->name == "ffmpeg") { - ingest->set("ffmpeg", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "engine") { - SrsJsonObject* engine = SrsJsonAny::object(); - ingest->set("engine", engine); - - if ((err = srs_config_dumps_engine(sdir, engine)) != srs_success) { - return srs_error_wrap(err, "dump engine"); - } - } - } - } - - // transcode - SrsJsonArray* transcodes = NULL; - for (int i = 0; i < (int)vhost->directives.size(); i++) { - dir = vhost->directives.at(i); - if (dir->name != "transcode") { - continue; - } - - if (!transcodes) { - transcodes = SrsJsonAny::array(); - obj->set("transcodes", transcodes); - } - - SrsJsonObject* transcode = SrsJsonAny::object(); - transcodes->append(transcode); - - transcode->set("apply", dir->dumps_arg0_to_str()); - transcode->set("enabled", SrsJsonAny::boolean(get_transcode_enabled(dir))); - - SrsJsonArray* engines = SrsJsonAny::array(); - transcode->set("engines", engines); - - for (int i = 0; i < (int)dir->directives.size(); i++) { - SrsConfDirective* sdir = dir->directives.at(i); - - if (sdir->name == "ffmpeg") { - transcode->set("ffmpeg", sdir->dumps_arg0_to_str()); - } else if (sdir->name == "engine") { - SrsJsonObject* engine = SrsJsonAny::object(); - engines->append(engine); - - if ((err = srs_config_dumps_engine(sdir, engine)) != srs_success) { - return srs_error_wrap(err, "dump engine"); - } - } - } - } - - return err; -} - srs_error_t SrsConfig::raw_to_json(SrsJsonObject* obj) { srs_error_t err = srs_success; - + SrsJsonObject* sobj = SrsJsonAny::object(); obj->set("http_api", sobj); - + sobj->set("enabled", SrsJsonAny::boolean(get_http_api_enabled())); sobj->set("listen", SrsJsonAny::str(get_http_api_listen().c_str())); sobj->set("crossdomain", SrsJsonAny::boolean(get_http_api_crossdomain())); - + SrsJsonObject* ssobj = SrsJsonAny::object(); sobj->set("raw_api", ssobj); - + ssobj->set("enabled", SrsJsonAny::boolean(get_raw_api())); ssobj->set("allow_reload", SrsJsonAny::boolean(get_raw_api_allow_reload())); ssobj->set("allow_query", SrsJsonAny::boolean(get_raw_api_allow_query())); ssobj->set("allow_update", SrsJsonAny::boolean(get_raw_api_allow_update())); - - return err; -} - -srs_error_t SrsConfig::raw_set_listen(const vector& eps, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get("listen"); - - // nothing changed, ignore. - if (srs_vector_actual_equals(conf->args, eps)) { - return err; - } - - // changed, apply and reload. - conf->args = eps; - - if ((err = do_reload_listen()) != srs_success) { - return srs_error_wrap(err, "reload listen"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_set_pid(string pid, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("pid"); - - if (conf->arg0() == pid) { - return err; - } - - conf->args.clear(); - conf->args.push_back(pid); - - if ((err = do_reload_pid()) != srs_success) { - return srs_error_wrap(err, "reload pid"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_set_chunk_size(string chunk_size, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("chunk_size"); - - if (conf->arg0() == chunk_size) { - return err; - } - - conf->args.clear(); - conf->args.push_back(chunk_size); - - // directly supported reload for chunk_size change. - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_set_ff_log_dir(string ff_log_dir, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("ff_log_dir"); - - if (conf->arg0() == ff_log_dir) { - return err; - } - - conf->args.clear(); - conf->args.push_back(ff_log_dir); - - // directly supported reload for ff_log_dir change. - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_set_srs_log_tank(string srs_log_tank, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("srs_log_tank"); - - if (conf->arg0() == srs_log_tank) { - return err; - } - - conf->args.clear(); - conf->args.push_back(srs_log_tank); - - if ((err = do_reload_srs_log_tank()) != srs_success) { - return srs_error_wrap(err, "reload log tank"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_set_srs_log_level(string srs_log_level, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("srs_log_level"); - - if (conf->arg0() == srs_log_level) { - return err; - } - - conf->args.clear(); - conf->args.push_back(srs_log_level); - - if ((err = do_reload_srs_log_level()) != srs_success) { - return srs_error_wrap(err, "reload log level"); - } - - applied = true; - - return err; -} -srs_error_t SrsConfig::raw_set_srs_log_file(string srs_log_file, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("srs_log_file"); - - if (conf->arg0() == srs_log_file) { - return err; - } - - conf->args.clear(); - conf->args.push_back(srs_log_file); - - if ((err = do_reload_srs_log_file()) != srs_success) { - return srs_error_wrap(err, "reload log file"); - } - - applied = true; - return err; } -srs_error_t SrsConfig::raw_set_max_connections(string max_connections, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("max_connections"); - - if (conf->arg0() == max_connections) { - return err; - } - - conf->args.clear(); - conf->args.push_back(max_connections); - - if ((err = do_reload_max_connections()) != srs_success) { - return srs_error_wrap(err, "reload max connection"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_set_utc_time(string utc_time, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("utc_time"); - - if (conf->arg0() == utc_time) { - return err; - } - - conf->args.clear(); - conf->args.push_back(utc_time); - - if ((err = do_reload_utc_time()) != srs_success) { - return srs_error_wrap(err, "reload"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_set_pithy_print_ms(string pithy_print_ms, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("pithy_print_ms"); - - if (conf->arg0() == pithy_print_ms) { - return err; - } - - conf->args.clear(); - conf->args.push_back(pithy_print_ms); - - if ((err = do_reload_pithy_print_ms()) != srs_success) { - return srs_error_wrap(err, "reload pithy print"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_create_vhost(string vhost, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get_or_create("vhost", vhost); - conf->get_or_create("enabled")->set_arg0("on"); - - if ((err = do_reload_vhost_added(vhost)) != srs_success) { - return srs_error_wrap(err, "reload vhost"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_update_vhost(string vhost, string name, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - // the vhost must be disabled, so we donot need to reload. - SrsConfDirective* conf = root->get_or_create("vhost", vhost); - conf->set_arg0(name); - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_delete_vhost(string vhost, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - // the vhost must be disabled, so we donot need to reload. - SrsConfDirective* conf = root->get("vhost", vhost); - srs_assert(conf); - - // remove the directive. - root->remove(conf); - srs_freep(conf); - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_disable_vhost(string vhost, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get("vhost", vhost); - srs_assert(conf); - - conf->get_or_create("enabled")->set_arg0("off"); - - if ((err = do_reload_vhost_removed(vhost)) != srs_success) { - return srs_error_wrap(err, "reload vhost removed"); - } - - applied = true; - - return err; -} - -srs_error_t SrsConfig::raw_enable_vhost(string vhost, bool& applied) -{ - srs_error_t err = srs_success; - - applied = false; - - SrsConfDirective* conf = root->get("vhost", vhost); - srs_assert(conf); - - conf->get_or_create("enabled")->set_arg0("on"); - - if ((err = do_reload_vhost_added(vhost)) != srs_success) { - return srs_error_wrap(err, "reload vhost added"); - } - - applied = true; - - return err; -} -// LCOV_EXCL_STOP - srs_error_t SrsConfig::do_reload_listen() { srs_error_t err = srs_success; @@ -7569,46 +6455,14 @@ bool SrsConfig::get_raw_api_allow_reload() bool SrsConfig::get_raw_api_allow_query() { - static bool DEFAULT = false; - - SrsConfDirective* conf = root->get("http_api"); - if (!conf) { - return DEFAULT; - } - - conf = conf->get("raw_api"); - if (!conf) { - return DEFAULT; - } - - conf = conf->get("allow_query"); - if (!conf || conf->arg0().empty()) { - return DEFAULT; - } - - return SRS_CONF_PERFER_FALSE(conf->arg0()); + // Disable RAW API query, @see https://github.com/ossrs/srs/issues/2653#issuecomment-939389178 + return false; } bool SrsConfig::get_raw_api_allow_update() { - static bool DEFAULT = false; - - SrsConfDirective* conf = root->get("http_api"); - if (!conf) { - return DEFAULT; - } - - conf = conf->get("raw_api"); - if (!conf) { - return DEFAULT; - } - - conf = conf->get("allow_update"); - if (!conf || conf->arg0().empty()) { - return DEFAULT; - } - - return SRS_CONF_PERFER_FALSE(conf->arg0()); + // Disable RAW API update, @see https://github.com/ossrs/srs/issues/2653#issuecomment-939389178 + return false; } SrsConfDirective* SrsConfig::get_https_api() diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index d1b65ace6e..46b87e6baa 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -333,44 +333,8 @@ class SrsConfig private: virtual srs_error_t do_persistence(SrsFileWriter* fw); public: - // Dumps the global sections to json. - virtual srs_error_t global_to_json(SrsJsonObject* obj); - // Dumps the minimal sections to json. - virtual srs_error_t minimal_to_json(SrsJsonObject* obj); - // Dumps the vhost section to json. - virtual srs_error_t vhost_to_json(SrsConfDirective* vhost, SrsJsonObject* obj); // Dumps the http_api sections to json for raw api info. virtual srs_error_t raw_to_json(SrsJsonObject* obj); - // RAW set the global listen. - virtual srs_error_t raw_set_listen(const std::vector& eps, bool& applied); - // RAW set the global pid. - virtual srs_error_t raw_set_pid(std::string pid, bool& applied); - // RAW set the global chunk size. - virtual srs_error_t raw_set_chunk_size(std::string chunk_size, bool& applied); - // RAW set the global ffmpeg log dir. - virtual srs_error_t raw_set_ff_log_dir(std::string ff_log_dir, bool& applied); - // RAW set the global log tank. - virtual srs_error_t raw_set_srs_log_tank(std::string srs_log_tank, bool& applied); - // RAW set the global log level. - virtual srs_error_t raw_set_srs_log_level(std::string srs_log_level, bool& applied); - // RAW set the global log file path for file tank. - virtual srs_error_t raw_set_srs_log_file(std::string srs_log_file, bool& applied); - // RAW set the global max connections of srs. - virtual srs_error_t raw_set_max_connections(std::string max_connections, bool& applied); - // RAW set the global whether use utc time. - virtual srs_error_t raw_set_utc_time(std::string utc_time, bool& applied); - // RAW set the global pithy print interval in ms. - virtual srs_error_t raw_set_pithy_print_ms(std::string pithy_print_ms, bool& applied); - // RAW create the new vhost. - virtual srs_error_t raw_create_vhost(std::string vhost, bool& applied); - // RAW update the disabled vhost name. - virtual srs_error_t raw_update_vhost(std::string vhost, std::string name, bool& applied); - // RAW delete the disabled vhost. - virtual srs_error_t raw_delete_vhost(std::string vhost, bool& applied); - // RAW disable the enabled vhost. - virtual srs_error_t raw_disable_vhost(std::string vhost, bool& applied); - // RAW enable the disabled vhost. - virtual srs_error_t raw_enable_vhost(std::string vhost, bool& applied); private: virtual srs_error_t do_reload_listen(); virtual srs_error_t do_reload_pid(); diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index e2fe05283c..5b0d2eec46 100644 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -902,7 +902,7 @@ srs_error_t SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* ////////////////////////////////////////////////////////////////////////// // the rpc is required. // the allowd rpc method check. - if (rpc.empty() || (rpc != "reload" && rpc != "query" && rpc != "raw" && rpc != "update")) { + if (rpc.empty() || rpc != "reload") { return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW); } @@ -916,312 +916,6 @@ srs_error_t SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* return srs_api_response_code(w, r, ERROR_SUCCESS); } - // for rpc=query, to get the configs of server. - // @param scope the scope to query for config, it can be: - // global, the configs belongs to the root, donot includes any sub directives. - // minimal, the minimal summary of server, for preview stream to got the port serving. - // vhost, the configs for specified vhost by @param vhost. - // @param vhost the vhost name for @param scope is vhost to query config. - // for the default vhost, must be __defaultVhost__ - if (rpc == "query") { - if (!allow_query) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_DISABLED); - } - - std::string scope = r->query_get("scope"); - std::string vhost = r->query_get("vhost"); - if (scope.empty() || (scope != "global" && scope != "vhost" && scope != "minimal")) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED); - } - - if (scope == "vhost") { - // query vhost scope. - if (vhost.empty()) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - SrsConfDirective* root = _srs_config->get_root(); - SrsConfDirective* conf = root->get("vhost", vhost); - if (!conf) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - SrsJsonObject* data = SrsJsonAny::object(); - obj->set("vhost", data); - if ((err = _srs_config->vhost_to_json(conf, data)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "minimal") { - SrsJsonObject* data = SrsJsonAny::object(); - obj->set("minimal", data); - - // query minimal scope. - if ((err = _srs_config->minimal_to_json(data)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else { - SrsJsonObject* data = SrsJsonAny::object(); - obj->set("global", data); - - // query global scope. - if ((err = _srs_config->global_to_json(data)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } - - return srs_api_response(w, r, obj->dumps()); - } - - // for rpc=update, to update the configs of server. - // @scope the scope to update for config. - // @value the updated value for scope. - // @param the extra param for scope. - // @data the extra data for scope. - // possible updates: - // @scope @value value-description - // listen 1935,1936 the port list. - // pid ./objs/srs.pid the pid file of srs. - // chunk_size 60000 the global RTMP chunk_size. - // ff_log_dir ./objs the dir for ffmpeg log. - // srs_log_tank file the tank to log, file or console. - // srs_log_level trace the level of log, verbose, info, trace, warn, error. - // srs_log_file ./objs/srs.log the log file when tank is file. - // max_connections 1000 the max connections of srs. - // utc_time false whether enable utc time. - // pithy_print_ms 10000 the pithy print interval in ms. - // vhost specified updates: - // @scope @value @param @data description - // vhost ossrs.net create - create vhost ossrs.net - // vhost ossrs.net update new.ossrs.net the new name to update vhost - // dvr specified updates: - // @scope @value @param @data description - // dvr ossrs.net enable live/livestream enable the dvr of stream - // dvr ossrs.net disable live/livestream disable the dvr of stream - if (rpc == "update") { - if (!allow_update) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_DISABLED); - } - - std::string scope = r->query_get("scope"); - std::string value = r->query_get("value"); - if (scope.empty()) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED); - } - if (scope != "listen" && scope != "pid" && scope != "chunk_size" - && scope != "ff_log_dir" && scope != "srs_log_tank" && scope != "srs_log_level" - && scope != "srs_log_file" && scope != "max_connections" && scope != "utc_time" - && scope != "pithy_print_ms" && scope != "vhost" && scope != "dvr" - ) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED); - } - - bool applied = false; - string extra = ""; - if (scope == "listen") { - vector eps = srs_string_split(value, ","); - - bool invalid = eps.empty(); - for (int i = 0; i < (int)eps.size(); i++) { - string ep = eps.at(i); - int port = ::atoi(ep.c_str()); - if (port <= 2 || port >= 65535) { - invalid = true; - break; - } - } - if (invalid) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_listen(eps, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "pid") { - if (value.empty() || !srs_string_starts_with(value, "./", "/tmp/", "/var/") || !srs_string_ends_with(value, ".pid")) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_pid(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "chunk_size") { - int csv = ::atoi(value.c_str()); - if (csv < 128 || csv > 65535 || !srs_is_digit_number(value)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_chunk_size(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "ff_log_dir") { - if (value.empty() || (value != "/dev/null" && !srs_string_starts_with(value, "./", "/tmp/", "/var/"))) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_ff_log_dir(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "srs_log_tank") { - if (value.empty() || (value != "file" && value != "console")) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_srs_log_tank(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "srs_log_level") { - if (value != "verbose" && value != "info" && value != "trace" && value != "warn" && value != "error") { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_srs_log_level(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "srs_log_file") { - if (value.empty() || !srs_string_starts_with(value, "./", "/tmp/", "/var/") || !srs_string_ends_with(value, ".log")) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_srs_log_file(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "max_connections") { - int mcv = ::atoi(value.c_str()); - if (mcv < 10 || mcv > 65535 || !srs_is_digit_number(value)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_max_connections(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "utc_time") { - if (!srs_is_boolean(value)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_utc_time(srs_config_bool2switch(value), applied)) != srs_success) { - return srs_api_response_code(w, r, srs_error_wrap(err, "raw api update utc_time=%s", value.c_str())); - } - } else if (scope == "pithy_print_ms") { - int ppmv = ::atoi(value.c_str()); - if (ppmv < 100 || ppmv > 300000 || !srs_is_digit_number(value)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_set_pithy_print_ms(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (scope == "vhost") { - std::string param = r->query_get("param"); - std::string data = r->query_get("data"); - if (param != "create" && param != "update" && param != "delete" && param != "disable" && param != "enable") { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED); - } - extra += " " + param; - - if (param == "create") { - // when create, the vhost must not exists. - if (param.empty() || _srs_config->get_vhost(value, false)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_create_vhost(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (param == "update") { - extra += " to " + data; - - // when update, the vhost must exists and disabled. - SrsConfDirective* vhost = _srs_config->get_vhost(value, false); - if (data.empty() || data == value || param.empty() || !vhost || _srs_config->get_vhost_enabled(vhost)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_update_vhost(value, data, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (param == "delete") { - // when delete, the vhost must exists and disabled. - SrsConfDirective* vhost = _srs_config->get_vhost(value, false); - if (param.empty() || !vhost || _srs_config->get_vhost_enabled(vhost)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_delete_vhost(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (param == "disable") { - // when disable, the vhost must exists and enabled. - SrsConfDirective* vhost = _srs_config->get_vhost(value, false); - if (param.empty() || !vhost || !_srs_config->get_vhost_enabled(vhost)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_disable_vhost(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else if (param == "enable") { - // when enable, the vhost must exists and disabled. - SrsConfDirective* vhost = _srs_config->get_vhost(value, false); - if (param.empty() || !vhost || _srs_config->get_vhost_enabled(vhost)) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_RAW_PARAMS); - } - - if ((err = _srs_config->raw_enable_vhost(value, applied)) != srs_success) { - int code = srs_error_code(err); - srs_error_reset(err); - return srs_api_response_code(w, r, code); - } - } else { - // TODO: support other param. - } - } else { - // TODO: support other scope. - } - - // whether the config applied. - if (applied) { - server->on_signal(SRS_SIGNAL_PERSISTENCE_CONFIG); - srs_trace("raw api update %s=%s%s ok.", scope.c_str(), value.c_str(), extra.c_str()); - } else { - srs_warn("raw api update not applied %s=%s%s.", scope.c_str(), value.c_str(), extra.c_str()); - } - - return srs_api_response(w, r, obj->dumps()); - } - return err; } diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 9f309267bc..c5ccbbc391 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 169 +#define VERSION_REVISION 170 #endif