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
--- 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