mozilla-gstreamer-760140.patch
changeset 541 830e50bbfc79
parent 529 4812378b5646
child 568 2c74c5927ea2
--- a/mozilla-gstreamer-760140.patch	Tue Sep 11 19:27:36 2012 +0200
+++ b/mozilla-gstreamer-760140.patch	Thu Sep 13 21:36:45 2012 +0200
@@ -24,7 +24,7 @@
  #include "mozilla/Base64.h"
  #include "mozilla/Preferences.h"
  #include "nsDOMMutationObserver.h"
-@@ -6511,26 +6514,23 @@ nsContentUtils::FindInternalContentViewe
+@@ -6580,26 +6583,23 @@ nsContentUtils::FindInternalContentViewe
          }
          return docFactory.forget();
        }
@@ -43,7 +43,7 @@
 -        }
 -        return docFactory.forget();
 +  if (nsHTMLMediaElement::IsGStreamerEnabled()) {
-+    if (nsGStreamerDecoder::CanHandleMediaType(aType, NULL)) {
++    if (nsGStreamerDecoder::CanHandleMediaType(aType, nullptr)) {
 +      docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
 +      if (docFactory && aLoaderType) {
 +        *aLoaderType = TYPE_CONTENT;
@@ -52,15 +52,15 @@
      }
    }
  #endif
- #endif // MOZ_MEDIA
  
-   return NULL;
- }
- 
+ #ifdef MOZ_MEDIA_PLUGINS
+   if (nsHTMLMediaElement::IsMediaPluginsEnabled() &&
+       nsHTMLMediaElement::IsMediaPluginsType(nsDependentCString(aType))) {
+     docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
 diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h
 --- a/content/html/content/public/nsHTMLMediaElement.h
 +++ b/content/html/content/public/nsHTMLMediaElement.h
-@@ -250,17 +250,19 @@ public:
+@@ -256,17 +256,19 @@ public:
    void UpdateMediaSize(nsIntSize size);
  
    // Returns the CanPlayStatus indicating if we can handle this
@@ -81,18 +81,18 @@
    // Returns true if we should handle this MIME type when it appears
    // as an <object> or as a toplevel page. If, in practice, our support
    // for the type is more limited than appears in the wild, we should return
-@@ -290,20 +292,17 @@ public:
+@@ -296,20 +298,17 @@ public:
  #ifdef MOZ_WEBM
    static bool IsWebMEnabled();
    static bool IsWebMType(const nsACString& aType);
-   static const char gWebMTypes[2][17];
+   static const char gWebMTypes[2][11];
    static char const *const gWebMCodecs[4];
  #endif
  
  #ifdef MOZ_GSTREAMER
 -  static bool IsH264Enabled();
 -  static bool IsH264Type(const nsACString& aType);
--  static const char gH264Types[3][17];
+-  static const char gH264Types[3][16];
 -  static char const *const gH264Codecs[7];
 +  static bool IsGStreamerEnabled();
  #endif
@@ -106,7 +106,7 @@
 diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp
 --- a/content/html/content/src/nsHTMLMediaElement.cpp
 +++ b/content/html/content/src/nsHTMLMediaElement.cpp
-@@ -2070,68 +2070,40 @@ nsHTMLMediaElement::IsWebMType(const nsA
+@@ -2112,52 +2112,20 @@ nsHTMLMediaElement::IsWebMType(const nsA
      }
    }
  
@@ -115,7 +115,7 @@
  #endif
  
  #ifdef MOZ_GSTREAMER
--const char nsHTMLMediaElement::gH264Types[3][17] = {
+-const char nsHTMLMediaElement::gH264Types[3][16] = {
 -  "video/mp4",
 -  "video/3gpp",
 -  "video/quicktime",
@@ -128,7 +128,7 @@
 -  "avc1.4D401E",
 -  "avc1.64001E",
 -  "mp4a.40.2",
--  nsnull
+-  nullptr
 -};
 -
  bool
@@ -145,7 +145,7 @@
 -    return false;
 -  }
 -
--  for (PRUint32 i = 0; i < ArrayLength(gH264Types); ++i) {
+-  for (uint32_t i = 0; i < ArrayLength(gH264Types); ++i) {
 -    if (aType.EqualsASCII(gH264Types[i])) {
 -      return true;
 -    }
@@ -161,6 +161,9 @@
  nsHTMLMediaElement::IsMediaPluginsEnabled()
  {
    return Preferences::GetBool("media.plugins.enabled");
+@@ -2180,18 +2148,22 @@ nsHTMLMediaElement::IsMediaPluginsType(c
+   }
+   return false;
  }
  #endif
  
@@ -182,7 +185,7 @@
  #endif
  #ifdef MOZ_OGG
    if (IsOggType(nsDependentCString(aMIMEType))) {
-@@ -2148,20 +2120,22 @@ nsHTMLMediaElement::CanHandleMediaType(c
+@@ -2208,20 +2180,22 @@ nsHTMLMediaElement::CanHandleMediaType(c
  #ifdef MOZ_WEBM
    if (IsWebMType(nsDependentCString(aMIMEType))) {
      *aCodecList = gWebMCodecs;
@@ -198,18 +201,18 @@
 +  if (aCheckCodecList)
 +    *aCheckCodecList = false;
 +  if (aCodecList)
-+    *aCodecList = NULL;
++    *aCodecList = nullptr;
 +  if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, aCodecs))
 +    return CANPLAY_YES;
  #endif
  #ifdef MOZ_MEDIA_PLUGINS
-   if (GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), aCodecList))
+   if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), aCodecList))
      return CANPLAY_MAYBE;
  #endif
    return CANPLAY_NO;
  }
  
