diff options
author | James Almer <jamrial@gmail.com> | 2017-02-10 20:24:27 -0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2017-02-25 09:57:44 +0100 |
commit | 4cc0227040adb9efc63be6a5765e3214f5c6f662 (patch) | |
tree | 357b33fa876fad5ae2c61391fe63c822d11a5967 /libavformat | |
parent | 3f258f5ee05c9da05f61447b802ae3e39629f44b (diff) | |
download | ffmpeg-streaming-4cc0227040adb9efc63be6a5765e3214f5c6f662.zip ffmpeg-streaming-4cc0227040adb9efc63be6a5765e3214f5c6f662.tar.gz |
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.
Signed-off-by: James Almer <jamrial@gmail.com>
CC: libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/apetag.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 93a4fb3..a7cf853 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -31,6 +31,7 @@ #define APE_TAG_VERSION 2000 #define APE_TAG_FOOTER_BYTES 32 +#define APE_TAG_HEADER_BYTES 32 #define APE_TAG_FLAG_CONTAINS_HEADER (1 << 31) #define APE_TAG_FLAG_LACKS_FOOTER (1 << 30) #define APE_TAG_FLAG_IS_HEADER (1 << 29) @@ -154,7 +155,6 @@ int64_t ff_ape_parse_tag(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Invalid tag size %"PRIu32".\n", tag_bytes); return 0; } - tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES; fields = avio_rl32(pb); /* number of fields */ if (fields > 65536) { @@ -170,6 +170,11 @@ int64_t ff_ape_parse_tag(AVFormatContext *s) 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++) if (ape_tag_read_field(s) < 0) break; |