Bug 1176218 - p7. Hide CanHandle{Media|Codecs}Type - r=jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Mon, 26 Sep 2016 16:01:59 +1000
changeset 421999 458b92a2b8987007ed68f32bbf26eaf4cf46742f
parent 421998 1a62ac51fbb33c5cc19f58b34ede28e91fa96d0a
child 422000 dc9a771d1e7b84828903d7d3e72732d8c66752ca
push id31653
push usergsquelart@mozilla.com
push dateFri, 07 Oct 2016 06:47:50 +0000
reviewersjya
bugs1176218
milestone52.0a1
Bug 1176218 - p7. 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;
--- a/dom/media/DecoderTraits.h
+++ b/dom/media/DecoderTraits.h
@@ -28,36 +28,16 @@ enum CanPlayStatus {
 };
 
 class DecoderTraits {
 public:
   // Returns the CanPlayStatus indicating if we can handle this content type.
   static CanPlayStatus CanHandleContentType(const MediaContentType& aContentType,
                                             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