summaryrefslogtreecommitdiff
path: root/libavformat/mp3dec.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2014-09-20 13:48:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-20 19:46:25 +0200
commitd87fe2687fdc5b1cb9aaec957afadb56d207618f (patch)
tree0bc6a62e2054495f5393277f20c42e5d7988f087 /libavformat/mp3dec.c
parent7ac6b8cfa7e6af3f8ebd468607cacdbb386feb8f (diff)
avformat/mp3dec: fix gapless audio support
The code already had skipping of initial padding, but discarding trailing frame padding was missing. This is somewhat questionable, because it will make the decoder discard any data after the declared file size in the LAME header. But note that skipping full frames at the end of the stream is required. Encoders actually create such files. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mp3dec.c')
-rw-r--r--libavformat/mp3dec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 4872afc43c..639c78d405 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -219,6 +219,8 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
mp3->start_pad = v>>12;
mp3-> end_pad = v&4095;
st->skip_samples = mp3->start_pad + 528 + 1;
+ if (mp3->frames)
+ st->end_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf;
if (!st->start_time)
st->start_time = av_rescale_q(st->skip_samples,
(AVRational){1, c->sample_rate},