mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine config, return the vhosts vector.
This commit is contained in:
parent
96e0e699dd
commit
f572531eca
3 changed files with 33 additions and 13 deletions
|
@ -1412,10 +1412,12 @@ SrsConfDirective* SrsConfig::get_vhost(string vhost)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void SrsConfig::get_vhosts(std::vector<SrsConfDirective*>& vhosts)
|
||||
vector<SrsConfDirective*> SrsConfig::get_vhosts()
|
||||
{
|
||||
srs_assert(root);
|
||||
|
||||
std::vector<SrsConfDirective*> vhosts;
|
||||
|
||||
for (int i = 0; i < (int)root->directives.size(); i++) {
|
||||
SrsConfDirective* conf = root->at(i);
|
||||
|
||||
|
@ -1425,6 +1427,8 @@ void SrsConfig::get_vhosts(std::vector<SrsConfDirective*>& vhosts)
|
|||
|
||||
vhosts.push_back(conf);
|
||||
}
|
||||
|
||||
return vhosts;
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
|
||||
|
|
|
@ -366,44 +366,61 @@ public:
|
|||
*/
|
||||
virtual std::vector<std::string> get_listen();
|
||||
/**
|
||||
*
|
||||
* get the pid file path.
|
||||
* the pid file is used to save the pid of SRS,
|
||||
* use file lock to prevent multiple SRS starting.
|
||||
* @remark, if user need to run multiple SRS instance,
|
||||
* for example, to start multiple SRS for multiple CPUs,
|
||||
* user can use different pid file for each process.
|
||||
*/
|
||||
virtual std::string get_pid_file();
|
||||
/**
|
||||
*
|
||||
* get the pithy print interval for publish, in ms,
|
||||
* the publish(flash/FMLE) message print.
|
||||
*/
|
||||
virtual int get_pithy_print_publish();
|
||||
/**
|
||||
*
|
||||
* get the pithy print interval for forwarder, in ms,
|
||||
* the forwarder message print, for SRS forward stream to other servers.
|
||||
*/
|
||||
virtual int get_pithy_print_forwarder();
|
||||
/**
|
||||
*
|
||||
* get the pithy print interval for encoder, in ms,
|
||||
* the encoder message print, for FFMPEG transcoder.
|
||||
*/
|
||||
virtual int get_pithy_print_encoder();
|
||||
/**
|
||||
*
|
||||
* get the pithy print interval for ingester, in ms,
|
||||
* the ingest used FFMPEG, or your tools, to read and transcode other stream
|
||||
* to RTMP to SRS.
|
||||
*/
|
||||
virtual int get_pithy_print_ingester();
|
||||
/**
|
||||
*
|
||||
* get the pithy print interval for HLS, in ms,
|
||||
* the HLS used for IOS/android/PC, SRS will mux RTMP to HLS.
|
||||
*/
|
||||
virtual int get_pithy_print_hls();
|
||||
/**
|
||||
*
|
||||
* get the pithy print interval for Play, in ms,
|
||||
* the play is client or edge playing RTMP stream
|
||||
*/
|
||||
virtual int get_pithy_print_play();
|
||||
/**
|
||||
*
|
||||
* get the pithy print interval for edge, in ms,
|
||||
* the edge will get stream from upnode.
|
||||
*/
|
||||
virtual int get_pithy_print_edge();
|
||||
// vhost specified section
|
||||
public:
|
||||
/**
|
||||
* get the vhost directive by vhost name.
|
||||
* @param vhost, the name of vhost to get.
|
||||
*/
|
||||
virtual SrsConfDirective* get_vhost(std::string vhost);
|
||||
/**
|
||||
*
|
||||
* get all vhosts in config file.
|
||||
*/
|
||||
virtual void get_vhosts(std::vector<SrsConfDirective*>& vhosts);
|
||||
virtual std::vector<SrsConfDirective*> get_vhosts();
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -215,8 +215,7 @@ int SrsIngester::parse()
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// parse ingesters
|
||||
std::vector<SrsConfDirective*> vhosts;
|
||||
_srs_config->get_vhosts(vhosts);
|
||||
std::vector<SrsConfDirective*> vhosts = _srs_config->get_vhosts();
|
||||
|
||||
for (int i = 0; i < (int)vhosts.size(); i++) {
|
||||
SrsConfDirective* vhost = vhosts[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue