File mozilla-disable-ogg.patch of Package MozillaFirefox.3724
# HG changeset patch
# Parent 5adcc6895d1cb730f31e7039bb5c233602479db6
diff --git a/dom/media/DecoderTraits.cpp b/dom/media/DecoderTraits.cpp
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -5,18 +5,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DecoderTraits.h"
#include "MediaDecoder.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsMimeTypes.h"
#include "mozilla/Preferences.h"
+#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"
#include "WebMDemuxer.h"
@@ -113,25 +115,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",
@@ -188,18 +192,20 @@ static bool
IsGStreamerSupportedType(const nsACString& aMimeType)
{
if (DecoderTraits::IsWebMTypeAndEnabled(aMimeType))
return false;
if (!MediaDecoder::IsGStreamerEnabled())
return false;
+#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",
@@ -386,19 +392,21 @@ DecoderTraits::CanHandleCodecsType(const
const nsAString& aRequestedCodecs)
{
char const* const* codecList = nullptr;
#ifdef MOZ_RAW
if (IsRawType(nsDependentCString(aMIMEType))) {
codecList = gRawCodecs;
}
#endif
+#ifdef MOZ_WEBM
if (IsOggType(nsDependentCString(aMIMEType))) {
codecList = MediaDecoder::IsOpusEnabled() ? gOggCodecsWithOpus : gOggCodecs;
}
+#endif
#ifdef MOZ_WAVE
if (IsWaveType(nsDependentCString(aMIMEType))) {
codecList = gWaveCodecs;
}
#endif
#if !defined(MOZ_OMX_WEBM_DECODER)
if (IsWebMTypeAndEnabled(nsDependentCString(aMIMEType))) {
if (IsWebMSupportedType(nsDependentCString(aMIMEType), aRequestedCodecs)) {
@@ -488,19 +496,21 @@ DecoderTraits::CanHandleMediaType(const
return result;
}
}
#ifdef MOZ_RAW
if (IsRawType(nsDependentCString(aMIMEType))) {
return CANPLAY_MAYBE;
}
#endif
+#ifdef MOZ_WEBM
if (IsOggType(nsDependentCString(aMIMEType))) {
return CANPLAY_MAYBE;
}
+#endif
#ifdef MOZ_WAVE
if (IsWaveType(nsDependentCString(aMIMEType))) {
return CANPLAY_MAYBE;
}
#endif
if (IsMP4TypeAndEnabled(nsDependentCString(aMIMEType))) {
return CANPLAY_MAYBE;
}
@@ -574,20 +584,22 @@ InstantiateDecoder(const nsACString& aTy
}
#endif
#ifdef MOZ_RAW
if (IsRawType(aType)) {
decoder = new RawDecoder(aOwner);
return decoder.forget();
}
#endif
+#ifdef MOZ_WEBM
if (IsOggType(aType)) {
decoder = new OggDecoder(aOwner);
return decoder.forget();
}
+#endif
#ifdef MOZ_WAVE
if (IsWaveType(aType)) {
decoder = new WaveDecoder(aOwner);
return decoder.forget();
}
#endif
#ifdef MOZ_OMX_DECODER
if (IsOmxSupportedType(aType)) {
@@ -674,19 +686,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)) {
decoderReader = new MediaOmxReader(aDecoder);
@@ -722,17 +736,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