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-18 11:46:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a5f4323ea818edc84900139ef182c67eb4cf3068
a5f4323e
1 parent
b4e2d703
refine config, add comments
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
107 行增加
和
79 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_ffmpeg.cpp
trunk/src/app/srs_app_ingest.cpp
trunk/src/app/srs_app_config.cpp
查看文件 @
a5f4323
...
...
@@ -1835,7 +1835,7 @@ int SrsConfig::get_bw_check_limit_kbps(string vhost)
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
bool
SrsConfig
::
get_vhost_is_edge
(
st
d
::
st
ring
vhost
)
bool
SrsConfig
::
get_vhost_is_edge
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
return
get_vhost_is_edge
(
conf
);
...
...
@@ -1868,7 +1868,7 @@ SrsConfDirective* SrsConfig::get_vhost_edge_origin(string vhost)
return
conf
->
get
(
"origin"
);
}
bool
SrsConfig
::
get_vhost_edge_token_traverse
(
st
d
::
st
ring
vhost
)
bool
SrsConfig
::
get_vhost_edge_token_traverse
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
@@ -1965,6 +1965,32 @@ bool SrsConfig::get_engine_enabled(SrsConfDirective* engine)
return
true
;
}
vector
<
string
>
SrsConfig
::
get_engine_vfilter
(
SrsConfDirective
*
engine
)
{
vector
<
string
>
vfilter
;
if
(
!
engine
)
{
return
vfilter
;
}
SrsConfDirective
*
conf
=
engine
->
get
(
"vfilter"
);
if
(
!
conf
)
{
return
vfilter
;
}
for
(
int
i
=
0
;
i
<
(
int
)
conf
->
directives
.
size
();
i
++
)
{
SrsConfDirective
*
p
=
conf
->
directives
[
i
];
if
(
!
p
)
{
continue
;
}
vfilter
.
push_back
(
"-"
+
p
->
name
);
vfilter
.
push_back
(
p
->
arg0
());
}
return
vfilter
;
}
string
SrsConfig
::
get_engine_vcodec
(
SrsConfDirective
*
engine
)
{
if
(
!
engine
)
{
...
...
@@ -2077,15 +2103,17 @@ string SrsConfig::get_engine_vpreset(SrsConfDirective* engine)
return
conf
->
arg0
();
}
v
oid
SrsConfig
::
get_engine_vparams
(
SrsConfDirective
*
engine
,
vector
<
string
>&
vparams
)
v
ector
<
string
>
SrsConfig
::
get_engine_vparams
(
SrsConfDirective
*
engine
)
{
vector
<
string
>
vparams
;
if
(
!
engine
)
{
return
;
return
vparams
;
}
SrsConfDirective
*
conf
=
engine
->
get
(
"vparams"
);
if
(
!
conf
)
{
return
;
return
vparams
;
}
for
(
int
i
=
0
;
i
<
(
int
)
conf
->
directives
.
size
();
i
++
)
{
...
...
@@ -2097,28 +2125,8 @@ void SrsConfig::get_engine_vparams(SrsConfDirective* engine, vector<string>& vpa
vparams
.
push_back
(
"-"
+
p
->
name
);
vparams
.
push_back
(
p
->
arg0
());
}
}
void
SrsConfig
::
get_engine_vfilter
(
SrsConfDirective
*
engine
,
vector
<
string
>&
vfilter
)
{
if
(
!
engine
)
{
return
;
}
SrsConfDirective
*
conf
=
engine
->
get
(
"vfilter"
);
if
(
!
conf
)
{
return
;
}
for
(
int
i
=
0
;
i
<
(
int
)
conf
->
directives
.
size
();
i
++
)
{
SrsConfDirective
*
p
=
conf
->
directives
[
i
];
if
(
!
p
)
{
continue
;
}
vfilter
.
push_back
(
"-"
+
p
->
name
);
vfilter
.
push_back
(
p
->
arg0
());
}
return
vparams
;
}
string
SrsConfig
::
get_engine_acodec
(
SrsConfDirective
*
engine
)
...
...
@@ -2177,15 +2185,17 @@ int SrsConfig::get_engine_achannels(SrsConfDirective* engine)
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
v
oid
SrsConfig
::
get_engine_aparams
(
SrsConfDirective
*
engine
,
vector
<
string
>&
aparams
)
v
ector
<
string
>
SrsConfig
::
get_engine_aparams
(
SrsConfDirective
*
engine
)
{
vector
<
string
>
aparams
;
if
(
!
engine
)
{
return
;
return
aparams
;
}
SrsConfDirective
*
conf
=
engine
->
get
(
"aparams"
);
if
(
!
conf
)
{
return
;
return
aparams
;
}
for
(
int
i
=
0
;
i
<
(
int
)
conf
->
directives
.
size
();
i
++
)
{
...
...
@@ -2197,6 +2207,8 @@ void SrsConfig::get_engine_aparams(SrsConfDirective* engine, vector<string>& apa
aparams
.
push_back
(
"-"
+
p
->
name
);
aparams
.
push_back
(
p
->
arg0
());
}
return
aparams
;
}
string
SrsConfig
::
get_engine_output
(
SrsConfDirective
*
engine
)
...
...
@@ -2213,11 +2225,13 @@ string SrsConfig::get_engine_output(SrsConfDirective* engine)
return
conf
->
arg0
();
}
v
oid
SrsConfig
::
get_ingesters
(
std
::
string
vhost
,
std
::
vector
<
SrsConfDirective
*>&
ingeters
)
v
ector
<
SrsConfDirective
*>
SrsConfig
::
get_ingesters
(
string
vhost
)
{
vector
<
SrsConfDirective
*>
ingeters
;
SrsConfDirective
*
vhost_conf
=
get_vhost
(
vhost
);
if
(
!
vhost_conf
)
{
return
;
return
ingeters
;
}
for
(
int
i
=
0
;
i
<
(
int
)
vhost_conf
->
directives
.
size
();
i
++
)
{
...
...
@@ -2228,10 +2242,10 @@ void SrsConfig::get_ingesters(std::string vhost, std::vector<SrsConfDirective*>&
}
}
return
;
return
ingeters
;
}
SrsConfDirective
*
SrsConfig
::
get_ingest_by_id
(
st
d
::
string
vhost
,
std
::
string
ingest_id
)
SrsConfDirective
*
SrsConfig
::
get_ingest_by_id
(
st
ring
vhost
,
string
ingest_id
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
if
(
!
conf
)
{
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
a5f4323
...
...
@@ -601,97 +601,112 @@ public:
*/
virtual
std
::
vector
<
SrsConfDirective
*>
get_transcode_engines
(
SrsConfDirective
*
transcode
);
/**
*
*
whether the engine is enabled.
*/
virtual
bool
get_engine_enabled
(
SrsConfDirective
*
engine
);
/**
*
* get the vfilter of engine,
* the video filter set before the vcodec of FFMPEG.
*/
virtual
std
::
vector
<
std
::
string
>
get_engine_vfilter
(
SrsConfDirective
*
engine
);
/**
* get the vcodec of engine,
* the codec of video, copy or libx264
*/
virtual
std
::
string
get_engine_vcodec
(
SrsConfDirective
*
engine
);
/**
*
* get the vbitrate of engine,
* the bitrate in kbps of video, for example, 800kbps
*/
virtual
int
get_engine_vbitrate
(
SrsConfDirective
*
engine
);
/**
*
* get the vfps of engine.
* the video fps, for example, 25fps
*/
virtual
double
get_engine_vfps
(
SrsConfDirective
*
engine
);
/**
*
* get the vwidth of engine,
* the video width, for example, 1024
*/
virtual
int
get_engine_vwidth
(
SrsConfDirective
*
engine
);
/**
*
* get the vheight of engine,
* the video height, for example, 576
*/
virtual
int
get_engine_vheight
(
SrsConfDirective
*
engine
);
/**
*
* get the vthreads of engine,
* the video transcode libx264 threads, for instance, 8
*/
virtual
int
get_engine_vthreads
(
SrsConfDirective
*
engine
);
/**
*
* get the vprofile of engine,
* the libx264 profile, can be high,main,baseline
*/
virtual
std
::
string
get_engine_vprofile
(
SrsConfDirective
*
engine
);
/**
*
* get the vpreset of engine,
* the libx264 preset, can be ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow,placebo
*/
virtual
std
::
string
get_engine_vpreset
(
SrsConfDirective
*
engine
);
/**
*
*
get the additional video params.
*/
virtual
void
get_engine_vparams
(
SrsConfDirective
*
engine
,
std
::
vector
<
std
::
string
>&
vparams
);
virtual
std
::
vector
<
std
::
string
>
get_engine_vparams
(
SrsConfDirective
*
engine
);
/**
*
*/
virtual
void
get_engine_vfilter
(
SrsConfDirective
*
engine
,
std
::
vector
<
std
::
string
>&
vfilter
);
/**
*
* get the acodec of engine,
* the audio codec can be copy or libaacplus
*/
virtual
std
::
string
get_engine_acodec
(
SrsConfDirective
*
engine
);
/**
*
* get the abitrate of engine,
* the audio bitrate in kbps, for instance, 64kbps.
*/
virtual
int
get_engine_abitrate
(
SrsConfDirective
*
engine
);
/**
*
* get the asample_rate of engine,
* the audio sample_rate, for instance, 44100HZ
*/
virtual
int
get_engine_asample_rate
(
SrsConfDirective
*
engine
);
/**
*
* get the achannels of engine,
* the audio channel, for instance, 1 for mono, 2 for stereo.
*/
virtual
int
get_engine_achannels
(
SrsConfDirective
*
engine
);
/**
*
* get the aparams of engine,
* the audio additional params.
*/
virtual
void
get_engine_aparams
(
SrsConfDirective
*
engine
,
std
::
vector
<
std
::
string
>&
aparams
);
virtual
std
::
vector
<
std
::
string
>
get_engine_aparams
(
SrsConfDirective
*
engine
);
/**
*
* get the output of engine, for example, rtmp://127.0.0.1/live/livestream,
* @remark, we will use some variable, for instance, [vhost] to substitude with vhost.
*/
virtual
std
::
string
get_engine_output
(
SrsConfDirective
*
engine
);
// ingest section
public:
/**
*
*
get the ingest directives of vhost.
*/
virtual
void
get_ingesters
(
std
::
string
vhost
,
std
::
vector
<
SrsConfDirective
*>&
ingeters
);
virtual
std
::
vector
<
SrsConfDirective
*>
get_ingesters
(
std
::
string
vhost
);
/**
*
*
get specified ingest.
*/
virtual
SrsConfDirective
*
get_ingest_by_id
(
std
::
string
vhost
,
std
::
string
ingest_id
);
/**
*
*
whether ingest is enalbed.
*/
virtual
bool
get_ingest_enabled
(
SrsConfDirective
*
ingest
);
/**
*
*
get the ingest ffmpeg tool
*/
virtual
std
::
string
get_ingest_ffmpeg
(
SrsConfDirective
*
ingest
);
/**
*
*
get the ingest input type, file or stream.
*/
virtual
std
::
string
get_ingest_input_type
(
SrsConfDirective
*
ingest
);
/**
*
*
get the ingest input url.
*/
virtual
std
::
string
get_ingest_input_url
(
SrsConfDirective
*
ingest
);
// log section
...
...
trunk/src/app/srs_app_ffmpeg.cpp
查看文件 @
a5f4323
...
...
@@ -96,21 +96,21 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine)
{
int
ret
=
ERROR_SUCCESS
;
_srs_config
->
get_engine_vfilter
(
engine
,
vfilter
);
vcodec
=
_srs_config
->
get_engine_vcodec
(
engine
);
vbitrate
=
_srs_config
->
get_engine_vbitrate
(
engine
);
vfps
=
_srs_config
->
get_engine_vfps
(
engine
);
vwidth
=
_srs_config
->
get_engine_vwidth
(
engine
);
vheight
=
_srs_config
->
get_engine_vheight
(
engine
);
vthreads
=
_srs_config
->
get_engine_vthreads
(
engine
);
vprofile
=
_srs_config
->
get_engine_vprofile
(
engine
);
vpreset
=
_srs_config
->
get_engine_vpreset
(
engine
);
_srs_config
->
get_engine_vparams
(
engine
,
vparams
);
acodec
=
_srs_config
->
get_engine_acodec
(
engine
);
abitrate
=
_srs_config
->
get_engine_abitrate
(
engine
);
asample_rate
=
_srs_config
->
get_engine_asample_rate
(
engine
);
achannels
=
_srs_config
->
get_engine_achannels
(
engine
);
_srs_config
->
get_engine_aparams
(
engine
,
aparams
);
vfilter
=
_srs_config
->
get_engine_vfilter
(
engine
);
vcodec
=
_srs_config
->
get_engine_vcodec
(
engine
);
vbitrate
=
_srs_config
->
get_engine_vbitrate
(
engine
);
vfps
=
_srs_config
->
get_engine_vfps
(
engine
);
vwidth
=
_srs_config
->
get_engine_vwidth
(
engine
);
vheight
=
_srs_config
->
get_engine_vheight
(
engine
);
vthreads
=
_srs_config
->
get_engine_vthreads
(
engine
);
vprofile
=
_srs_config
->
get_engine_vprofile
(
engine
);
vpreset
=
_srs_config
->
get_engine_vpreset
(
engine
);
vparams
=
_srs_config
->
get_engine_vparams
(
engine
);
acodec
=
_srs_config
->
get_engine_acodec
(
engine
);
abitrate
=
_srs_config
->
get_engine_abitrate
(
engine
);
asample_rate
=
_srs_config
->
get_engine_asample_rate
(
engine
);
achannels
=
_srs_config
->
get_engine_achannels
(
engine
);
aparams
=
_srs_config
->
get_engine_aparams
(
engine
);
// ensure the size is even.
vwidth
-=
vwidth
%
2
;
...
...
trunk/src/app/srs_app_ingest.cpp
查看文件 @
a5f4323
...
...
@@ -93,8 +93,7 @@ int SrsIngester::parse_ingesters(SrsConfDirective* vhost)
{
int
ret
=
ERROR_SUCCESS
;
std
::
vector
<
SrsConfDirective
*>
ingesters
;
_srs_config
->
get_ingesters
(
vhost
->
arg0
(),
ingesters
);
std
::
vector
<
SrsConfDirective
*>
ingesters
=
_srs_config
->
get_ingesters
(
vhost
->
arg0
());
// create engine
for
(
int
i
=
0
;
i
<
(
int
)
ingesters
.
size
();
i
++
)
{
...
...
请
注册
或
登录
后发表评论