Bug 1176218 - p6. Move ShouldHandleMediaType down the cpp - r=jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Mon, 26 Sep 2016 16:02:59 +1000
changeset 421998 1a62ac51fbb33c5cc19f58b34ede28e91fa96d0a
parent 421997 b3d102b02fa671d0a42d70ae7fe66bdd51ac5d86
child 421999 458b92a2b8987007ed68f32bbf26eaf4cf46742f
push id31653
push usergsquelart@mozilla.com
push dateFri, 07 Oct 2016 06:47:50 +0000
reviewersjya
bugs1176218
milestone52.0a1
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
dom/media/DecoderTraits.cpp
--- 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());