Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
1eb40884
Commit
1eb40884
authored
5 years ago
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善按需拉流范例
parent
c876c433
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
26 行增加
和
2 行删除
+26
-2
server/WebApi.cpp
+26
-2
没有找到文件。
server/WebApi.cpp
查看文件 @
1eb40884
...
...
@@ -578,8 +578,10 @@ void installWebApi() {
//媒体未找到事件,我们都及时拉流hks作为替代品,目的是为了测试按需拉流
CHECK_SECRET
();
CHECK_ARGS
(
"vhost"
,
"app"
,
"stream"
);
GET_CONFIG
(
int
,
rtmp_port
,
Rtmp
::
kPort
);
#if 1
//通过FFmpeg按需拉流
GET_CONFIG
(
int
,
rtmp_port
,
Rtmp
::
kPort
);
string
dst_url
=
StrPrinter
<<
"rtmp://127.0.0.1:"
<<
rtmp_port
<<
"/"
...
...
@@ -587,7 +589,7 @@ void installWebApi() {
<<
allArgs
[
"stream"
]
<<
"?vhost="
<<
allArgs
[
"vhost"
];
addFFmepgSource
(
"http://live.hkstv.hk.lxdns.com/live/hks2/playlist.m3u8"
,
addFFmepgSource
(
"http://live.hkstv.hk.lxdns.com/live/hks2/playlist.m3u8"
,
/** ffmpeg拉流支持任意编码格式任意协议 **/
dst_url
,
10000
,
[
invoker
,
val
,
headerOut
](
const
SockException
&
ex
,
const
string
&
key
){
...
...
@@ -599,6 +601,28 @@ void installWebApi() {
}
invoker
(
"200 OK"
,
headerOut
,
val
.
toStyledString
());
});
#else
//通过内置支持的rtsp/rtmp按需拉流
addStreamProxy
(
allArgs
[
"vhost"
],
allArgs
[
"app"
],
allArgs
[
"stream"
],
/** 支持rtsp和rtmp方式拉流 ,rtsp支持h265/h264/aac,rtmp仅支持h264/aac **/
"rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"
,
//rtmp://live.hkstv.hk.lxdns.com/live/hks2
false
,
false
,
0
,
//rtp over tcp方式拉流
[
invoker
,
val
,
headerOut
](
const
SockException
&
ex
,
const
string
&
key
){
if
(
ex
){
const_cast
<
Value
&>
(
val
)[
"code"
]
=
API
::
OtherFailed
;
const_cast
<
Value
&>
(
val
)[
"msg"
]
=
ex
.
what
();
}
else
{
const_cast
<
Value
&>
(
val
)[
"data"
][
"key"
]
=
key
;
}
invoker
(
"200 OK"
,
headerOut
,
val
.
toStyledString
());
});
#endif
});
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论