summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2018-09-09 12:17:23 -0700
committerJohn Stebbins <[email protected]>2018-09-09 12:17:23 -0700
commit09ed0b5574c92972b23ae44e60c718450d16d388 (patch)
treea4393e884564bdfde8c52bcaf666e8bc42388c83 /contrib
parentd3e071f1a0def30929e20c367e2b920f747aa120 (diff)
ffmpeg: fix static audio with pcm in mp4
Fixes https://github.com/HandBrake/HandBrake/issues/1555
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ffmpeg/A03-mp4-pcm.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A03-mp4-pcm.patch b/contrib/ffmpeg/A03-mp4-pcm.patch
new file mode 100644
index 000000000..d9f4932f8
--- /dev/null
+++ b/contrib/ffmpeg/A03-mp4-pcm.patch
@@ -0,0 +1,64 @@
+From d2047c14c0789ce3059b840472fb96fd8bd854a9 Mon Sep 17 00:00:00 2001
+From: Justin Ruggles <[email protected]>
+Date: Wed, 5 Sep 2018 17:54:57 -0400
+Subject: [PATCH 1/2] Use QT format for audio sample descriptors depending on
+ stsd version.
+
+ISOBMFF does not allow AudioSampleEntryV1 in stsd version 0, so
+assume the descriptor format is QTFF SoundDescriptionV1. ISOBMFF does
+not define a version 2.
+
+This fixes audio decoding for some MP4 files generated with Apple
+tools. The additional fields present in SoundDescriptionV1/V2 need to
+be read in order to correctly read additional boxes that contain
+information required for decoding the stream.
+
+Fixes #7376.
+
+Also see: https://github.com/HandBrake/HandBrake/issues/1555
+
+Signed-off-by: Derek Buitenhuis <[email protected]>
+---
+ libavformat/isom.h | 1 +
+ libavformat/mov.c | 6 +++---
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/libavformat/isom.h b/libavformat/isom.h
+index f3a7a8633d..e629663949 100644
+--- a/libavformat/isom.h
++++ b/libavformat/isom.h
+@@ -218,6 +218,7 @@ typedef struct MOVStreamContext {
+ int *extradata_size;
+ int last_stsd_index;
+ int stsd_count;
++ int stsd_version;
+
+ int32_t *display_matrix;
+ AVStereo3D *stereo3d;
+diff --git a/libavformat/mov.c b/libavformat/mov.c
+index 02c8ec66ed..ec57a05803 100644
+--- a/libavformat/mov.c
++++ b/libavformat/mov.c
+@@ -2122,8 +2122,8 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
+ // Read QT version 1 fields. In version 0 these do not exist.
+ av_log(c->fc, AV_LOG_TRACE, "version =%d, isom =%d\n", version, c->isom);
+ if (!c->isom ||
+- (compatible_brands && strstr(compatible_brands->value, "qt "))) {
+-
++ (compatible_brands && strstr(compatible_brands->value, "qt ")) ||
++ (sc->stsd_version == 0 && version > 0)) {
+ if (version == 1) {
+ sc->samples_per_frame = avio_rb32(pb);
+ avio_rb32(pb); /* bytes per packet */
+@@ -2554,7 +2554,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+ st = c->fc->streams[c->fc->nb_streams - 1];
+ sc = st->priv_data;
+
+- avio_r8(pb); /* version */
++ sc->stsd_version = avio_r8(pb);
+ avio_rb24(pb); /* flags */
+ entries = avio_rb32(pb);
+
+--
+2.17.1
+