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-07 21:16:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e4af098d0696a574edd77ad2c358e3cbffb219cd
e4af098d
1 parent
b964a6c5
refine code for bug #66
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
21 行增加
和
12 行删除
trunk/research/librtmp/srs_h264_raw_publish.c
trunk/research/librtmp/srs_h264_raw_publish.c
查看文件 @
e4af098
...
...
@@ -34,18 +34,26 @@ gcc srs_h264_raw_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_h
int
main
(
int
argc
,
char
**
argv
)
{
srs_rtmp_t
rtmp
;
// packet data
int
type
,
size
;
u_int32_t
timestamp
=
0
;
char
*
data
;
srs_trace
(
"publish raw h.264 as rtmp stream to server like FMLE/FFMPEG/Encoder"
);
srs_trace
(
"srs(simple-rtmp-server) client librtmp library."
);
srs_trace
(
"version: %d.%d.%d
\n
"
,
srs_version_major
(),
srs_version_minor
(),
srs_version_revision
());
srs_trace
(
"version: %d.%d.%d"
,
srs_version_major
(),
srs_version_minor
(),
srs_version_revision
());
rtmp
=
srs_rtmp_create
(
"rtmp://127.0.0.1:1935/live/livestream"
);
if
(
argc
<=
2
)
{
srs_trace
(
"Usage: %s <h264_raw_file> <rtmp_publish_url>"
,
argv
[
0
]);
srs_trace
(
" h264_raw_file: the raw h264 steam file."
);
srs_trace
(
" rtmp_publish_url: the rtmp publish url."
);
srs_trace
(
"For example:"
);
srs_trace
(
" %s ./720p.h264.raw rtmp://127.0.0.1:1935/live/livestream"
,
argv
[
0
]);
srs_trace
(
"Where the file: http://winlinvip.github.io/srs.release/3rdparty/720p.h264.raw"
);
srs_trace
(
"See: https://github.com/winlinvip/simple-rtmp-server/issues/66"
);
exit
(
-
1
);
}
const
char
*
raw_file
=
argv
[
1
];
const
char
*
rtmp_url
=
argv
[
2
];
srs_trace
(
"raw_file=%s, rtmp_url=%s"
,
raw_file
,
rtmp_url
);
srs_rtmp_t
rtmp
=
srs_rtmp_create
(
rtmp_url
);
if
(
srs_simple_handshake
(
rtmp
)
!=
0
)
{
srs_trace
(
"simple handshake failed."
);
...
...
@@ -65,11 +73,12 @@ int main(int argc, char** argv)
}
srs_trace
(
"publish stream success"
);
u_int32_t
timestamp
=
0
;
for
(;;)
{
type
=
SRS_RTMP_TYPE_VIDEO
;
int
type
=
SRS_RTMP_TYPE_VIDEO
;
timestamp
+=
40
;
size
=
4096
;
data
=
(
char
*
)
malloc
(
4096
);
int
size
=
4096
;
char
*
data
=
(
char
*
)
malloc
(
4096
);
if
(
srs_write_packet
(
rtmp
,
type
,
timestamp
,
data
,
size
)
!=
0
)
{
goto
rtmp_destroy
;
...
...
请
注册
或
登录
后发表评论