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
67d2beb5
Commit
67d2beb5
authored
Oct 18, 2019
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置文件支持相对路径,http文件服务器防止访问根目录父目录
parent
cbb25ead
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
18 行增加
和
17 行删除
+18
-17
3rdpart/ZLToolKit
+1
-1
server/FFmpegSource.cpp
+2
-2
src/Common/config.cpp
+1
-1
src/Http/HttpSession.cpp
+2
-5
src/MediaFile/MediaReader.cpp
+3
-2
src/MediaFile/MediaRecorder.cpp
+9
-6
没有找到文件。
ZLToolKit
@
ace77b13
Subproject commit
665f53b6a4385e2312d3bf09aa305d7e3bf079e6
Subproject commit
ace77b132039d6ef8a97b6dad92115f88821bc45
server/FFmpegSource.cpp
查看文件 @
67d2beb5
...
...
@@ -39,7 +39,7 @@ const char kLog[] = FFmpeg_FIELD"log";
onceToken
token
([]()
{
mINI
::
Instance
()[
kBin
]
=
trim
(
System
::
execute
(
"which ffmpeg"
));
mINI
::
Instance
()[
kCmd
]
=
"%s -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s"
;
mINI
::
Instance
()[
kLog
]
=
exeDir
()
+
"
ffmpeg/ffmpeg.log"
;
mINI
::
Instance
()[
kLog
]
=
"./
ffmpeg/ffmpeg.log"
;
});
}
...
...
@@ -64,7 +64,7 @@ void FFmpegSource::play(const string &src_url,const string &dst_url,int timeout_
char
cmd
[
1024
]
=
{
0
};
snprintf
(
cmd
,
sizeof
(
cmd
),
ffmpeg_cmd
.
data
(),
ffmpeg_bin
.
data
(),
src_url
.
data
(),
dst_url
.
data
());
_process
.
run
(
cmd
,
ffmpeg_log
);
_process
.
run
(
cmd
,
File
::
absolutePath
(
""
,
true
,
ffmpeg_log
)
);
InfoL
<<
cmd
;
if
(
_media_info
.
_host
==
"127.0.0.1"
){
...
...
src/Common/config.cpp
查看文件 @
67d2beb5
...
...
@@ -122,7 +122,7 @@ const string kMaxReqCount = HTTP_FIELD"maxReqCount";
const
string
kCharSet
=
HTTP_FIELD
"charSet"
;
//http 服务器根目录
#define HTTP_ROOT_PATH
(exeDir() + "httpRoot")
#define HTTP_ROOT_PATH
"./httpRoot"
const
string
kRootPath
=
HTTP_FIELD
"rootPath"
;
//http 404错误提示内容
...
...
src/Http/HttpSession.cpp
查看文件 @
67d2beb5
...
...
@@ -375,10 +375,7 @@ static bool checkHls(BroadcastHttpAccessArgs){
return
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastMediaPlayed
,
args_copy
,
mediaAuthInvoker
,
sender
);
}
void
HttpSession
::
canAccessPath
(
const
string
&
path_in
,
bool
is_dir
,
const
function
<
void
(
const
string
&
errMsg
,
const
HttpServerCookie
::
Ptr
&
cookie
)
>
&
callback_in
){
auto
path
=
path_in
;
replace
(
const_cast
<
string
&>
(
path
),
"//"
,
"/"
);
void
HttpSession
::
canAccessPath
(
const
string
&
path
,
bool
is_dir
,
const
function
<
void
(
const
string
&
errMsg
,
const
HttpServerCookie
::
Ptr
&
cookie
)
>
&
callback_in
){
auto
callback
=
[
callback_in
,
this
](
const
string
&
errMsg
,
const
HttpServerCookie
::
Ptr
&
cookie
){
try
{
callback_in
(
errMsg
,
cookie
);
...
...
@@ -507,7 +504,7 @@ void HttpSession::Handle_Req_GET(int64_t &content_len) {
GET_CONFIG
(
uint32_t
,
reqCnt
,
Http
::
kMaxReqCount
);
GET_CONFIG
(
bool
,
enableVhost
,
General
::
kEnableVhost
);
GET_CONFIG
(
string
,
rootPath
,
Http
::
kRootPath
);
string
strFile
=
enableVhost
?
rootPath
+
"/"
+
_mediaInfo
.
_vhost
+
_parser
.
Url
()
:
rootPath
+
_parser
.
Url
(
);
auto
strFile
=
File
::
absolutePath
(
enableVhost
?
_mediaInfo
.
_vhost
+
_parser
.
Url
()
:
_parser
.
Url
(),
false
,
rootPath
);
bool
bClose
=
(
strcasecmp
(
_parser
[
"Connection"
].
data
(),
"close"
)
==
0
)
||
(
++
_iReqCnt
>
reqCnt
);
do
{
...
...
src/MediaFile/MediaReader.cpp
查看文件 @
67d2beb5
...
...
@@ -44,10 +44,11 @@ MediaReader::MediaReader(const string &strVhost,const string &strApp, const stri
GET_CONFIG
(
string
,
recordPath
,
Record
::
kFilePath
);
GET_CONFIG
(
bool
,
enableVhost
,
General
::
kEnableVhost
);
if
(
enableVhost
){
strFileName
=
recordPath
+
"/"
+
strVhost
+
"/"
+
strApp
+
"/"
+
strId
;
strFileName
=
strVhost
+
"/"
+
strApp
+
"/"
+
strId
;
}
else
{
strFileName
=
recordPath
+
"/"
+
strApp
+
"/"
+
strId
;
strFileName
=
strApp
+
"/"
+
strId
;
}
strFileName
=
File
::
absolutePath
(
strFileName
,
true
,
recordPath
);
}
_hMP4File
=
MP4Read
(
strFileName
.
data
());
...
...
src/MediaFile/MediaRecorder.cpp
查看文件 @
67d2beb5
...
...
@@ -56,13 +56,15 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
#if defined(ENABLE_HLS)
if
(
enableHls
)
{
string
m3u8FilePath
;
string
params
;
if
(
enableVhost
){
m3u8FilePath
=
hlsPath
+
"/"
+
strVhost
+
"/"
+
strApp
+
"/"
+
strId
+
"/hls.m3u8"
;
_hlsRecorder
.
reset
(
new
HlsRecorder
(
m3u8FilePath
,
string
(
VHOST_KEY
)
+
"="
+
strVhost
,
hlsBufSize
,
hlsDuration
,
hlsNum
))
;
m3u8FilePath
=
strVhost
+
"/"
+
strApp
+
"/"
+
strId
+
"/hls.m3u8"
;
params
=
string
(
VHOST_KEY
)
+
"="
+
strVhost
;
}
else
{
m3u8FilePath
=
hlsPath
+
"/"
+
strApp
+
"/"
+
strId
+
"/hls.m3u8"
;
_hlsRecorder
.
reset
(
new
HlsRecorder
(
m3u8FilePath
,
""
,
hlsBufSize
,
hlsDuration
,
hlsNum
));
m3u8FilePath
=
strApp
+
"/"
+
strId
+
"/hls.m3u8"
;
}
m3u8FilePath
=
File
::
absolutePath
(
m3u8FilePath
,
true
,
hlsPath
);
_hlsRecorder
.
reset
(
new
HlsRecorder
(
m3u8FilePath
,
params
,
hlsBufSize
,
hlsDuration
,
hlsNum
));
}
#endif //defined(ENABLE_HLS)
...
...
@@ -73,10 +75,11 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
if
(
enableMp4
){
string
mp4FilePath
;
if
(
enableVhost
){
mp4FilePath
=
recordPath
+
"/"
+
strVhost
+
"/"
+
recordAppName
+
"/"
+
strApp
+
"/"
+
strId
+
"/"
;
mp4FilePath
=
strVhost
+
"/"
+
recordAppName
+
"/"
+
strApp
+
"/"
+
strId
+
"/"
;
}
else
{
mp4FilePath
=
record
Path
+
"/"
+
record
AppName
+
"/"
+
strApp
+
"/"
+
strId
+
"/"
;
mp4FilePath
=
recordAppName
+
"/"
+
strApp
+
"/"
+
strId
+
"/"
;
}
mp4FilePath
=
File
::
absolutePath
(
mp4FilePath
,
true
,
recordPath
);
_mp4Recorder
.
reset
(
new
MP4Recorder
(
mp4FilePath
,
strVhost
,
strApp
,
strId
));
}
#endif //defined(ENABLE_MP4RECORD)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论