Bug 1330284 - Use MediaContentType in DirectShowDecoder - r=jya

MozReview-Commit-ID: JKBAUVH49If

--HG--
extra : rebase_source : 91ebe7726dd45d285e713619ebd843887c52810e
This commit is contained in:
Gerald Squelart 2016-12-23 15:53:16 +11:00
Родитель 588d91b674
Коммит cb9b24b872
3 изменённых файлов: 12 добавлений и 17 удалений

Просмотреть файл

@ -93,14 +93,6 @@ IsAndroidMediaType(const nsACString& aType)
}
#endif
#ifdef MOZ_DIRECTSHOW
static bool
IsDirectShowSupportedType(const nsACString& aType)
{
return DirectShowDecoder::GetSupportedCodecs(aType, nullptr);
}
#endif
/* static */ bool
DecoderTraits::IsMP4SupportedType(const MediaContentType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
@ -175,7 +167,7 @@ CanHandleCodecsType(const MediaContentType& aType,
return CANPLAY_YES;
}
#ifdef MOZ_DIRECTSHOW
DirectShowDecoder::GetSupportedCodecs(aType.Type().AsString(), &codecList);
DirectShowDecoder::GetSupportedCodecs(aType, &codecList);
#endif
#ifdef MOZ_ANDROID_OMX
if (MediaDecoder::IsAndroidMediaPluginEnabled()) {
@ -256,7 +248,7 @@ CanHandleMediaType(const MediaContentType& aType,
return CANPLAY_MAYBE;
}
#ifdef MOZ_DIRECTSHOW
if (DirectShowDecoder::GetSupportedCodecs(mimeType.Type().AsString(), nullptr)) {
if (DirectShowDecoder::GetSupportedCodecs(mimeType, nullptr)) {
return CANPLAY_MAYBE;
}
#endif
@ -362,7 +354,7 @@ InstantiateDecoder(const MediaContentType& aType,
#ifdef MOZ_DIRECTSHOW
// Note: DirectShow should come before WMF, so that we prefer DirectShow's
// MP3 support over WMF's.
if (IsDirectShowSupportedType(aType.Type().AsString())) {
if (DirectShowDecoder::GetSupportedCodecs(aType, nullptr)) {
decoder = new DirectShowDecoder(aOwner);
return decoder.forget();
}
@ -436,7 +428,7 @@ MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, Abstrac
new MediaFormatReader(aDecoder, new WebMDemuxer(aDecoder->GetResource()));
} else
#ifdef MOZ_DIRECTSHOW
if (IsDirectShowSupportedType(aType)) {
if (DirectShowDecoder::GetSupportedCodecs(*type, nullptr)) {
decoderReader = new DirectShowReader(aDecoder);
} else
#endif
@ -474,7 +466,7 @@ bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
ADTSDecoder::IsSupportedType(*type) ||
FlacDecoder::IsSupportedType(*type) ||
#ifdef MOZ_DIRECTSHOW
IsDirectShowSupportedType(aType) ||
DirectShowDecoder::GetSupportedCodecs(*type, nullptr) ||
#endif
false;
}

Просмотреть файл

@ -7,6 +7,7 @@
#include "DirectShowDecoder.h"
#include "DirectShowReader.h"
#include "DirectShowUtils.h"
#include "MediaContentType.h"
#include "MediaDecoderStateMachine.h"
#include "mozilla/Preferences.h"
#include "mozilla/WindowsVersion.h"
@ -20,7 +21,7 @@ MediaDecoderStateMachine* DirectShowDecoder::CreateStateMachine()
/* static */
bool
DirectShowDecoder::GetSupportedCodecs(const nsACString& aType,
DirectShowDecoder::GetSupportedCodecs(const MediaContentType& aType,
char const *const ** aCodecList)
{
if (!IsEnabled()) {
@ -31,8 +32,8 @@ DirectShowDecoder::GetSupportedCodecs(const nsACString& aType,
"mp3",
nullptr
};
if (aType.EqualsASCII("audio/mpeg") ||
aType.EqualsASCII("audio/mp3")) {
if (aType.Type() == MEDIAMIMETYPE("audio/mpeg")
|| aType.Type() == MEDIAMIMETYPE("audio/mp3")) {
if (aCodecList) {
*aCodecList = mp3AudioCodecs;
}

Просмотреть файл

@ -11,6 +11,8 @@
namespace mozilla {
class MediaContentType;
// Decoder that uses DirectShow to playback MP3 files only.
class DirectShowDecoder : public MediaDecoder
{
@ -33,7 +35,7 @@ public:
// it is filled with a (static const) null-terminated list of strings
// denoting the codecs we'll playback. Note that playback is strictly
// limited to MP3 only.
static bool GetSupportedCodecs(const nsACString& aType,
static bool GetSupportedCodecs(const MediaContentType& aType,
char const *const ** aCodecList);
// Returns true if the DirectShow backend is preffed on.