-@@ -2176,17 +2150,17 @@ bool nsHTMLMediaElement::ShouldHandleMed
+@@ -2236,17 +2210,17 @@ bool nsHTMLMediaElement::ShouldHandleMed
    if (IsOggType(nsDependentCString(aMIMEType)))
      return true;
  #endif
@@ -219,16 +222,16 @@
  #endif
  #ifdef MOZ_GSTREAMER
 -  if (IsH264Type(nsDependentCString(aMIMEType)))
-+  if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, NULL))
++  if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, nullptr))
      return true;
  #endif
  #ifdef MOZ_MEDIA_PLUGINS
-   if (GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), NULL))
+   if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), NULL))
      return true;
  #endif
    // We should not return true for Wave types, since there are some
    // Wave codecs actually in use in the wild that we don't support, and
-@@ -2212,26 +2186,31 @@ nsHTMLMediaElement::GetCanPlay(const nsA
+@@ -2272,26 +2246,31 @@ nsHTMLMediaElement::GetCanPlay(const nsA
  {
    nsContentTypeParser parser(aType);
    nsAutoString mimeType;
@@ -265,7 +268,7 @@
    // of the 'codecs' parameter
    nsCharSeparatedTokenizer tokenizer(codecs, ',');
    bool expectMoreTokens = false;
-@@ -2309,17 +2288,19 @@ nsHTMLMediaElement::CreateDecoder(const 
+@@ -2369,17 +2348,19 @@ nsHTMLMediaElement::CreateDecoder(const 
      nsRefPtr<nsWebMDecoder> decoder = new nsWebMDecoder();
      if (decoder->Init(this)) {
        return decoder.forget();
@@ -284,12 +287,12 @@
      }
    }
  #endif
-   return nsnull;
+   return nullptr;
  }
 diff --git a/content/media/gstreamer/Makefile.in b/content/media/gstreamer/Makefile.in
 --- a/content/media/gstreamer/Makefile.in
 +++ b/content/media/gstreamer/Makefile.in
-@@ -16,16 +16,17 @@ LIBXUL_LIBRARY 	= 1
+@@ -17,16 +17,17 @@ LIBXUL_LIBRARY 	= 1
  
  EXPORTS		+= \
  		nsGStreamerDecoder.h \
@@ -545,7 +548,7 @@
 diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js
 --- a/modules/libpref/src/init/all.js
 +++ b/modules/libpref/src/init/all.js
-@@ -159,17 +159,17 @@ pref("media.opus.enabled", true);
+@@ -165,17 +165,17 @@ pref("media.opus.enabled", true);
  #endif
  #ifdef MOZ_WAVE
  pref("media.wave.enabled", true);
@@ -557,10 +560,10 @@
 -pref("media.h264.enabled", true);
 +pref("media.gstreamer.enabled", true);
  #endif
- 
- 
- // Whether to autostart a media element with an |autoplay| attribute
- pref("media.autoplay.enabled", true);
- 
- // 0 = Off, 1 = Full, 2 = Tagged Images Only. 
- // See eCMSMode in gfx/thebes/gfxPlatform.h
+ #ifdef MOZ_WEBRTC
+ pref("media.navigator.enabled", false);
+ #else
+ #ifdef ANDROID
+ pref("media.navigator.enabled", true);
+ #endif
+ #endif