From 70deb2f2c99677e91b8a404882d9bb0db1791efa Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Tue, 21 Feb 2017 10:46:02 -0700 Subject: [PATCH] mov: extract audio initial_padding from edit list --- libavformat/mov.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 1657647..a080216 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3806,13 +3806,24 @@ static int mov_read_header(AVFormatContext *s) MOVStreamContext *sc = st->priv_data; switch (st->codecpar->codec_type) { - case AVMEDIA_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: { + int64_t skip_samples; err = ff_replaygain_export(st, s->metadata); if (err < 0) { mov_read_close(s); return err; } + skip_samples = av_rescale(sc->time_offset_skip, + st->codecpar->sample_rate, + sc->time_scale); + /* If the number of skipped samples specified in the edit list + * is in a range that looks like an initial_padding, set + * initial_padding to tell decoders to drop the samples */ + if (skip_samples > 0 && skip_samples <= 3840) { + st->codecpar->initial_padding = skip_samples; + } break; + } case AVMEDIA_TYPE_VIDEO: if (sc->display_matrix) { err = av_stream_add_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, -- 2.9.3