aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-07 12:37:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-07 12:49:37 +0200
commit4cc32e5cad98e3037bce9ca945ea6e5fbcfd5d09 (patch)
tree850b46b99a56147ef3aa43c4d6031711229d1182
parenta71832f826bbefd80fca59eb45c72b5d141a064b (diff)
downloadffmpeg-4cc32e5cad98e3037bce9ca945ea6e5fbcfd5d09.tar.gz
avformat/mp3dec: read xing toc independant of usetoc, only skip filling index if requested
Fixes hypothetical parsing bug with -usetoc 0 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mp3dec.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index c822eb6f2a..522ccf7baa 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -94,9 +94,6 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
int i;
MP3DecContext *mp3 = s->priv_data;
- if (!mp3->usetoc)
- return;
-
if (!filesize &&
!(filesize = avio_size(s->pb))) {
av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n");
@@ -105,8 +102,8 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
for (i = 0; i < XING_TOC_COUNT; i++) {
uint8_t b = avio_r8(s->pb);
-
- av_add_index_entry(s->streams[0],
+ if (mp3->usetoc)
+ av_add_index_entry(s->streams[0],
av_rescale(b, filesize, 256),
av_rescale(i, duration, XING_TOC_COUNT),
0, 0, AVINDEX_KEYFRAME);