Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
云duo
FFmpeg
提交
f0a87479
F
FFmpeg
项目概览
云duo
/
FFmpeg
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FFmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f0a87479
编写于
2月 13, 2015
作者:
L
Luca Barbato
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rtp: h264: Move STAP-A NAL parsing to a function
上级
a9a0b8d6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
61 addition
and
54 deletion
+61
-54
libavformat/rtpdec_h264.c
libavformat/rtpdec_h264.c
+61
-54
未找到文件。
libavformat/rtpdec_h264.c
浏览文件 @
f0a87479
...
...
@@ -180,6 +180,66 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
return
0
;
}
static
int
h264_handle_packet_stap_a
(
AVFormatContext
*
ctx
,
AVPacket
*
pkt
,
const
uint8_t
*
buf
,
int
len
)
{
int
pass
=
0
;
int
total_length
=
0
;
uint8_t
*
dst
=
NULL
;
int
ret
;
for
(
pass
=
0
;
pass
<
2
;
pass
++
)
{
const
uint8_t
*
src
=
buf
;
int
src_len
=
len
;
while
(
src_len
>
2
)
{
uint16_t
nal_size
=
AV_RB16
(
src
);
// consume the length of the aggregate
src
+=
2
;
src_len
-=
2
;
if
(
nal_size
<=
src_len
)
{
if
(
pass
==
0
)
{
// counting
total_length
+=
sizeof
(
start_sequence
)
+
nal_size
;
}
else
{
// copying
assert
(
dst
);
memcpy
(
dst
,
start_sequence
,
sizeof
(
start_sequence
));
dst
+=
sizeof
(
start_sequence
);
memcpy
(
dst
,
src
,
nal_size
);
COUNT_NAL_TYPE
(
data
,
*
src
);
dst
+=
nal_size
;
}
}
else
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"nal size exceeds length: %d %d
\n
"
,
nal_size
,
src_len
);
}
// eat what we handled
src
+=
nal_size
;
src_len
-=
nal_size
;
if
(
src_len
<
0
)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Consumed more bytes than we got! (%d)
\n
"
,
src_len
);
}
if
(
pass
==
0
)
{
/* now we know the total size of the packet (with the
* start sequences added) */
if
((
ret
=
av_new_packet
(
pkt
,
total_length
))
<
0
)
return
ret
;
dst
=
pkt
->
data
;
}
else
{
assert
(
dst
-
pkt
->
data
==
total_length
);
}
}
return
0
;
}
// return 0 on packet, no more left, 1 on packet, 1 on partial packet
static
int
h264_handle_packet
(
AVFormatContext
*
ctx
,
PayloadContext
*
data
,
AVStream
*
st
,
AVPacket
*
pkt
,
uint32_t
*
timestamp
,
...
...
@@ -219,60 +279,7 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
buf
++
;
len
--
;
// first we are going to figure out the total size
{
int
pass
=
0
;
int
total_length
=
0
;
uint8_t
*
dst
=
NULL
;
for
(
pass
=
0
;
pass
<
2
;
pass
++
)
{
const
uint8_t
*
src
=
buf
;
int
src_len
=
len
;
while
(
src_len
>
2
)
{
uint16_t
nal_size
=
AV_RB16
(
src
);
// consume the length of the aggregate
src
+=
2
;
src_len
-=
2
;
if
(
nal_size
<=
src_len
)
{
if
(
pass
==
0
)
{
// counting
total_length
+=
sizeof
(
start_sequence
)
+
nal_size
;
}
else
{
// copying
assert
(
dst
);
memcpy
(
dst
,
start_sequence
,
sizeof
(
start_sequence
));
dst
+=
sizeof
(
start_sequence
);
memcpy
(
dst
,
src
,
nal_size
);
COUNT_NAL_TYPE
(
data
,
*
src
);
dst
+=
nal_size
;
}
}
else
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"nal size exceeds length: %d %d
\n
"
,
nal_size
,
src_len
);
}
// eat what we handled
src
+=
nal_size
;
src_len
-=
nal_size
;
if
(
src_len
<
0
)
av_log
(
ctx
,
AV_LOG_ERROR
,
"Consumed more bytes than we got! (%d)
\n
"
,
src_len
);
}
if
(
pass
==
0
)
{
/* now we know the total size of the packet (with the
* start sequences added) */
if
((
result
=
av_new_packet
(
pkt
,
total_length
))
<
0
)
return
result
;
dst
=
pkt
->
data
;
}
else
{
assert
(
dst
-
pkt
->
data
==
total_length
);
}
}
}
result
=
h264_handle_packet_stap_a
(
ctx
,
pkt
,
buf
,
len
);
break
;
case
25
:
// STAP-B
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录