]> granicus.if.org Git - handbrake/commitdiff
libav: extract initial_padding from mp4 edit list
authorJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 21 Feb 2017 17:50:58 +0000 (10:50 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 21 Feb 2017 17:53:57 +0000 (10:53 -0700)
contrib/ffmpeg/A12-mov-initial_padding.patch [new file with mode: 0644]

diff --git a/contrib/ffmpeg/A12-mov-initial_padding.patch b/contrib/ffmpeg/A12-mov-initial_padding.patch
new file mode 100644 (file)
index 0000000..61ca819
--- /dev/null
@@ -0,0 +1,42 @@
+From 70deb2f2c99677e91b8a404882d9bb0db1791efa Mon Sep 17 00:00:00 2001
+From: John Stebbins <stebbins@jetheaddev.com>
+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
+