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
f41f7e28
Commit
f41f7e28
authored
Oct 24, 2018
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理文件 规范命名
parent
2c413e07
隐藏空白字符变更
内嵌
并排
正在显示
35 个修改的文件
包含
60 行增加
和
61 行删除
+60
-61
src/Common/Factory.h
+1
-1
src/Device/Device.h
+3
-3
src/Http/HttpSession.h
+1
-1
src/Rtmp/RtmpMediaSource.h
+2
-2
src/Rtmp/RtmpPlayerImp.h
+3
-3
src/Rtmp/RtmpToRtspMediaSource.h
+5
-6
src/RtmpMuxer/AACRtmpCodec.cpp
+0
-0
src/RtmpMuxer/AACRtmpCodec.h
+0
-0
src/RtmpMuxer/FlvMuxer.cpp
+2
-2
src/RtmpMuxer/FlvMuxer.h
+2
-2
src/RtmpMuxer/H264RtmpCodec.cpp
+0
-0
src/RtmpMuxer/H264RtmpCodec.h
+0
-0
src/RtmpMuxer/RtmpCodec.cpp
+0
-0
src/RtmpMuxer/RtmpCodec.h
+0
-0
src/RtmpMuxer/RtmpDemuxer.cpp
+10
-10
src/RtmpMuxer/RtmpDemuxer.h
+6
-6
src/Rtsp/RtspMediaSource.h
+1
-1
src/Rtsp/RtspPlayerImp.h
+3
-3
src/Rtsp/RtspToRtmpMediaSource.h
+3
-3
src/RtspMuxer/AACRtpCodec.cpp
+0
-0
src/RtspMuxer/AACRtpCodec.h
+0
-0
src/RtspMuxer/H264RtpCodec.cpp
+0
-0
src/RtspMuxer/H264RtpCodec.h
+0
-0
src/RtspMuxer/RtpCodec.h
+0
-0
src/RtspMuxer/RtpMaker.h
+0
-0
src/RtspMuxer/RtpMakerAAC.cpp
+0
-0
src/RtspMuxer/RtpMakerAAC.h
+0
-0
src/RtspMuxer/RtpMakerH264.cpp
+0
-0
src/RtspMuxer/RtpMakerH264.h
+0
-0
src/RtspMuxer/RtspDemuxer.cpp
+6
-6
src/RtspMuxer/RtspDemuxer.h
+5
-5
src/RtspMuxer/RtspMuxer.cpp
+2
-2
src/RtspMuxer/RtspMuxer.h
+3
-3
src/RtspMuxer/RtspSdp.cpp
+0
-0
src/RtspMuxer/RtspSdp.h
+2
-2
没有找到文件。
src/Common/Factory.h
查看文件 @
f41f7e28
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include <string>
#include <string>
#include "Player/Track.h"
#include "Player/Track.h"
#include "Rtsp/RtspSdp.h"
#include "Rtsp
Muxer
/RtspSdp.h"
using
namespace
std
;
using
namespace
std
;
using
namespace
toolkit
;
using
namespace
toolkit
;
...
...
src/Device/Device.h
查看文件 @
f41f7e28
...
@@ -32,10 +32,10 @@
...
@@ -32,10 +32,10 @@
#include <functional>
#include <functional>
#include "Util/util.h"
#include "Util/util.h"
#include "Player/Player.h"
#include "Player/Player.h"
#include "Rt
pCodec
/RtpMakerAAC.h"
#include "Rt
spMuxer
/RtpMakerAAC.h"
#include "Rt
pCodec
/RtpMakerH264.h"
#include "Rt
spMuxer
/RtpMakerH264.h"
#include "Rtsp/RtspToRtmpMediaSource.h"
#include "Rtsp/RtspToRtmpMediaSource.h"
#include "Rtsp/RtspSdp.h"
#include "Rtsp
Muxer
/RtspSdp.h"
#include "Util/TimeTicker.h"
#include "Util/TimeTicker.h"
using
namespace
std
;
using
namespace
std
;
...
...
src/Http/HttpSession.h
查看文件 @
f41f7e28
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include "Network/TcpSession.h"
#include "Network/TcpSession.h"
#include "Network/TcpServer.h"
#include "Network/TcpServer.h"
#include "Rtmp/RtmpMediaSource.h"
#include "Rtmp/RtmpMediaSource.h"
#include "Rtmp/FlvMuxer.h"
#include "Rtmp
Muxer
/FlvMuxer.h"
#include "HttpRequestSplitter.h"
#include "HttpRequestSplitter.h"
#include "WebSocketSplitter.h"
#include "WebSocketSplitter.h"
...
...
src/Rtmp/RtmpMediaSource.h
查看文件 @
f41f7e28
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#include <unordered_map>
#include <unordered_map>
#include "amf.h"
#include "amf.h"
#include "Rtmp.h"
#include "Rtmp.h"
#include "Rtmp
Pars
er.h"
#include "Rtmp
Muxer/RtmpDemux
er.h"
#include "Common/config.h"
#include "Common/config.h"
#include "Common/MediaSource.h"
#include "Common/MediaSource.h"
#include "Util/util.h"
#include "Util/util.h"
...
@@ -79,7 +79,7 @@ public:
...
@@ -79,7 +79,7 @@ public:
virtual
void
onGetMetaData
(
const
AMFValue
&
metadata
)
{
virtual
void
onGetMetaData
(
const
AMFValue
&
metadata
)
{
lock_guard
<
recursive_mutex
>
lock
(
_mtxMap
);
lock_guard
<
recursive_mutex
>
lock
(
_mtxMap
);
_metadata
=
metadata
;
_metadata
=
metadata
;
Rtmp
Pars
er
parser
(
metadata
);
Rtmp
Demux
er
parser
(
metadata
);
_iCfgFrameSize
=
parser
.
getTracks
().
size
();
_iCfgFrameSize
=
parser
.
getTracks
().
size
();
if
(
ready
()){
if
(
ready
()){
MediaSource
::
regist
();
MediaSource
::
regist
();
...
...
src/Rtmp/RtmpPlayerImp.h
查看文件 @
f41f7e28
...
@@ -31,15 +31,15 @@
...
@@ -31,15 +31,15 @@
#include <functional>
#include <functional>
#include "Common/config.h"
#include "Common/config.h"
#include "RtmpPlayer.h"
#include "RtmpPlayer.h"
#include "RtmpParser.h"
#include "RtmpMediaSource.h"
#include "RtmpMediaSource.h"
#include "RtmpMuxer/RtmpDemuxer.h"
#include "Poller/Timer.h"
#include "Poller/Timer.h"
#include "Util/TimeTicker.h"
#include "Util/TimeTicker.h"
using
namespace
toolkit
;
using
namespace
toolkit
;
namespace
mediakit
{
namespace
mediakit
{
class
RtmpPlayerImp
:
public
PlayerImp
<
RtmpPlayer
,
Rtmp
Pars
er
>
{
class
RtmpPlayerImp
:
public
PlayerImp
<
RtmpPlayer
,
Rtmp
Demux
er
>
{
public
:
public
:
typedef
std
::
shared_ptr
<
RtmpPlayerImp
>
Ptr
;
typedef
std
::
shared_ptr
<
RtmpPlayerImp
>
Ptr
;
RtmpPlayerImp
(){};
RtmpPlayerImp
(){};
...
@@ -65,7 +65,7 @@ private:
...
@@ -65,7 +65,7 @@ private:
_pRtmpMediaSrc
->
onGetMetaData
(
val
);
_pRtmpMediaSrc
->
onGetMetaData
(
val
);
}
}
try
{
try
{
_parser
.
reset
(
new
Rtmp
Pars
er
(
val
));
_parser
.
reset
(
new
Rtmp
Demux
er
(
val
));
//todo(xzl) 修复此处
//todo(xzl) 修复此处
// _parser->setOnVideoCB(_onGetVideoCB);
// _parser->setOnVideoCB(_onGetVideoCB);
// _parser->setOnAudioCB(_onGetAudioCB);
// _parser->setOnAudioCB(_onGetAudioCB);
...
...
src/Rtmp/RtmpToRtspMediaSource.h
查看文件 @
f41f7e28
...
@@ -34,11 +34,10 @@
...
@@ -34,11 +34,10 @@
#include <unordered_map>
#include <unordered_map>
#include "amf.h"
#include "amf.h"
#include "Rtmp.h"
#include "Rtmp.h"
#include "RtmpParser.h"
#include "RtmpMediaSource.h"
#include "RtmpMediaSource.h"
#include "Rt
pCodec
/RtpMakerH264.h"
#include "Rt
spMuxer
/RtpMakerH264.h"
#include "Rt
pCodec
/RtpMakerAAC.h"
#include "Rt
spMuxer
/RtpMakerAAC.h"
#include "Rt
sp/RtpPars
er.h"
#include "Rt
mpMuxer/RtmpDemux
er.h"
#include "Rtsp/RtspMediaSource.h"
#include "Rtsp/RtspMediaSource.h"
#include "Util/util.h"
#include "Util/util.h"
#include "Util/logger.h"
#include "Util/logger.h"
...
@@ -61,7 +60,7 @@ public:
...
@@ -61,7 +60,7 @@ public:
void
onGetMetaData
(
const
AMFValue
&
_metadata
)
override
{
void
onGetMetaData
(
const
AMFValue
&
_metadata
)
override
{
try
{
try
{
_pParser
.
reset
(
new
Rtmp
Pars
er
(
_metadata
));
_pParser
.
reset
(
new
Rtmp
Demux
er
(
_metadata
));
_pRecorder
.
reset
(
new
MediaRecorder
(
getVhost
(),
getApp
(),
getId
(),
_pParser
,
_bEnableHls
,
_bEnableMp4
));
_pRecorder
.
reset
(
new
MediaRecorder
(
getVhost
(),
getApp
(),
getId
(),
_pParser
,
_bEnableHls
,
_bEnableMp4
));
//todo(xzl) 修复此处
//todo(xzl) 修复此处
...
@@ -84,7 +83,7 @@ public:
...
@@ -84,7 +83,7 @@ public:
}
}
private
:
private
:
Rtmp
Pars
er
::
Ptr
_pParser
;
Rtmp
Demux
er
::
Ptr
_pParser
;
RtspMediaSource
::
Ptr
_pRtspSrc
;
RtspMediaSource
::
Ptr
_pRtspSrc
;
RtpMaker_AAC
::
Ptr
_pRtpMaker_aac
;
RtpMaker_AAC
::
Ptr
_pRtpMaker_aac
;
RtpMaker_H264
::
Ptr
_pRtpMaker_h264
;
RtpMaker_H264
::
Ptr
_pRtpMaker_h264
;
...
...
src/Rtmp
Codec
/AACRtmpCodec.cpp
→
src/Rtmp
Muxer
/AACRtmpCodec.cpp
查看文件 @
f41f7e28
File moved
src/Rtmp
Codec
/AACRtmpCodec.h
→
src/Rtmp
Muxer
/AACRtmpCodec.h
查看文件 @
f41f7e28
File moved
src/Rtmp/FlvMuxer.cpp
→
src/Rtmp
Muxer
/FlvMuxer.cpp
查看文件 @
f41f7e28
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
// Created by xzl on 2018/8/30.
// Created by xzl on 2018/8/30.
//
//
#include "Util/File.h"
#include "FlvMuxer.h"
#include "FlvMuxer.h"
#include "utils.h"
#include "Util/File.h"
#include "Rtmp/utils.h"
#define FILE_BUF_SIZE (64 * 1024)
#define FILE_BUF_SIZE (64 * 1024)
...
...
src/Rtmp/FlvMuxer.h
→
src/Rtmp
Muxer
/FlvMuxer.h
查看文件 @
f41f7e28
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
#ifndef ZLMEDIAKIT_FLVRECORDER_H
#ifndef ZLMEDIAKIT_FLVRECORDER_H
#define ZLMEDIAKIT_FLVRECORDER_H
#define ZLMEDIAKIT_FLVRECORDER_H
#include "Rtmp.h"
#include "Rtmp
/Rtmp
.h"
#include "RtmpMediaSource.h"
#include "Rtmp
/Rtmp
MediaSource.h"
#include "Network/Socket.h"
#include "Network/Socket.h"
using
namespace
toolkit
;
using
namespace
toolkit
;
...
...
src/Rtmp
Codec
/H264RtmpCodec.cpp
→
src/Rtmp
Muxer
/H264RtmpCodec.cpp
查看文件 @
f41f7e28
File moved
src/Rtmp
Codec
/H264RtmpCodec.h
→
src/Rtmp
Muxer
/H264RtmpCodec.h
查看文件 @
f41f7e28
File moved
src/Rtmp
Codec
/RtmpCodec.cpp
→
src/Rtmp
Muxer
/RtmpCodec.cpp
查看文件 @
f41f7e28
File moved
src/Rtmp
Codec
/RtmpCodec.h
→
src/Rtmp
Muxer
/RtmpCodec.h
查看文件 @
f41f7e28
File moved
src/Rtmp
/RtmpPars
er.cpp
→
src/Rtmp
Muxer/RtmpDemux
er.cpp
查看文件 @
f41f7e28
...
@@ -24,11 +24,11 @@
...
@@ -24,11 +24,11 @@
* SOFTWARE.
* SOFTWARE.
*/
*/
#include "Rtmp
Pars
er.h"
#include "Rtmp
Demux
er.h"
namespace
mediakit
{
namespace
mediakit
{
Rtmp
Parser
::
RtmpPars
er
(
const
AMFValue
&
val
)
{
Rtmp
Demuxer
::
RtmpDemux
er
(
const
AMFValue
&
val
)
{
auto
videoCodec
=
val
[
"videocodecid"
];
auto
videoCodec
=
val
[
"videocodecid"
];
auto
audioCodec
=
val
[
"audiocodecid"
];
auto
audioCodec
=
val
[
"audiocodecid"
];
...
@@ -62,10 +62,10 @@ RtmpParser::RtmpParser(const AMFValue &val) {
...
@@ -62,10 +62,10 @@ RtmpParser::RtmpParser(const AMFValue &val) {
onCheckMedia
(
val
);
onCheckMedia
(
val
);
}
}
Rtmp
Parser
::~
RtmpPars
er
()
{
Rtmp
Demuxer
::~
RtmpDemux
er
()
{
}
}
bool
Rtmp
Pars
er
::
inputRtmp
(
const
RtmpPacket
::
Ptr
&
pkt
)
{
bool
Rtmp
Demux
er
::
inputRtmp
(
const
RtmpPacket
::
Ptr
&
pkt
)
{
switch
(
pkt
->
typeId
)
{
switch
(
pkt
->
typeId
)
{
case
MSG_VIDEO
:{
case
MSG_VIDEO
:{
if
(
_iVideoCodecID
==
0
){
if
(
_iVideoCodecID
==
0
){
...
@@ -100,7 +100,7 @@ bool RtmpParser::inputRtmp(const RtmpPacket::Ptr &pkt) {
...
@@ -100,7 +100,7 @@ bool RtmpParser::inputRtmp(const RtmpPacket::Ptr &pkt) {
}
}
}
}
inline
bool
Rtmp
Pars
er
::
inputVideo
(
const
RtmpPacket
::
Ptr
&
pkt
)
{
inline
bool
Rtmp
Demux
er
::
inputVideo
(
const
RtmpPacket
::
Ptr
&
pkt
)
{
if
(
pkt
->
isCfgFrame
())
{
if
(
pkt
->
isCfgFrame
())
{
//WarnL << " got h264 cfg";
//WarnL << " got h264 cfg";
if
(
_strSPS
.
size
())
{
if
(
_strSPS
.
size
())
{
...
@@ -133,7 +133,7 @@ inline bool RtmpParser::inputVideo(const RtmpPacket::Ptr &pkt) {
...
@@ -133,7 +133,7 @@ inline bool RtmpParser::inputVideo(const RtmpPacket::Ptr &pkt) {
}
}
return
pkt
->
isVideoKeyFrame
();
return
pkt
->
isVideoKeyFrame
();
}
}
inline
void
Rtmp
Pars
er
::
_onGetH264
(
const
char
*
pcData
,
int
iLen
,
uint32_t
ui32TimeStamp
)
{
inline
void
Rtmp
Demux
er
::
_onGetH264
(
const
char
*
pcData
,
int
iLen
,
uint32_t
ui32TimeStamp
)
{
switch
(
pcData
[
0
]
&
0x1F
)
{
switch
(
pcData
[
0
]
&
0x1F
)
{
case
5
:
{
case
5
:
{
onGetH264
(
_strSPS
.
data
()
+
4
,
_strSPS
.
length
()
-
4
,
ui32TimeStamp
);
onGetH264
(
_strSPS
.
data
()
+
4
,
_strSPS
.
length
()
-
4
,
ui32TimeStamp
);
...
@@ -148,7 +148,7 @@ inline void RtmpParser::_onGetH264(const char* pcData, int iLen, uint32_t ui32Ti
...
@@ -148,7 +148,7 @@ inline void RtmpParser::_onGetH264(const char* pcData, int iLen, uint32_t ui32Ti
break
;
break
;
}
}
}
}
inline
void
Rtmp
Pars
er
::
onGetH264
(
const
char
*
pcData
,
int
iLen
,
uint32_t
ui32TimeStamp
)
{
inline
void
Rtmp
Demux
er
::
onGetH264
(
const
char
*
pcData
,
int
iLen
,
uint32_t
ui32TimeStamp
)
{
_h264frame
.
type
=
pcData
[
0
]
&
0x1F
;
_h264frame
.
type
=
pcData
[
0
]
&
0x1F
;
_h264frame
.
timeStamp
=
ui32TimeStamp
;
_h264frame
.
timeStamp
=
ui32TimeStamp
;
_h264frame
.
buffer
.
assign
(
"\x0\x0\x0\x1"
,
4
);
//添加264头
_h264frame
.
buffer
.
assign
(
"\x0\x0\x0\x1"
,
4
);
//添加264头
...
@@ -162,7 +162,7 @@ inline void RtmpParser::onGetH264(const char* pcData, int iLen, uint32_t ui32Tim
...
@@ -162,7 +162,7 @@ inline void RtmpParser::onGetH264(const char* pcData, int iLen, uint32_t ui32Tim
_h264frame
.
buffer
.
clear
();
_h264frame
.
buffer
.
clear
();
}
}
inline
bool
Rtmp
Pars
er
::
inputAudio
(
const
RtmpPacket
::
Ptr
&
pkt
)
{
inline
bool
Rtmp
Demux
er
::
inputAudio
(
const
RtmpPacket
::
Ptr
&
pkt
)
{
if
(
pkt
->
isCfgFrame
())
{
if
(
pkt
->
isCfgFrame
())
{
if
(
_strAudioCfg
.
size
())
{
if
(
_strAudioCfg
.
size
())
{
return
false
;
return
false
;
...
@@ -178,7 +178,7 @@ inline bool RtmpParser::inputAudio(const RtmpPacket::Ptr &pkt) {
...
@@ -178,7 +178,7 @@ inline bool RtmpParser::inputAudio(const RtmpPacket::Ptr &pkt) {
}
}
return
false
;
return
false
;
}
}
inline
void
Rtmp
Pars
er
::
onGetAAC
(
const
char
*
pcData
,
int
iLen
,
uint32_t
ui32TimeStamp
)
{
inline
void
Rtmp
Demux
er
::
onGetAAC
(
const
char
*
pcData
,
int
iLen
,
uint32_t
ui32TimeStamp
)
{
if
(
iLen
+
7
>
sizeof
(
_adts
.
buffer
)){
if
(
iLen
+
7
>
sizeof
(
_adts
.
buffer
)){
WarnL
<<
"Illegal adts data, exceeding the length limit."
;
WarnL
<<
"Illegal adts data, exceeding the length limit."
;
return
;
return
;
...
@@ -197,7 +197,7 @@ inline void RtmpParser::onGetAAC(const char* pcData, int iLen, uint32_t ui32Time
...
@@ -197,7 +197,7 @@ inline void RtmpParser::onGetAAC(const char* pcData, int iLen, uint32_t ui32Time
_adts
.
aac_frame_length
=
7
;
_adts
.
aac_frame_length
=
7
;
}
}
inline
void
Rtmp
Pars
er
::
onCheckMedia
(
const
AMFValue
&
obj
)
{
inline
void
Rtmp
Demux
er
::
onCheckMedia
(
const
AMFValue
&
obj
)
{
obj
.
object_for_each
([
&
](
const
string
&
key
,
const
AMFValue
&
val
)
{
obj
.
object_for_each
([
&
](
const
string
&
key
,
const
AMFValue
&
val
)
{
if
(
key
==
"duration"
)
{
if
(
key
==
"duration"
)
{
_fDuration
=
val
.
as_number
();
_fDuration
=
val
.
as_number
();
...
...
src/Rtmp
/RtmpPars
er.h
→
src/Rtmp
Muxer/RtmpDemux
er.h
查看文件 @
f41f7e28
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
#include <functional>
#include <functional>
#include <unordered_map>
#include <unordered_map>
#include "amf.h"
#include "
Rtmp/
amf.h"
#include "Rtmp.h"
#include "Rtmp
/Rtmp
.h"
#include "Player/Player.h"
#include "Player/Player.h"
#include "Util/TimeTicker.h"
#include "Util/TimeTicker.h"
#include "Player/PlayerBase.h"
#include "Player/PlayerBase.h"
...
@@ -41,11 +41,11 @@ using namespace toolkit;
...
@@ -41,11 +41,11 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
class
Rtmp
Pars
er
:
public
PlayerBase
{
class
Rtmp
Demux
er
:
public
PlayerBase
{
public
:
public
:
typedef
std
::
shared_ptr
<
Rtmp
Pars
er
>
Ptr
;
typedef
std
::
shared_ptr
<
Rtmp
Demux
er
>
Ptr
;
Rtmp
Pars
er
(
const
AMFValue
&
val
);
Rtmp
Demux
er
(
const
AMFValue
&
val
);
virtual
~
Rtmp
Pars
er
();
virtual
~
Rtmp
Demux
er
();
bool
inputRtmp
(
const
RtmpPacket
::
Ptr
&
pkt
);
bool
inputRtmp
(
const
RtmpPacket
::
Ptr
&
pkt
);
...
...
src/Rtsp/RtspMediaSource.h
查看文件 @
f41f7e28
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include "Rtsp.h"
#include "Rtsp.h"
#include "Common/config.h"
#include "Common/config.h"
#include "Common/MediaSource.h"
#include "Common/MediaSource.h"
#include "Rt
pCodec
/RtpCodec.h"
#include "Rt
spMuxer
/RtpCodec.h"
#include "Util/logger.h"
#include "Util/logger.h"
#include "Util/RingBuffer.h"
#include "Util/RingBuffer.h"
...
...
src/Rtsp/RtspPlayerImp.h
查看文件 @
f41f7e28
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
#include <algorithm>
#include <algorithm>
#include <functional>
#include <functional>
#include "Common/config.h"
#include "Common/config.h"
#include "RtpParser.h"
#include "RtspPlayer.h"
#include "RtspPlayer.h"
#include "RtspMuxer/RtspDemuxer.h"
#include "Poller/Timer.h"
#include "Poller/Timer.h"
#include "Util/TimeTicker.h"
#include "Util/TimeTicker.h"
...
@@ -41,7 +41,7 @@ using namespace toolkit;
...
@@ -41,7 +41,7 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
class
RtspPlayerImp
:
public
PlayerImp
<
RtspPlayer
,
Rt
pPars
er
>
{
class
RtspPlayerImp
:
public
PlayerImp
<
RtspPlayer
,
Rt
spDemux
er
>
{
public
:
public
:
typedef
std
::
shared_ptr
<
RtspPlayerImp
>
Ptr
;
typedef
std
::
shared_ptr
<
RtspPlayerImp
>
Ptr
;
RtspPlayerImp
(){};
RtspPlayerImp
(){};
...
@@ -68,7 +68,7 @@ private:
...
@@ -68,7 +68,7 @@ private:
_pRtspMediaSrc
->
onGetSDP
(
sdp
);
_pRtspMediaSrc
->
onGetSDP
(
sdp
);
}
}
try
{
try
{
_parser
.
reset
(
new
Rt
pPars
er
(
sdp
));
_parser
.
reset
(
new
Rt
spDemux
er
(
sdp
));
//todo(xzl) 修复此处
//todo(xzl) 修复此处
// _parser->setOnVideoCB(_onGetVideoCB);
// _parser->setOnVideoCB(_onGetVideoCB);
// _parser->setOnAudioCB(_onGetAudioCB);
// _parser->setOnAudioCB(_onGetAudioCB);
...
...
src/Rtsp/RtspToRtmpMediaSource.h
查看文件 @
f41f7e28
...
@@ -27,10 +27,10 @@
...
@@ -27,10 +27,10 @@
#ifndef SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
#ifndef SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
#define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
#define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
#include "RtpParser.h"
#include "RtspMediaSource.h"
#include "RtspMediaSource.h"
#include "Rtmp/amf.h"
#include "Rtmp/amf.h"
#include "Rtmp/RtmpMediaSource.h"
#include "Rtmp/RtmpMediaSource.h"
#include "RtspMuxer/RtspDemuxer.h"
#include "MediaFile/MediaRecorder.h"
#include "MediaFile/MediaRecorder.h"
using
namespace
toolkit
;
using
namespace
toolkit
;
...
@@ -50,7 +50,7 @@ public:
...
@@ -50,7 +50,7 @@ public:
virtual
void
onGetSDP
(
const
string
&
strSdp
)
override
{
virtual
void
onGetSDP
(
const
string
&
strSdp
)
override
{
try
{
try
{
_pParser
.
reset
(
new
Rt
pPars
er
(
strSdp
));
_pParser
.
reset
(
new
Rt
spDemux
er
(
strSdp
));
_pRecorder
.
reset
(
new
MediaRecorder
(
getVhost
(),
getApp
(),
getId
(),
_pParser
,
_bEnableHls
,
_bEnableMp4
));
_pRecorder
.
reset
(
new
MediaRecorder
(
getVhost
(),
getApp
(),
getId
(),
_pParser
,
_bEnableHls
,
_bEnableMp4
));
//todo(xzl) 修复此处
//todo(xzl) 修复此处
// _pParser->setOnAudioCB( std::bind(&RtspToRtmpMediaSource::onGetAAC, this, placeholders::_1));
// _pParser->setOnAudioCB( std::bind(&RtspToRtmpMediaSource::onGetAAC, this, placeholders::_1));
...
@@ -98,7 +98,7 @@ private:
...
@@ -98,7 +98,7 @@ private:
void
makeAudioConfigPkt
();
void
makeAudioConfigPkt
();
void
makeMetaData
();
void
makeMetaData
();
private
:
private
:
Rt
pPars
er
::
Ptr
_pParser
;
Rt
spDemux
er
::
Ptr
_pParser
;
RtmpMediaSource
::
Ptr
_pRtmpSrc
;
RtmpMediaSource
::
Ptr
_pRtmpSrc
;
uint8_t
_ui8AudioFlags
=
0
;
uint8_t
_ui8AudioFlags
=
0
;
MediaRecorder
::
Ptr
_pRecorder
;
MediaRecorder
::
Ptr
_pRecorder
;
...
...
src/Rt
pCodec
/AACRtpCodec.cpp
→
src/Rt
spMuxer
/AACRtpCodec.cpp
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/AACRtpCodec.h
→
src/Rt
spMuxer
/AACRtpCodec.h
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/H264RtpCodec.cpp
→
src/Rt
spMuxer
/H264RtpCodec.cpp
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/H264RtpCodec.h
→
src/Rt
spMuxer
/H264RtpCodec.h
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/RtpCodec.h
→
src/Rt
spMuxer
/RtpCodec.h
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/RtpMaker.h
→
src/Rt
spMuxer
/RtpMaker.h
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/RtpMakerAAC.cpp
→
src/Rt
spMuxer
/RtpMakerAAC.cpp
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/RtpMakerAAC.h
→
src/Rt
spMuxer
/RtpMakerAAC.h
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/RtpMakerH264.cpp
→
src/Rt
spMuxer
/RtpMakerH264.cpp
查看文件 @
f41f7e28
File moved
src/Rt
pCodec
/RtpMakerH264.h
→
src/Rt
spMuxer
/RtpMakerH264.h
查看文件 @
f41f7e28
File moved
src/Rtsp
/RtpPars
er.cpp
→
src/Rtsp
Muxer/RtspDemux
er.cpp
查看文件 @
f41f7e28
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <cctype>
#include <cctype>
#include <algorithm>
#include <algorithm>
#include "Rt
pPars
er.h"
#include "Rt
spDemux
er.h"
#include "Util/base64.h"
#include "Util/base64.h"
#include "H264/SPSParser.h"
#include "H264/SPSParser.h"
#include "Common/Factory.h"
#include "Common/Factory.h"
...
@@ -50,7 +50,7 @@ static int getTimeInSDP(const string &sdp) {
...
@@ -50,7 +50,7 @@ static int getTimeInSDP(const string &sdp) {
}
}
return
atof
(
strEnd
.
data
())
-
atof
(
strStart
.
data
());
return
atof
(
strEnd
.
data
())
-
atof
(
strStart
.
data
());
}
}
Rt
pParser
::
RtpPars
er
(
const
string
&
sdp
)
{
Rt
spDemuxer
::
RtspDemux
er
(
const
string
&
sdp
)
{
RtspTrack
tmp
[
2
];
RtspTrack
tmp
[
2
];
int
cnt
=
parserSDP
(
sdp
,
tmp
);
int
cnt
=
parserSDP
(
sdp
,
tmp
);
for
(
int
i
=
0
;
i
<
cnt
;
i
++
)
{
for
(
int
i
=
0
;
i
<
cnt
;
i
++
)
{
...
@@ -70,7 +70,7 @@ RtpParser::RtpParser(const string& sdp) {
...
@@ -70,7 +70,7 @@ RtpParser::RtpParser(const string& sdp) {
_fDuration
=
getTimeInSDP
(
sdp
);
_fDuration
=
getTimeInSDP
(
sdp
);
}
}
bool
Rt
pPars
er
::
inputRtp
(
const
RtpPacket
::
Ptr
&
rtp
)
{
bool
Rt
spDemux
er
::
inputRtp
(
const
RtpPacket
::
Ptr
&
rtp
)
{
switch
(
rtp
->
getTrackType
())
{
switch
(
rtp
->
getTrackType
())
{
case
TrackVideo
:{
case
TrackVideo
:{
if
(
_videoRtpDecoder
){
if
(
_videoRtpDecoder
){
...
@@ -88,7 +88,7 @@ bool RtpParser::inputRtp(const RtpPacket::Ptr & rtp) {
...
@@ -88,7 +88,7 @@ bool RtpParser::inputRtp(const RtpPacket::Ptr & rtp) {
}
}
inline
void
Rt
pPars
er
::
onGetAudioTrack
(
const
RtspTrack
&
audio
)
{
inline
void
Rt
spDemux
er
::
onGetAudioTrack
(
const
RtspTrack
&
audio
)
{
//生成Track对象
//生成Track对象
_audioTrack
=
dynamic_pointer_cast
<
AudioTrack
>
(
Factory
::
getTrackBySdp
(
audio
.
trackSdp
));
_audioTrack
=
dynamic_pointer_cast
<
AudioTrack
>
(
Factory
::
getTrackBySdp
(
audio
.
trackSdp
));
if
(
_audioTrack
){
if
(
_audioTrack
){
...
@@ -101,7 +101,7 @@ inline void RtpParser::onGetAudioTrack(const RtspTrack& audio) {
...
@@ -101,7 +101,7 @@ inline void RtpParser::onGetAudioTrack(const RtspTrack& audio) {
}
}
}
}
inline
void
Rt
pPars
er
::
onGetVideoTrack
(
const
RtspTrack
&
video
)
{
inline
void
Rt
spDemux
er
::
onGetVideoTrack
(
const
RtspTrack
&
video
)
{
//生成Track对象
//生成Track对象
_videoTrack
=
dynamic_pointer_cast
<
VideoTrack
>
(
Factory
::
getTrackBySdp
(
video
.
trackSdp
));
_videoTrack
=
dynamic_pointer_cast
<
VideoTrack
>
(
Factory
::
getTrackBySdp
(
video
.
trackSdp
));
if
(
_videoTrack
){
if
(
_videoTrack
){
...
@@ -114,7 +114,7 @@ inline void RtpParser::onGetVideoTrack(const RtspTrack& video) {
...
@@ -114,7 +114,7 @@ inline void RtpParser::onGetVideoTrack(const RtspTrack& video) {
}
}
}
}
vector
<
Track
::
Ptr
>
Rt
pPars
er
::
getTracks
()
const
{
vector
<
Track
::
Ptr
>
Rt
spDemux
er
::
getTracks
()
const
{
vector
<
Track
::
Ptr
>
ret
;
vector
<
Track
::
Ptr
>
ret
;
if
(
_videoTrack
){
if
(
_videoTrack
){
ret
.
emplace_back
(
_videoTrack
);
ret
.
emplace_back
(
_videoTrack
);
...
...
src/Rtsp
/RtpPars
er.h
→
src/Rtsp
Muxer/RtspDemux
er.h
查看文件 @
f41f7e28
...
@@ -32,18 +32,18 @@
...
@@ -32,18 +32,18 @@
#include "Player/Player.h"
#include "Player/Player.h"
#include "Player/PlayerBase.h"
#include "Player/PlayerBase.h"
#include "Util/TimeTicker.h"
#include "Util/TimeTicker.h"
#include "Rt
pCodec
/RtpCodec.h"
#include "Rt
spMuxer
/RtpCodec.h"
using
namespace
std
;
using
namespace
std
;
using
namespace
toolkit
;
using
namespace
toolkit
;
namespace
mediakit
{
namespace
mediakit
{
class
Rt
pPars
er
:
public
PlayerBase
{
class
Rt
spDemux
er
:
public
PlayerBase
{
public
:
public
:
typedef
std
::
shared_ptr
<
Rt
pPars
er
>
Ptr
;
typedef
std
::
shared_ptr
<
Rt
spDemux
er
>
Ptr
;
Rt
pPars
er
(
const
string
&
sdp
);
Rt
spDemux
er
(
const
string
&
sdp
);
virtual
~
Rt
pPars
er
(){};
virtual
~
Rt
spDemux
er
(){};
//返回值:true 代表是i帧第一个rtp包
//返回值:true 代表是i帧第一个rtp包
bool
inputRtp
(
const
RtpPacket
::
Ptr
&
rtp
);
bool
inputRtp
(
const
RtpPacket
::
Ptr
&
rtp
);
...
...
src/Rtsp
/RtspMak
er.cpp
→
src/Rtsp
Muxer/RtspMux
er.cpp
查看文件 @
f41f7e28
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
// Created by xzl on 2018/10/24.
// Created by xzl on 2018/10/24.
//
//
#include "RtspM
ak
er.h"
#include "RtspM
ux
er.h"
#include "Common/Factory.h"
#include "Common/Factory.h"
namespace
mediakit
{
namespace
mediakit
{
void
RtspM
ak
er
::
addTrack
(
const
Track
::
Ptr
&
track
,
uint32_t
ssrc
,
int
mtu
)
{
void
RtspM
ux
er
::
addTrack
(
const
Track
::
Ptr
&
track
,
uint32_t
ssrc
,
int
mtu
)
{
if
(
track
->
getCodecId
()
==
CodecInvalid
)
{
if
(
track
->
getCodecId
()
==
CodecInvalid
)
{
addTrack
(
std
::
make_shared
<
TitleSdp
>
(),
ssrc
,
mtu
);
addTrack
(
std
::
make_shared
<
TitleSdp
>
(),
ssrc
,
mtu
);
}
else
{
}
else
{
...
...
src/Rtsp
/RtspMak
er.h
→
src/Rtsp
Muxer/RtspMux
er.h
查看文件 @
f41f7e28
...
@@ -11,16 +11,16 @@ namespace mediakit{
...
@@ -11,16 +11,16 @@ namespace mediakit{
/**
/**
* rtsp生成器
* rtsp生成器
*/
*/
class
RtspM
ak
er
:
public
FrameRingInterface
,
public
RtpRingInterface
{
class
RtspM
ux
er
:
public
FrameRingInterface
,
public
RtpRingInterface
{
public
:
public
:
/**
/**
* 构成函数
* 构成函数
*/
*/
RtspM
ak
er
(){
RtspM
ux
er
(){
_rtpRing
=
std
::
make_shared
<
RtpRingInterface
::
RingType
>
();
_rtpRing
=
std
::
make_shared
<
RtpRingInterface
::
RingType
>
();
_frameRing
=
std
::
make_shared
<
FrameRingInterface
::
RingType
>
();
_frameRing
=
std
::
make_shared
<
FrameRingInterface
::
RingType
>
();
}
}
virtual
~
RtspM
ak
er
(){}
virtual
~
RtspM
ux
er
(){}
/**
/**
* 添加音视频或title 媒体
* 添加音视频或title 媒体
...
...
src/Rtsp/RtspSdp.cpp
→
src/Rtsp
Muxer
/RtspSdp.cpp
查看文件 @
f41f7e28
File moved
src/Rtsp/RtspSdp.h
→
src/Rtsp
Muxer
/RtspSdp.h
查看文件 @
f41f7e28
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
#ifndef ZLMEDIAKIT_RTSPSDP_H
#ifndef ZLMEDIAKIT_RTSPSDP_H
#define ZLMEDIAKIT_RTSPSDP_H
#define ZLMEDIAKIT_RTSPSDP_H
#include "Rt
pCodec
/H264RtpCodec.h"
#include "Rt
spMuxer
/H264RtpCodec.h"
#include "Rt
pCodec
/AACRtpCodec.h"
#include "Rt
spMuxer
/AACRtpCodec.h"
#include "Util/base64.h"
#include "Util/base64.h"
#include "Player/Track.h"
#include "Player/Track.h"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论