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
55814070
Commit
55814070
authored
Dec 05, 2019
by
Gemfield
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CMakeFiles for RTP Proxy
parent
55d258fa
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
111 行增加
和
23 行删除
+111
-23
CMakeLists.txt
+33
-23
server/WebApi.cpp
+14
-0
tests/test_rtp.cpp
+64
-0
没有找到文件。
CMakeLists.txt
查看文件 @
55814070
...
...
@@ -34,6 +34,8 @@ LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH})
#设置工程源码根目录
set
(
ToolKit_Root
${
CMAKE_CURRENT_SOURCE_DIR
}
/3rdpart/ZLToolKit/src
)
set
(
MediaKit_Root
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
)
set
(
MediaServer_Root
${
CMAKE_CURRENT_SOURCE_DIR
}
/3rdpart/media-server
)
#设置头文件目录
INCLUDE_DIRECTORIES
(
${
ToolKit_Root
}
)
...
...
@@ -59,22 +61,8 @@ set(ENABLE_FAAC false)
set
(
ENABLE_X264 false
)
set
(
ENABLE_MP4RECORD true
)
#添加两个静态库
if
(
ENABLE_HLS
)
message
(
STATUS
"ENABLE_HLS defined"
)
add_definitions
(
-DENABLE_HLS
)
set
(
MediaServer_Root
${
CMAKE_CURRENT_SOURCE_DIR
}
/3rdpart/media-server
)
set
(
LINK_LIB_LIST zlmediakit zltoolkit mpeg
)
else
()
set
(
LINK_LIB_LIST zlmediakit zltoolkit
)
endif
()
set
(
LINK_LIB_LIST zlmediakit zltoolkit
)
if
(
ENABLE_MP4RECORD
)
message
(
STATUS
"ENABLE_MP4RECORD defined"
)
add_definitions
(
-DENABLE_MP4RECORD
)
set
(
MediaServer_Root
${
CMAKE_CURRENT_SOURCE_DIR
}
/3rdpart/media-server
)
list
(
APPEND LINK_LIB_LIST mov flv
)
endif
()
#查找openssl是否安装
find_package
(
OpenSSL QUIET
)
if
(
OPENSSL_FOUND AND ENABLE_OPENSSL
)
...
...
@@ -122,32 +110,42 @@ if (FAAC_FOUND AND ENABLE_FAAC)
endif
()
#添加库
add_library
(
zltoolkit STATIC
${
ToolKit_src_list
}
)
add_library
(
zlmediakit STATIC
${
MediaKit_src_list
}
)
set
(
VS_FALGS
"/wd4819 /wd4996 /wd4018 /wd4267 /wd4244 /wd4101 /wd4828 /wd4309 /wd4573"
)
#libmpeg
#添加mpeg用于支持ts生成
if
(
ENABLE_HLS
)
message
(
STATUS
"ENABLE_HLS defined"
)
add_definitions
(
-DENABLE_HLS
)
aux_source_directory
(
${
MediaServer_Root
}
/libmpeg/include src_mpeg
)
aux_source_directory
(
${
MediaServer_Root
}
/libmpeg/source src_mpeg
)
include_directories
(
${
MediaServer_Root
}
/libmpeg/include
)
add_library
(
mpeg STATIC
${
src_mpeg
}
)
list
(
APPEND LINK_LIB_LIST mpeg
)
if
(
WIN32
)
set_target_properties
(
mpeg PROPERTIES COMPILE_FLAGS
${
VS_FALGS
}
)
endif
(
WIN32
)
endif
()
#添加mov、flv库用于MP4录制
if
(
ENABLE_MP4RECORD
)
message
(
STATUS
"ENABLE_MP4RECORD defined"
)
add_definitions
(
-DENABLE_MP4RECORD
)
aux_source_directory
(
${
MediaServer_Root
}
/libmov/include src_mov
)
aux_source_directory
(
${
MediaServer_Root
}
/libmov/source src_mov
)
include_directories
(
${
MediaServer_Root
}
/libmov/include
)
aux_source_directory
(
${
MediaServer_Root
}
/libflv/include src_flv
)
aux_source_directory
(
${
MediaServer_Root
}
/libflv/source src_flv
)
include_directories
(
${
MediaServer_Root
}
/libflv/include
)
add_library
(
mov STATIC
${
src_mov
}
)
add_library
(
mov STATIC
${
src_mov
}
)
add_library
(
flv STATIC
${
src_flv
}
)
list
(
APPEND LINK_LIB_LIST mov flv
)
if
(
WIN32
)
set_target_properties
(
mov flv PROPERTIES COMPILE_FLAGS
${
VS_FALGS
}
)
endif
(
WIN32
)
...
...
@@ -163,6 +161,19 @@ if(${CMAKE_BUILD_TYPE} MATCHES "Release")
endif
()
endif
()
#添加rtp库用于rtp转ps/ts
aux_source_directory
(
${
MediaServer_Root
}
/librtp/include src_rtp
)
aux_source_directory
(
${
MediaServer_Root
}
/librtp/source src_rtp
)
aux_source_directory
(
${
MediaServer_Root
}
/librtp/payload src_rtp
)
include_directories
(
${
MediaServer_Root
}
/librtp/include
)
add_library
(
rtp STATIC
${
src_rtp
}
)
list
(
APPEND LINK_LIB_LIST rtp
)
#添加库
add_library
(
zltoolkit STATIC
${
ToolKit_src_list
}
)
add_library
(
zlmediakit STATIC
${
MediaKit_src_list
}
)
if
(
WIN32
)
list
(
APPEND LINK_LIB_LIST WS2_32 Iphlpapi shlwapi
)
set_target_properties
(
zltoolkit PROPERTIES COMPILE_FLAGS
${
VS_FALGS
}
)
...
...
@@ -172,7 +183,6 @@ elseif(NOT ANDROID OR IOS)
endif
()
#测试程序
add_subdirectory
(
tests
)
...
...
server/WebApi.cpp
查看文件 @
55814070
...
...
@@ -46,6 +46,7 @@
#include "WebApi.h"
#include "WebHook.h"
#include "Thread/WorkThreadPool.h"
#include "Rtp/RtpSelector.h"
#if !defined(_WIN32)
#include "FFmpegSource.h"
...
...
@@ -692,6 +693,19 @@ void installWebApi() {
invoker
.
responseFile
(
headerIn
,
StrCaseMap
(),
exePath
());
});
API_REGIST
(
api
,
getSsrcInfo
,{
CHECK_SECRET
();
CHECK_ARGS
(
"ssrc"
);
auto
process
=
RtpSelector
::
Instance
().
getProcess
(
allArgs
[
"ssrc"
],
false
);
if
(
!
process
){
val
[
"exist"
]
=
false
;
return
;
}
val
[
"exist"
]
=
true
;
val
[
"peer_ip"
]
=
process
->
get_peer_ip
();
val
[
"peer_port"
]
=
process
->
get_peer_port
();
});
// 开始录制hls或MP4
API_REGIST
(
api
,
startRecord
,{
CHECK_SECRET
();
...
...
tests/test_rtp.cpp
0 → 100644
查看文件 @
55814070
/*
* MIT License
*
* Copyright (c) 2016-2019 Gemfield <gemfield@civilnet.cn>
*
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
*
* 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.
*/
#include <map>
#include <iostream>
#include "Util/MD5.h"
#include "Util/File.h"
#include "Util/logger.h"
#include "Util/SSLBox.h"
#include "Util/util.h"
#include "Network/TcpServer.h"
#include "Common/config.h"
#include "Rtsp/RtspSession.h"
#include "Rtmp/RtmpSession.h"
#include "Http/HttpSession.h"
#include "Rtp/RtpFileLoader.h"
using
namespace
std
;
using
namespace
toolkit
;
using
namespace
mediakit
;
int
main
(
int
argc
,
char
*
argv
[])
{
{
//设置日志
Logger
::
Instance
().
add
(
std
::
make_shared
<
ConsoleChannel
>
(
"ConsoleChannel"
));
//启动异步日志线程
Logger
::
Instance
().
setWriter
(
std
::
make_shared
<
AsyncLogWriter
>
());
loadIniConfig
((
exeDir
()
+
"config.ini"
).
data
());
TcpServer
::
Ptr
rtspSrv
(
new
TcpServer
());
TcpServer
::
Ptr
rtmpSrv
(
new
TcpServer
());
TcpServer
::
Ptr
httpSrv
(
new
TcpServer
());
rtspSrv
->
start
<
RtspSession
>
(
554
);
//默认554
rtmpSrv
->
start
<
RtmpSession
>
(
1935
);
//默认1935
httpSrv
->
start
<
HttpSession
>
(
80
);
//默认80
RtpFileLoader
::
loadFile
(
argv
[
1
]);
}
return
0
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论