Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
782e64fb
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
782e64fb
编写于
7月 30, 2012
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wv,mpc8: don't return apetag data in packets.
上级
9c9c21ea
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
9 deletion
+34
-9
libavformat/apetag.c
libavformat/apetag.c
+15
-6
libavformat/apetag.h
libavformat/apetag.h
+3
-1
libavformat/mpc8.c
libavformat/mpc8.c
+8
-1
libavformat/wv.c
libavformat/wv.c
+8
-1
未找到文件。
libavformat/apetag.c
浏览文件 @
782e64fb
...
...
@@ -113,40 +113,47 @@ static int ape_tag_read_field(AVFormatContext *s)
return
0
;
}
void
ff_ape_parse_tag
(
AVFormatContext
*
s
)
int64_t
ff_ape_parse_tag
(
AVFormatContext
*
s
)
{
AVIOContext
*
pb
=
s
->
pb
;
int
file_size
=
avio_size
(
pb
);
uint32_t
val
,
fields
,
tag_bytes
;
uint8_t
buf
[
8
];
int64_t
tag_start
;
int
i
;
if
(
file_size
<
APE_TAG_FOOTER_BYTES
)
return
;
return
0
;
avio_seek
(
pb
,
file_size
-
APE_TAG_FOOTER_BYTES
,
SEEK_SET
);
avio_read
(
pb
,
buf
,
8
);
/* APETAGEX */
if
(
strncmp
(
buf
,
"APETAGEX"
,
8
))
{
return
;
return
0
;
}
val
=
avio_rl32
(
pb
);
/* APE tag version */
if
(
val
>
APE_TAG_VERSION
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported tag version. (>=%d)
\n
"
,
APE_TAG_VERSION
);
return
;
return
0
;
}
tag_bytes
=
avio_rl32
(
pb
);
/* tag size */
if
(
tag_bytes
-
APE_TAG_FOOTER_BYTES
>
(
1024
*
1024
*
16
))
{
av_log
(
s
,
AV_LOG_ERROR
,
"Tag size is way too big
\n
"
);
return
;
return
0
;
}
tag_start
=
file_size
-
tag_bytes
-
APE_TAG_FOOTER_BYTES
;
if
(
tag_start
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid tag size %u.
\n
"
,
tag_bytes
);
return
0
;
}
fields
=
avio_rl32
(
pb
);
/* number of fields */
if
(
fields
>
65536
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Too many tag fields (%d)
\n
"
,
fields
);
return
;
return
0
;
}
val
=
avio_rl32
(
pb
);
/* flags */
...
...
@@ -159,4 +166,6 @@ void ff_ape_parse_tag(AVFormatContext *s)
for
(
i
=
0
;
i
<
fields
;
i
++
)
if
(
ape_tag_read_field
(
s
)
<
0
)
break
;
return
tag_start
;
}
libavformat/apetag.h
浏览文件 @
782e64fb
...
...
@@ -27,7 +27,9 @@
/**
* Read and parse an APE tag
*
* @return offset of the tag start in the file
*/
void
ff_ape_parse_tag
(
AVFormatContext
*
s
);
int64_t
ff_ape_parse_tag
(
AVFormatContext
*
s
);
#endif
/* AVFORMAT_APETAG_H */
libavformat/mpc8.c
浏览文件 @
782e64fb
...
...
@@ -52,6 +52,8 @@ typedef struct {
int
frame
;
int64_t
header_pos
;
int64_t
samples
;
int64_t
apetag_start
;
}
MPCContext
;
static
inline
int64_t
bs_get_v
(
uint8_t
**
bs
)
...
...
@@ -243,7 +245,7 @@ static int mpc8_read_header(AVFormatContext *s)
if
(
pb
->
seekable
)
{
int64_t
pos
=
avio_tell
(
s
->
pb
);
ff_ape_parse_tag
(
s
);
c
->
apetag_start
=
ff_ape_parse_tag
(
s
);
avio_seek
(
s
->
pb
,
pos
,
SEEK_SET
);
}
...
...
@@ -258,6 +260,11 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
while
(
!
s
->
pb
->
eof_reached
){
pos
=
avio_tell
(
s
->
pb
);
/* don't return bogus packets with the ape tag data */
if
(
c
->
apetag_start
&&
pos
>=
c
->
apetag_start
)
return
AVERROR_EOF
;
mpc8_get_chunk_header
(
s
->
pb
,
&
tag
,
&
size
);
if
(
size
<
0
)
return
-
1
;
...
...
libavformat/wv.c
浏览文件 @
782e64fb
...
...
@@ -64,6 +64,8 @@ typedef struct {
int
block_parsed
;
uint8_t
extra
[
WV_EXTRA_SIZE
];
int64_t
pos
;
int64_t
apetag_start
;
}
WVContext
;
static
int
wv_probe
(
AVProbeData
*
p
)
...
...
@@ -88,6 +90,11 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb,
uint32_t
chmask
;
wc
->
pos
=
avio_tell
(
pb
);
/* don't return bogus packets with the ape tag data */
if
(
wc
->
apetag_start
&&
wc
->
pos
>=
wc
->
apetag_start
)
return
AVERROR_EOF
;
if
(
!
append
)
{
tag
=
avio_rl32
(
pb
);
if
(
tag
!=
MKTAG
(
'w'
,
'v'
,
'p'
,
'k'
))
...
...
@@ -252,7 +259,7 @@ static int wv_read_header(AVFormatContext *s)
if
(
s
->
pb
->
seekable
)
{
int64_t
cur
=
avio_tell
(
s
->
pb
);
ff_ape_parse_tag
(
s
);
wc
->
apetag_start
=
ff_ape_parse_tag
(
s
);
if
(
!
av_dict_get
(
s
->
metadata
,
""
,
NULL
,
AV_DICT_IGNORE_SUFFIX
))
ff_id3v1_read
(
s
);
avio_seek
(
s
->
pb
,
cur
,
SEEK_SET
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录