Bug 1176218 - Hide CanHandle{Media|Codecs}Type - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Mon, 26 Sep 2016 16:01:59 +1000
changeset 419880 17edde78551e9cde10bd41a50165969ef0aff335
parent 419879 37121eb602c6fad4a4bafb52f04fbb269367c736
child 419881 2dd548a046ad0195bfb9bcc486261b74d79b5c07
push id31034
push usergsquelart@mozilla.com
push dateSat, 01 Oct 2016 12:07:57 +0000
reviewersjya
bugs1176218
milestone52.0a1
Bug 1176218 - Hide CanHandle{Media|Codecs}Type - r?jya These methods don't need to be exposed anymore. They are still used in the cpp, so we keep them there as static functions. MozReview-Commit-ID: F1BxEFzj7Re
dom/media/DecoderTraits.cpp
dom/media/DecoderTraits.h
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -300,48 +300,48 @@ IsWAVSupportedType(const nsACString& aTy
 
 static bool
 IsFlacSupportedType(const nsACString& aType,
                    const nsAString& aCodecs = EmptyString())
 {
   return FlacDecoder::CanHandleMediaType(aType, aCodecs);
 }
 
-/* static */
+static
 CanPlayStatus
-DecoderTraits::CanHandleCodecsType(const char* aMIMEType,
-                                   const nsAString& aRequestedCodecs,
-                                   DecoderDoctorDiagnostics* aDiagnostics)
+CanHandleCodecsType(const char* aMIMEType,
+                    const nsAString& aRequestedCodecs,
+                    DecoderDoctorDiagnostics* aDiagnostics)
 {
   char const* const* codecList = nullptr;
   if (IsOggTypeAndEnabled(nsDependentCString(aMIMEType))) {
     if (IsOggSupportedType(nsDependentCString(aMIMEType), aRequestedCodecs)) {
       return CANPLAY_YES;
     } else {
       // We can only reach this position if a particular codec was requested,
       // ogg is supported and working: the codec must be invalid.
       return CANPLAY_NO;
     }
   }
   if (IsWaveType(nsDependentCString(aMIMEType))) {
     codecList = gWaveCodecs;
   }
 #if !defined(MOZ_OMX_WEBM_DECODER)
-  if (IsWebMTypeAndEnabled(nsDependentCString(aMIMEType))) {
+  if (DecoderTraits::IsWebMTypeAndEnabled(nsDependentCString(aMIMEType))) {
     if (IsWebMSupportedType(nsDependentCString(aMIMEType), aRequestedCodecs)) {
       return CANPLAY_YES;
     } else {
       // We can only reach this position if a particular codec was requested,
       // webm is supported and working: the codec must be invalid.
       return CANPLAY_NO;
     }
   }
 #endif
 #ifdef MOZ_FMP4
-  if (IsMP4TypeAndEnabled(nsDependentCString(aMIMEType), aDiagnostics)) {
+  if (DecoderTraits::IsMP4TypeAndEnabled(nsDependentCString(aMIMEType), aDiagnostics)) {
     if (IsMP4SupportedType(nsDependentCString(aMIMEType), aDiagnostics, aRequestedCodecs)) {
       return CANPLAY_YES;
     } else {
       // We can only reach this position if a particular codec was requested,
       // fmp4 is supported and working: the codec must be invalid.
       return CANPLAY_NO;
     }
   }
@@ -397,22 +397,22 @@ DecoderTraits::CanHandleCodecsType(const
   if (expectMoreTokens) {
     // Last codec name was empty
     return CANPLAY_NO;
   }
 
   return CANPLAY_YES;
 }
 
-/* static */
+static
 CanPlayStatus
-DecoderTraits::CanHandleMediaType(const char* aMIMEType,
-                                  bool aHaveRequestedCodecs,
-                                  const nsAString& aRequestedCodecs,
-                                  DecoderDoctorDiagnostics* aDiagnostics)
+CanHandleMediaType(const char* aMIMEType,
+                   bool aHaveRequestedCodecs,
+                   const nsAString& aRequestedCodecs,
+                   DecoderDoctorDiagnostics* aDiagnostics)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (IsHttpLiveStreamingType(nsDependentCString(aMIMEType))) {
     Telemetry::Accumulate(Telemetry::MEDIA_HLS_CANPLAY_REQUESTED, true);
   }
 
   if (aHaveRequestedCodecs) {
@@ -424,21 +424,21 @@ DecoderTraits::CanHandleMediaType(const 
     }
   }
   if (IsOggTypeAndEnabled(nsDependentCString(aMIMEType))) {
     return CANPLAY_MAYBE;
   }
   if (IsWaveType(nsDependentCString(aMIMEType))) {
     return CANPLAY_MAYBE;
   }
-  if (IsMP4TypeAndEnabled(nsDependentCString(aMIMEType), aDiagnostics)) {
+  if (DecoderTraits::IsMP4TypeAndEnabled(nsDependentCString(aMIMEType), aDiagnostics)) {
     return CANPLAY_MAYBE;
   }
 #if !defined(MOZ_OMX_WEBM_DECODER)
-  if (IsWebMTypeAndEnabled(nsDependentCString(aMIMEType))) {
+  if (DecoderTraits::IsWebMTypeAndEnabled(nsDependentCString(aMIMEType))) {
     return CANPLAY_MAYBE;
   }
 #endif
   if (IsMP3SupportedType(nsDependentCString(aMIMEType))) {
     return CANPLAY_MAYBE;
   }
   if (IsAACSupportedType(nsDependentCString(aMIMEType))) {
     return CANPLAY_MAYBE;
@@ -484,20 +484,20 @@ DecoderTraits::CanHandleContentType(nsCo
   if (NS_FAILED(rv)) {
     return CANPLAY_NO;
   }
 
   nsAutoString codecs;
   rv = aParsedType.GetParameter("codecs", codecs);
 
   NS_ConvertUTF16toUTF8 mimeTypeUTF8(mimeType);
-  return DecoderTraits::CanHandleMediaType(mimeTypeUTF8.get(),
-                                           NS_SUCCEEDED(rv),
-                                           codecs,
-                                           aDiagnostics);
+  return CanHandleMediaType(mimeTypeUTF8.get(),
+                            NS_SUCCEEDED(rv),
+                            codecs,
+                            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
--- a/dom/media/DecoderTraits.h
+++ b/dom/media/DecoderTraits.h
@@ -31,36 +31,16 @@ class DecoderTraits {
 public:
   // Returns the CanPlayStatus indicating if we can handle this content type.
   static CanPlayStatus CanHandleContentType(const nsAString& aType,
                                             DecoderDoctorDiagnostics* aDiagnostics);
   // Returns the CanPlayStatus indicating if we can handle this parsed content type.
   static CanPlayStatus CanHandleContentType(nsContentTypeParser& aParsedType,
                                             DecoderDoctorDiagnostics* aDiagnostics);
 
-  // Returns the CanPlayStatus indicating if we can handle this
-  // MIME type. The MIME type should not include the codecs parameter.
-  // That parameter should be passed in aRequestedCodecs, and will only be
-  // used if whether a given MIME type being handled depends on the
-  // codec that will be used.  If the codecs parameter has not been
-  // specified, pass false in aHaveRequestedCodecs.
-  static CanPlayStatus CanHandleMediaType(const char* aMIMEType,
-                                          bool aHaveRequestedCodecs,
-                                          const nsAString& aRequestedCodecs,
-                                          DecoderDoctorDiagnostics* aDiagnostics);
-
-  // Returns the CanPlayStatus indicating if we can handle this MIME type and
-  // codecs type natively, excluding any plugins-based reader (such as
-  // GStreamer)
-  // The MIME type should not include the codecs parameter.
-  // That parameter is passed in aRequestedCodecs.
-  static CanPlayStatus CanHandleCodecsType(const char* aMIMEType,
-                                           const nsAString& aRequestedCodecs,
-                                           DecoderDoctorDiagnostics* aDiagnostics);
-
   // Returns true if we should handle this MIME type when it appears
   // as an <object> or as a toplevel page. If, in practice, our support
   // for the type is more limited than appears in the wild, we should return
   // false here even if CanHandleMediaType would return true.
   static bool ShouldHandleMediaType(const char* aMIMEType,
                                     DecoderDoctorDiagnostics* aDiagnostics);
 
   // Create a decoder for the given aType. Returns null if we