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
2015-03-07 22:25:43 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fbbe46d272a515b8e72be8f912cf49b56d300cf7
fbbe46d2
1 parent
b8e70f85
refine the config, support directly parse file.
显示空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
66 行增加
和
48 行删除
trunk/configure
trunk/modules/readme.txt
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/main/srs_main_server.cpp
trunk/configure
查看文件 @
fbbe46d
...
...
@@ -51,9 +51,9 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS_DIR}/utest; \$(M
#####################################################################################
# finger out modules to install.
# where srs module is a dir which contains a config file.
SRS_MODULES
=
""
SRS_MODULES
=
()
__mfiles
=
`
find modules -name
"config"
`
&&
for
__mfile
in
$__mfiles
;
do
SRS_MODULES
=
"
$SRS_MODULES
`
dirname
$__mfile
`
"
SRS_MODULES
+
=
"
`
dirname
$__mfile
`
"
done
# variables for makefile for all modules.
...
...
@@ -177,6 +177,11 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
"srs_app_kbps"
"srs_app_heartbeat"
"srs_app_empty"
"srs_app_http_client"
"srs_app_recv_thread"
"srs_app_security"
"srs_app_statistic"
"srs_app_mpegts_udp"
"srs_app_rtsp"
"srs_app_listener"
)
# add each modules for app
for
SRS_MODULE
in
$SRS_MODULES
;
do
.
$SRS_MODULE
/config
MODULE_FILES+
=(
$SRS_MODULE_APP
)
done
APP_INCS
=
"src/app"
;
MODULE_DIR
=
${
APP_INCS
}
. auto/modules.sh
APP_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
fi
...
...
@@ -198,7 +203,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# add each modules for main
for
SRS_MODULE
in
$SRS_MODULES
;
do
.
$SRS_MODULE
/config
MODULE_FILES
=
"
${
MODULE_FILES
[@]
}
$SRS_MODULE_MAIN
"
MODULE_FILES
+
=(
$SRS_MODULE_MAIN
)
done
MAIN_INCS
=
"src/main"
;
MODULE_DIR
=
${
MAIN_INCS
}
. auto/modules.sh
MAIN_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
...
...
@@ -215,7 +220,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# add each modules for main
for
SRS_MODULE
in
$SRS_MODULES
;
do
.
$SRS_MODULE
/config
MAIN_ENTRANCES
=
"
${
MAIN_ENTRANCES
[@]
}
$SRS_MODULE_MAIN
"
MAIN_ENTRANCES
+
=(
$SRS_MODULE_MAIN
)
done
#
# all depends libraries
...
...
trunk/modules/readme.txt
查看文件 @
fbbe46d
...
...
@@ -6,5 +6,6 @@ SRS模块规则:
模块中需要定义变量,例如:
1. SRS_MODULE_NAME:模块名称,用来做Makefile的phony以及执行binary文件名。
2. SRS_MODULE_MAIN:模块的main函数所在的cpp文件,在src/main目录。
3. SRS_MODULE_APP:模块在src/app目录的源文件列表。
winlin, 2015.3
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
fbbe46d
...
...
@@ -351,11 +351,11 @@ private:
* print help and exit.
*/
virtual
void
print_help
(
char
**
argv
);
public
:
/**
* parse the config file, which is specified by cli.
*/
virtual
int
parse_file
(
const
char
*
filename
);
public
:
/**
* check the parsed config.
*/
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
fbbe46d
...
...
@@ -488,49 +488,6 @@ int SrsServer::initialize()
}
#endif
#ifdef SRS_AUTO_HTTP_API
srs_assert
(
http_api_mux
);
if
((
ret
=
http_api_mux
->
handle
(
"/"
,
new
SrsGoApiRoot
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api"
,
new
SrsGoApiApi
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1"
,
new
SrsGoApiV1
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/versions"
,
new
SrsGoApiVersion
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/summaries"
,
new
SrsGoApiSummaries
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/rusages"
,
new
SrsGoApiRusages
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/self_proc_stats"
,
new
SrsGoApiSelfProcStats
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/system_proc_stats"
,
new
SrsGoApiSystemProcStats
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/meminfos"
,
new
SrsGoApiMemInfos
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/authors"
,
new
SrsGoApiAuthors
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/requests"
,
new
SrsGoApiRequests
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/vhosts"
,
new
SrsGoApiVhosts
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/streams"
,
new
SrsGoApiStreams
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
#endif
#ifdef SRS_AUTO_HTTP_SERVER
srs_assert
(
http_stream_mux
);
if
((
ret
=
http_stream_mux
->
initialize
())
!=
ERROR_SUCCESS
)
{
...
...
@@ -689,6 +646,56 @@ int SrsServer::register_signal()
return
signal_manager
->
start
();
}
int
SrsServer
::
http_handle
()
{
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_AUTO_HTTP_API
srs_assert
(
http_api_mux
);
if
((
ret
=
http_api_mux
->
handle
(
"/"
,
new
SrsGoApiRoot
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api"
,
new
SrsGoApiApi
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1"
,
new
SrsGoApiV1
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/versions"
,
new
SrsGoApiVersion
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/summaries"
,
new
SrsGoApiSummaries
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/rusages"
,
new
SrsGoApiRusages
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/self_proc_stats"
,
new
SrsGoApiSelfProcStats
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/system_proc_stats"
,
new
SrsGoApiSystemProcStats
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/meminfos"
,
new
SrsGoApiMemInfos
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/authors"
,
new
SrsGoApiAuthors
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/requests"
,
new
SrsGoApiRequests
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/vhosts"
,
new
SrsGoApiVhosts
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
http_api_mux
->
handle
(
"/api/v1/streams"
,
new
SrsGoApiStreams
()))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
#endif
return
ret
;
}
int
SrsServer
::
ingest
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
fbbe46d
...
...
@@ -236,6 +236,7 @@ public:
virtual
int
initialize_st
();
virtual
int
listen
();
virtual
int
register_signal
();
virtual
int
http_handle
();
virtual
int
ingest
();
virtual
int
cycle
();
// server utility
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
fbbe46d
...
...
@@ -336,6 +336,10 @@ int run_master()
return
ret
;
}
if
((
ret
=
_srs_server
->
http_handle
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
_srs_server
->
ingest
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
请
注册
或
登录
后发表评论