File mozilla-disable-ogg.patch of Package MozillaFirefox.1158
# HG changeset patch
# Parent 0ad90a933657a172d814e3b45ed4aafaee82d2c8
diff --git a/dom/media/DecoderTraits.cpp b/dom/media/DecoderTraits.cpp
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -9,18 +9,20 @@
#include "nsCharSeparatedTokenizer.h"
#include "nsMimeTypes.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_ANDROID_OMX
#include "AndroidMediaPluginHost.h"
#endif
+#ifdef MOZ_WEBM
#include "OggDecoder.h"
#include "OggReader.h"
+#endif
#ifdef MOZ_WAVE
#include "WaveDecoder.h"
#include "WaveReader.h"
#endif
#ifdef MOZ_WEBM
#include "WebMDecoder.h"
#include "WebMReader.h"
#endif
@@ -126,25 +128,27 @@ static char const *const gOggCodecs[3] =
static char const *const gOggCodecsWithOpus[4] = {
"vorbis",
"opus",
"theora",
nullptr
};
+#ifdef MOZ_WEBM
static bool
IsOggType(const nsACString& aType)
{
if (!MediaDecoder::IsOggEnabled()) {
return false;
}
return CodecListContains(gOggTypes, aType);
}
+#endif
#ifdef MOZ_WAVE
// See http://www.rfc-editor.org/rfc/rfc2361.txt for the definitions
// of WAVE media types and codec types. However, the audio/vnd.wave
// MIME type described there is not used.
static const char* const gWaveTypes[5] = {
"audio/x-wav",
"audio/wav",
@@ -203,18 +207,20 @@ IsGStreamerSupportedType(const nsACStrin
{
if (!MediaDecoder::IsGStreamerEnabled())
return false;
#ifdef MOZ_WEBM
if (IsWebMType(aMimeType) && !Preferences::GetBool("media.prefer-gstreamer", false))
return false;
#endif
+#ifdef MOZ_WEBM
if (IsOggType(aMimeType) && !Preferences::GetBool("media.prefer-gstreamer", false))
return false;
+#endif
return GStreamerDecoder::CanHandleMediaType(aMimeType, nullptr);
}
#endif
#ifdef MOZ_OMX_DECODER
static const char* const gOmxTypes[] = {
"audio/mpeg",
@@ -419,20 +425,22 @@ DecoderTraits::CanHandleMediaType(const
char const* const* codecList = nullptr;
CanPlayStatus result = CANPLAY_NO;
#ifdef MOZ_RAW
if (IsRawType(nsDependentCString(aMIMEType))) {
codecList = gRawCodecs;
result = CANPLAY_MAYBE;
}
#endif
+#ifdef MOZ_WEBM
if (IsOggType(nsDependentCString(aMIMEType))) {
codecList = MediaDecoder::IsOpusEnabled() ? gOggCodecsWithOpus : gOggCodecs;
result = CANPLAY_MAYBE;
}
+#endif
#ifdef MOZ_WAVE
if (IsWaveType(nsDependentCString(aMIMEType))) {
codecList = gWaveCodecs;
result = CANPLAY_MAYBE;
}
#endif
#if defined(MOZ_WEBM) && !defined(MOZ_OMX_WEBM_DECODER)
if (IsWebMType(nsDependentCString(aMIMEType))) {
@@ -546,20 +554,22 @@ InstantiateDecoder(const nsACString& aTy
}
#endif
#ifdef MOZ_RAW
if (IsRawType(aType)) {
decoder = new RawDecoder();
return decoder.forget();
}
#endif
+#ifdef MOZ_WEBM
if (IsOggType(aType)) {
decoder = new OggDecoder();
return decoder.forget();
}
+#endif
#ifdef MOZ_WAVE
if (IsWaveType(aType)) {
decoder = new WaveDecoder();
return decoder.forget();
}
#endif
#ifdef MOZ_OMX_DECODER
if (IsOmxSupportedType(aType)) {
@@ -668,19 +678,21 @@ MediaDecoderReader* DecoderTraits::Creat
decoderReader = new GStreamerReader(aDecoder);
} else
#endif
#ifdef MOZ_RAW
if (IsRawType(aType)) {
decoderReader = new RawReader(aDecoder);
} else
#endif
+#ifdef MOZ_WEBM
if (IsOggType(aType)) {
decoderReader = new OggReader(aDecoder);
} else
+#endif
#ifdef MOZ_WAVE
if (IsWaveType(aType)) {
decoderReader = new WaveReader(aDecoder);
} else
#endif
#ifdef MOZ_OMX_DECODER
if (IsOmxSupportedType(aType)) {
#if ANDROID_VERSION >= 18
@@ -732,17 +744,19 @@ bool DecoderTraits::IsSupportedInVideoDo
// not to, using either the legacy WMF specific pref, or the newer
// catch-all pref.
if (!Preferences::GetBool("media.windows-media-foundation.play-stand-alone", true) ||
!Preferences::GetBool("media.play-stand-alone", true)) {
return false;
}
return
+#ifdef MOZ_WEBM
IsOggType(aType) ||
+#endif
#ifdef MOZ_OMX_DECODER
// We support the formats in gB2GOnlyTypes only inside WebApps on firefoxOS
// but not in general web content. Ensure we dont create a VideoDocument
// when accessing those format URLs directly.
(IsOmxSupportedType(aType) &&
!IsB2GSupportOnlyType(aType)) ||
#endif
#ifdef MOZ_WEBM