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
83a0ee85
Commit
83a0ee85
authored
6 years ago
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加注释
parent
820da438
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
49 行增加
和
2 行删除
+49
-2
src/Common/MediaSink.h
+4
-0
src/Player/Frame.h
+26
-0
src/Player/Track.h
+19
-2
没有找到文件。
src/Common/MediaSink.h
查看文件 @
83a0ee85
...
@@ -37,6 +37,10 @@ using namespace toolkit;
...
@@ -37,6 +37,10 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
/**
* 该类的作用是等待Track ready()返回true也就是就绪后再通知派生类进行下一步的操作
* 目的是输入Frame前由Track截取处理下,以便获取有效的信息(譬如sps pps aa_cfg)
*/
class
MediaSink
:
public
FrameWriterInterface
,
public
std
::
enable_shared_from_this
<
MediaSink
>
{
class
MediaSink
:
public
FrameWriterInterface
,
public
std
::
enable_shared_from_this
<
MediaSink
>
{
public
:
public
:
typedef
std
::
shared_ptr
<
MediaSink
>
Ptr
;
typedef
std
::
shared_ptr
<
MediaSink
>
Ptr
;
...
...
This diff is collapsed.
Click to expand it.
src/Player/Frame.h
查看文件 @
83a0ee85
...
@@ -52,6 +52,9 @@ typedef enum {
...
@@ -52,6 +52,9 @@ typedef enum {
TrackMax
=
0x7FFF
TrackMax
=
0x7FFF
}
TrackType
;
}
TrackType
;
/**
* 编码信息的抽象接口
*/
class
CodecInfo
{
class
CodecInfo
{
public
:
public
:
typedef
std
::
shared_ptr
<
CodecInfo
>
Ptr
;
typedef
std
::
shared_ptr
<
CodecInfo
>
Ptr
;
...
@@ -70,6 +73,9 @@ public:
...
@@ -70,6 +73,9 @@ public:
virtual
CodecId
getCodecId
()
const
=
0
;
virtual
CodecId
getCodecId
()
const
=
0
;
};
};
/**
* 帧类型的抽象接口
*/
class
Frame
:
public
Buffer
,
public
CodecInfo
{
class
Frame
:
public
Buffer
,
public
CodecInfo
{
public
:
public
:
typedef
std
::
shared_ptr
<
Frame
>
Ptr
;
typedef
std
::
shared_ptr
<
Frame
>
Ptr
;
...
@@ -92,6 +98,10 @@ public:
...
@@ -92,6 +98,10 @@ public:
virtual
bool
keyFrame
()
const
=
0
;
virtual
bool
keyFrame
()
const
=
0
;
};
};
/**
* 循环池辅助类
* @tparam T
*/
template
<
typename
T
>
template
<
typename
T
>
class
ResourcePoolHelper
{
class
ResourcePoolHelper
{
public
:
public
:
...
@@ -107,6 +117,9 @@ private:
...
@@ -107,6 +117,9 @@ private:
ResourcePool
<
T
>
_pool
;
ResourcePool
<
T
>
_pool
;
};
};
/**
* 写帧接口的抽闲接口
*/
class
FrameWriterInterface
{
class
FrameWriterInterface
{
public
:
public
:
typedef
std
::
shared_ptr
<
FrameWriterInterface
>
Ptr
;
typedef
std
::
shared_ptr
<
FrameWriterInterface
>
Ptr
;
...
@@ -120,11 +133,18 @@ public:
...
@@ -120,11 +133,18 @@ public:
virtual
void
inputFrame
(
const
Frame
::
Ptr
&
frame
)
=
0
;
virtual
void
inputFrame
(
const
Frame
::
Ptr
&
frame
)
=
0
;
};
};
/**
* 写帧接口转function,辅助类
*/
class
FrameWriterInterfaceHelper
:
public
FrameWriterInterface
{
class
FrameWriterInterfaceHelper
:
public
FrameWriterInterface
{
public
:
public
:
typedef
std
::
shared_ptr
<
FrameWriterInterfaceHelper
>
Ptr
;
typedef
std
::
shared_ptr
<
FrameWriterInterfaceHelper
>
Ptr
;
typedef
std
::
function
<
void
(
const
Frame
::
Ptr
&
frame
)
>
onWriteFrame
;
typedef
std
::
function
<
void
(
const
Frame
::
Ptr
&
frame
)
>
onWriteFrame
;
/**
* inputFrame后触发onWriteFrame回调
* @param cb
*/
FrameWriterInterfaceHelper
(
const
onWriteFrame
&
cb
){
FrameWriterInterfaceHelper
(
const
onWriteFrame
&
cb
){
_writeCallback
=
cb
;
_writeCallback
=
cb
;
}
}
...
@@ -165,6 +185,9 @@ public:
...
@@ -165,6 +185,9 @@ public:
virtual
void
setFrameRing
(
const
RingType
::
Ptr
&
ring
)
=
0
;
virtual
void
setFrameRing
(
const
RingType
::
Ptr
&
ring
)
=
0
;
};
};
/**
* 帧环形缓存
*/
class
FrameRing
:
public
FrameRingInterface
{
class
FrameRing
:
public
FrameRingInterface
{
public
:
public
:
typedef
std
::
shared_ptr
<
FrameRing
>
Ptr
;
typedef
std
::
shared_ptr
<
FrameRing
>
Ptr
;
...
@@ -202,6 +225,9 @@ protected:
...
@@ -202,6 +225,9 @@ protected:
RingType
::
Ptr
_frameRing
;
RingType
::
Ptr
_frameRing
;
};
};
/**
* 支持代理转发的帧环形缓存
*/
class
FrameRingInterfaceDelegate
:
public
FrameRing
{
class
FrameRingInterfaceDelegate
:
public
FrameRing
{
public
:
public
:
typedef
std
::
shared_ptr
<
FrameRingInterfaceDelegate
>
Ptr
;
typedef
std
::
shared_ptr
<
FrameRingInterfaceDelegate
>
Ptr
;
...
...
This diff is collapsed.
Click to expand it.
src/Player/Track.h
查看文件 @
83a0ee85
...
@@ -37,6 +37,9 @@ using namespace toolkit;
...
@@ -37,6 +37,9 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
/**
* 媒体通道描述类,也支持帧输入输出
*/
class
Track
:
public
FrameRingInterfaceDelegate
,
public
CodecInfo
{
class
Track
:
public
FrameRingInterfaceDelegate
,
public
CodecInfo
{
public
:
public
:
typedef
std
::
shared_ptr
<
Track
>
Ptr
;
typedef
std
::
shared_ptr
<
Track
>
Ptr
;
...
@@ -45,25 +48,30 @@ public:
...
@@ -45,25 +48,30 @@ public:
virtual
~
Track
(){}
virtual
~
Track
(){}
/**
/**
* 是否准备好
* 是否准备好
,准备好才能获取譬如sps pps等信息
* @return
* @return
*/
*/
virtual
bool
ready
()
=
0
;
virtual
bool
ready
()
=
0
;
/**
/**
* 克隆接口,用于复制本对象用
* 克隆接口,用于复制本对象用
* 在调用该接口时只会复制派生类的信息
* 环形缓存和代理关系不能拷贝,否则会关系紊乱
* @return
* @return
*/
*/
virtual
Track
::
Ptr
clone
()
=
0
;
virtual
Track
::
Ptr
clone
()
=
0
;
/**
/**
* 复制拷贝,只能拷贝
一些描述
信息,
* 复制拷贝,只能拷贝
派生类的
信息,
* 环形缓存和代理关系不能拷贝,否则会关系紊乱
* 环形缓存和代理关系不能拷贝,否则会关系紊乱
* @param that
* @param that
*/
*/
Track
(
const
Track
&
that
){}
Track
(
const
Track
&
that
){}
};
};
/**
* 视频通道描述Track类,支持获取宽高fps信息
*/
class
VideoTrack
:
public
Track
{
class
VideoTrack
:
public
Track
{
public
:
public
:
typedef
std
::
shared_ptr
<
VideoTrack
>
Ptr
;
typedef
std
::
shared_ptr
<
VideoTrack
>
Ptr
;
...
@@ -89,6 +97,9 @@ public:
...
@@ -89,6 +97,9 @@ public:
virtual
float
getVideoFps
()
const
=
0
;
virtual
float
getVideoFps
()
const
=
0
;
};
};
/**
* 音频Track派生类,支持采样率通道数,采用位数信息
*/
class
AudioTrack
:
public
Track
{
class
AudioTrack
:
public
Track
{
public
:
public
:
typedef
std
::
shared_ptr
<
AudioTrack
>
Ptr
;
typedef
std
::
shared_ptr
<
AudioTrack
>
Ptr
;
...
@@ -114,6 +125,9 @@ public:
...
@@ -114,6 +125,9 @@ public:
virtual
int
getAudioChannel
()
const
=
0
;
virtual
int
getAudioChannel
()
const
=
0
;
};
};
/**
* 264视频通道
*/
class
H264Track
:
public
VideoTrack
{
class
H264Track
:
public
VideoTrack
{
public
:
public
:
typedef
std
::
shared_ptr
<
H264Track
>
Ptr
;
typedef
std
::
shared_ptr
<
H264Track
>
Ptr
;
...
@@ -270,6 +284,9 @@ private:
...
@@ -270,6 +284,9 @@ private:
float
_fps
=
0
;
float
_fps
=
0
;
};
};
/**
* aac音频通道
*/
class
AACTrack
:
public
AudioTrack
{
class
AACTrack
:
public
AudioTrack
{
public
:
public
:
typedef
std
::
shared_ptr
<
AACTrack
>
Ptr
;
typedef
std
::
shared_ptr
<
AACTrack
>
Ptr
;
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论