From de261254de7a5ded6717cf689aba9bc543a0ae6b Mon Sep 17 00:00:00 2001 From: Evangelos Foutras <foutrelis@archlinux.org> Date: Tue, 2 Feb 2016 13:34:41 +0000 Subject: [PATCH] Add QuickTime support (FS#47953). --- PKGBUILD | 7 +- firefox-quicktime.patch | 144 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 firefox-quicktime.patch diff --git a/PKGBUILD b/PKGBUILD index 0361b1f..db967b9 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ pkgname=firefox pkgver=44.0 -pkgrel=1 +pkgrel=2 pkgdesc="Standalone web browser from mozilla.org" arch=('i686' 'x86_64') license=('MPL' 'GPL' 'LGPL') @@ -23,12 +23,14 @@ source=(https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$pkgver/source/ firefox.desktop firefox-install-dir.patch vendor.js + firefox-quicktime.patch firefox-fixed-loading-icon.png) sha256sums=('ea82b0f4840d320aa4fe8046ba28e686bf6dc60f707a0514a9d68c150d0c4c1d' 'a7a5dffa8df27a8f4d1e034c5fc10b39d69068be92ee3f40e8ee7980a68655a6' 'c202e5e18da1eeddd2e1d81cb3436813f11e44585ca7357c4c5f1bddd4bec826' 'd86e41d87363656ee62e12543e2f5181aadcff448e406ef3218e91865ae775cd' '4b50e9aec03432e21b44d18c4c97b2630bace606b033f7d556c9d3e3eb0f4fa4' + '6b731ca36e7688aeb24685da702e0af0475e6671072fc96464fbbed49d0bbd50' '68e3a5b47c6d175cc95b98b069a15205f027cab83af9e075818d38610feb6213') validpgpkeys=('2B90598A745E992F315E22C58AB132963A06537A') @@ -50,6 +52,9 @@ _mozilla_api_key=16674381-f021-49de-8622-3021c5942aff prepare() { cd $pkgname-$pkgver + # https://bugzilla.mozilla.org/show_bug.cgi?id=1244523 + patch -Np1 -i ../firefox-quicktime.patch + cp ../mozconfig .mozconfig patch -Np1 -i ../firefox-install-dir.patch diff --git a/firefox-quicktime.patch b/firefox-quicktime.patch new file mode 100644 index 0000000..353ee3f --- /dev/null +++ b/firefox-quicktime.patch @@ -0,0 +1,144 @@ + +# HG changeset patch +# User John Lin <jolin@mozilla.com> +# Date 1447265580 -3600 +# Node ID aeb7ece8cbd40280f27ec3631f4f9e5b8b52c5a9 +# Parent 22d372a893d764554af0edb7e47f817af93b2114 +Bug 1211802 - Recognize 'avc?' as mp4 video. r=jya + +diff --git a/toolkit/components/mediasniffer/nsMediaSniffer.cpp b/toolkit/components/mediasniffer/nsMediaSniffer.cpp +--- a/toolkit/components/mediasniffer/nsMediaSniffer.cpp ++++ b/toolkit/components/mediasniffer/nsMediaSniffer.cpp +@@ -36,16 +36,17 @@ nsMediaSnifferEntry nsMediaSniffer::sSni + PATTERN_ENTRY("\xFF\xFF\xFF\xFF\x00\x00\x00\x00\xFF\xFF\xFF\xFF", "RIFF\x00\x00\x00\x00WAVE", AUDIO_WAV), + // mp3 with ID3 tags, the string "ID3". + PATTERN_ENTRY("\xFF\xFF\xFF", "ID3", AUDIO_MP3) + }; + + // For a complete list of file types, see http://www.ftyps.com/index.html + nsMediaSnifferEntry sFtypEntries[] = { + PATTERN_ENTRY("\xFF\xFF\xFF", "mp4", VIDEO_MP4), // Could be mp41 or mp42. ++ PATTERN_ENTRY("\xFF\xFF\xFF", "avc", VIDEO_MP4), // Could be avc1, avc2, ... + PATTERN_ENTRY("\xFF\xFF\xFF", "3gp", VIDEO_3GPP), // Could be 3gp4, 3gp5, ... + PATTERN_ENTRY("\xFF\xFF\xFF\xFF", "M4A ", AUDIO_MP4), + PATTERN_ENTRY("\xFF\xFF\xFF\xFF", "M4P ", AUDIO_MP4) + }; + + static bool MatchesBrands(const uint8_t aData[4], nsACString& aSniffedType) + { + for (size_t i = 0; i < mozilla::ArrayLength(sFtypEntries); ++i) { + + +# HG changeset patch +# User Jean-Yves Avenard <jyavenard@mozilla.com> +# Date 1454373529 -39600 +# Node ID f7d66b2782266c066f2efecc9f066af01472ffb5 +# Parent b237f1bffcfd9b7c7da767ffa54dbf4ed7b68321 +Bug 1244523: P1. Allow video/quicktime mimetype. r=cpearce + +It's just like video/mp4 + + +diff --git a/dom/media/fmp4/MP4Decoder.cpp b/dom/media/fmp4/MP4Decoder.cpp +--- a/dom/media/fmp4/MP4Decoder.cpp ++++ b/dom/media/fmp4/MP4Decoder.cpp +@@ -102,16 +102,17 @@ MP4Decoder::CanHandleMediaType(const nsA + const bool isMP4Audio = aMIMETypeExcludingCodecs.EqualsASCII("audio/mp4") || + aMIMETypeExcludingCodecs.EqualsASCII("audio/x-m4a"); + const bool isMP4Video = + // On B2G, treat 3GPP as MP4 when Gonk PDM is available. + #ifdef MOZ_GONK_MEDIACODEC + aMIMETypeExcludingCodecs.EqualsASCII(VIDEO_3GPP) || + #endif + aMIMETypeExcludingCodecs.EqualsASCII("video/mp4") || ++ aMIMETypeExcludingCodecs.EqualsASCII("video/quicktime") || + aMIMETypeExcludingCodecs.EqualsASCII("video/x-m4v"); + if (!isMP4Audio && !isMP4Video) { + return false; + } + + nsTArray<nsCString> codecMimes; + if (aCodecs.IsEmpty()) { + // No codecs specified. Assume AAC/H.264 + + +# HG changeset patch +# User Jean-Yves Avenard <jyavenard@mozilla.com> +# Date 1454373530 -39600 +# Node ID b0c3e8efafc8aa13935d023762e26495fc9b99a9 +# Parent f7d66b2782266c066f2efecc9f066af01472ffb5 +Bug 1244523: [mp4] P2. Have sniffer recognise ftyp qt subtype. r=cpearce + + +diff --git a/toolkit/components/mediasniffer/nsMediaSniffer.cpp b/toolkit/components/mediasniffer/nsMediaSniffer.cpp +--- a/toolkit/components/mediasniffer/nsMediaSniffer.cpp ++++ b/toolkit/components/mediasniffer/nsMediaSniffer.cpp +@@ -37,17 +37,18 @@ nsMediaSnifferEntry nsMediaSniffer::sSni + }; + + // For a complete list of file types, see http://www.ftyps.com/index.html + nsMediaSnifferEntry sFtypEntries[] = { + PATTERN_ENTRY("\xFF\xFF\xFF", "mp4", VIDEO_MP4), // Could be mp41 or mp42. + PATTERN_ENTRY("\xFF\xFF\xFF", "avc", VIDEO_MP4), // Could be avc1, avc2, ... + PATTERN_ENTRY("\xFF\xFF\xFF", "3gp", VIDEO_3GPP), // Could be 3gp4, 3gp5, ... + PATTERN_ENTRY("\xFF\xFF\xFF\xFF", "M4A ", AUDIO_MP4), +- PATTERN_ENTRY("\xFF\xFF\xFF\xFF", "M4P ", AUDIO_MP4) ++ PATTERN_ENTRY("\xFF\xFF\xFF\xFF", "M4P ", AUDIO_MP4), ++ PATTERN_ENTRY("\xFF\xFF\xFF\xFF", "qt ", VIDEO_MP4), + }; + + static bool MatchesBrands(const uint8_t aData[4], nsACString& aSniffedType) + { + for (size_t i = 0; i < mozilla::ArrayLength(sFtypEntries); ++i) { + const auto& currentEntry = sFtypEntries[i]; + bool matched = true; + MOZ_ASSERT(currentEntry.mLength <= 4, "Pattern is too large to match brand strings."); + + +# HG changeset patch +# User Jean-Yves Avenard <jyavenard@mozilla.com> +# Date 1454373533 -39600 +# Node ID 15d15d76aae97b14717eded043ea73cc81fe50e6 +# Parent b0c3e8efafc8aa13935d023762e26495fc9b99a9 +Bug 1244523: [mp4] P3. Skip four bytes when we hit a zero length box, r=kentuckyfriedtakahe + +Similar to bug 1180101, but don't handle only the last box in the file. + + +diff --git a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp +--- a/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp ++++ b/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp +@@ -646,24 +646,24 @@ static bool ValidInputSize(int32_t size) + // frame. This is a reasonable cut-off for a lossy codec, + // combined with the current Firefox limit to 5k video. + return (size > 0 && size <= 4 * (1920 * 1080) * 3 / 2); + } + + status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { + ALOGV("entering parseChunk %lld/%d", *offset, depth); + uint32_t hdr[2]; +- ssize_t nbytes; +- if ((nbytes = mDataSource->readAt(*offset, hdr, 8)) < 8) { +- if (nbytes == 4) { +- if (!hdr[0]) { +- *offset += 4; +- return OK; +- } +- } ++ if (mDataSource->readAt(*offset, hdr, 4) < 4) { ++ return ERROR_IO; ++ } ++ if (!hdr[0]) { ++ *offset += 4; ++ return OK; ++ } ++ if (mDataSource->readAt(*offset + 4, hdr + 1, 4) < 4) { + return ERROR_IO; + } + uint64_t chunk_size = ntohl(hdr[0]); + uint32_t chunk_type = ntohl(hdr[1]); + off64_t data_offset = *offset + 8; + + if (chunk_size == 1) { + if (mDataSource->readAt(*offset + 8, &chunk_size, 8) < 8) { + -- GitLab