Bug 795623 - Add audio/mpeg to list of supported OMX codecs. r=doublec, a=blocking-basecamp

This commit is contained in:
Edwin Flores 2012-10-09 17:06:34 +13:00
Родитель 999eef84be
Коммит f8b904d725
2 изменённых файлов: 22 добавлений и 14 удалений

Просмотреть файл

@ -316,8 +316,8 @@ public:
#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

Просмотреть файл

@ -2134,12 +2134,6 @@ nsHTMLMediaElement::IsWebMType(const nsACString& aType)
#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",
@ -2152,6 +2146,12 @@ char const *const nsHTMLMediaElement::gH264Codecs[7] = {
#endif
#ifdef MOZ_GSTREAMER
const char nsHTMLMediaElement::gH264Types[3][16] = {
"video/mp4",
"video/3gpp",
"video/quicktime",
};
bool
nsHTMLMediaElement::IsH264Enabled()
{
@ -2176,6 +2176,14 @@ nsHTMLMediaElement::IsH264Type(const nsACString& aType)
#endif
#ifdef MOZ_WIDGET_GONK
const char nsHTMLMediaElement::gOmxTypes[5][16] = {
"audio/mpeg",
"audio/mp4",
"video/mp4",
"video/3gpp",
"video/quicktime",
};
bool
nsHTMLMediaElement::IsOmxEnabled()
{
@ -2183,14 +2191,14 @@ nsHTMLMediaElement::IsOmxEnabled()
}
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;
}
}
@ -2300,7 +2308,7 @@ nsHTMLMediaElement::CanHandleMediaType(const char* aMIMEType,
}
#endif
#ifdef MOZ_WIDGET_GONK
if (IsH264Type(nsDependentCString(aMIMEType))) {
if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
*aCodecList = gH264Codecs;
return CANPLAY_MAYBE;
}
@ -2332,7 +2340,7 @@ bool nsHTMLMediaElement::ShouldHandleMediaType(const char* aMIMEType)
return true;
#endif
#ifdef MOZ_WIDGET_GONK
if (IsH264Type(nsDependentCString(aMIMEType))) {
if (IsOmxSupportedType(nsDependentCString(aMIMEType))) {
return true;
}
#endif
@ -2453,7 +2461,7 @@ nsHTMLMediaElement::CreateDecoder(const nsACString& aType)
}
#endif
#ifdef MOZ_WIDGET_GONK
if (IsH264Type(aType)) {
if (IsOmxSupportedType(aType)) {
nsRefPtr<nsMediaOmxDecoder> decoder = new nsMediaOmxDecoder();
if (decoder->Init(this)) {
return decoder.forget();