mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
Bug 834172 - Implement IsSupportedTypeInVideo in DecoderTraits. r=cpearce
This change moves the policy of supported media types in the element nsHTMLMediaElement to the DecoderTraits class. The codec-specific code has been removed from the media element.
This commit is contained in:
parent
bad04aa1d2
commit
d634135a54
@ -6335,77 +6335,13 @@ nsContentUtils::FindInternalContentViewer(const char* aType,
|
||||
}
|
||||
|
||||
#ifdef MOZ_MEDIA
|
||||
#ifdef MOZ_OGG
|
||||
if (DecoderTraits::IsOggType(nsDependentCString(aType))) {
|
||||
if (DecoderTraits::IsSupportedInVideoDocument(nsDependentCString(aType))) {
|
||||
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
||||
if (docFactory && aLoaderType) {
|
||||
*aLoaderType = TYPE_CONTENT;
|
||||
}
|
||||
return docFactory.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (DecoderTraits::IsOmxSupportedType(nsDependentCString(aType))) {
|
||||
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
||||
if (docFactory && aLoaderType) {
|
||||
*aLoaderType = TYPE_CONTENT;
|
||||
}
|
||||
return docFactory.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBM
|
||||
if (DecoderTraits::IsWebMType(nsDependentCString(aType))) {
|
||||
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
||||
if (docFactory && aLoaderType) {
|
||||
*aLoaderType = TYPE_CONTENT;
|
||||
}
|
||||
return docFactory.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DASH
|
||||
if (DecoderTraits::IsDASHMPDType(nsDependentCString(aType))) {
|
||||
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
||||
if (docFactory && aLoaderType) {
|
||||
*aLoaderType = TYPE_CONTENT;
|
||||
}
|
||||
return docFactory.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_GSTREAMER
|
||||
if (DecoderTraits::IsGStreamerSupportedType(nsDependentCString(aType))) {
|
||||
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
||||
if (docFactory && aLoaderType) {
|
||||
*aLoaderType = TYPE_CONTENT;
|
||||
}
|
||||
return docFactory.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_MEDIA_PLUGINS
|
||||
if (mozilla::MediaDecoder::IsMediaPluginsEnabled() &&
|
||||
DecoderTraits::IsMediaPluginsType(nsDependentCString(aType))) {
|
||||
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
||||
if (docFactory && aLoaderType) {
|
||||
*aLoaderType = TYPE_CONTENT;
|
||||
}
|
||||
return docFactory.forget();
|
||||
}
|
||||
#endif // MOZ_MEDIA_PLUGINS
|
||||
|
||||
#ifdef MOZ_WMF
|
||||
if (DecoderTraits::IsWMFSupportedType(nsDependentCString(aType))) {
|
||||
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
|
||||
if (docFactory && aLoaderType) {
|
||||
*aLoaderType = TYPE_CONTENT;
|
||||
}
|
||||
return docFactory.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MOZ_MEDIA
|
||||
|
||||
return NULL;
|
||||
|
@ -440,5 +440,32 @@ DecoderTraits::CreateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
|
||||
return decoder.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
|
||||
{
|
||||
return
|
||||
#ifdef MOZ_OGG
|
||||
IsOggType(aType) ||
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
IsOmxSupportedType(aType) ||
|
||||
#endif
|
||||
#ifdef MOZ_WEBM
|
||||
IsWebMType(aType) ||
|
||||
#endif
|
||||
#ifdef MOZ_DASH
|
||||
IsDASHMPDType(aType) ||
|
||||
#endif
|
||||
#ifdef MOZ_GSTREAMER
|
||||
IsGStreamerSupportedType(aType) ||
|
||||
#endif
|
||||
#ifdef MOZ_MEDIA_PLUGINS
|
||||
(mozilla::MediaDecoder::IsMediaPluginsEnabled() && IsMediaPluginsType(aType)) ||
|
||||
#endif
|
||||
#ifdef MOZ_WMF
|
||||
IsWMFSupportedType(aType) ||
|
||||
#endif
|
||||
false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,6 +83,11 @@ public:
|
||||
// were unable to create the decoder.
|
||||
static already_AddRefed<MediaDecoder> CreateDecoder(const nsACString& aType,
|
||||
MediaDecoderOwner* aOwner);
|
||||
|
||||
// Returns true if MIME type aType is supported in video documents,
|
||||
// or false otherwise. Not all platforms support all MIME types, and
|
||||
// vice versa.
|
||||
static bool IsSupportedInVideoDocument(const nsACString& aType);
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user