1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

refine the config

This commit is contained in:
winlin 2014-07-25 11:05:54 +08:00
parent 7865b0e935
commit 50cd1d2360
2 changed files with 104 additions and 106 deletions

View file

@ -1257,120 +1257,118 @@ int SrsConfig::check_config()
} }
} }
} }
if (true) { for (int i = 0; i < (int)vhosts.size(); i++) {
for (int i = 0; i < (int)vhosts.size(); i++) { SrsConfDirective* conf = vhosts[i];
SrsConfDirective* conf = vhosts[i]; for (int i = 0; conf && i < (int)conf->directives.size(); i++) {
for (int i = 0; conf && i < (int)conf->directives.size(); i++) { SrsConfDirective* conf0 = conf->at(i);
SrsConfDirective* conf0 = conf->at(i); string n = conf0->name;
string n = conf0->name; if (n != "enabled" && n != "chunk_size"
if (n != "enabled" && n != "chunk_size" && n != "mode" && n != "origin" && n != "token_traverse"
&& n != "mode" && n != "origin" && n != "token_traverse" && n != "dvr" && n != "ingest" && n != "http" && n != "hls" && n != "http_hooks"
&& n != "dvr" && n != "ingest" && n != "http" && n != "hls" && n != "http_hooks" && n != "gop_cache" && n != "queue_length"
&& n != "gop_cache" && n != "queue_length" && n != "refer" && n != "refer_publish" && n != "refer_play"
&& n != "refer" && n != "refer_publish" && n != "refer_play" && n != "forward" && n != "transcode" && n != "bandcheck"
&& n != "forward" && n != "transcode" && n != "bandcheck" && n != "time_jitter"
&& n != "time_jitter" && n != "atc" && n != "atc_auto"
&& n != "atc" && n != "atc_auto" ) {
) { ret = ERROR_SYSTEM_CONFIG_INVALID;
ret = ERROR_SYSTEM_CONFIG_INVALID; srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret);
srs_error("unsupported vhost directive %s, ret=%d", n.c_str(), ret); return ret;
return ret; }
// for each sub directives of vhost.
if (n == "dvr") {
for (int j = 0; j < (int)conf0->directives.size(); j++) {
string m = conf0->at(j)->name.c_str();
if (m != "enabled" && m != "dvr_path" && m != "dvr_plan"
&& m != "dvr_duration" && m != "time_jitter"
) {
ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret);
return ret;
}
} }
// for each sub directives of vhost. } else if (n == "ingest") {
if (n == "dvr") { for (int j = 0; j < (int)conf0->directives.size(); j++) {
for (int j = 0; j < (int)conf0->directives.size(); j++) { string m = conf0->at(j)->name.c_str();
string m = conf0->at(j)->name.c_str(); if (m != "enabled" && m != "input" && m != "ffmpeg"
if (m != "enabled" && m != "dvr_path" && m != "dvr_plan" && m != "engine"
&& m != "dvr_duration" && m != "time_jitter" ) {
) { ret = ERROR_SYSTEM_CONFIG_INVALID;
ret = ERROR_SYSTEM_CONFIG_INVALID; srs_error("unsupported vhost ingest directive %s, ret=%d", m.c_str(), ret);
srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret); return ret;
return ret;
}
} }
} else if (n == "ingest") { }
for (int j = 0; j < (int)conf0->directives.size(); j++) { } else if (n == "http") {
string m = conf0->at(j)->name.c_str(); for (int j = 0; j < (int)conf0->directives.size(); j++) {
if (m != "enabled" && m != "input" && m != "ffmpeg" string m = conf0->at(j)->name.c_str();
&& m != "engine" if (m != "enabled" && m != "mount" && m != "dir") {
) { ret = ERROR_SYSTEM_CONFIG_INVALID;
ret = ERROR_SYSTEM_CONFIG_INVALID; srs_error("unsupported vhost http directive %s, ret=%d", m.c_str(), ret);
srs_error("unsupported vhost ingest directive %s, ret=%d", m.c_str(), ret); return ret;
return ret;
}
} }
} else if (n == "http") { }
for (int j = 0; j < (int)conf0->directives.size(); j++) { } else if (n == "hls") {
string m = conf0->at(j)->name.c_str(); for (int j = 0; j < (int)conf0->directives.size(); j++) {
if (m != "enabled" && m != "mount" && m != "dir") { string m = conf0->at(j)->name.c_str();
ret = ERROR_SYSTEM_CONFIG_INVALID; if (m != "enabled" && m != "hls_path" && m != "hls_fragment" && m != "hls_window") {
srs_error("unsupported vhost http directive %s, ret=%d", m.c_str(), ret); ret = ERROR_SYSTEM_CONFIG_INVALID;
return ret; srs_error("unsupported vhost hls directive %s, ret=%d", m.c_str(), ret);
} return ret;
} }
} else if (n == "hls") { }
for (int j = 0; j < (int)conf0->directives.size(); j++) { } else if (n == "http_hooks") {
string m = conf0->at(j)->name.c_str(); for (int j = 0; j < (int)conf0->directives.size(); j++) {
if (m != "enabled" && m != "hls_path" && m != "hls_fragment" && m != "hls_window") { string m = conf0->at(j)->name.c_str();
ret = ERROR_SYSTEM_CONFIG_INVALID; if (m != "enabled" && m != "on_connect" && m != "on_close" && m != "on_publish"
srs_error("unsupported vhost hls directive %s, ret=%d", m.c_str(), ret); && m != "on_unpublish" && m != "on_play" && m != "on_stop" && m != "on_dvr_hss_reap_flv"
return ret; ) {
} ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("unsupported vhost http_hooks directive %s, ret=%d", m.c_str(), ret);
return ret;
} }
} else if (n == "http_hooks") { }
for (int j = 0; j < (int)conf0->directives.size(); j++) { } else if (n == "forward") {
string m = conf0->at(j)->name.c_str(); // TODO: FIXME: implements it.
if (m != "enabled" && m != "on_connect" && m != "on_close" && m != "on_publish" /*for (int j = 0; j < (int)conf0->directives.size(); j++) {
&& m != "on_unpublish" && m != "on_play" && m != "on_stop" && m != "on_dvr_hss_reap_flv" string m = conf0->at(j)->name.c_str();
) { if (m != "enabled" && m != "vhost" && m != "refer") {
ret = ERROR_SYSTEM_CONFIG_INVALID; ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("unsupported vhost http_hooks directive %s, ret=%d", m.c_str(), ret); srs_error("unsupported vhost forward directive %s, ret=%d", m.c_str(), ret);
return ret; return ret;
}
} }
} else if (n == "forward") { }*/
// TODO: FIXME: implements it. } else if (n == "transcode") {
/*for (int j = 0; j < (int)conf0->directives.size(); j++) { for (int j = 0; j < (int)conf0->directives.size(); j++) {
string m = conf0->at(j)->name.c_str(); SrsConfDirective* conf1 = conf0->at(j);
if (m != "enabled" && m != "vhost" && m != "refer") { string m = conf1->name.c_str();
ret = ERROR_SYSTEM_CONFIG_INVALID; if (m != "enabled" && m != "ffmpeg" && m != "engine") {
srs_error("unsupported vhost forward directive %s, ret=%d", m.c_str(), ret); ret = ERROR_SYSTEM_CONFIG_INVALID;
return ret; srs_error("unsupported vhost transcode directive %s, ret=%d", m.c_str(), ret);
} return ret;
}*/ }
} else if (n == "transcode") { if (m == "engine") {
for (int j = 0; j < (int)conf0->directives.size(); j++) { for (int k = 0; k < (int)conf1->directives.size(); k++) {
SrsConfDirective* conf1 = conf0->at(j); string e = conf1->at(k)->name;
string m = conf1->name.c_str(); if (e != "enabled" && e != "vfilter" && e != "vcodec"
if (m != "enabled" && m != "ffmpeg" && m != "engine") { && e != "vbitrate" && e != "vfps" && e != "vwidth" && e != "vheight"
ret = ERROR_SYSTEM_CONFIG_INVALID; && e != "vthreads" && e != "vprofile" && e != "vpreset" && e != "vparams"
srs_error("unsupported vhost transcode directive %s, ret=%d", m.c_str(), ret); && e != "acodec" && e != "abitrate" && e != "asample_rate" && e != "achannels"
return ret; && e != "aparams" && e != "output"
} ) {
if (m == "engine") { ret = ERROR_SYSTEM_CONFIG_INVALID;
for (int k = 0; k < (int)conf1->directives.size(); k++) { srs_error("unsupported vhost transcode engine directive %s, ret=%d", e.c_str(), ret);
string e = conf1->at(k)->name; return ret;
if (e != "enabled" && e != "vfilter" && e != "vcodec"
&& e != "vbitrate" && e != "vfps" && e != "vwidth" && e != "vheight"
&& e != "vthreads" && e != "vprofile" && e != "vpreset" && e != "vparams"
&& e != "acodec" && e != "abitrate" && e != "asample_rate" && e != "achannels"
&& e != "aparams" && e != "output"
) {
ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("unsupported vhost transcode engine directive %s, ret=%d", e.c_str(), ret);
return ret;
}
} }
} }
} }
} else if (n == "bandcheck") { }
for (int j = 0; j < (int)conf0->directives.size(); j++) { } else if (n == "bandcheck") {
string m = conf0->at(j)->name.c_str(); for (int j = 0; j < (int)conf0->directives.size(); j++) {
if (m != "enabled" && m != "key" && m != "interval" && m != "limit_kbps") { string m = conf0->at(j)->name.c_str();
ret = ERROR_SYSTEM_CONFIG_INVALID; if (m != "enabled" && m != "key" && m != "interval" && m != "limit_kbps") {
srs_error("unsupported vhost bandcheck directive %s, ret=%d", m.c_str(), ret); ret = ERROR_SYSTEM_CONFIG_INVALID;
return ret; srs_error("unsupported vhost bandcheck directive %s, ret=%d", m.c_str(), ret);
} return ret;
} }
} }
} }

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version // current release version
#define VERSION_MAJOR "0" #define VERSION_MAJOR "0"
#define VERSION_MINOR "9" #define VERSION_MINOR "9"
#define VERSION_REVISION "169" #define VERSION_REVISION "170"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info. // server info.
#define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_KEY "SRS"