mozilla-gstreamer-760140.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Tue, 08 Jan 2013 06:54:29 +0100
branchfirefox18
changeset 600 5eb2128332e5
parent 573 71cf05d3ee57
child 606 9d39369e1b4c
permissions -rw-r--r--
18.0 release
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
From: Alessandro Decina <alessandro.d@gmail.com>
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
Bug 760140 - Query the GstRegistry for the required demuxers/decoders from canPlayType
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
--- a/content/base/src/nsContentUtils.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
+++ b/content/base/src/nsContentUtils.cpp
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
     7
@@ -147,16 +147,19 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
 #include "xpcprivate.h" // nsXPConnect
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
 #include "nsScriptSecurityManager.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
 #include "nsIChannelPolicy.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
 #include "nsChannelPolicy.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
 #include "nsIContentSecurityPolicy.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
 #include "nsContentDLF.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 #ifdef MOZ_MEDIA
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 #include "nsHTMLMediaElement.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
+#ifdef MOZ_GSTREAMER
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
+#include "nsGStreamerDecoder.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
+#endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
 #include "nsDOMTouchEvent.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
 #include "nsIContentViewer.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
 #include "nsIObjectLoadingContent.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
 #include "nsCCUncollectableMarker.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
 #include "mozilla/Base64.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
 #include "mozilla/Preferences.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
 #include "nsDOMMutationObserver.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
--- a/content/html/content/public/nsHTMLMediaElement.h
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
+++ b/content/html/content/public/nsHTMLMediaElement.h
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    30
@@ -263,17 +263,19 @@ public:
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
   void UpdateMediaSize(nsIntSize size);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
   // Returns the CanPlayStatus indicating if we can handle this
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
   // MIME type. The MIME type should not include the codecs parameter.
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
   // If it returns anything other than CANPLAY_NO then it also
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
   // returns a null-terminated list of supported codecs
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
   // in *aSupportedCodecs. This list should not be freed, it is static data.
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
   static CanPlayStatus CanHandleMediaType(const char* aMIMEType,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
-                                          char const *const ** aSupportedCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
+                                          const char* aCodecs,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
+                                          char const *const ** aSupportedCodecs,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
+                                          bool* aCheckSupportedCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
   // Returns the CanPlayStatus indicating if we can handle the
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
   // full MIME type including the optional codecs parameter.
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
   static CanPlayStatus GetCanPlay(const nsAString& aType);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
   // Returns true if we should handle this MIME type when it appears
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
   // as an <object> or as a toplevel page. If, in practice, our support
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
   // for the type is more limited than appears in the wild, we should return
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
    51
@@ -305,19 +307,16 @@ public:
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
   static bool IsWebMType(const nsACString& aType);
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
    53
   static const char gWebMTypes[2][11];
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
   static char const *const gWebMCodecs[4];
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
 #ifdef MOZ_GSTREAMER
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
    58
   static bool IsGStreamerEnabled();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
    59
   static bool IsGStreamerSupportedType(const nsACString& aType);
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
-  static bool IsH264Type(const nsACString& aType);
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
    61
-  static const char gH264Types[3][16];
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
-  static char const *const gH264Codecs[7];
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    65
 #ifdef MOZ_WIDGET_GONK
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    66
   static bool IsOmxEnabled();
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    67
   static bool IsOmxSupportedType(const nsACString& aType);
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    68
   static const char gOmxTypes[5][16];
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    69
   static char const *const gH264Codecs[7];
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
--- a/content/html/content/src/nsHTMLMediaElement.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
    74
@@ -2128,51 +2128,34 @@ nsHTMLMediaElement::IsWebMType(const nsA
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    75
       return true;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
     }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
   }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
   return false;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
 }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    83
-#if defined(MOZ_GSTREAMER) || defined(MOZ_WIDGET_GONK)
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    84
+#ifdef MOZ_WIDGET_GONK
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    85
 char const *const nsHTMLMediaElement::gH264Codecs[7] = {
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    86
   "avc1.42E01E",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    87
   "avc1.42001E",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    88
   "avc1.58A01E",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    89
   "avc1.4D401E",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    90
   "avc1.64001E",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    91
   "mp4a.40.2",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    92
   nullptr
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    93
 };
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    94
 #endif
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
    95
 
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
 #ifdef MOZ_GSTREAMER
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
    97
