forked from FFmpeg/FFmpeg
avformat/apetag: account for header size if present when returning the start position
The size field in the header/footer accounts for the entire APE tag structure except the 32 bytes from header, for compatibility with APEv1. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
e8d6fef316
commit
84d874a680
2 changed files with 6 additions and 1 deletions
|
@ -150,7 +150,6 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
|
||||||
av_log(s, AV_LOG_ERROR, "Invalid tag size %"PRIu32".\n", tag_bytes);
|
av_log(s, AV_LOG_ERROR, "Invalid tag size %"PRIu32".\n", tag_bytes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
|
|
||||||
|
|
||||||
fields = avio_rl32(pb); /* number of fields */
|
fields = avio_rl32(pb); /* number of fields */
|
||||||
if (fields > 65536) {
|
if (fields > 65536) {
|
||||||
|
@ -166,6 +165,11 @@ int64_t ff_ape_parse_tag(AVFormatContext *s)
|
||||||
|
|
||||||
avio_seek(pb, file_size - tag_bytes, SEEK_SET);
|
avio_seek(pb, file_size - tag_bytes, SEEK_SET);
|
||||||
|
|
||||||
|
if (val & APE_TAG_FLAG_CONTAINS_HEADER)
|
||||||
|
tag_bytes += APE_TAG_HEADER_BYTES;
|
||||||
|
|
||||||
|
tag_start = file_size - tag_bytes;
|
||||||
|
|
||||||
for (i=0; i<fields; i++)
|
for (i=0; i<fields; i++)
|
||||||
if (ape_tag_read_field(s) < 0) break;
|
if (ape_tag_read_field(s) < 0) break;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#define APE_TAG_PREAMBLE "APETAGEX"
|
#define APE_TAG_PREAMBLE "APETAGEX"
|
||||||
#define APE_TAG_VERSION 2000
|
#define APE_TAG_VERSION 2000
|
||||||
#define APE_TAG_FOOTER_BYTES 32
|
#define APE_TAG_FOOTER_BYTES 32
|
||||||
|
#define APE_TAG_HEADER_BYTES 32
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read and parse an APE tag
|
* Read and parse an APE tag
|
||||||
|
|
Loading…
Add table
Reference in a new issue