summaryrefslogtreecommitdiff
path: root/libavformat/mp3dec.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-03-31 22:47:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-03-31 23:22:07 +0200
commit8b76c0eb561b0313e2a27950fe9d2bc5e4780dd8 (patch)
tree2a9b19eb800ca913f5d04630b11d9a4529074358 /libavformat/mp3dec.c
parent2ddedfd39c0d6b49e6396c535d5cb21846676a13 (diff)
avformat/mp3dec: offset seek index to end of id3v2 tag
The Xing index won't account for the id3 tag - it's relative to the headers. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mp3dec.c')
-rw-r--r--libavformat/mp3dec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index d2498a049f..161f27d2ca 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -106,7 +106,7 @@ static int mp3_read_probe(AVProbeData *p)
//mpegps_mp3_unrecognized_format.mpg has max_frames=3
}
-static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration)
+static void read_xing_toc(AVFormatContext *s, int64_t base, int64_t filesize, int64_t duration)
{
int i;
MP3DecContext *mp3 = s->priv_data;
@@ -122,7 +122,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
uint8_t b = avio_r8(s->pb);
if (fill_index)
av_add_index_entry(s->streams[0],
- av_rescale(b, filesize, 256),
+ av_rescale(b, filesize, 256) + base,
av_rescale(i, duration, XING_TOC_COUNT),
0, 0, AVINDEX_KEYFRAME);
}
@@ -130,7 +130,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
mp3->xing_toc = 1;
}
-static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
+static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, int64_t base,
MPADecodeHeader *c, uint32_t spf)
{
#define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1))
@@ -172,7 +172,7 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
}
}
if (v & XING_FLAG_TOC)
- read_xing_toc(s, mp3->header_filesize, av_rescale_q(mp3->frames,
+ read_xing_toc(s, base, mp3->header_filesize, av_rescale_q(mp3->frames,
(AVRational){spf, c->sample_rate},
st->time_base));
/* VBR quality */
@@ -310,7 +310,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
mp3->frames = 0;
mp3->header_filesize = 0;
- mp3_parse_info_tag(s, st, &c, spf);
+ mp3_parse_info_tag(s, st, base, &c, spf);
mp3_parse_vbri_tag(s, st, base);
if (!mp3->frames && !mp3->header_filesize)