winlin

refine config, add comments.

... ... @@ -1431,153 +1431,6 @@ vector<SrsConfDirective*> SrsConfig::get_vhosts()
return vhosts;
}
SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_connect");
}
SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_close");
}
SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_publish");
}
SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_unpublish");
}
SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_play");
}
SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_stop");
}
SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_dvr_hss_reap_flv");
}
bool SrsConfig::get_vhost_enabled(string vhost)
{
SrsConfDirective* vhost_conf = get_vhost(vhost);
... ... @@ -1684,17 +1537,6 @@ double SrsConfig::get_queue_length(string vhost)
return ::atoi(conf->arg0().c_str());
}
SrsConfDirective* SrsConfig::get_forward(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
return conf->get("forward");
}
SrsConfDirective* SrsConfig::get_refer(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
... ... @@ -1751,6 +1593,164 @@ int SrsConfig::get_chunk_size(const string &vhost)
return ::atoi(conf->arg0().c_str());
}
SrsConfDirective* SrsConfig::get_forward(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
return conf->get("forward");
}
SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_connect");
}
SrsConfDirective* SrsConfig::get_vhost_on_close(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_close");
}
SrsConfDirective* SrsConfig::get_vhost_on_publish(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_publish");
}
SrsConfDirective* SrsConfig::get_vhost_on_unpublish(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_unpublish");
}
SrsConfDirective* SrsConfig::get_vhost_on_play(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_play");
}
SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_stop");
}
SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return NULL;
}
conf = conf->get("http_hooks");
if (!conf) {
return NULL;
}
SrsConfDirective* enabled = conf->get("enabled");
if (!enabled || enabled->arg0() != "on") {
return NULL;
}
return conf->get("on_dvr_hss_reap_flv");
}
bool SrsConfig::get_bw_check_enabled(const string &vhost)
{
SrsConfDirective* conf = get_vhost(vhost);
... ...
... ... @@ -422,81 +422,103 @@ public:
*/
virtual std::vector<SrsConfDirective*> get_vhosts();
/**
*
* whether vhost is enabled
* @param vhost, the vhost name.
* @return true when vhost is ok; otherwise, false.
*/
virtual bool get_vhost_enabled(std::string vhost);
/**
*
* whether vhost is enabled
* @param vhost, the vhost directive.
* @return true when vhost is ok; otherwise, false.
*/
virtual bool get_vhost_enabled(SrsConfDirective* vhost);
/**
*
* whether gop_cache is enabled of vhost.
* gop_cache used to cache last gop, for client to fast startup.
* @return true when gop_cache is ok; otherwise, false.
*/
virtual SrsConfDirective* get_vhost_on_connect(std::string vhost);
virtual bool get_gop_cache(std::string vhost);
/**
*
* whether atc is enabled of vhost.
* atc always use encoder timestamp, SRS never adjust the time.
* @return true when atc is ok; otherwise, false.
*/
virtual SrsConfDirective* get_vhost_on_close(std::string vhost);
virtual bool get_atc(std::string vhost);
/**
*
* whether atc_auto is enabled of vhost.
* atc_auto used to auto enable atc, when metadata specified the bravo_atc.
* @return true when atc_auto is ok; otherwise, false.
*/
virtual SrsConfDirective* get_vhost_on_publish(std::string vhost);
virtual bool get_atc_auto(std::string vhost);
/**
*
* get the time_jitter algorithm.
* @return the time_jitter algorithm, defined in SrsRtmpJitterAlgorithm.
*/
virtual SrsConfDirective* get_vhost_on_unpublish(std::string vhost);
virtual int get_time_jitter(std::string vhost);
/**
*
*/
virtual SrsConfDirective* get_vhost_on_play(std::string vhost);
virtual double get_queue_length(std::string vhost);
/**
*
*/
virtual SrsConfDirective* get_vhost_on_stop(std::string vhost);
virtual SrsConfDirective* get_refer(std::string vhost);
/**
*
*/
virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost);
virtual SrsConfDirective* get_refer_play(std::string vhost);
/**
*
*/
virtual bool get_gop_cache(std::string vhost);
virtual SrsConfDirective* get_refer_publish(std::string vhost);
/**
*
*/
virtual bool get_atc(std::string vhost);
virtual int get_chunk_size(const std::string& vhost);
// forward section
public:
/**
*
*/
virtual bool get_atc_auto(std::string vhost);
virtual SrsConfDirective* get_forward(std::string vhost);
// http_hooks section
public:
/**
*
* get the on_connect callbacks of vhost.
* @return the on_connect callback directive, the args is the url to callback.
*/
virtual int get_time_jitter(std::string vhost);
virtual SrsConfDirective* get_vhost_on_connect(std::string vhost);
/**
*
* get the on_close callbacks of vhost.
* @return the on_close callback directive, the args is the url to callback.
*/
virtual double get_queue_length(std::string vhost);
virtual SrsConfDirective* get_vhost_on_close(std::string vhost);
/**
*
* get the on_publish callbacks of vhost.
* @return the on_publish callback directive, the args is the url to callback.
*/
virtual SrsConfDirective* get_forward(std::string vhost);
virtual SrsConfDirective* get_vhost_on_publish(std::string vhost);
/**
*
* get the on_unpublish callbacks of vhost.
* @return the on_unpublish callback directive, the args is the url to callback.
*/
virtual SrsConfDirective* get_refer(std::string vhost);
virtual SrsConfDirective* get_vhost_on_unpublish(std::string vhost);
/**
*
* get the on_play callbacks of vhost.
* @return the on_play callback directive, the args is the url to callback.
*/
virtual SrsConfDirective* get_refer_play(std::string vhost);
virtual SrsConfDirective* get_vhost_on_play(std::string vhost);
/**
*
* get the on_stop callbacks of vhost.
* @return the on_stop callback directive, the args is the url to callback.
*/
virtual SrsConfDirective* get_refer_publish(std::string vhost);
virtual SrsConfDirective* get_vhost_on_stop(std::string vhost);
/**
*
* get the on_dvr_hss_reap_flv callbacks of vhost.
* @return the on_dvr_hss_reap_flv callback directive, the args is the url to callback.
*/
virtual int get_chunk_size(const std::string& vhost);
virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost);
// bwct(bandwidth check tool) section
public:
/**
... ...