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 09:25:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
99bf397487e296deb17afdaf52b304f54b4cca47
99bf3974
1 parent
b04888a3
for bug #293, add mp3 id3 spec
隐藏空白字符变更
内嵌
并排对比
正在显示
9 个修改的文件
包含
78 行增加
和
10 行删除
trunk/configure
trunk/doc/mp3.id3v2.3.0.pdf
trunk/doc/readme.txt
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http_conn.hpp
trunk/src/kernel/srs_kernel_aac.cpp
trunk/src/kernel/srs_kernel_aac.hpp
trunk/src/kernel/srs_kernel_error.hpp
trunk/src/srs/srs.upp
trunk/configure
查看文件 @
99bf397
...
...
@@ -365,7 +365,7 @@ MODULE_DEPENDS=("CORE")
ModuleLibIncs
=(
${
SRS_OBJS_DIR
}
)
MODULE_FILES
=(
"srs_kernel_error"
"srs_kernel_log"
"srs_kernel_stream"
"srs_kernel_utility"
"srs_kernel_flv"
"srs_kernel_codec"
"srs_kernel_file"
"srs_kernel_consts"
"srs_kernel_aac"
)
"srs_kernel_consts"
"srs_kernel_aac"
"srs_kernel_mp3"
)
KERNEL_INCS
=
"src/kernel"
;
MODULE_DIR
=
${
KERNEL_INCS
}
. auto/modules.sh
KERNEL_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
#
...
...
trunk/doc/mp3.id3v2.3.0.pdf
0 → 100644
查看文件 @
99bf397
不能预览此文件类型
trunk/doc/readme.txt
查看文件 @
99bf397
...
...
@@ -63,4 +63,8 @@ http1.1-rfc2616.txt
arpa-internet-text-messages-rfc822.txt
http://www.rfc-editor.org/rfc/rfc822.txt
mp3规范:
mp3.id3v2.3.0.pdf
http://id3.org/id3v2.3.0
Winlin
...
...
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
99bf397
...
...
@@ -45,6 +45,7 @@ using namespace std;
#include <srs_app_source.hpp>
#include <srs_protocol_msg_array.hpp>
#include <srs_kernel_aac.hpp>
#include <srs_kernel_mp3.hpp>
SrsVodStream
::
SrsVodStream
(
string
root_dir
)
:
SrsGoHttpFileServer
(
root_dir
)
...
...
@@ -226,6 +227,44 @@ int SrsAacStreamEncoder::write_metadata(int64_t /*timestamp*/, char* /*data*/, i
return
ERROR_SUCCESS
;
}
SrsMp3StreamEncoder
::
SrsMp3StreamEncoder
()
{
enc
=
new
SrsMp3Encoder
();
}
SrsMp3StreamEncoder
::~
SrsMp3StreamEncoder
()
{
srs_freep
(
enc
);
}
int
SrsMp3StreamEncoder
::
initialize
(
SrsFileWriter
*
w
)
{
int
ret
=
ERROR_SUCCESS
;
if
((
ret
=
enc
->
initialize
(
w
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
ret
;
}
int
SrsMp3StreamEncoder
::
write_audio
(
int64_t
timestamp
,
char
*
data
,
int
size
)
{
return
enc
->
write_audio
(
timestamp
,
data
,
size
);
}
int
SrsMp3StreamEncoder
::
write_video
(
int64_t
/*timestamp*/
,
char
*
/*data*/
,
int
/*size*/
)
{
// mp3 ignore any flv video.
return
ERROR_SUCCESS
;
}
int
SrsMp3StreamEncoder
::
write_metadata
(
int64_t
/*timestamp*/
,
char
*
/*data*/
,
int
/*size*/
)
{
// mp3 ignore any flv metadata.
return
ERROR_SUCCESS
;
}
SrsStreamWriter
::
SrsStreamWriter
(
ISrsGoHttpResponseWriter
*
w
)
{
writer
=
w
;
...
...
@@ -279,12 +318,15 @@ int SrsLiveStream::serve_http(ISrsGoHttpResponseWriter* w, SrsHttpMessage* r)
bool
serve_flv_streaming
=
false
;
bool
serve_aac_streaming
=
false
;
bool
serve_mp3_streaming
=
false
;
srs_assert
(
entry
);
if
(
srs_string_ends_with
(
entry
->
pattern
,
".flv"
))
{
serve_flv_streaming
=
true
;
}
else
if
(
srs_string_ends_with
(
entry
->
pattern
,
".aac"
))
{
serve_aac_streaming
=
true
;
}
else
if
(
srs_string_ends_with
(
entry
->
pattern
,
".mp3"
))
{
serve_mp3_streaming
=
true
;
}
else
{
ret
=
ERROR_HTTP_LIVE_STREAM_EXT
;
srs_error
(
"http: unsupported pattern %s"
,
entry
->
pattern
.
c_str
());
...
...
@@ -322,6 +364,9 @@ int SrsLiveStream::serve_http(ISrsGoHttpResponseWriter* w, SrsHttpMessage* r)
if
(
serve_aac_streaming
)
{
enc
=
new
SrsAacStreamEncoder
();
}
if
(
serve_mp3_streaming
)
{
enc
=
new
SrsMp3StreamEncoder
();
}
SrsAutoFree
(
ISrsStreamEncoder
,
enc
);
if
((
ret
=
enc
->
initialize
(
&
writer
))
!=
ERROR_SUCCESS
)
{
...
...
trunk/src/app/srs_app_http_conn.hpp
查看文件 @
99bf397
...
...
@@ -42,6 +42,7 @@ class SrsSource;
class
SrsRequest
;
class
SrsStSocket
;
class
SrsAacEncoder
;
class
SrsMp3Encoder
;
class
SrsFlvEncoder
;
class
SrsHttpParser
;
class
SrsHttpMessage
;
...
...
@@ -113,6 +114,23 @@ public:
};
/**
* the mp3 stream encoder, remux rtmp stream to mp3 stream.
*/
class
SrsMp3StreamEncoder
:
public
ISrsStreamEncoder
{
private
:
SrsMp3Encoder
*
enc
;
public
:
SrsMp3StreamEncoder
();
virtual
~
SrsMp3StreamEncoder
();
public
:
virtual
int
initialize
(
SrsFileWriter
*
w
);
virtual
int
write_audio
(
int64_t
timestamp
,
char
*
data
,
int
size
);
virtual
int
write_video
(
int64_t
timestamp
,
char
*
data
,
int
size
);
virtual
int
write_metadata
(
int64_t
timestamp
,
char
*
data
,
int
size
);
};
/**
* write stream to http response direclty.
*/
class
SrsStreamWriter
:
public
SrsFileWriter
...
...
trunk/src/kernel/srs_kernel_aac.cpp
查看文件 @
99bf397
...
...
@@ -38,9 +38,6 @@ using namespace std;
#include <srs_kernel_file.hpp>
#include <srs_kernel_codec.hpp>
#define SRS_FLV_TAG_HEADER_SIZE 11
#define SRS_FLV_PREVIOUS_TAG_SIZE 4
SrsAacEncoder
::
SrsAacEncoder
()
{
_fs
=
NULL
;
...
...
trunk/src/kernel/srs_kernel_aac.hpp
查看文件 @
99bf397
...
...
@@ -36,7 +36,7 @@ class SrsFileWriter;
class
SrsFileReader
;
/**
* encode data to
flv
file.
* encode data to
aac
file.
*/
class
SrsAacEncoder
{
...
...
@@ -55,8 +55,8 @@ public:
public
:
/**
* initialize the underlayer file stream.
* @remark user can initialize multiple times to encode multiple flv files.
* @remark, user must free the fs, flv encoder never close/free it.
* @remark user can initialize multiple times to encode multiple aac files.
* @remark, user must free the fs, aac encoder never close/free it.
*/
virtual
int
initialize
(
SrsFileWriter
*
fs
);
public
:
...
...
trunk/src/kernel/srs_kernel_error.hpp
查看文件 @
99bf397
...
...
@@ -202,9 +202,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_AAC_REQUIRED_ADTS 3046
#define ERROR_AAC_ADTS_HEADER 3047
#define ERROR_AAC_DATA_INVALID 3048
#define ERROR_HTTP_STATUS_INVLIAD 3049
#define ERROR_KERNEL_AAC_STREAM_CLOSED 3050
#define ERROR_AAC_DECODE_ERROR 3051
///////////////////////////////////////////////////////
// HTTP protocol error.
...
...
@@ -214,6 +211,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_HTTP_URL_NOT_CLEAN 4002
#define ERROR_HTTP_CONTENT_LENGTH 4003
#define ERROR_HTTP_LIVE_STREAM_EXT 4004
#define ERROR_HTTP_STATUS_INVLIAD 4005
#define ERROR_KERNEL_AAC_STREAM_CLOSED 4006
#define ERROR_AAC_DECODE_ERROR 4007
#define ERROR_KERNEL_MP3_STREAM_CLOSED 4008
#define ERROR_MP3_DECODE_ERROR 4009
/**
* whether the error code is an system control error.
...
...
trunk/src/srs/srs.upp
查看文件 @
99bf397
...
...
@@ -32,6 +32,8 @@ file
..\kernel\srs_kernel_flv.cpp,
..\kernel\srs_kernel_log.hpp,
..\kernel\srs_kernel_log.cpp,
..\kernel\srs_kernel_mp3.hpp,
..\kernel\srs_kernel_mp3.cpp,
..\kernel\srs_kernel_stream.hpp,
..\kernel\srs_kernel_stream.cpp,
..\kernel\srs_kernel_utility.hpp,
...
...
请
注册
或
登录
后发表评论