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
9511a9fe
Commit
9511a9fe
authored
Oct 30, 2018
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
规范代码
parent
b4f8d35e
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
29 行增加
和
30 行删除
+29
-30
src/Extension/AAC.h
+6
-7
src/Extension/H264.h
+8
-9
src/Extension/H265.h
+15
-14
没有找到文件。
src/Extension/AAC.h
查看文件 @
9511a9fe
...
...
@@ -152,7 +152,7 @@ public:
throw
std
::
invalid_argument
(
"adts配置必须为2个字节"
);
}
_cfg
=
aac_cfg
;
parseAacCfg
(
_cfg
);
onReady
(
);
}
/**
...
...
@@ -165,7 +165,7 @@ public:
throw
std
::
invalid_argument
(
"adts头必须不少于7个字节"
);
}
_cfg
=
makeAdtsConfig
((
uint8_t
*
)
adts_header
);
parseAacCfg
(
_cfg
);
onReady
(
);
}
/**
...
...
@@ -177,7 +177,7 @@ public:
throw
std
::
invalid_argument
(
"必须输入带adts头的aac帧"
);
}
_cfg
=
makeAdtsConfig
((
uint8_t
*
)
aac_frame_with_adts
->
data
());
parseAacCfg
(
_cfg
);
onReady
(
);
}
/**
...
...
@@ -235,18 +235,17 @@ public:
if
(
_cfg
.
empty
()
&&
frame
->
prefixSize
()
>=
7
){
//7个字节的adts头
_cfg
=
makeAdtsConfig
(
reinterpret_cast
<
const
uint8_t
*>
(
frame
->
data
()));
parseAacCfg
(
_cfg
);
onReady
(
);
}
AudioTrack
::
inputFrame
(
frame
);
}
private
:
/**
* 解析2个字节的aac配置
* @param aac_cfg
*/
void
parseAacCfg
(
const
string
&
aac_cfg
){
void
onReady
(
){
AACFrame
aacFrame
;
makeAdtsHeader
(
aac
_cfg
,
aacFrame
);
makeAdtsHeader
(
_cfg
,
aacFrame
);
getAACInfo
(
aacFrame
,
_sampleRate
,
_channel
);
}
Track
::
Ptr
clone
()
override
{
...
...
src/Extension/H264.h
查看文件 @
9511a9fe
...
...
@@ -131,7 +131,7 @@ public:
H264Track
(
const
string
&
sps
,
const
string
&
pps
,
int
sps_prefix_len
=
4
,
int
pps_prefix_len
=
4
){
_sps
=
sps
.
substr
(
sps_prefix_len
);
_pps
=
pps
.
substr
(
pps_prefix_len
);
parseSps
(
_sps
);
onReady
(
);
}
/**
...
...
@@ -145,7 +145,7 @@ public:
}
_sps
=
string
(
sps
->
data
()
+
sps
->
prefixSize
(),
sps
->
size
()
-
sps
->
prefixSize
());
_pps
=
string
(
pps
->
data
()
+
pps
->
prefixSize
(),
pps
->
size
()
-
pps
->
prefixSize
());
parseSps
(
_sps
);
onReady
(
);
}
/**
...
...
@@ -207,11 +207,7 @@ public:
switch
(
type
){
case
H264Frame
:
:
NAL_SPS
:
{
//sps
bool
flag
=
_sps
.
empty
();
_sps
=
string
(
frame
->
data
()
+
frame
->
prefixSize
(),
frame
->
size
()
-
frame
->
prefixSize
());
if
(
flag
&&
_width
==
0
){
parseSps
(
_sps
);
}
}
break
;
case
H264Frame
:
:
NAL_PPS
:
{
...
...
@@ -261,14 +257,17 @@ public:
}
break
;
}
if
(
_width
==
0
&&
ready
()){
onReady
();
}
}
private
:
/**
* 解析sps获取宽高fps
* @param sps sps不含头数据
*/
void
parseSps
(
const
string
&
sps
){
getAVCInfo
(
sps
,
_width
,
_height
,
_fps
);
void
onReady
(
){
getAVCInfo
(
_
sps
,
_width
,
_height
,
_fps
);
}
Track
::
Ptr
clone
()
override
{
return
std
::
make_shared
<
std
::
remove_reference
<
decltype
(
*
this
)
>::
type
>
(
*
this
);
...
...
src/Extension/H265.h
查看文件 @
9511a9fe
...
...
@@ -161,29 +161,26 @@ public:
/**
* 构造h265类型的媒体
* @param vps vps帧数据
* @param sps sps帧数据
* @param pps pps帧数据
* @param vps_prefix_len 265头长度,可以为3个或4个字节,一般为0x00 00 00 01
* @param sps_prefix_len 265头长度,可以为3个或4个字节,一般为0x00 00 00 01
* @param pps_prefix_len 265头长度,可以为3个或4个字节,一般为0x00 00 00 01
*/
H265Track
(
const
string
&
sps
,
const
string
&
pps
,
int
sps_prefix_len
=
4
,
int
pps_prefix_len
=
4
)
{
H265Track
(
const
string
&
vps
,
const
string
&
sps
,
const
string
&
pps
,
int
vps_prefix_len
=
4
,
int
sps_prefix_len
=
4
,
int
pps_prefix_len
=
4
)
{
_vps
=
vps
.
substr
(
vps_prefix_len
);
_sps
=
sps
.
substr
(
sps_prefix_len
);
_pps
=
pps
.
substr
(
pps_prefix_len
);
parseSps
(
_sps
);
onReady
(
);
}
/**
* 构造h265类型的媒体
* @param sps sps帧
* @param pps pps帧
* 返回不带0x00 00 00 01头的vps
* @return
*/
H265Track
(
const
Frame
::
Ptr
&
sps
,
const
Frame
::
Ptr
&
pps
)
{
if
(
sps
->
getCodecId
()
!=
CodecH265
||
pps
->
getCodecId
()
!=
CodecH265
)
{
throw
std
::
invalid_argument
(
"必须输入H265类型的帧"
);
}
_sps
=
string
(
sps
->
data
()
+
sps
->
prefixSize
(),
sps
->
size
()
-
sps
->
prefixSize
());
_pps
=
string
(
pps
->
data
()
+
pps
->
prefixSize
(),
pps
->
size
()
-
pps
->
prefixSize
());
parseSps
(
_sps
);
const
string
&
getVps
()
const
{
return
_vps
;
}
/**
...
...
@@ -231,7 +228,7 @@ public:
}
bool
ready
()
override
{
return
!
_sps
.
empty
()
&&
!
_pps
.
empty
();
return
!
_sps
.
empty
()
&&
!
_pps
.
empty
()
&&
!
_vps
.
empty
()
;
}
...
...
@@ -312,13 +309,17 @@ public:
}
break
;
}
if
(
_width
==
0
&&
ready
()
){
onReady
();
}
}
private
:
/**
* 解析sps获取宽高fps
* @param sps sps不含头数据
*/
void
parseSps
(
const
string
&
sps
)
{
void
onReady
(
)
{
// getAVCInfo(sps,_width,_height,_fps);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论