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
b2ebd848
Commit
b2ebd848
authored
Oct 28, 2018
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善MediaRecord 类
parent
6364b147
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
31 行增加
和
23 行删除
+31
-23
src/MediaFile/MediaRecorder.cpp
+10
-10
src/MediaFile/MediaRecorder.h
+13
-9
src/Rtmp/RtmpToRtspMediaSource.cpp
+4
-2
src/Rtsp/RtspToRtmpMediaSource.cpp
+4
-2
没有找到文件。
src/MediaFile/MediaRecorder.cpp
查看文件 @
b2ebd848
...
@@ -70,24 +70,24 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
...
@@ -70,24 +70,24 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
MediaRecorder
::~
MediaRecorder
()
{
MediaRecorder
::~
MediaRecorder
()
{
}
}
void
MediaRecorder
::
input
H264
(
void
*
pData
,
uint32_t
ui32Length
,
uint32_t
ui32TimeStamp
,
int
iTyp
e
)
{
void
MediaRecorder
::
input
Frame
(
const
Frame
::
Ptr
&
fram
e
)
{
if
(
_hlsMaker
)
{
if
(
_hlsMaker
)
{
// _hlsMaker->inputH264(pData, ui32Length, ui32TimeStamp, iTyp
e);
_hlsMaker
->
inputFrame
(
fram
e
);
}
}
#ifdef ENABLE_MP4V2
#ifdef ENABLE_MP4V2
if
(
_mp4Maker
)
{
if
(
_mp4Maker
)
{
// _mp4Maker->inputH264(pData, ui32Length, ui32TimeStamp, iTyp
e);
_mp4Maker
->
inputFrame
(
fram
e
);
}
}
#endif //ENABLE_MP4V2
#endif //ENABLE_MP4V2
}
}
void
MediaRecorder
::
inputAAC
(
void
*
pData
,
uint32_t
ui32Length
,
uint32_t
ui32TimeStamp
)
{
void
MediaRecorder
::
addTrack
(
const
Track
::
Ptr
&
track
)
{
if
(
_hlsMaker
)
{
if
(
_hlsMaker
)
{
// _hlsMaker->inputAAC(pData, ui32Length, ui32TimeStamp
);
_hlsMaker
->
addTrack
(
track
);
}
}
#ifdef ENABLE_MP4V2
#ifdef ENABLE_MP4V2
if
(
_mp4Maker
)
{
if
(
_mp4Maker
)
{
// _mp4Maker->inputAAC(pData, ui32Length, ui32TimeStamp
);
_mp4Maker
->
addTrack
(
track
);
}
}
#endif //ENABLE_MP4V2
#endif //ENABLE_MP4V2
}
}
...
...
src/MediaFile/MediaRecorder.h
查看文件 @
b2ebd848
...
@@ -39,7 +39,7 @@ using namespace toolkit;
...
@@ -39,7 +39,7 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
class
MediaRecorder
{
class
MediaRecorder
:
public
MediaSink
{
public
:
public
:
typedef
std
::
shared_ptr
<
MediaRecorder
>
Ptr
;
typedef
std
::
shared_ptr
<
MediaRecorder
>
Ptr
;
MediaRecorder
(
const
string
&
strVhost
,
MediaRecorder
(
const
string
&
strVhost
,
...
@@ -48,15 +48,19 @@ public:
...
@@ -48,15 +48,19 @@ public:
bool
enableHls
=
true
,
bool
enableHls
=
true
,
bool
enableMp4
=
false
);
bool
enableMp4
=
false
);
virtual
~
MediaRecorder
();
virtual
~
MediaRecorder
();
protected
:
/**
* 输入frame
* @param frame
*/
void
inputFrame
(
const
Frame
::
Ptr
&
frame
)
override
;
void
inputH264
(
void
*
pData
,
/**
uint32_t
ui32Length
,
* 添加track,内部会调用Track的clone方法
uint32_t
ui32TimeStamp
,
* 只会克隆sps pps这些信息 ,而不会克隆Delegate相关关系
int
iType
);
* @param track
*/
void
inputAAC
(
void
*
pData
,
void
addTrack
(
const
Track
::
Ptr
&
track
)
override
;
uint32_t
ui32Length
,
uint32_t
ui32TimeStamp
);
private
:
private
:
std
::
shared_ptr
<
HLSMaker
>
_hlsMaker
;
std
::
shared_ptr
<
HLSMaker
>
_hlsMaker
;
#ifdef ENABLE_MP4V2
#ifdef ENABLE_MP4V2
...
...
src/Rtmp/RtmpToRtspMediaSource.cpp
查看文件 @
b2ebd848
...
@@ -45,7 +45,8 @@ RtmpToRtspMediaSource::~RtmpToRtspMediaSource() {}
...
@@ -45,7 +45,8 @@ RtmpToRtspMediaSource::~RtmpToRtspMediaSource() {}
void
RtmpToRtspMediaSource
::
onGetH264
(
const
H264Frame
&
frame
)
{
void
RtmpToRtspMediaSource
::
onGetH264
(
const
H264Frame
&
frame
)
{
if
(
_pRecorder
){
if
(
_pRecorder
){
_pRecorder
->
inputH264
((
char
*
)
frame
.
data
(),
frame
.
size
(),
frame
.
timeStamp
,
frame
.
type
);
//todo(xzl) 修复此处
// _pRecorder->inputH264((char *) frame.data(), frame.size(), frame.timeStamp, frame.type);
}
}
if
(
_pRtpMaker_h264
){
if
(
_pRtpMaker_h264
){
...
@@ -54,7 +55,8 @@ void RtmpToRtspMediaSource::onGetH264(const H264Frame &frame) {
...
@@ -54,7 +55,8 @@ void RtmpToRtspMediaSource::onGetH264(const H264Frame &frame) {
}
}
inline
void
RtmpToRtspMediaSource
::
onGetAAC
(
const
AACFrame
&
frame
)
{
inline
void
RtmpToRtspMediaSource
::
onGetAAC
(
const
AACFrame
&
frame
)
{
if
(
_pRecorder
){
if
(
_pRecorder
){
_pRecorder
->
inputAAC
((
char
*
)
frame
.
buffer
,
frame
.
aac_frame_length
,
frame
.
timeStamp
);
//todo(xzl) 修复此处
// _pRecorder->inputAAC((char *) frame.buffer, frame.aac_frame_length, frame.timeStamp);
}
}
if
(
_pRtpMaker_aac
)
{
if
(
_pRtpMaker_aac
)
{
...
...
src/Rtsp/RtspToRtmpMediaSource.cpp
查看文件 @
b2ebd848
...
@@ -90,7 +90,8 @@ void RtspToRtmpMediaSource::makeVideoConfigPkt() {
...
@@ -90,7 +90,8 @@ void RtspToRtmpMediaSource::makeVideoConfigPkt() {
}
}
void
RtspToRtmpMediaSource
::
onGetH264
(
const
H264Frame
&
frame
)
{
void
RtspToRtmpMediaSource
::
onGetH264
(
const
H264Frame
&
frame
)
{
if
(
_pRecorder
){
if
(
_pRecorder
){
_pRecorder
->
inputH264
((
char
*
)
frame
.
data
(),
frame
.
size
(),
frame
.
timeStamp
,
frame
.
type
);
//todo(xzl) 修复此处
// _pRecorder->inputH264((char *) frame.data(), frame.size(), frame.timeStamp, frame.type);
}
}
uint8_t
nal_type
=
frame
.
data
()[
4
]
&
0x1F
;
uint8_t
nal_type
=
frame
.
data
()[
4
]
&
0x1F
;
int8_t
flags
=
7
;
//h.264
int8_t
flags
=
7
;
//h.264
...
@@ -124,7 +125,8 @@ void RtspToRtmpMediaSource::onGetH264(const H264Frame& frame) {
...
@@ -124,7 +125,8 @@ void RtspToRtmpMediaSource::onGetH264(const H264Frame& frame) {
}
}
void
RtspToRtmpMediaSource
::
onGetAAC
(
const
AACFrame
&
frame
)
{
void
RtspToRtmpMediaSource
::
onGetAAC
(
const
AACFrame
&
frame
)
{
if
(
_pRecorder
){
if
(
_pRecorder
){
_pRecorder
->
inputAAC
((
char
*
)
frame
.
buffer
,
frame
.
aac_frame_length
,
frame
.
timeStamp
);
//todo(xzl) 修复此处
// _pRecorder->inputAAC((char *) frame.buffer, frame.aac_frame_length, frame.timeStamp);
}
}
RtmpPacket
::
Ptr
rtmpPkt
(
new
RtmpPacket
);
RtmpPacket
::
Ptr
rtmpPkt
(
new
RtmpPacket
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论