[FFmpeg-cvslog] mp3dec: fix seeking without xing TOC
Michael Niedermayer
git at videolan.org
Thu Sep 20 22:07:39 CEST 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Sep 20 22:00:52 2012 +0200| [6d87781758ec7beb3dc1d3d6cf672977ac960beb] | committer: Michael Niedermayer
mp3dec: fix seeking without xing TOC
fixes regression from the xing toc support
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d87781758ec7beb3dc1d3d6cf672977ac960beb
---
libavformat/mp3dec.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index db01cd2..ae54975 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -37,6 +37,7 @@
typedef struct {
int64_t filesize;
+ int xing_toc;
int start_pad;
int end_pad;
} MP3Context;
@@ -88,6 +89,7 @@ static int mp3_read_probe(AVProbeData *p)
static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration)
{
int i;
+ MP3Context *mp3 = s->priv_data;
if (!filesize &&
!(filesize = avio_size(s->pb))) {
@@ -103,6 +105,7 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
av_rescale(i, duration, XING_TOC_COUNT),
0, 0, AVINDEX_KEYFRAME);
}
+ mp3->xing_toc = 1;
}
/**
@@ -259,6 +262,12 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
int64_t ret = av_index_search_timestamp(st, timestamp, flags);
uint32_t header = 0;
+ if (!mp3->xing_toc) {
+ st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0;
+
+ return -1;
+ }
+
if (ret < 0)
return ret;
More information about the ffmpeg-cvslog
mailing list