PKGBUILDs/extra/firefox/firefox-quicktime.patch
2016-02-02 14:21:35 +00:00

144 lines
5.7 KiB
Diff

# 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) {