-const char nsHTMLMediaElement::gH264Types[3][16] = {
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
-  "video/mp4",
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
-  "video/3gpp",
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
-  "video/quicktime",
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
-};
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
-
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   103
 bool
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   104
 nsHTMLMediaElement::IsGStreamerEnabled()
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
 {
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   106
   return Preferences::GetBool("media.gstreamer.enabled");
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   107
 }
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
-
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
-bool
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
-nsHTMLMediaElement::IsH264Type(const nsACString& aType)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
-{
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
   112
-  for (uint32_t i = 0; i < ArrayLength(gH264Types); ++i) {
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
-    if (aType.EqualsASCII(gH264Types[i])) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
-      return true;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
-    }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
-  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
-  return false;
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   118
-}
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   120
 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   121
 #ifdef MOZ_WIDGET_GONK
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   122
 const char nsHTMLMediaElement::gOmxTypes[5][16] = {
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   123
   "audio/mpeg",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   124
   "audio/mp4",
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   125
   "video/mp4",
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   126
   "video/3gpp",
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   127
@@ -2257,18 +2240,22 @@ nsHTMLMediaElement::IsDASHMPDType(const 
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   128
 
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
   129
   return false;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   130
 }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   131
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   132
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   133
 /* static */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   134
 nsHTMLMediaElement::CanPlayStatus 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   135
 nsHTMLMediaElement::CanHandleMediaType(const char* aMIMEType,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
-                                       char const *const ** aCodecList)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   137
+                                       const char *aCodecs,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   138
+                                       char const *const ** aCodecList,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   139
+                                       bool* aCheckCodecList)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   140
 {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   141
+  if (aCheckCodecList)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   142
+    *aCheckCodecList = true;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   143
 #ifdef MOZ_RAW
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   144
   if (IsRawType(nsDependentCString(aMIMEType))) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   145
     *aCodecList = gRawCodecs;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   146
     return CANPLAY_MAYBE;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   147
   }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   148
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
 #ifdef MOZ_OGG
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   150
   if (IsOggType(nsDependentCString(aMIMEType))) {
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   151
@@ -2292,20 +2279,22 @@ nsHTMLMediaElement::CanHandleMediaType(c
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   152
   if (IsDASHMPDType(nsDependentCString(aMIMEType))) {
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   153
     // DASH manifest uses WebM codecs only.
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   154
     *aCodecList = gWebMCodecs;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
     return CANPLAY_YES;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   156
   }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   157
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   158
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   159
 #ifdef MOZ_GSTREAMER
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   160
-  if (IsH264Type(nsDependentCString(aMIMEType))) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   161
-    *aCodecList = gH264Codecs;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
-    return CANPLAY_MAYBE;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
-  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   164
+  if (aCheckCodecList)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
+    *aCheckCodecList = false;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
+  if (aCodecList)
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
   167
+    *aCodecList = nullptr;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
+  if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, aCodecs))
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   169
+    return CANPLAY_YES;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   170
 #endif
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   171
 #ifdef MOZ_WIDGET_GONK
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   172
   if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   173
     *aCodecList = gH264Codecs;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
     return CANPLAY_MAYBE;
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   175
   }
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   176
 #endif
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   177
 #ifdef MOZ_MEDIA_PLUGINS
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   178
@@ -2326,17 +2315,17 @@ bool nsHTMLMediaElement::ShouldHandleMed
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   179
   if (IsOggType(nsDependentCString(aMIMEType)))
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   180
     return true;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   181
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
 #ifdef MOZ_WEBM
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   183
   if (IsWebMType(nsDependentCString(aMIMEType)))
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
     return true;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
 #ifdef MOZ_GSTREAMER
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   187
-  if (IsH264Type(nsDependentCString(aMIMEType)))
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
   188
