22 #include "nsIObjectLoadingContent.h" |
22 #include "nsIObjectLoadingContent.h" |
23 #include "nsCCUncollectableMarker.h" |
23 #include "nsCCUncollectableMarker.h" |
24 #include "mozilla/Base64.h" |
24 #include "mozilla/Base64.h" |
25 #include "mozilla/Preferences.h" |
25 #include "mozilla/Preferences.h" |
26 #include "nsDOMMutationObserver.h" |
26 #include "nsDOMMutationObserver.h" |
27 @@ -6511,26 +6514,23 @@ nsContentUtils::FindInternalContentViewe |
27 @@ -6580,26 +6583,23 @@ nsContentUtils::FindInternalContentViewe |
28 } |
28 } |
29 return docFactory.forget(); |
29 return docFactory.forget(); |
30 } |
30 } |
31 } |
31 } |
32 } |
32 } |
41 - if (docFactory && aLoaderType) { |
41 - if (docFactory && aLoaderType) { |
42 - *aLoaderType = TYPE_CONTENT; |
42 - *aLoaderType = TYPE_CONTENT; |
43 - } |
43 - } |
44 - return docFactory.forget(); |
44 - return docFactory.forget(); |
45 + if (nsHTMLMediaElement::IsGStreamerEnabled()) { |
45 + if (nsHTMLMediaElement::IsGStreamerEnabled()) { |
46 + if (nsGStreamerDecoder::CanHandleMediaType(aType, NULL)) { |
46 + if (nsGStreamerDecoder::CanHandleMediaType(aType, nullptr)) { |
47 + docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1"); |
47 + docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1"); |
48 + if (docFactory && aLoaderType) { |
48 + if (docFactory && aLoaderType) { |
49 + *aLoaderType = TYPE_CONTENT; |
49 + *aLoaderType = TYPE_CONTENT; |
50 } |
50 } |
51 + return docFactory.forget(); |
51 + return docFactory.forget(); |
52 } |
52 } |
53 } |
53 } |
54 #endif |
54 #endif |
55 #endif // MOZ_MEDIA |
55 |
56 |
56 #ifdef MOZ_MEDIA_PLUGINS |
57 return NULL; |
57 if (nsHTMLMediaElement::IsMediaPluginsEnabled() && |
58 } |
58 nsHTMLMediaElement::IsMediaPluginsType(nsDependentCString(aType))) { |
59 |
59 docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1"); |
60 diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h |
60 diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h |
61 --- a/content/html/content/public/nsHTMLMediaElement.h |
61 --- a/content/html/content/public/nsHTMLMediaElement.h |
62 +++ b/content/html/content/public/nsHTMLMediaElement.h |
62 +++ b/content/html/content/public/nsHTMLMediaElement.h |
63 @@ -250,17 +250,19 @@ public: |
63 @@ -256,17 +256,19 @@ public: |
64 void UpdateMediaSize(nsIntSize size); |
64 void UpdateMediaSize(nsIntSize size); |
65 |
65 |
66 // Returns the CanPlayStatus indicating if we can handle this |
66 // Returns the CanPlayStatus indicating if we can handle this |
67 // MIME type. The MIME type should not include the codecs parameter. |
67 // MIME type. The MIME type should not include the codecs parameter. |
68 // If it returns anything other than CANPLAY_NO then it also |
68 // If it returns anything other than CANPLAY_NO then it also |
79 static CanPlayStatus GetCanPlay(const nsAString& aType); |
79 static CanPlayStatus GetCanPlay(const nsAString& aType); |
80 |
80 |
81 // Returns true if we should handle this MIME type when it appears |
81 // Returns true if we should handle this MIME type when it appears |
82 // as an <object> or as a toplevel page. If, in practice, our support |
82 // as an <object> or as a toplevel page. If, in practice, our support |
83 // for the type is more limited than appears in the wild, we should return |
83 // for the type is more limited than appears in the wild, we should return |
84 @@ -290,20 +292,17 @@ public: |
84 @@ -296,20 +298,17 @@ public: |
85 #ifdef MOZ_WEBM |
85 #ifdef MOZ_WEBM |
86 static bool IsWebMEnabled(); |
86 static bool IsWebMEnabled(); |
87 static bool IsWebMType(const nsACString& aType); |
87 static bool IsWebMType(const nsACString& aType); |
88 static const char gWebMTypes[2][17]; |
88 static const char gWebMTypes[2][11]; |
89 static char const *const gWebMCodecs[4]; |
89 static char const *const gWebMCodecs[4]; |
90 #endif |
90 #endif |
91 |
91 |
92 #ifdef MOZ_GSTREAMER |
92 #ifdef MOZ_GSTREAMER |
93 - static bool IsH264Enabled(); |
93 - static bool IsH264Enabled(); |
94 - static bool IsH264Type(const nsACString& aType); |
94 - static bool IsH264Type(const nsACString& aType); |
95 - static const char gH264Types[3][17]; |
95 - static const char gH264Types[3][16]; |
96 - static char const *const gH264Codecs[7]; |
96 - static char const *const gH264Codecs[7]; |
97 + static bool IsGStreamerEnabled(); |
97 + static bool IsGStreamerEnabled(); |
98 #endif |
98 #endif |
99 |
99 |
100 #ifdef MOZ_MEDIA_PLUGINS |
100 #ifdef MOZ_MEDIA_PLUGINS |
104 |
104 |
105 /** |
105 /** |
106 diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp |
106 diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp |
107 --- a/content/html/content/src/nsHTMLMediaElement.cpp |
107 --- a/content/html/content/src/nsHTMLMediaElement.cpp |
108 +++ b/content/html/content/src/nsHTMLMediaElement.cpp |
108 +++ b/content/html/content/src/nsHTMLMediaElement.cpp |
109 @@ -2070,68 +2070,40 @@ nsHTMLMediaElement::IsWebMType(const nsA |
109 @@ -2112,52 +2112,20 @@ nsHTMLMediaElement::IsWebMType(const nsA |
110 } |
110 } |
111 } |
111 } |
112 |
112 |
113 return false; |
113 return false; |
114 } |
114 } |
115 #endif |
115 #endif |
116 |
116 |
117 #ifdef MOZ_GSTREAMER |
117 #ifdef MOZ_GSTREAMER |
118 -const char nsHTMLMediaElement::gH264Types[3][17] = { |
118 -const char nsHTMLMediaElement::gH264Types[3][16] = { |
119 - "video/mp4", |
119 - "video/mp4", |
120 - "video/3gpp", |
120 - "video/3gpp", |
121 - "video/quicktime", |
121 - "video/quicktime", |
122 -}; |
122 -}; |
123 - |
123 - |
180 return CANPLAY_MAYBE; |
183 return CANPLAY_MAYBE; |
181 } |
184 } |
182 #endif |
185 #endif |
183 #ifdef MOZ_OGG |
186 #ifdef MOZ_OGG |
184 if (IsOggType(nsDependentCString(aMIMEType))) { |
187 if (IsOggType(nsDependentCString(aMIMEType))) { |
185 @@ -2148,20 +2120,22 @@ nsHTMLMediaElement::CanHandleMediaType(c |
188 @@ -2208,20 +2180,22 @@ nsHTMLMediaElement::CanHandleMediaType(c |
186 #ifdef MOZ_WEBM |
189 #ifdef MOZ_WEBM |
187 if (IsWebMType(nsDependentCString(aMIMEType))) { |
190 if (IsWebMType(nsDependentCString(aMIMEType))) { |
188 *aCodecList = gWebMCodecs; |
191 *aCodecList = gWebMCodecs; |
189 return CANPLAY_YES; |
192 return CANPLAY_YES; |
190 } |
193 } |
196 - return CANPLAY_MAYBE; |
199 - return CANPLAY_MAYBE; |
197 - } |
200 - } |
198 + if (aCheckCodecList) |
201 + if (aCheckCodecList) |
199 + *aCheckCodecList = false; |
202 + *aCheckCodecList = false; |
200 + if (aCodecList) |
203 + if (aCodecList) |
201 + *aCodecList = NULL; |
204 + *aCodecList = nullptr; |
202 + if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, aCodecs)) |
205 + if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, aCodecs)) |
203 + return CANPLAY_YES; |
206 + return CANPLAY_YES; |
204 #endif |
207 #endif |
205 #ifdef MOZ_MEDIA_PLUGINS |
208 #ifdef MOZ_MEDIA_PLUGINS |
206 if (GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), aCodecList)) |
209 if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), aCodecList)) |
207 return CANPLAY_MAYBE; |
210 return CANPLAY_MAYBE; |
208 #endif |
211 #endif |
209 return CANPLAY_NO; |
212 return CANPLAY_NO; |
210 } |
213 } |
211 |
214 |
212 @@ -2176,17 +2150,17 @@ bool nsHTMLMediaElement::ShouldHandleMed |
215 @@ -2236,17 +2210,17 @@ bool nsHTMLMediaElement::ShouldHandleMed |
213 if (IsOggType(nsDependentCString(aMIMEType))) |
216 if (IsOggType(nsDependentCString(aMIMEType))) |
214 return true; |
217 return true; |
215 #endif |
218 #endif |
216 #ifdef MOZ_WEBM |
219 #ifdef MOZ_WEBM |
217 if (IsWebMType(nsDependentCString(aMIMEType))) |
220 if (IsWebMType(nsDependentCString(aMIMEType))) |
218 return true; |
221 return true; |
219 #endif |
222 #endif |
220 #ifdef MOZ_GSTREAMER |
223 #ifdef MOZ_GSTREAMER |
221 - if (IsH264Type(nsDependentCString(aMIMEType))) |
224 - if (IsH264Type(nsDependentCString(aMIMEType))) |
222 + if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, NULL)) |
225 + if (nsGStreamerDecoder::CanHandleMediaType(aMIMEType, nullptr)) |
223 return true; |
226 return true; |
224 #endif |
227 #endif |
225 #ifdef MOZ_MEDIA_PLUGINS |
228 #ifdef MOZ_MEDIA_PLUGINS |
226 if (GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), NULL)) |
229 if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), NULL)) |
227 return true; |
230 return true; |
228 #endif |
231 #endif |
229 // We should not return true for Wave types, since there are some |
232 // We should not return true for Wave types, since there are some |
230 // Wave codecs actually in use in the wild that we don't support, and |
233 // Wave codecs actually in use in the wild that we don't support, and |
231 @@ -2212,26 +2186,31 @@ nsHTMLMediaElement::GetCanPlay(const nsA |
234 @@ -2272,26 +2246,31 @@ nsHTMLMediaElement::GetCanPlay(const nsA |
232 { |
235 { |
233 nsContentTypeParser parser(aType); |
236 nsContentTypeParser parser(aType); |
234 nsAutoString mimeType; |
237 nsAutoString mimeType; |
235 nsresult rv = parser.GetType(mimeType); |
238 nsresult rv = parser.GetType(mimeType); |
236 if (NS_FAILED(rv)) |
239 if (NS_FAILED(rv)) |
263 CanPlayStatus result = CANPLAY_YES; |
266 CanPlayStatus result = CANPLAY_YES; |
264 // See http://www.rfc-editor.org/rfc/rfc4281.txt for the description |
267 // See http://www.rfc-editor.org/rfc/rfc4281.txt for the description |
265 // of the 'codecs' parameter |
268 // of the 'codecs' parameter |
266 nsCharSeparatedTokenizer tokenizer(codecs, ','); |
269 nsCharSeparatedTokenizer tokenizer(codecs, ','); |
267 bool expectMoreTokens = false; |
270 bool expectMoreTokens = false; |
268 @@ -2309,17 +2288,19 @@ nsHTMLMediaElement::CreateDecoder(const |
271 @@ -2369,17 +2348,19 @@ nsHTMLMediaElement::CreateDecoder(const |
269 nsRefPtr<nsWebMDecoder> decoder = new nsWebMDecoder(); |
272 nsRefPtr<nsWebMDecoder> decoder = new nsWebMDecoder(); |
270 if (decoder->Init(this)) { |
273 if (decoder->Init(this)) { |
271 return decoder.forget(); |
274 return decoder.forget(); |
272 } |
275 } |
273 } |
276 } |
282 if (decoder->Init(this)) { |
285 if (decoder->Init(this)) { |
283 return decoder.forget(); |
286 return decoder.forget(); |
284 } |
287 } |
285 } |
288 } |
286 #endif |
289 #endif |
287 return nsnull; |
290 return nullptr; |
288 } |
291 } |
289 diff --git a/content/media/gstreamer/Makefile.in b/content/media/gstreamer/Makefile.in |
292 diff --git a/content/media/gstreamer/Makefile.in b/content/media/gstreamer/Makefile.in |
290 --- a/content/media/gstreamer/Makefile.in |
293 --- a/content/media/gstreamer/Makefile.in |
291 +++ b/content/media/gstreamer/Makefile.in |
294 +++ b/content/media/gstreamer/Makefile.in |
292 @@ -16,16 +16,17 @@ LIBXUL_LIBRARY = 1 |
295 @@ -17,16 +17,17 @@ LIBXUL_LIBRARY = 1 |
293 |
296 |
294 EXPORTS += \ |
297 EXPORTS += \ |
295 nsGStreamerDecoder.h \ |
298 nsGStreamerDecoder.h \ |
296 $(NULL) |
299 $(NULL) |
297 |
300 |
543 + |
546 + |
544 +#endif |
547 +#endif |
545 diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js |
548 diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js |
546 --- a/modules/libpref/src/init/all.js |
549 --- a/modules/libpref/src/init/all.js |
547 +++ b/modules/libpref/src/init/all.js |
550 +++ b/modules/libpref/src/init/all.js |
548 @@ -159,17 +159,17 @@ pref("media.opus.enabled", true); |
551 @@ -165,17 +165,17 @@ pref("media.opus.enabled", true); |
549 #endif |
552 #endif |
550 #ifdef MOZ_WAVE |
553 #ifdef MOZ_WAVE |
551 pref("media.wave.enabled", true); |
554 pref("media.wave.enabled", true); |
552 #endif |
555 #endif |
553 #ifdef MOZ_WEBM |
556 #ifdef MOZ_WEBM |
555 #endif |
558 #endif |
556 #ifdef MOZ_GSTREAMER |
559 #ifdef MOZ_GSTREAMER |
557 -pref("media.h264.enabled", true); |
560 -pref("media.h264.enabled", true); |
558 +pref("media.gstreamer.enabled", true); |
561 +pref("media.gstreamer.enabled", true); |
559 #endif |
562 #endif |
560 |
563 #ifdef MOZ_WEBRTC |
561 |
564 pref("media.navigator.enabled", false); |
562 // Whether to autostart a media element with an |autoplay| attribute |
565 #else |
563 pref("media.autoplay.enabled", true); |
566 #ifdef ANDROID |
564 |
567 pref("media.navigator.enabled", true); |
565 // 0 = Off, 1 = Full, 2 = Tagged Images Only. |
568 #endif |
566 // See eCMSMode in gfx/thebes/gfxPlatform.h |
569 #endif |