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-01-19 10:13:43 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d364a81d8f7c96dd925410871fc46831c8fadaad
d364a81d
1 parent
99bf3974
for #293, support http mp3 streaming
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
12 行增加
和
28 行删除
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
d364a81
...
...
@@ -245,6 +245,10 @@ int SrsMp3StreamEncoder::initialize(SrsFileWriter* w)
return
ret
;
}
if
((
ret
=
enc
->
write_header
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
ret
;
}
...
...
@@ -316,22 +320,24 @@ int SrsLiveStream::serve_http(ISrsGoHttpResponseWriter* w, SrsHttpMessage* r)
{
int
ret
=
ERROR_SUCCESS
;
bool
serve_flv_streaming
=
false
;
bool
serve_aac_streaming
=
false
;
bool
serve_mp3_streaming
=
false
;
ISrsStreamEncoder
*
enc
=
NULL
;
srs_assert
(
entry
);
if
(
srs_string_ends_with
(
entry
->
pattern
,
".flv"
))
{
serve_flv_streaming
=
true
;
w
->
header
()
->
set_content_type
(
"video/x-flv"
);
enc
=
new
SrsFlvStreamEncoder
();
}
else
if
(
srs_string_ends_with
(
entry
->
pattern
,
".aac"
))
{
serve_aac_streaming
=
true
;
w
->
header
()
->
set_content_type
(
"audio/x-aac"
);
enc
=
new
SrsAacStreamEncoder
();
}
else
if
(
srs_string_ends_with
(
entry
->
pattern
,
".mp3"
))
{
serve_mp3_streaming
=
true
;
w
->
header
()
->
set_content_type
(
"audio/mpeg"
);
enc
=
new
SrsMp3StreamEncoder
();
}
else
{
ret
=
ERROR_HTTP_LIVE_STREAM_EXT
;
srs_error
(
"http: unsupported pattern %s"
,
entry
->
pattern
.
c_str
());
return
ret
;
}
SrsAutoFree
(
ISrsStreamEncoder
,
enc
);
// create consumer of souce.
SrsConsumer
*
consumer
=
NULL
;
...
...
@@ -344,31 +350,9 @@ int SrsLiveStream::serve_http(ISrsGoHttpResponseWriter* w, SrsHttpMessage* r)
SrsMessageArray
msgs
(
SRS_PERF_MW_MSGS
);
// TODO: FIMXE: add pithy print.
// write http header for streaming.
// use chunked encoding, for we donot specifes the content length.
if
(
serve_flv_streaming
)
{
w
->
header
()
->
set_content_type
(
"video/x-flv"
);
}
if
(
serve_aac_streaming
)
{
w
->
header
()
->
set_content_type
(
"audio/x-aac"
);
}
// the memory writer.
SrsStreamWriter
writer
(
w
);
ISrsStreamEncoder
*
enc
=
NULL
;
if
(
serve_flv_streaming
)
{
enc
=
new
SrsFlvStreamEncoder
();
}
if
(
serve_aac_streaming
)
{
enc
=
new
SrsAacStreamEncoder
();
}
if
(
serve_mp3_streaming
)
{
enc
=
new
SrsMp3StreamEncoder
();
}
SrsAutoFree
(
ISrsStreamEncoder
,
enc
);
if
((
ret
=
enc
->
initialize
(
&
writer
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
...
...
请
注册
或
登录
后发表评论