Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a42ab110
提交
a42ab110
authored
3月 23, 2016
作者:
Seven Du
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8959 #resolve refactor code
上级
0929d7d7
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
31 行增加
和
30 行删除
+31
-30
avcodec.c
src/mod/applications/mod_av/avcodec.c
+31
-30
没有找到文件。
src/mod/applications/mod_av/avcodec.c
浏览文件 @
a42ab110
...
@@ -734,28 +734,11 @@ static switch_status_t consume_h263p_bitstream(h264_codec_context_t *context, sw
...
@@ -734,28 +734,11 @@ static switch_status_t consume_h263p_bitstream(h264_codec_context_t *context, sw
return
frame
->
m
?
SWITCH_STATUS_SUCCESS
:
SWITCH_STATUS_MORE_DATA
;
return
frame
->
m
?
SWITCH_STATUS_SUCCESS
:
SWITCH_STATUS_MORE_DATA
;
}
}
static
switch_status_t
consume_
nalu
(
h264_codec_context_t
*
context
,
switch_frame_t
*
frame
)
static
switch_status_t
consume_
h264_bitstream
(
h264_codec_context_t
*
context
,
switch_frame_t
*
frame
)
{
{
AVPacket
*
pkt
=
&
context
->
encoder_avpacket
;
AVPacket
*
pkt
=
&
context
->
encoder_avpacket
;
our_h264_nalu_t
*
nalu
=
&
context
->
nalus
[
context
->
nalu_current_index
];
our_h264_nalu_t
*
nalu
=
&
context
->
nalus
[
context
->
nalu_current_index
];
if
(
!
nalu
->
len
)
{
frame
->
datalen
=
0
;
frame
->
m
=
0
;
if
(
pkt
->
size
>
0
)
av_free_packet
(
pkt
);
// if (context->encoder_avframe->data[0]) av_freep(&context->encoder_avframe->data[0]);
context
->
nalu_current_index
=
0
;
return
SWITCH_STATUS_NOTFOUND
;
}
if
(
context
->
av_codec_id
==
AV_CODEC_ID_H263
)
{
return
consume_h263_bitstream
(
context
,
frame
);
}
else
if
(
context
->
av_codec_id
==
AV_CODEC_ID_H263P
)
{
return
consume_h263p_bitstream
(
context
,
frame
);
}
assert
(
nalu
->
len
);
if
(
nalu
->
len
<=
SLICE_SIZE
)
{
if
(
nalu
->
len
<=
SLICE_SIZE
)
{
uint8_t
nalu_hdr
=
*
(
uint8_t
*
)(
nalu
->
start
);
uint8_t
nalu_hdr
=
*
(
uint8_t
*
)(
nalu
->
start
);
uint8_t
nalu_type
=
nalu_hdr
&
0x1f
;
uint8_t
nalu_type
=
nalu_hdr
&
0x1f
;
...
@@ -768,15 +751,13 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
...
@@ -768,15 +751,13 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
return
SWITCH_STATUS_MORE_DATA
;
return
SWITCH_STATUS_MORE_DATA
;
}
}
frame
->
m
=
context
->
nalus
[
context
->
nalu_current_index
].
len
?
0
:
1
;
if
(
context
->
nalus
[
context
->
nalu_current_index
].
len
)
{
if
(
frame
->
m
)
frame
->
m
=
0
;
{
if
(
pkt
->
size
>
0
)
{
av_packet_unref
(
pkt
);
}
return
SWITCH_STATUS_SUCCESS
;
}
else
{
return
SWITCH_STATUS_MORE_DATA
;
return
SWITCH_STATUS_MORE_DATA
;
}
else
{
if
(
pkt
->
size
>
0
)
av_packet_unref
(
pkt
);
return
SWITCH_STATUS_SUCCESS
;
}
}
}
else
{
}
else
{
uint8_t
nalu_hdr
=
*
(
uint8_t
*
)(
nalu
->
start
);
uint8_t
nalu_hdr
=
*
(
uint8_t
*
)(
nalu
->
start
);
...
@@ -793,10 +774,8 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
...
@@ -793,10 +774,8 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
frame
->
datalen
=
left
+
2
;
frame
->
datalen
=
left
+
2
;
frame
->
m
=
1
;
frame
->
m
=
1
;
context
->
nalu_current_index
++
;
context
->
nalu_current_index
++
;
if
(
pkt
->
size
>
0
)
{
if
(
pkt
->
size
>
0
)
av_packet_unref
(
pkt
);
av_packet_unref
(
pkt
);
}
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
else
{
}
else
{
uint8_t
start
=
nalu
->
start
==
nalu
->
eat
?
0x80
:
0
;
uint8_t
start
=
nalu
->
start
==
nalu
->
eat
?
0x80
:
0
;
...
@@ -812,6 +791,28 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
...
@@ -812,6 +791,28 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
}
}
}
}
static
switch_status_t
consume_nalu
(
h264_codec_context_t
*
context
,
switch_frame_t
*
frame
)
{
AVPacket
*
pkt
=
&
context
->
encoder_avpacket
;
our_h264_nalu_t
*
nalu
=
&
context
->
nalus
[
context
->
nalu_current_index
];
if
(
!
nalu
->
len
)
{
frame
->
datalen
=
0
;
frame
->
m
=
0
;
if
(
pkt
->
size
>
0
)
av_free_packet
(
pkt
);
context
->
nalu_current_index
=
0
;
return
SWITCH_STATUS_NOTFOUND
;
}
if
(
context
->
av_codec_id
==
AV_CODEC_ID_H263
)
{
return
consume_h263_bitstream
(
context
,
frame
);
}
else
if
(
context
->
av_codec_id
==
AV_CODEC_ID_H263P
)
{
return
consume_h263p_bitstream
(
context
,
frame
);
}
else
{
return
consume_h264_bitstream
(
context
,
frame
);
}
}
static
switch_status_t
open_encoder
(
h264_codec_context_t
*
context
,
uint32_t
width
,
uint32_t
height
)
static
switch_status_t
open_encoder
(
h264_codec_context_t
*
context
,
uint32_t
width
,
uint32_t
height
)
{
{
int
sane
=
0
;
int
sane
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论