Bug 795623 - Add audio/mpeg to list of supported OMX codecs. r=doublec, a=blocking-basecamp
--- a/content/html/content/public/nsHTMLMediaElement.h
+++ b/content/html/content/public/nsHTMLMediaElement.h
@@ -311,18 +311,18 @@ public:
static bool IsH264Enabled();
static bool IsH264Type(const nsACString& aType);
static const char gH264Types[3][16];
static char const *const gH264Codecs[7];
#endif
#ifdef MOZ_WIDGET_GONK
static bool IsOmxEnabled();
- static bool IsH264Type(const nsACString& aType);
- static const char gH264Types[3][16];
+ static bool IsOmxSupportedType(const nsACString& aType);
+ static const char gOmxTypes[5][16];
static char const *const gH264Codecs[7];
#endif
#ifdef MOZ_MEDIA_PLUGINS
static bool IsMediaPluginsEnabled();
static bool IsMediaPluginsType(const nsACString& aType);
#endif
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -2129,34 +2129,34 @@ nsHTMLMediaElement::IsWebMType(const nsA
}
}
return false;
}
#endif
#if defined(MOZ_GSTREAMER) || defined(MOZ_WIDGET_GONK)
-const char nsHTMLMediaElement::gH264Types[3][16] = {
- "video/mp4",
- "video/3gpp",
- "video/quicktime",
-};
-
char const *const nsHTMLMediaElement::gH264Codecs[7] = {
"avc1.42E01E",
"avc1.42001E",
"avc1.58A01E",
"avc1.4D401E",
"avc1.64001E",
"mp4a.40.2",
nullptr
};
#endif
#ifdef MOZ_GSTREAMER
+const char nsHTMLMediaElement::gH264Types[3][16] = {
+ "video/mp4",
+ "video/3gpp",
+ "video/quicktime",
+};
+
bool
nsHTMLMediaElement::IsH264Enabled()
{
return Preferences::GetBool("media.h264.enabled");
}
bool
nsHTMLMediaElement::IsH264Type(const nsACString& aType)
@@ -2171,31 +2171,39 @@ nsHTMLMediaElement::IsH264Type(const nsA
}
}
return false;
}
#endif
#ifdef MOZ_WIDGET_GONK
+const char nsHTMLMediaElement::gOmxTypes[5][16] = {
+ "audio/mpeg",
+ "audio/mp4",
+ "video/mp4",
+ "video/3gpp",
+ "video/quicktime",
+};
+
bool
nsHTMLMediaElement::IsOmxEnabled()
{
return Preferences::GetBool("media.omx.enabled", false);
}
bool
-nsHTMLMediaElement::IsH264Type(const nsACString& aType)
+nsHTMLMediaElement::IsOmxSupportedType(const nsACString& aType)
{
if (!IsOmxEnabled()) {
return false;
}
- for (uint32_t i = 0; i < ArrayLength(gH264Types); ++i) {
- if (aType.EqualsASCII(gH264Types[i])) {
+ for (uint32_t i = 0; i < ArrayLength(gOmxTypes); ++i) {
+ if (aType.EqualsASCII(gOmxTypes[i])) {
return true;
}
}
return false;
}
#endif
@@ -2295,17 +2303,17 @@ nsHTMLMediaElement::CanHandleMediaType(c
#ifdef MOZ_GSTREAMER
if (IsH264Type(nsDependentCString(aMIMEType))) {
*aCodecList = gH264Codecs;
return CANPLAY_MAYBE;
}
#endif
#ifdef MOZ_WIDGET_GONK
- if (IsH264Type(nsDependentCString(aMIMEType))) {
+ if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
*aCodecList = gH264Codecs;
return CANPLAY_MAYBE;
}
#endif
#ifdef MOZ_MEDIA_PLUGINS
if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), aCodecList))
return CANPLAY_MAYBE;
#endif
@@ -2327,17 +2335,17 @@ bool nsHTMLMediaElement::ShouldHandleMed
if (IsWebMType(nsDependentCString(aMIMEType)))
return true;
#endif
#ifdef MOZ_GSTREAMER
if (IsH264Type(nsDependentCString(aMIMEType)))
return true;
#endif
#ifdef MOZ_WIDGET_GONK
- if (IsH264Type(nsDependentCString(aMIMEType))) {
+ if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
return true;
}
#endif
#ifdef MOZ_MEDIA_PLUGINS
if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(nsDependentCString(aMIMEType), NULL))
return true;
#endif
// We should not return true for Wave types, since there are some
@@ -2448,17 +2456,17 @@ nsHTMLMediaElement::CreateDecoder(const
if (IsWaveType(aType)) {
nsRefPtr<nsWaveDecoder> decoder = new nsWaveDecoder();
if (decoder->Init(this)) {
return decoder.forget();
}
}
#endif
#ifdef MOZ_WIDGET_GONK
- if (IsH264Type(aType)) {
+ if (IsOmxSupportedType(aType)) {
nsRefPtr<nsMediaOmxDecoder> decoder = new nsMediaOmxDecoder();
if (decoder->Init(this)) {
return decoder.forget();
}
}
#endif
#ifdef MOZ_MEDIA_PLUGINS
if (IsMediaPluginsEnabled() && GetMediaPluginHost()->FindDecoder(aType, NULL)) {