зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1316205: P2. Remove wave duplicated code. r=kaku
MozReview-Commit-ID: 5s7eeMa9DU9 --HG-- extra : rebase_source : c8180552158face5950fa4ad6825f13d9d5f4366
This commit is contained in:
Родитель
f170567837
Коммит
510964c575
|
@ -64,7 +64,7 @@ CodecListContains(char const *const * aCodecs, const String& aCodec)
|
|||
|
||||
static bool
|
||||
IsOggSupportedType(const nsACString& aType,
|
||||
const nsAString& aCodecs = EmptyString())
|
||||
const nsAString& aCodecs = EmptyString())
|
||||
{
|
||||
return OggDecoder::CanHandleMediaType(aType, aCodecs);
|
||||
}
|
||||
|
@ -75,34 +75,6 @@ IsOggTypeAndEnabled(const nsACString& aType)
|
|||
return IsOggSupportedType(aType);
|
||||
}
|
||||
|
||||
// See http://www.rfc-editor.org/rfc/rfc2361.txt for the definitions
|
||||
// of WAVE media types and codec types. However, the audio/vnd.wave
|
||||
// MIME type described there is not used.
|
||||
static const char* const gWaveTypes[5] = {
|
||||
"audio/x-wav",
|
||||
"audio/wav",
|
||||
"audio/wave",
|
||||
"audio/x-pn-wav",
|
||||
nullptr
|
||||
};
|
||||
|
||||
static char const *const gWaveCodecs[4] = {
|
||||
"1", // Microsoft PCM Format
|
||||
"6", // aLaw Encoding
|
||||
"7", // uLaw Encoding
|
||||
nullptr
|
||||
};
|
||||
|
||||
static bool
|
||||
IsWaveType(const nsACString& aType)
|
||||
{
|
||||
if (!MediaDecoder::IsWaveEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return CodecListContains(gWaveTypes, aType);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsWebMSupportedType(const nsACString& aType,
|
||||
const nsAString& aCodecs = EmptyString())
|
||||
|
@ -203,8 +175,8 @@ IsAACSupportedType(const nsACString& aType,
|
|||
}
|
||||
|
||||
static bool
|
||||
IsWAVSupportedType(const nsACString& aType,
|
||||
const nsAString& aCodecs = EmptyString())
|
||||
IsWaveSupportedType(const nsACString& aType,
|
||||
const nsAString& aCodecs = EmptyString())
|
||||
{
|
||||
return WaveDecoder::CanHandleMediaType(aType, aCodecs);
|
||||
}
|
||||
|
@ -235,8 +207,14 @@ CanHandleCodecsType(const MediaContentType& aType,
|
|||
return CANPLAY_NO;
|
||||
}
|
||||
}
|
||||
if (IsWaveType(aType.GetMIMEType())) {
|
||||
codecList = gWaveCodecs;
|
||||
if (IsWaveSupportedType(aType.GetMIMEType())) {
|
||||
if (IsWaveSupportedType(aType.GetMIMEType(), aType.GetCodecs())) {
|
||||
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 !defined(MOZ_OMX_WEBM_DECODER)
|
||||
if (DecoderTraits::IsWebMTypeAndEnabled(aType.GetMIMEType())) {
|
||||
|
@ -322,7 +300,7 @@ CanHandleMediaType(const MediaContentType& aType,
|
|||
if (IsOggTypeAndEnabled(aType.GetMIMEType())) {
|
||||
return CANPLAY_MAYBE;
|
||||
}
|
||||
if (IsWaveType(aType.GetMIMEType())) {
|
||||
if (IsWaveSupportedType(aType.GetMIMEType())) {
|
||||
return CANPLAY_MAYBE;
|
||||
}
|
||||
if (DecoderTraits::IsMP4TypeAndEnabled(aType.GetMIMEType(), aDiagnostics)) {
|
||||
|
@ -372,7 +350,7 @@ DecoderTraits::CanHandleContentType(const MediaContentType& aContentType,
|
|||
bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics)
|
||||
{
|
||||
if (IsWaveType(nsDependentCString(aMIMEType))) {
|
||||
if (IsWaveSupportedType(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.
|
||||
|
@ -425,7 +403,7 @@ InstantiateDecoder(const nsACString& aType,
|
|||
decoder = new OggDecoder(aOwner);
|
||||
return decoder.forget();
|
||||
}
|
||||
if (IsWaveType(aType)) {
|
||||
if (IsWaveSupportedType(aType)) {
|
||||
decoder = new WaveDecoder(aOwner);
|
||||
return decoder.forget();
|
||||
}
|
||||
|
@ -493,7 +471,7 @@ MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, Abstrac
|
|||
if (IsAACSupportedType(aType)) {
|
||||
decoderReader = new MediaFormatReader(aDecoder, new ADTSDemuxer(aDecoder->GetResource()));
|
||||
} else
|
||||
if (IsWAVSupportedType(aType)) {
|
||||
if (IsWaveSupportedType(aType)) {
|
||||
decoderReader = new MediaFormatReader(aDecoder, new WAVDemuxer(aDecoder->GetResource()));
|
||||
} else
|
||||
if (IsFlacSupportedType(aType)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче