From 066b92e91d678f500c64c947d86cd8bf73ee6c61 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 22 Apr 2015 12:24:37 +0200 Subject: avformat/mp3dec: use the common mechanism for skipping samples The mp2 seek test results change. Whether to skip samples if the file had no LAME gapless tags was inconsistent. When seeking to the start of the file, 529 samples were skipped, but when playing from start, nothing was skipped. This commit changes the behavior on seek to skip nothing. Signed-off-by: Michael Niedermayer --- libavformat/mp3dec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'libavformat/mp3dec.c') diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 0604e315e2..008cb23c12 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -228,13 +228,13 @@ 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; + st->start_skip_samples = mp3->start_pad + 528 + 1; if (mp3->frames) { st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * (int64_t)spf; st->last_discard_sample = mp3->frames * (int64_t)spf; } if (!st->start_time) - st->start_time = av_rescale_q(st->skip_samples, + st->start_time = av_rescale_q(st->start_skip_samples, (AVRational){1, c->sample_rate}, st->time_base); av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad); @@ -447,8 +447,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, ie = &st->index_entries[ret]; } else { - st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; - return -1; } @@ -496,7 +494,6 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, } ff_update_cur_dts(s, st, ie->timestamp); - st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; return 0; } -- cgit v1.2.3