+  if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, nullptr))
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   189
     return true;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
 #endif
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   191
 #ifdef MOZ_WIDGET_GONK
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   192
   if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   193
     return true;
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   194
   }
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   195
 #endif
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   196
 #ifdef MOZ_MEDIA_PLUGINS
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   197
@@ -2367,26 +2356,31 @@ nsHTMLMediaElement::GetCanPlay(const nsA
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   198
 {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   199
   nsContentTypeParser parser(aType);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   200
   nsAutoString mimeType;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   201
   nsresult rv = parser.GetType(mimeType);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   202
   if (NS_FAILED(rv))
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   203
     return CANPLAY_NO;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   204
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   205
   NS_ConvertUTF16toUTF8 mimeTypeUTF8(mimeType);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   206
+  nsAutoString codecs;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
+  rv = parser.GetParameter("codecs", codecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
+  NS_ConvertUTF16toUTF8 codecsUTF8(codecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   209
   char const *const * supportedCodecs;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   210
+  bool checkSupportedCodecs = true;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   211
   CanPlayStatus status = CanHandleMediaType(mimeTypeUTF8.get(),
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   212
-                                            &supportedCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   213
+                                            codecsUTF8.get(),
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
+                                            &supportedCodecs,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+                                            &checkSupportedCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
   if (status == CANPLAY_NO)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
     return CANPLAY_NO;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   219
-  nsAutoString codecs;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
-  rv = parser.GetParameter("codecs", codecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
-  if (NS_FAILED(rv)) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
-    // Parameter not found or whatever
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+  if (codecs.IsEmpty() || !checkSupportedCodecs) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
+    /* no codecs to check for or they were already checked in CanHandleMediaType
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
+     * above */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
     return status;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   227
   }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
   CanPlayStatus result = CANPLAY_YES;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   230
   // See http://www.rfc-editor.org/rfc/rfc4281.txt for the description
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
   // of the 'codecs' parameter
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   232
   nsCharSeparatedTokenizer tokenizer(codecs, ',');
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   233
   bool expectMoreTokens = false;
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   234
@@ -2425,46 +2419,41 @@ nsHTMLMediaElement::CanPlayType(const ns
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   235
 }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   236
 
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   237
 #ifdef MOZ_GSTREAMER
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   238
 bool
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   239
 nsHTMLMediaElement::IsGStreamerSupportedType(const nsACString& aMimeType)
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   240
 {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   241
   if (!IsGStreamerEnabled())
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   242
     return false;
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   243
-  if (IsH264Type(aMimeType))
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   244
+
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   245
+  const char *type;
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   246
+  NS_CStringGetData(aMimeType, &type, nullptr);
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   247
+  if (nsGStreamerDecoder::CanHandleMediaType(type, nullptr))
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   248
     return true;
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   249
-  if (!Preferences::GetBool("media.prefer-gstreamer", false))
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   250
-    return false;
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   251
-#ifdef MOZ_WEBM
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   252
-  if (IsWebMType(aMimeType))
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   253
-    return true;
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   254
-#endif
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   255
-#ifdef MOZ_OGG
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   256
-  if (IsOggType(aMimeType))
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   257
-    return true;
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   258
-#endif
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   259
+
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   260
   return false;
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   261
 }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   262
 #endif
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   263
 
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   264
 already_AddRefed<nsMediaDecoder>
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   265
 nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   266
 {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   267
 #ifdef MOZ_GSTREAMER
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   268
   // When enabled, use GStreamer for H.264, but not for codecs handled by our
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   269
   // bundled decoders, unless the "media.prefer-gstreamer" pref is set.
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   270
-  if (IsGStreamerSupportedType(aType)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   271
-    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   272
-    if (decoder->Init(this)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   273
-      return decoder.forget();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   274
+  if (!Preferences::GetBool("media.prefer-gstreamer", false)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   275
+    if (IsGStreamerSupportedType(aType)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   276
+      nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   277
+      if (decoder->Init(this)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   278
+        return decoder.forget();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   279
+      }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   280
     }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   281
   }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   282
 #endif
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   283
-
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   284
 #ifdef MOZ_RAW
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   285
   if (IsRawType(aType)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   286
     nsRefPtr<nsRawDecoder> decoder = new nsRawDecoder();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   287
     if (decoder->Init(this)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   288
       return decoder.forget();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   289
     }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   290
   }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   291
 #endif
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   292
@@ -2503,25 +2492,33 @@ nsHTMLMediaElement::CreateDecoder(const 
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   293
 #ifdef MOZ_WEBM
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   294
   if (IsWebMType(aType)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   295
     nsRefPtr<nsWebMDecoder> decoder = new nsWebMDecoder();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   296
     if (decoder->Init(this)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   297
       return decoder.forget();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   298
     }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   299
   }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   300
 #endif
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   301
-
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   302
 #ifdef MOZ_DASH
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   303
   if (IsDASHMPDType(aType)) {
568
2c74c5927ea2 first working Aurora 18 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 541
diff changeset
   304
     nsRefPtr<nsDASHDecoder> decoder = new nsDASHDecoder();
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
     if (decoder->Init(this)) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
       return decoder.forget();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
     }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
   }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
 #endif
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   310
+#ifdef MOZ_GSTREAMER
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   311
+  // use GStreamer as fallback if not preferred
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   312
+  if (IsGStreamerSupportedType(aType)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   313
+    nsRefPtr<nsGStreamerDecoder> decoder = new nsGStreamerDecoder();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   314
+    if (decoder->Init(this)) {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   315
+      return decoder.forget();
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   316
+    }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   317
+  }
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   318
+#endif
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   319
 
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
   320
   return nullptr;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
 }
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   322
 
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   323
 nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal)
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   324
 {
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   325
   NS_ASSERTION(mLoadingSrc, "mLoadingSrc must already be set");
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   326
   NS_ASSERTION(mDecoder == nullptr, "Shouldn't have a decoder");
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
diff --git a/content/media/gstreamer/Makefile.in b/content/media/gstreamer/Makefile.in
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
--- a/content/media/gstreamer/Makefile.in
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   329
+++ b/content/media/gstreamer/Makefile.in
541
830e50bbfc79 working Aurora 17.0 build
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 529
diff changeset
   330
@@ -17,16 +17,17 @@ LIBXUL_LIBRARY 	= 1
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   332
 EXPORTS		+= \
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   333
 		nsGStreamerDecoder.h \
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
 		$(NULL)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
 CPPSRCS		= \
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   337
 		nsGStreamerReader.cpp \
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
 		nsGStreamerDecoder.cpp \
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+		nsGStreamerFormatHelper.cpp \
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
 		$(NULL)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   341
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   342
 FORCE_STATIC_LIB = 1
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
 include $(topsrcdir)/config/rules.mk
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   345
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   346
 CFLAGS		+= $(GSTREAMER_CFLAGS)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   347
 CXXFLAGS	+= $(GSTREAMER_CFLAGS)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   348
diff --git a/content/media/gstreamer/nsGStreamerDecoder.cpp b/content/media/gstreamer/nsGStreamerDecoder.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
--- a/content/media/gstreamer/nsGStreamerDecoder.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   350
+++ b/content/media/gstreamer/nsGStreamerDecoder.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
@@ -2,13 +2,19 @@
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   352
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
 /* This Source Code Form is subject to the terms of the Mozilla Public
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   355
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   356
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   357
 #include "nsBuiltinDecoderStateMachine.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   358
 #include "nsGStreamerReader.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   359
 #include "nsGStreamerDecoder.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   360
+#include "nsGStreamerFormatHelper.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
 nsDecoderStateMachine* nsGStreamerDecoder::CreateStateMachine()
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   363
 {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   364
   return new nsBuiltinDecoderStateMachine(this, new nsGStreamerReader(this));
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   365
 }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   366
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+bool nsGStreamerDecoder::CanHandleMediaType(const char* aMIMEType,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
+                                            const char* aCodecs) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   369
+  return nsGStreamerFormatHelper::Instance()->CanHandleMediaType(aMIMEType, aCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   370
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   371
diff --git a/content/media/gstreamer/nsGStreamerDecoder.h b/content/media/gstreamer/nsGStreamerDecoder.h
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
--- a/content/media/gstreamer/nsGStreamerDecoder.h
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   373
+++ b/content/media/gstreamer/nsGStreamerDecoder.h
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   374
@@ -9,11 +9,12 @@
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   376
 #include "nsBuiltinDecoder.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   378
 class nsGStreamerDecoder : public nsBuiltinDecoder
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   379
 {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
 public:
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   381
   virtual nsMediaDecoder* Clone() { return new nsGStreamerDecoder(); }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
   virtual nsDecoderStateMachine* CreateStateMachine();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   383
+  static bool CanHandleMediaType(const char* aMIMEType, const char* aCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   384
 };
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   385
 
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   386
 #endif
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   387
diff --git a/content/media/gstreamer/nsGStreamerFormatHelper.cpp b/content/media/gstreamer/nsGStreamerFormatHelper.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   388
new file mode 100644
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   389
--- /dev/null
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
+++ b/content/media/gstreamer/nsGStreamerFormatHelper.cpp
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   391
@@ -0,0 +1,149 @@
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   393
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   394
+/* This Source Code Form is subject to the terms of the Mozilla Public
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   395
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   396
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   397
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   398
+#include "nsGStreamerFormatHelper.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   399
+#include "nsCharSeparatedTokenizer.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   400
+#include "nsXPCOMStrings.h"
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   401
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
+#define ENTRY_FORMAT(entry) entry[0]
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   403
+#define ENTRY_CAPS(entry) entry[1]
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   404
+
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   405
+nsGStreamerFormatHelper* nsGStreamerFormatHelper::gInstance = nullptr;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   407
+nsGStreamerFormatHelper *nsGStreamerFormatHelper::Instance() {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+  if (!gInstance) {
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   409
+    gst_init(nullptr, nullptr);
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+    gInstance = new nsGStreamerFormatHelper();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   411
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   412
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   413
+  return gInstance;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   414
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   415
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   416
+nsGStreamerFormatHelper::nsGStreamerFormatHelper()
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   417
+  : mFactories(nullptr),
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   418
+    mCookie(0)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   419
+{
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   420
+  const char *containers[3][2] = {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
+    {"video/mp4", "video/quicktime"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   422
+    {"audio/mp4", "audio/mpeg, mpegversion=(int)4"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
+    {"audio/mpeg", "audio/mpeg, mpegversion=(int)1"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
+  };
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   425
+  memcpy(mContainers, containers, sizeof(containers));
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   427
+  const char *codecs[7][2] = {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   428
+    {"avc1.42E01E", "video/x-h264"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
+    {"avc1.42001E", "video/x-h264"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   430
+    {"avc1.58A01E", "video/x-h264"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   431
+    {"avc1.4D401E", "video/x-h264"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   432
+    {"avc1.64001E", "video/x-h264"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   433
+    {"mp4a.40.2", "audio/mpeg, mpegversion=(int)4"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   434
+    {"mp3", "audio/mpeg, mpegversion=(int)1"},
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   435
+  };
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   436
+  memcpy(mCodecs, codecs, sizeof(codecs));
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   437
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   438
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   439
+nsGStreamerFormatHelper::~nsGStreamerFormatHelper() {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   440
+  if (mFactories)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   441
+    g_list_free(mFactories);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   442
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   443
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   444
+bool nsGStreamerFormatHelper::CanHandleMediaType(const char* aMIMEType,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
+                                                 const char *aCodecs) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   446
+  GstCaps *caps = ConvertFormatsToCaps(aMIMEType, aCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   447
+  if (!caps) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   448
+    return false;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   449
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   450
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   451
+  bool ret = HaveElementsToProcessCaps(caps);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   452
+  gst_caps_unref(caps);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   453
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   454
+  return ret;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   455
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   456
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   457
+GstCaps *nsGStreamerFormatHelper::ConvertFormatsToCaps(const char *aMIMEType,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   458
+                                                       const char *aCodecs) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   459
+  unsigned int i;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   460
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   461
+  /* convert aMIMEType to gst container caps */
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   462
+  const char *capsString = nullptr;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   463
+  for (i = 0; i < G_N_ELEMENTS(mContainers); i++) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   464
+    if (!strcmp(ENTRY_FORMAT(mContainers[i]), aMIMEType)) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   465
+      capsString = ENTRY_CAPS(mContainers[i]);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   466
+      break;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   467
+    }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   468
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   469
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+  if (!capsString) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   471
+    /* we couldn't find any matching caps */
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   472
+    return nullptr;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   474
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
+  GstCaps *caps = gst_caps_from_string(capsString);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   476
+  /* container only */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   477
+  if (!aCodecs) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
+    return caps;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   480
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   481
+  nsDependentCSubstring codecs(aCodecs, strlen(aCodecs));
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+  nsCCharSeparatedTokenizer tokenizer(codecs, ',');
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   483
+  while (tokenizer.hasMoreTokens()) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   484
+    const nsCSubstring& codec = tokenizer.nextToken();
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   485
+    capsString = nullptr;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
+    for (i = 0; i < G_N_ELEMENTS(mCodecs); i++) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
+      if (codec.Equals(ENTRY_FORMAT(mCodecs[i]))) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
+        capsString = ENTRY_CAPS(mCodecs[i]);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
+        break;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+      }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   492
+    }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   494
+    if (!capsString) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   495
+      gst_caps_unref(caps);
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   496
+      return nullptr;
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   497
+    }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   498
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   499
+    GstCaps *tmp = gst_caps_from_string(capsString);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+    /* appends and frees tmp */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+    gst_caps_append(caps, tmp);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   502
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   503
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   504
+  return caps;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   505
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   506
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   507
+bool nsGStreamerFormatHelper::HaveElementsToProcessCaps(GstCaps *aCaps) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   508
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   509
+  GList *factories = GetFactories();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
+  GList *list;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   512
+  /* here aCaps contains [containerCaps, [codecCaps1, [codecCaps2, ...]]] so process
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   513
+   * caps structures individually as we want one element for _each_
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   514
+   * structure */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   515
+  for (unsigned int i = 0; i < gst_caps_get_size(aCaps); i++) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   516
+    GstStructure *s = gst_caps_get_structure(aCaps, i);
573
71cf05d3ee57 added mozilla-gstreamer-803287.patch (TM: mozilla19) as replacement for mozilla-gstreamer.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 568
diff changeset
   517
+    GstCaps *caps = gst_caps_new_full(gst_structure_copy(s), nullptr);
529
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   518
+    list = gst_element_factory_list_filter (factories, caps, GST_PAD_SINK, FALSE);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   519
+    gst_caps_unref(caps);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   520
+    if (!list) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   521
+      return false;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   522
+    }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   523
+    g_list_free(list);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   524
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   526
+  return true;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   527
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   528
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   529
+GList * nsGStreamerFormatHelper::GetFactories() {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+  uint32_t cookie = gst_default_registry_get_feature_list_cookie ();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   531
+  if (cookie != mCookie) {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+    g_list_free(mFactories);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   533
+    mFactories = gst_element_factory_list_get_elements
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   534
+        (GST_ELEMENT_FACTORY_TYPE_DEMUXER | GST_ELEMENT_FACTORY_TYPE_DECODER,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   535
+         GST_RANK_MARGINAL);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+    mCookie = cookie;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+  }
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   539
+  return mFactories;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
+}
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
diff --git a/content/media/gstreamer/nsGStreamerFormatHelper.h b/content/media/gstreamer/nsGStreamerFormatHelper.h
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   542
new file mode 100644
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   543
--- /dev/null
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   544
+++ b/content/media/gstreamer/nsGStreamerFormatHelper.h
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   545
@@ -0,0 +1,37 @@
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   547
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   548
+/* This Source Code Form is subject to the terms of the Mozilla Public
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   549
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   550
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   552
+#if !defined(nsGStreamerFormatHelper_h_)
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   553
+#define nsGStreamerFormatHelper_h_
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   555
+#include <gst/gst.h>
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
+#include <mozilla/Types.h>
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   558
+class nsGStreamerFormatHelper {
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
+  public:
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
+    static nsGStreamerFormatHelper *Instance();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
+    ~nsGStreamerFormatHelper();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   563
+    bool CanHandleMediaType(const char *aMIMEType,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
+                            const char *aCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   566
+  private:
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   567
+    nsGStreamerFormatHelper();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
+    GstCaps *ConvertFormatsToCaps(const char *aMIMEType,
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
+                                  const char *aCodecs);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
+    char * const *CodecListFromCaps(GstCaps *aCaps);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   571
+    bool HaveElementsToProcessCaps(GstCaps *aCaps);
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
+    GList *GetFactories();
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   574
+    static nsGStreamerFormatHelper *gInstance;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   575
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   576
+    const char *mContainers[3][2];
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
+    const char *mCodecs[7][2];
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   578
+    GList *mFactories;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
+    uint32_t mCookie;
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   580
+};
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
+
4812378b5646 import GStreamer improvement from bmo#760140 (support mpeg audio)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   582
+#endif