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
7a95c87a
Commit
7a95c87a
authored
Apr 22, 2023
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
空构造和析构函数替换为缺省 去除多余分号
parent
e8a42594
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
50 行增加
和
57 行删除
+50
-57
api/source/mk_player.cpp
+1
-1
server/main.cpp
+6
-6
src/Extension/Track.h
+4
-5
src/Http/HttpBody.cpp
+1
-1
src/Http/HttpBody.h
+3
-3
src/Http/HttpCookie.h
+6
-4
src/Http/HttpFileManager.h
+2
-2
src/Http/HttpRequestSplitter.h
+2
-2
src/Http/WebSocketClient.h
+1
-1
src/Http/WebSocketSession.h
+2
-2
src/Http/WebSocketSplitter.h
+4
-4
src/Record/MPEG.h
+1
-1
src/Rtcp/Rtcp.cpp
+1
-3
src/Rtmp/Rtmp.h
+4
-5
src/Rtmp/RtmpProtocol.cpp
+2
-2
src/Rtp/RtpSplitter.cpp
+1
-6
src/Rtp/RtpSplitter.h
+2
-2
src/Rtp/TSDecoder.h
+1
-1
src/Rtsp/RtpCodec.h
+1
-1
src/Rtsp/Rtsp.h
+3
-3
src/Rtsp/RtspSplitter.h
+2
-2
没有找到文件。
api/source/mk_player.cpp
查看文件 @
7a95c87a
...
...
@@ -24,7 +24,7 @@ public:
MediaPlayerForC
(){
_player
=
std
::
make_shared
<
MediaPlayer
>
();
}
~
MediaPlayerForC
()
{}
~
MediaPlayerForC
()
=
default
;
MediaPlayer
*
operator
->
(){
return
_player
.
get
();
...
...
server/main.cpp
查看文件 @
7a95c87a
...
...
@@ -260,16 +260,16 @@ int start_main(int argc,char *argv[]) {
auto
shellSrv
=
std
::
make_shared
<
TcpServer
>
();
//rtsp[s]服务器, 可用于诸如亚马逊echo show这样的设备访问
auto
rtspSrv
=
std
::
make_shared
<
TcpServer
>
();
;
auto
rtspSSLSrv
=
std
::
make_shared
<
TcpServer
>
();
;
auto
rtspSrv
=
std
::
make_shared
<
TcpServer
>
();
auto
rtspSSLSrv
=
std
::
make_shared
<
TcpServer
>
();
//rtmp[s]服务器
auto
rtmpSrv
=
std
::
make_shared
<
TcpServer
>
();
;
auto
rtmpsSrv
=
std
::
make_shared
<
TcpServer
>
();
;
auto
rtmpSrv
=
std
::
make_shared
<
TcpServer
>
();
auto
rtmpsSrv
=
std
::
make_shared
<
TcpServer
>
();
//http[s]服务器
auto
httpSrv
=
std
::
make_shared
<
TcpServer
>
();
;
auto
httpsSrv
=
std
::
make_shared
<
TcpServer
>
();
;
auto
httpSrv
=
std
::
make_shared
<
TcpServer
>
();
auto
httpsSrv
=
std
::
make_shared
<
TcpServer
>
();
#if defined(ENABLE_RTPPROXY)
//GB28181 rtp推流端口,支持UDP/TCP
...
...
src/Extension/Track.h
查看文件 @
7a95c87a
...
...
@@ -24,9 +24,8 @@ namespace mediakit{
class
Track
:
public
FrameDispatcher
,
public
CodecInfo
{
public
:
using
Ptr
=
std
::
shared_ptr
<
Track
>
;
Track
(){}
virtual
~
Track
(){}
Track
()
=
default
;
virtual
~
Track
()
=
default
;
/**
* 是否准备好,准备好才能获取譬如sps pps等信息
...
...
@@ -177,8 +176,8 @@ private:
class
TrackSource
{
public
:
TrackSource
()
{}
virtual
~
TrackSource
()
{}
TrackSource
()
=
default
;
virtual
~
TrackSource
()
=
default
;
/**
* 获取全部的Track
...
...
src/Http/HttpBody.cpp
查看文件 @
7a95c87a
...
...
@@ -189,7 +189,7 @@ public:
_data
=
map_addr
.
get
()
+
offset
;
_size
=
size
;
}
~
BufferMmap
()
override
{}
;
~
BufferMmap
()
override
=
default
;
//返回数据长度
char
*
data
()
const
override
{
return
_data
;
}
size_t
size
()
const
override
{
return
_size
;
}
...
...
src/Http/HttpBody.h
查看文件 @
7a95c87a
...
...
@@ -30,9 +30,9 @@ namespace mediakit {
class
HttpBody
:
public
std
::
enable_shared_from_this
<
HttpBody
>
{
public
:
using
Ptr
=
std
::
shared_ptr
<
HttpBody
>
;
HttpBody
()
{}
HttpBody
()
=
default
;
virtual
~
HttpBody
()
{}
virtual
~
HttpBody
()
=
default
;
/**
* 剩余数据大小,如果返回-1, 那么就不设置content-length
...
...
@@ -151,7 +151,7 @@ public:
* @param boundary boundary字符串
*/
HttpMultiFormBody
(
const
HttpArgs
&
args
,
const
std
::
string
&
filePath
,
const
std
::
string
&
boundary
=
"0xKhTmLbOuNdArY"
);
virtual
~
HttpMultiFormBody
()
{}
virtual
~
HttpMultiFormBody
()
=
default
;
int64_t
remainSize
()
override
;
toolkit
::
Buffer
::
Ptr
readData
(
size_t
size
)
override
;
...
...
src/Http/HttpCookie.h
查看文件 @
7a95c87a
...
...
@@ -27,8 +27,8 @@ class HttpCookie {
public
:
using
Ptr
=
std
::
shared_ptr
<
HttpCookie
>
;
friend
class
HttpCookieStorage
;
HttpCookie
()
{}
~
HttpCookie
()
{}
HttpCookie
()
=
default
;
~
HttpCookie
()
=
default
;
void
setPath
(
const
std
::
string
&
path
);
void
setHost
(
const
std
::
string
&
host
);
...
...
@@ -52,12 +52,14 @@ private:
*/
class
HttpCookieStorage
{
public
:
~
HttpCookieStorage
()
{}
~
HttpCookieStorage
()
=
default
;
static
HttpCookieStorage
&
Instance
();
void
set
(
const
HttpCookie
::
Ptr
&
cookie
);
std
::
vector
<
HttpCookie
::
Ptr
>
get
(
const
std
::
string
&
host
,
const
std
::
string
&
path
);
private
:
HttpCookieStorage
(){};
HttpCookieStorage
()
=
default
;
private
:
std
::
unordered_map
<
std
::
string
/*host*/
,
std
::
map
<
std
::
string
/*cookie path*/
,
std
::
map
<
std
::
string
/*cookie_key*/
,
HttpCookie
::
Ptr
>
>
>
_all_cookie
;
std
::
mutex
_mtx_cookie
;
...
...
src/Http/HttpFileManager.h
查看文件 @
7a95c87a
...
...
@@ -24,8 +24,8 @@ public:
typedef
std
::
function
<
void
(
int
code
,
const
StrCaseMap
&
headerOut
,
const
HttpBody
::
Ptr
&
body
)
>
HttpResponseInvokerLambda0
;
typedef
std
::
function
<
void
(
int
code
,
const
StrCaseMap
&
headerOut
,
const
std
::
string
&
body
)
>
HttpResponseInvokerLambda1
;
HttpResponseInvokerImp
()
{}
~
HttpResponseInvokerImp
()
{}
HttpResponseInvokerImp
()
=
default
;
~
HttpResponseInvokerImp
()
=
default
;
template
<
typename
C
>
HttpResponseInvokerImp
(
const
C
&
c
)
:
HttpResponseInvokerImp
(
typename
toolkit
::
function_traits
<
C
>::
stl_function_type
(
c
))
{}
HttpResponseInvokerImp
(
const
HttpResponseInvokerLambda0
&
lambda
);
...
...
src/Http/HttpRequestSplitter.h
查看文件 @
7a95c87a
...
...
@@ -18,8 +18,8 @@ namespace mediakit {
class
HttpRequestSplitter
{
public
:
HttpRequestSplitter
()
{}
;
virtual
~
HttpRequestSplitter
()
{}
;
HttpRequestSplitter
()
=
default
;
virtual
~
HttpRequestSplitter
()
=
default
;
/**
* 添加数据
...
...
src/Http/WebSocketClient.h
查看文件 @
7a95c87a
...
...
@@ -37,7 +37,7 @@ public:
template
<
typename
...
ArgsType
>
ClientTypeImp
(
ArgsType
&&
...
args
)
:
ClientType
(
std
::
forward
<
ArgsType
>
(
args
)...)
{}
~
ClientTypeImp
()
override
{}
;
~
ClientTypeImp
()
override
=
default
;
protected
:
/**
...
...
src/Http/WebSocketSession.h
查看文件 @
7a95c87a
...
...
@@ -82,7 +82,7 @@ template<typename Creator, typename HttpSessionType = mediakit::HttpSession, med
class
WebSocketSessionBase
:
public
HttpSessionType
{
public
:
WebSocketSessionBase
(
const
toolkit
::
Socket
::
Ptr
&
pSock
)
:
HttpSessionType
(
pSock
){}
virtual
~
WebSocketSessionBase
()
{}
virtual
~
WebSocketSessionBase
()
=
default
;
//收到eof或其他导致脱离TcpServer事件的回调
void
onError
(
const
toolkit
::
SockException
&
err
)
override
{
...
...
@@ -248,7 +248,7 @@ template<typename SessionType,typename HttpSessionType = mediakit::HttpSession,
class
WebSocketSession
:
public
WebSocketSessionBase
<
SessionCreator
<
SessionType
>
,
HttpSessionType
,
DataType
>
{
public
:
WebSocketSession
(
const
toolkit
::
Socket
::
Ptr
&
pSock
)
:
WebSocketSessionBase
<
SessionCreator
<
SessionType
>
,
HttpSessionType
,
DataType
>
(
pSock
){}
virtual
~
WebSocketSession
()
{}
virtual
~
WebSocketSession
()
=
default
;
};
#endif //ZLMEDIAKIT_WEBSOCKETSESSION_H
src/Http/WebSocketSplitter.h
查看文件 @
7a95c87a
...
...
@@ -51,7 +51,7 @@ public:
//根据内存地址设置掩码随机数
_mask
.
assign
((
uint8_t
*
)(
&
ptr
),
(
uint8_t
*
)(
&
ptr
)
+
4
);
}
virtual
~
WebSocketHeader
()
{}
virtual
~
WebSocketHeader
()
=
default
;
public
:
bool
_fin
;
...
...
@@ -71,7 +71,7 @@ public:
WebSocketBuffer
(
WebSocketHeader
::
Type
headType
,
bool
fin
,
ARGS
&&
...
args
)
:
toolkit
::
BufferString
(
std
::
forward
<
ARGS
>
(
args
)...),
_fin
(
fin
),
_head_type
(
headType
){}
~
WebSocketBuffer
()
override
{}
~
WebSocketBuffer
()
override
=
default
;
WebSocketHeader
::
Type
headType
()
const
{
return
_head_type
;
}
...
...
@@ -84,8 +84,8 @@ private:
class
WebSocketSplitter
:
public
WebSocketHeader
{
public
:
WebSocketSplitter
()
{}
virtual
~
WebSocketSplitter
()
{}
WebSocketSplitter
()
=
default
;
virtual
~
WebSocketSplitter
()
=
default
;
/**
* 输入数据以便解包webSocket数据以及处理粘包问题
...
...
src/Record/MPEG.h
查看文件 @
7a95c87a
...
...
@@ -86,7 +86,7 @@ namespace mediakit {
class
MpegMuxer
:
public
MediaSinkInterface
{
public
:
MpegMuxer
(
bool
is_ps
)
{}
;
MpegMuxer
(
bool
is_ps
)
=
default
;
~
MpegMuxer
()
override
=
default
;
bool
addTrack
(
const
Track
::
Ptr
&
track
)
override
{
return
false
;
}
void
resetTracks
()
override
{}
...
...
src/Rtcp/Rtcp.cpp
查看文件 @
7a95c87a
...
...
@@ -242,11 +242,9 @@ vector<RtcpHeader *> RtcpHeader::loadFromBytes(char *data, size_t len) {
class
BufferRtcp
:
public
Buffer
{
public
:
BufferRtcp
(
std
::
shared_ptr
<
RtcpHeader
>
rtcp
)
{
_rtcp
=
std
::
move
(
rtcp
);
}
~
BufferRtcp
()
override
{}
~
BufferRtcp
()
override
=
default
;
char
*
data
()
const
override
{
return
(
char
*
)
_rtcp
.
get
();
}
size_t
size
()
const
override
{
return
_rtcp
->
getSize
();
}
private
:
...
...
src/Rtmp/Rtmp.h
查看文件 @
7a95c87a
...
...
@@ -207,8 +207,8 @@ class Metadata : public CodecInfo{
public
:
using
Ptr
=
std
::
shared_ptr
<
Metadata
>
;
Metadata
()
:
_metadata
(
AMF_OBJECT
)
{}
virtual
~
Metadata
()
{}
Metadata
()
:
_metadata
(
AMF_OBJECT
)
{}
virtual
~
Metadata
()
=
default
;
const
AMFValue
&
getMetadata
()
const
{
return
_metadata
;
}
...
...
@@ -239,7 +239,7 @@ public:
using
Ptr
=
std
::
shared_ptr
<
VideoMeta
>
;
VideoMeta
(
const
VideoTrack
::
Ptr
&
video
);
virtual
~
VideoMeta
()
{}
virtual
~
VideoMeta
()
=
default
;
CodecId
getCodecId
()
const
override
{
return
_codecId
;
...
...
@@ -253,8 +253,7 @@ public:
using
Ptr
=
std
::
shared_ptr
<
AudioMeta
>
;
AudioMeta
(
const
AudioTrack
::
Ptr
&
audio
);
virtual
~
AudioMeta
(){}
virtual
~
AudioMeta
()
=
default
;
CodecId
getCodecId
()
const
override
{
return
_codecId
;
...
...
src/Rtmp/RtmpProtocol.cpp
查看文件 @
7a95c87a
...
...
@@ -181,13 +181,13 @@ void RtmpProtocol::sendRequest(int cmd, const string& str) {
class
BufferPartial
:
public
Buffer
{
public
:
BufferPartial
(
const
Buffer
::
Ptr
&
buffer
,
size_t
offset
,
size_t
size
){
BufferPartial
(
const
Buffer
::
Ptr
&
buffer
,
size_t
offset
,
size_t
size
)
{
_buffer
=
buffer
;
_data
=
buffer
->
data
()
+
offset
;
_size
=
size
;
}
~
BufferPartial
()
override
{}
~
BufferPartial
()
override
=
default
;
char
*
data
()
const
override
{
return
_data
;
...
...
src/Rtp/RtpSplitter.cpp
查看文件 @
7a95c87a
...
...
@@ -13,12 +13,8 @@
#include "RtpSplitter.h"
namespace
mediakit
{
static
const
char
kEHOME_MAGIC
[]
=
"
\x01\x00\x01\x00
"
;
static
const
int
kEHOME_OFFSET
=
256
;
RtpSplitter
::
RtpSplitter
()
{}
RtpSplitter
::~
RtpSplitter
()
{}
ssize_t
RtpSplitter
::
onRecvHeader
(
const
char
*
data
,
size_t
len
){
//忽略偏移量
data
+=
_offset
;
...
...
@@ -38,11 +34,10 @@ static bool isEhome(const char *data, size_t len){
if
(
len
<
4
)
{
return
false
;
}
if
((
data
[
0
]
==
0x01
)
&&
(
data
[
1
]
==
0x00
)
&&
(
data
[
2
]
>=
0x01
))
{
if
((
data
[
0
]
==
0x01
)
&&
(
data
[
1
]
==
0x00
)
&&
(
data
[
2
]
>=
0x01
))
{
return
true
;
}
return
false
;
//return memcmp(data, kEHOME_MAGIC, sizeof(kEHOME_MAGIC) - 1) == 0;
}
const
char
*
RtpSplitter
::
onSearchPacketTail
(
const
char
*
data
,
size_t
len
)
{
...
...
src/Rtp/RtpSplitter.h
查看文件 @
7a95c87a
...
...
@@ -18,8 +18,8 @@ namespace mediakit{
class
RtpSplitter
:
public
HttpRequestSplitter
{
public
:
RtpSplitter
();
~
RtpSplitter
()
override
;
RtpSplitter
()
=
default
;
~
RtpSplitter
()
override
=
default
;
protected
:
/**
...
...
src/Rtp/TSDecoder.h
查看文件 @
7a95c87a
...
...
@@ -25,7 +25,7 @@ class TSSegment : public HttpRequestSplitter {
public
:
typedef
std
::
function
<
void
(
const
char
*
data
,
size_t
len
)
>
onSegment
;
TSSegment
(
size_t
size
=
TS_PACKET_SIZE
)
:
_size
(
size
){}
~
TSSegment
()
{}
~
TSSegment
()
=
default
;
void
setOnSegment
(
onSegment
cb
);
static
bool
isTSPacket
(
const
char
*
data
,
size_t
len
);
...
...
src/Rtsp/RtpCodec.h
查看文件 @
7a95c87a
...
...
@@ -74,7 +74,7 @@ public:
_interleaved
=
interleaved
;
}
virtual
~
RtpInfo
()
{}
virtual
~
RtpInfo
()
=
default
;
//返回rtp负载最大长度
size_t
getMaxSize
()
const
{
...
...
src/Rtsp/Rtsp.h
查看文件 @
7a95c87a
...
...
@@ -237,9 +237,9 @@ class SdpParser {
public
:
using
Ptr
=
std
::
shared_ptr
<
SdpParser
>
;
SdpParser
()
{}
SdpParser
()
=
default
;
SdpParser
(
const
std
::
string
&
sdp
)
{
load
(
sdp
);
}
~
SdpParser
()
{}
~
SdpParser
()
=
default
;
void
load
(
const
std
::
string
&
sdp
);
bool
available
()
const
;
...
...
@@ -268,7 +268,7 @@ public:
_payload_type
=
payload_type
;
}
virtual
~
Sdp
()
{}
virtual
~
Sdp
()
=
default
;
/**
* 获取sdp字符串
...
...
src/Rtsp/RtspSplitter.h
查看文件 @
7a95c87a
...
...
@@ -18,8 +18,8 @@ namespace mediakit{
class
RtspSplitter
:
public
HttpRequestSplitter
{
public
:
RtspSplitter
()
{}
virtual
~
RtspSplitter
()
{}
RtspSplitter
()
=
default
;
virtual
~
RtspSplitter
()
=
default
;
/**
* 是否允许接收rtp包
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论