Bug 1176218 - p6. Move ShouldHandleMediaType down the cpp - r=jya
Just moving a function, it will help review upcoming changes in the next patch.
MozReview-Commit-ID: Ilbhinse9C6
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -301,44 +301,16 @@ IsWAVSupportedType(const nsACString& aTy
static bool
IsFlacSupportedType(const nsACString& aType,
const nsAString& aCodecs = EmptyString())
{
return FlacDecoder::CanHandleMediaType(aType, aCodecs);
}
/* static */
-bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
- DecoderDoctorDiagnostics* aDiagnostics)
-{
- if (IsWaveType(nsDependentCString(aMIMEType))) {
- // We should not return true for Wave types, since there are some
- // Wave codecs actually in use in the wild that we don't support, and
- // we should allow those to be handled by plugins or helper apps.
- // Furthermore people can play Wave files on most platforms by other
- // means.
- return false;
- }
-
- // If an external plugin which can handle quicktime video is available
- // (and not disabled), prefer it over native playback as there several
- // codecs found in the wild that we do not handle.
- if (nsDependentCString(aMIMEType).EqualsASCII("video/quicktime")) {
- RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
- if (pluginHost &&
- pluginHost->HavePluginForType(nsDependentCString(aMIMEType))) {
- return false;
- }
- }
-
- return CanHandleMediaType(aMIMEType, false, EmptyString(), aDiagnostics)
- != CANPLAY_NO;
-}
-
-/* static */
CanPlayStatus
DecoderTraits::CanHandleCodecsType(const char* aMIMEType,
const nsAString& aRequestedCodecs,
DecoderDoctorDiagnostics* aDiagnostics)
{
char const* const* codecList = nullptr;
if (IsOggTypeAndEnabled(nsDependentCString(aMIMEType))) {
if (IsOggSupportedType(nsDependentCString(aMIMEType), aRequestedCodecs)) {
@@ -503,16 +475,44 @@ DecoderTraits::CanHandleContentType(cons
}
return CanHandleMediaType(aContentType.GetMIMEType().Data(),
aContentType.HaveCodecs(),
aContentType.GetCodecs(),
aDiagnostics);
}
+/* static */
+bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
+ DecoderDoctorDiagnostics* aDiagnostics)
+{
+ if (IsWaveType(nsDependentCString(aMIMEType))) {
+ // We should not return true for Wave types, since there are some
+ // Wave codecs actually in use in the wild that we don't support, and
+ // we should allow those to be handled by plugins or helper apps.
+ // Furthermore people can play Wave files on most platforms by other
+ // means.
+ return false;
+ }
+
+ // If an external plugin which can handle quicktime video is available
+ // (and not disabled), prefer it over native playback as there several
+ // codecs found in the wild that we do not handle.
+ if (nsDependentCString(aMIMEType).EqualsASCII("video/quicktime")) {
+ RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
+ if (pluginHost &&
+ pluginHost->HavePluginForType(nsDependentCString(aMIMEType))) {
+ return false;
+ }
+ }
+
+ return CanHandleMediaType(aMIMEType, false, EmptyString(), aDiagnostics)
+ != CANPLAY_NO;
+}
+
// Instantiates but does not initialize decoder.
static
already_AddRefed<MediaDecoder>
InstantiateDecoder(const nsACString& aType,
MediaDecoderOwner* aOwner,
DecoderDoctorDiagnostics* aDiagnostics)
{
MOZ_ASSERT(NS_IsMainThread());