winlin

add http callback in config

@@ -475,6 +475,8 @@ int SrsConfig::reload() @@ -475,6 +475,8 @@ int SrsConfig::reload()
475 srs_trace("reload pithy_print success."); 475 srs_trace("reload pithy_print success.");
476 } 476 }
477 477
  478 + // TODO: suppor reload hls/forward/ffmpeg/http
  479 +
478 return ret; 480 return ret;
479 } 481 }
480 482
@@ -557,6 +559,22 @@ SrsConfDirective* SrsConfig::get_vhost(std::string vhost) @@ -557,6 +559,22 @@ SrsConfDirective* SrsConfig::get_vhost(std::string vhost)
557 return NULL; 559 return NULL;
558 } 560 }
559 561
  562 +std::string SrsConfig::get_vhost_on_connect(std::string vhost)
  563 +{
  564 + SrsConfDirective* vhost_conf = get_vhost(vhost);
  565 +
  566 + if (!vhost_conf) {
  567 + return "";
  568 + }
  569 +
  570 + SrsConfDirective* conf = vhost_conf->get("on_connect");
  571 + if (!conf) {
  572 + return "";
  573 + }
  574 +
  575 + return conf->arg0();
  576 +}
  577 +
560 bool SrsConfig::get_vhost_enabled(std::string vhost) 578 bool SrsConfig::get_vhost_enabled(std::string vhost)
561 { 579 {
562 SrsConfDirective* vhost_conf = get_vhost(vhost); 580 SrsConfDirective* vhost_conf = get_vhost(vhost);
@@ -1128,6 +1146,7 @@ int SrsConfig::parse_file(const char* filename) @@ -1128,6 +1146,7 @@ int SrsConfig::parse_file(const char* filename)
1128 // TODO: check hls. 1146 // TODO: check hls.
1129 // TODO: check ssl. 1147 // TODO: check ssl.
1130 // TODO: check ffmpeg. 1148 // TODO: check ffmpeg.
  1149 + // TODO: check http.
1131 1150
1132 return ret; 1151 return ret;
1133 } 1152 }
@@ -119,6 +119,7 @@ public: @@ -119,6 +119,7 @@ public:
119 public: 119 public:
120 virtual SrsConfDirective* get_vhost(std::string vhost); 120 virtual SrsConfDirective* get_vhost(std::string vhost);
121 virtual bool get_vhost_enabled(std::string vhost); 121 virtual bool get_vhost_enabled(std::string vhost);
  122 + virtual std::string get_vhost_on_connect(std::string vhost);
122 virtual SrsConfDirective* get_transcode(std::string vhost, std::string scope); 123 virtual SrsConfDirective* get_transcode(std::string vhost, std::string scope);
123 virtual bool get_transcode_enabled(SrsConfDirective* transcode); 124 virtual bool get_transcode_enabled(SrsConfDirective* transcode);
124 virtual std::string get_transcode_ffmpeg(SrsConfDirective* transcode); 125 virtual std::string get_transcode_ffmpeg(SrsConfDirective* transcode);