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
b6c64fb4
Commit
b6c64fb4
authored
6 years ago
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成Track对象与SDP对象的转换
parent
be9af50d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
95 行增加
和
39 行删除
+95
-39
src/Player/Frame.h
+47
-1
src/RTP/RtpCodec.h
+1
-38
src/Rtsp/RtspEncoder.cpp
+38
-0
src/Rtsp/RtspEncoder.h
+9
-0
没有找到文件。
src/Player/Frame.h
查看文件 @
b6c64fb4
...
...
@@ -95,7 +95,6 @@ public:
virtual
void
inputFrame
(
const
Frame
::
Ptr
&
frame
)
=
0
;
};
class
FrameRing
:
public
FrameRingInterface
{
public
:
typedef
std
::
shared_ptr
<
FrameRing
>
Ptr
;
...
...
@@ -132,6 +131,53 @@ protected:
RingType
::
Ptr
_frameRing
;
};
class
FrameRingInterfaceDelegate
:
public
FrameRingInterface
{
public
:
typedef
std
::
shared_ptr
<
FrameRingInterfaceDelegate
>
Ptr
;
FrameRingInterfaceDelegate
(){
_delegate
=
std
::
make_shared
<
FrameRing
>
();
}
virtual
~
FrameRingInterfaceDelegate
(){}
void
setDelegate
(
const
FrameRingInterface
::
Ptr
&
delegate
){
_delegate
=
delegate
;
}
/**
* 获取帧环形缓存
* @return
*/
FrameRingInterface
::
RingType
::
Ptr
getFrameRing
()
const
override
{
if
(
_delegate
){
return
_delegate
->
getFrameRing
();
}
return
nullptr
;
}
/**
* 设置帧环形缓存
* @param ring
*/
void
setFrameRing
(
const
FrameRingInterface
::
RingType
::
Ptr
&
ring
)
override
{
if
(
_delegate
){
_delegate
->
setFrameRing
(
ring
);
}
}
/**
* 写入帧数据
* @param frame 帧
*/
void
inputFrame
(
const
Frame
::
Ptr
&
frame
)
override
{
if
(
_delegate
){
_delegate
->
inputFrame
(
frame
);
}
}
private
:
FrameRingInterface
::
Ptr
_delegate
;
};
/**
* 264帧类
*/
...
...
This diff is collapsed.
Click to expand it.
src/RTP/RtpCodec.h
查看文件 @
b6c64fb4
...
...
@@ -156,46 +156,12 @@ protected:
ResourcePool
<
RtpPacket
>
m_rtpPool
;
};
class
RtpCodec
:
public
RtpRing
,
public
FrameRingInterface
,
public
CodecInfo
{
class
RtpCodec
:
public
RtpRing
,
public
FrameRingInterface
Delegate
,
public
CodecInfo
{
public
:
typedef
std
::
shared_ptr
<
RtpCodec
>
Ptr
;
RtpCodec
(){}
virtual
~
RtpCodec
(){}
void
setDelegate
(
const
FrameRingInterface
::
Ptr
&
delegate
){
_delegate
=
delegate
;
}
/**
* 获取帧环形缓存
* @return
*/
FrameRingInterface
::
RingType
::
Ptr
getFrameRing
()
const
override
{
if
(
_delegate
){
return
_delegate
->
getFrameRing
();
}
return
nullptr
;
}
/**
* 设置帧环形缓存
* @param ring
*/
void
setFrameRing
(
const
FrameRingInterface
::
RingType
::
Ptr
&
ring
)
override
{
if
(
_delegate
){
_delegate
->
setFrameRing
(
ring
);
}
}
/**
* 写入帧数据
* @param frame 帧
*/
void
inputFrame
(
const
Frame
::
Ptr
&
frame
)
override
{
if
(
_delegate
){
_delegate
->
inputFrame
(
frame
);
}
}
/**
* 根据CodecId生成Rtp打包器
* @param codecId
...
...
@@ -220,9 +186,6 @@ public:
* @return
*/
static
Ptr
getRtpDecoderById
(
CodecId
codecId
,
uint32_t
ui32SampleRate
);
private
:
FrameRingInterface
::
Ptr
_delegate
;
};
...
...
This diff is collapsed.
Click to expand it.
src/Rtsp/RtspEncoder.cpp
0 → 100644
查看文件 @
b6c64fb4
//
// Created by xzl on 2018/10/23.
//
#include "RtspEncoder.h"
namespace
ZL
{
namespace
Rtsp
{
Sdp
::
Ptr
Sdp
::
getSdpByTrack
(
const
Track
::
Ptr
&
track
)
{
switch
(
track
->
getCodecId
()){
case
CodecH264
:{
H264Track
::
Ptr
h264Track
=
dynamic_pointer_cast
<
H264Track
>
(
track
);
if
(
!
h264Track
){
return
nullptr
;
}
return
std
::
make_shared
<
H264Sdp
>
(
h264Track
->
getSps
(),
h264Track
->
getPps
());
}
case
CodecAAC
:{
AACTrack
::
Ptr
aacTrack
=
dynamic_pointer_cast
<
AACTrack
>
(
track
);
if
(
!
aacTrack
){
return
nullptr
;
}
return
std
::
make_shared
<
AACSdp
>
(
aacTrack
->
getAacCfg
(),
aacTrack
->
getAudioSampleRate
());
}
default
:
return
nullptr
;
}
}
}
}
This diff is collapsed.
Click to expand it.
src/Rtsp/RtspEncoder.h
查看文件 @
b6c64fb4
...
...
@@ -8,6 +8,7 @@
#include "RTP/H264RtpCodec.h"
#include "RTP/AACRtpCodec.h"
#include "Util/base64.h"
#include "Player/Track.h"
namespace
ZL
{
namespace
Rtsp
{
...
...
@@ -28,6 +29,14 @@ public:
_sample_rate
=
sample_rate
;
_playload_type
=
playload_type
;
}
/**
* 根据Track生成SDP对象
* @param track 媒体信息
* @return 返回sdp对象
*/
static
Ptr
getSdpByTrack
(
const
Track
::
Ptr
&
track
);
virtual
~
Sdp
(){}
/**
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论