Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-17 11:53:51 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
25180c51b44c48886db1ba92492ca42a20900ac3
25180c51
1 parent
1e8981eb
refine the config comments.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
82 行增加
和
1 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_config.cpp
查看文件 @
25180c5
...
...
@@ -1019,6 +1019,7 @@ int SrsConfig::parse_options(int argc, char** argv)
{
int
ret
=
ERROR_SUCCESS
;
// argv
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
_argv
.
append
(
argv
[
i
]);
...
...
@@ -1027,10 +1028,12 @@ int SrsConfig::parse_options(int argc, char** argv)
}
}
// cwd
char
cwd
[
256
];
getcwd
(
cwd
,
sizeof
(
cwd
));
_cwd
=
cwd
;
// config
show_help
=
true
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
((
ret
=
parse_argv
(
i
,
argv
))
!=
ERROR_SUCCESS
)
{
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
25180c5
...
...
@@ -218,35 +218,106 @@ private:
*/
class
SrsConfig
{
// user command
private:
/**
* whether show help and exit.
*/
bool
show_help
;
/**
* whether test config file and exit.
*/
bool
test_conf
;
/**
* whether show SRS version and exit.
*/
bool
show_version
;
std
::
string
config_file
;
// global env variables.
private:
/**
* the user parameters, the argc and argv.
* the argv is " ".join(argv), where argv is from main(argc, argv).
*/
std
::
string
_argv
;
/**
* current working directory.
*/
std
::
string
_cwd
;
// config section
private:
/**
* the last parsed config file.
* if reload, reload the config file.
*/
std
::
string
config_file
;
/**
* the directive root.
*/
SrsConfDirective
*
root
;
// reload section
private:
/**
* the reload subscribers, when reload, callback all handlers.
*/
std
::
vector
<
ISrsReloadHandler
*>
subscribes
;
public
:
SrsConfig
();
virtual
~
SrsConfig
();
// reload
public:
/**
* for reload handler to register itself,
* when config service do the reload, callback the handler.
*/
virtual
void
subscribe
(
ISrsReloadHandler
*
handler
);
/**
* for reload handler to unregister itself.
*/
virtual
void
unsubscribe
(
ISrsReloadHandler
*
handler
);
/**
* reload the config file.
* @remark, user can test the config before reload it.
*/
virtual
int
reload
();
private
:
/**
* reload the http_api section of config.
*/
virtual
int
reload_http_api
(
SrsConfDirective
*
old_root
);
/**
* reload the http_stream section of config.
*/
virtual
int
reload_http_stream
(
SrsConfDirective
*
old_root
);
/**
* reload the vhost section of config.
*/
virtual
int
reload_vhost
(
SrsConfDirective
*
old_root
);
/**
* reload the transcode section of vhost of config.
*/
virtual
int
reload_transcode
(
SrsConfDirective
*
new_vhost
,
SrsConfDirective
*
old_vhost
);
/**
* reload the ingest section of vhost of config.
*/
virtual
int
reload_ingest
(
SrsConfDirective
*
new_vhost
,
SrsConfDirective
*
old_vhost
);
// parse options and file
public:
/**
* parse the cli, the main(argc,argv) function.
*/
virtual
int
parse_options
(
int
argc
,
char
**
argv
);
private
:
/**
* parse each argv.
*/
virtual
int
parse_argv
(
int
&
i
,
char
**
argv
);
/**
* print help and exit.
*/
virtual
void
print_help
(
char
**
argv
);
/**
* parse the config file, which is specified by cli.
*/
virtual
int
parse_file
(
const
char
*
filename
);
protected
:
/**
...
...
@@ -255,8 +326,15 @@ protected:
* @remark, protected for the utest to override with mock.
*/
virtual
int
parse_buffer
(
_srs_internal
::
SrsConfigBuffer
*
buffer
);
// global env
public:
/**
* get the current work directory.
*/
virtual
std
::
string
cwd
();
/**
* get the cli, the main(argc,argv), program start command.
*/
virtual
std
::
string
argv
();
// global section
public:
...
...
请
注册
或
登录
后发表评论