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-11-28 12:26:36 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ff5cdb1cc1770de988156746d717ad0d5d70ddb1
ff5cdb1c
1 parent
0d98dc88
for bug #215, add srs_rtmp_dump tool. 2.0.37.
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
131 行增加
和
2 行删除
README.md
trunk/research/librtmp/Makefile
trunk/research/librtmp/srs_rtmp_dump.c
trunk/src/core/srs_core.hpp
trunk/src/srs/srs.upp
README.md
查看文件 @
ff5cdb1
...
...
@@ -485,6 +485,7 @@ Supported operating systems and hardware:
*
2013-10-17, Created.
<br/>
## History
*
v2.0, 2014-11-28, fix
[
#215
](
https://github.com/winlinvip/simple-rtmp-server/issues/215
)
, for bug #215, add srs_rtmp_dump tool. 2.0.37.
*
v2.0, 2014-11-25, update PRIMARY, AUTHORS, CONTRIBUTORS rule. 2.0.32.
*
v2.0, 2014-11-24, fix
[
#212
](
https://github.com/winlinvip/simple-rtmp-server/issues/212
)
, support publish aac adts raw stream. 2.0.31.
*
v2.0, 2014-11-22, fix
[
#217
](
https://github.com/winlinvip/simple-rtmp-server/issues/217
)
, remove timeout recv, support 7.5k+ 250kbps clients. 2.0.30.
...
...
trunk/research/librtmp/Makefile
查看文件 @
ff5cdb1
...
...
@@ -7,7 +7,8 @@ else
objs/srs_flv_injecter objs/srs_publish objs/srs_play
\
objs/srs_ingest_flv objs/srs_ingest_rtmp objs/srs_detect_rtmp
\
objs/srs_bandwidth_check objs/srs_h264_raw_publish
\
objs/srs_audio_raw_publish objs/srs_aac_raw_publish
objs/srs_audio_raw_publish objs/srs_aac_raw_publish
\
objs/srs_rtmp_dump
endif
.PHONY
:
default clean help ssl nossl
...
...
@@ -32,6 +33,7 @@ help:
@
echo
" srs_ingest_rtmp ingest RTMP and publish to RTMP server."
@
echo
" srs_detect_rtmp detect RTMP stream info."
@
echo
" srs_bandwidth_check bandwidth check/test tool."
@
echo
" srs_rtmp_dump dump rtmp stream to flv file."
@
echo
"Remark: about simple/complex handshake, see: http://blog.csdn.net/win_lin/article/details/13006803"
@
echo
"Remark: srs Makefile will auto invoke this by --with/without-ssl, "
@
echo
" that is, if user specified ssl(by --with-ssl), srs will make this by 'make ssl'"
...
...
@@ -108,3 +110,6 @@ objs/srs_detect_rtmp: srs_detect_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(
objs/srs_bandwidth_check
:
srs_bandwidth_check.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
$(GCC)
srs_bandwidth_check.c
$(SRS_LIBRTMP_L)
$(SRS_LIBSSL_L)
$(EXTRA_CXX_FLAG)
-o objs/srs_bandwidth_check
objs/srs_rtmp_dump
:
srs_rtmp_dump.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
$(GCC)
srs_rtmp_dump.c
$(SRS_LIBRTMP_L)
$(SRS_LIBSSL_L)
$(EXTRA_CXX_FLAG)
-o objs/srs_rtmp_dump
...
...
trunk/research/librtmp/srs_rtmp_dump.c
0 → 100644
查看文件 @
ff5cdb1
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
gcc srs_rtmp_dump.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_rtmp_dump
*/
#include <stdio.h>
#include <stdlib.h>
#include "../../objs/include/srs_librtmp.h"
int
main
(
int
argc
,
char
**
argv
)
{
printf
(
"dump rtmp stream to flv file
\n
"
);
printf
(
"srs(simple-rtmp-server) client librtmp library.
\n
"
);
printf
(
"version: %d.%d.%d
\n
"
,
srs_version_major
(),
srs_version_minor
(),
srs_version_revision
());
if
(
argc
<=
2
)
{
printf
(
"Usage: %s <rtmp_url> <flv_path>
\n
"
" rtmp_url RTMP stream url to play
\n
"
" flv_path The flv file path to save
\n
"
"For example:
\n
"
" %s rtmp://127.0.0.1:1935/live/livestream output.flv
\n
"
,
argv
[
0
],
argv
[
0
]);
exit
(
-
1
);
}
srs_human_trace
(
"rtmp url: %s"
,
argv
[
1
]);
srs_human_trace
(
"flv path: %s"
,
argv
[
2
]);
srs_rtmp_t
rtmp
=
srs_rtmp_create
(
argv
[
1
]);
if
(
srs_rtmp_handshake
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"simple handshake failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"simple handshake success"
);
if
(
srs_rtmp_connect_app
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"connect vhost/app failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"connect vhost/app success"
);
if
(
srs_rtmp_play_stream
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"play stream failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"play stream success"
);
srs_flv_t
flv
=
srs_flv_open_write
(
argv
[
2
]);
// flv header
char
header
[
9
];
// 3bytes, signature, "FLV",
header
[
0
]
=
'F'
;
header
[
1
]
=
'L'
;
header
[
2
]
=
'V'
;
// 1bytes, version, 0x01,
header
[
3
]
=
0x01
;
// 1bytes, flags, UB[5] 0, UB[1] audio present, UB[1] 0, UB[1] video present.
header
[
4
]
=
0x03
;
// audio + video.
// 4bytes, dataoffset
header
[
5
]
=
0x00
;
header
[
6
]
=
0x00
;
header
[
7
]
=
0x00
;
header
[
8
]
=
0x09
;
if
(
srs_flv_write_header
(
flv
,
header
)
!=
0
)
{
srs_human_trace
(
"write flv header failed."
);
goto
rtmp_destroy
;
}
for
(;;)
{
int
size
;
char
type
;
char
*
data
;
u_int32_t
timestamp
;
if
(
srs_rtmp_read_packet
(
rtmp
,
&
type
,
&
timestamp
,
&
data
,
&
size
)
!=
0
)
{
srs_human_trace
(
"read rtmp packet failed."
);
goto
rtmp_destroy
;
}
if
(
srs_human_print_rtmp_packet
(
type
,
timestamp
,
data
,
size
)
!=
0
)
{
srs_human_trace
(
"print rtmp packet failed."
);
goto
rtmp_destroy
;
}
if
(
srs_flv_write_tag
(
flv
,
type
,
timestamp
,
data
,
size
)
!=
0
)
{
srs_human_trace
(
"dump rtmp packet failed."
);
goto
rtmp_destroy
;
}
free
(
data
);
}
rtmp_destroy:
srs_rtmp_destroy
(
rtmp
);
srs_flv_close
(
flv
);
srs_human_trace
(
"completed"
);
return
0
;
}
...
...
trunk/src/core/srs_core.hpp
查看文件 @
ff5cdb1
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 3
6
#define VERSION_REVISION 3
7
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
...
...
trunk/src/srs/srs.upp
查看文件 @
ff5cdb1
...
...
@@ -141,6 +141,7 @@ file
..\..\research\librtmp\srs_ingest_rtmp.c,
..\..\research\librtmp\srs_play.c,
..\..\research\librtmp\srs_publish.c,
..\..\research\librtmp\srs_rtmp_dump.c,
..\..\research\hls\ts_info.cc;
mainconfig
...
...
请
注册
或
登录
后发表评论