Bug 1176218 - p3. Add DecoderTraits::CanHandleContentType - r=jya

Instead of taking MIME&codecs strings, CanHandleContentType takes an
MediaContentType, which can be used to access these and other parameters.

MozReview-Commit-ID: 14Cg6JoQS0g

--HG--
extra : rebase_source : 85b8e852f004b2728b06831c43b33ee4e7aebe52
This commit is contained in:
Gerald Squelart 2016-09-26 16:43:16 +10:00
Родитель 80a0086ece
Коммит cc9b7da0e1
2 изменённых файлов: 21 добавлений и 0 удалений

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DecoderTraits.h"
#include "MediaContentType.h"
#include "MediaDecoder.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsMimeTypes.h"
@ -492,6 +493,21 @@ DecoderTraits::CanHandleMediaType(const char* aMIMEType,
return CANPLAY_NO;
}
/* static */
CanPlayStatus
DecoderTraits::CanHandleContentType(const MediaContentType& aContentType,
DecoderDoctorDiagnostics* aDiagnostics)
{
if (!aContentType.IsValid()) {
return CANPLAY_NO;
}
return CanHandleMediaType(aContentType.GetMIMEType().Data(),
aContentType.HaveCodecs(),
aContentType.GetCodecs(),
aDiagnostics);
}
// Instantiates but does not initialize decoder.
static
already_AddRefed<MediaDecoder>

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

@ -16,6 +16,7 @@ namespace mozilla {
class AbstractMediaDecoder;
class DecoderDoctorDiagnostics;
class MediaContentType;
class MediaDecoder;
class MediaDecoderOwner;
class MediaDecoderReader;
@ -28,6 +29,10 @@ 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