Bug 1331770 - Rename 'MediaContentType' to 'MediaContainerType' - r=jya

MozReview-Commit-ID: F0BWai8vPyo

--HG--
rename : dom/media/MediaContentType.cpp => dom/media/MediaContainerType.cpp
rename : dom/media/MediaContentType.h => dom/media/MediaContainerType.h
extra : rebase_source : 640ada96750b4496055087e80ae3f600c9df31c9
This commit is contained in:
Gerald Squelart 2017-01-18 11:59:03 +11:00
Родитель 509bc64559
Коммит 5745998021
35 изменённых файлов: 191 добавлений и 194 удалений

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

@ -95,7 +95,7 @@
#include "mozilla/Telemetry.h"
#include "DecoderDoctorDiagnostics.h"
#include "DecoderTraits.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "ImageContainer.h"
#include "nsRange.h"
@ -4473,11 +4473,11 @@ CanPlayStatus
HTMLMediaElement::GetCanPlay(const nsAString& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
if (!contentType) {
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
if (!containerType) {
return CANPLAY_NO;
}
return DecoderTraits::CanHandleContentType(*contentType, aDiagnostics);
return DecoderTraits::CanHandleContainerType(*containerType, aDiagnostics);
}
NS_IMETHODIMP

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

@ -6,7 +6,7 @@
#include "ADTSDecoder.h"
#include "ADTSDemuxer.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "PDMFactory.h"
@ -39,15 +39,15 @@ ADTSDecoder::IsEnabled()
}
/* static */ bool
ADTSDecoder::IsSupportedType(const MediaContentType& aContentType)
ADTSDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
if (aContentType.Type() == MEDIAMIMETYPE("audio/aac")
|| aContentType.Type() == MEDIAMIMETYPE("audio/aacp")
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-aac")) {
if (aContainerType.Type() == MEDIAMIMETYPE("audio/aac")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/aacp")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-aac")) {
return
IsEnabled()
&& (aContentType.ExtendedType().Codecs().IsEmpty()
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("aac"));
&& (aContainerType.ExtendedType().Codecs().IsEmpty()
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("aac"));
}
return false;

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

@ -11,7 +11,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
class ADTSDecoder : public MediaDecoder
{
@ -24,7 +24,7 @@ public:
// Returns true if the ADTS backend is pref'ed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsEnabled();
static bool IsSupportedType(const MediaContentType& aContentType);
static bool IsSupportedType(const MediaContainerType& aContainerType);
};
} // namespace mozilla

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

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DecoderTraits.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoder.h"
#include "nsMimeTypes.h"
#include "mozilla/Preferences.h"
@ -51,7 +51,7 @@ namespace mozilla
{
static bool
IsHttpLiveStreamingType(const MediaContentType& aType)
IsHttpLiveStreamingType(const MediaContainerType& aType)
{
return // For m3u8.
// https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-10
@ -63,7 +63,7 @@ IsHttpLiveStreamingType(const MediaContentType& aType)
#ifdef MOZ_ANDROID_OMX
static bool
IsAndroidMediaType(const MediaContentType& aType)
IsAndroidMediaType(const MediaContainerType& aType)
{
if (!MediaDecoder::IsAndroidMediaPluginEnabled()) {
return false;
@ -77,7 +77,7 @@ IsAndroidMediaType(const MediaContentType& aType)
#endif
/* static */ bool
DecoderTraits::IsMP4SupportedType(const MediaContentType& aType,
DecoderTraits::IsMP4SupportedType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
#ifdef MOZ_FMP4
@ -89,14 +89,14 @@ DecoderTraits::IsMP4SupportedType(const MediaContentType& aType,
static
CanPlayStatus
CanHandleCodecsType(const MediaContentType& aType,
CanHandleCodecsType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
// We should have been given a codecs string, though it may be empty.
MOZ_ASSERT(aType.ExtendedType().HaveCodecs());
// Content type with the the MIME type, no codecs.
const MediaContentType mimeType(aType.Type());
// Container type with the MIME type, no codecs.
const MediaContainerType mimeType(aType.Type());
if (OggDecoder::IsSupportedType(mimeType)) {
if (OggDecoder::IsSupportedType(aType)) {
@ -107,7 +107,7 @@ CanHandleCodecsType(const MediaContentType& aType,
return CANPLAY_NO;
}
}
if (WaveDecoder::IsSupportedType(MediaContentType(mimeType))) {
if (WaveDecoder::IsSupportedType(MediaContainerType(mimeType))) {
if (WaveDecoder::IsSupportedType(aType)) {
return CANPLAY_YES;
} else {
@ -172,7 +172,7 @@ CanHandleCodecsType(const MediaContentType& aType,
static
CanPlayStatus
CanHandleMediaType(const MediaContentType& aType,
CanHandleMediaType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
MOZ_ASSERT(NS_IsMainThread());
@ -188,8 +188,8 @@ CanHandleMediaType(const MediaContentType& aType,
}
}
// Content type with just the MIME type/subtype, no codecs.
const MediaContentType mimeType(aType.Type());
// Container type with just the MIME type/subtype, no codecs.
const MediaContainerType mimeType(aType.Type());
if (OggDecoder::IsSupportedType(mimeType)) {
return CANPLAY_MAYBE;
@ -232,22 +232,22 @@ CanHandleMediaType(const MediaContentType& aType,
/* static */
CanPlayStatus
DecoderTraits::CanHandleContentType(const MediaContentType& aContentType,
DecoderTraits::CanHandleContainerType(const MediaContainerType& aContainerType,
DecoderDoctorDiagnostics* aDiagnostics)
{
return CanHandleMediaType(aContentType, aDiagnostics);
return CanHandleMediaType(aContainerType, aDiagnostics);
}
/* static */
bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
DecoderDoctorDiagnostics* aDiagnostics)
{
Maybe<MediaContentType> contentType = MakeMediaContentType(aMIMEType);
if (!contentType) {
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aMIMEType);
if (!containerType) {
return false;
}
if (WaveDecoder::IsSupportedType(*contentType)) {
if (WaveDecoder::IsSupportedType(*containerType)) {
// 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.
@ -259,21 +259,21 @@ bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
// If an external plugin which can handle quicktime video is available
// (and not disabled), prefer it over native playback as there several
// codecs found in the wild that we do not handle.
if (contentType->Type() == MEDIAMIMETYPE("video/quicktime")) {
if (containerType->Type() == MEDIAMIMETYPE("video/quicktime")) {
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
if (pluginHost &&
pluginHost->HavePluginForType(contentType->Type().AsString())) {
pluginHost->HavePluginForType(containerType->Type().AsString())) {
return false;
}
}
return CanHandleMediaType(*contentType, aDiagnostics) != CANPLAY_NO;
return CanHandleMediaType(*containerType, aDiagnostics) != CANPLAY_NO;
}
// Instantiates but does not initialize decoder.
static
already_AddRefed<MediaDecoder>
InstantiateDecoder(const MediaContentType& aType,
InstantiateDecoder(const MediaContainerType& aType,
MediaDecoderOwner* aOwner,
DecoderDoctorDiagnostics* aDiagnostics)
{
@ -343,7 +343,7 @@ DecoderTraits::CreateDecoder(const nsACString& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
MOZ_ASSERT(NS_IsMainThread());
Maybe<MediaContentType> type = MakeMediaContentType(aType);
Maybe<MediaContainerType> type = MakeMediaContainerType(aType);
if (!type) {
return nullptr;
}
@ -352,7 +352,7 @@ DecoderTraits::CreateDecoder(const nsACString& aType,
/* static */
MediaDecoderReader*
DecoderTraits::CreateReader(const MediaContentType& aType,
DecoderTraits::CreateReader(const MediaContainerType& aType,
AbstractMediaDecoder* aDecoder)
{
MOZ_ASSERT(NS_IsMainThread());
@ -414,7 +414,7 @@ bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
return false;
}
Maybe<MediaContentType> type = MakeMediaContentType(aType);
Maybe<MediaContainerType> type = MakeMediaContainerType(aType);
if (!type) {
return false;
}

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

@ -16,7 +16,7 @@ namespace mozilla {
class AbstractMediaDecoder;
class DecoderDoctorDiagnostics;
class MediaContentType;
class MediaContainerType;
class MediaDecoder;
class MediaDecoderOwner;
class MediaDecoderReader;
@ -29,8 +29,8 @@ enum CanPlayStatus {
class DecoderTraits {
public:
// Returns the CanPlayStatus indicating if we can handle this content type.
static CanPlayStatus CanHandleContentType(const MediaContentType& aContentType,
// Returns the CanPlayStatus indicating if we can handle this container type.
static CanPlayStatus CanHandleContainerType(const MediaContainerType& aContainerType,
DecoderDoctorDiagnostics* aDiagnostics);
// Returns true if we should handle this MIME type when it appears
@ -48,7 +48,7 @@ public:
// Create a reader for thew given MIME type aType. Returns null
// if we were unable to create the reader.
static MediaDecoderReader* CreateReader(const MediaContentType& aType,
static MediaDecoderReader* CreateReader(const MediaContainerType& aType,
AbstractMediaDecoder* aDecoder);
// Returns true if MIME type aType is supported in video documents,
@ -58,7 +58,7 @@ public:
// Convenience function that returns false if MOZ_FMP4 is not defined,
// otherwise defers to MP4Decoder::IsSupportedType().
static bool IsMP4SupportedType(const MediaContentType& aType,
static bool IsMP4SupportedType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics);
};

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

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MP3Decoder.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "MP3Demuxer.h"
@ -38,14 +38,14 @@ MP3Decoder::IsEnabled() {
}
/* static */
bool MP3Decoder::IsSupportedType(const MediaContentType& aContentType)
bool MP3Decoder::IsSupportedType(const MediaContainerType& aContainerType)
{
if (aContentType.Type() == MEDIAMIMETYPE("audio/mp3")
|| aContentType.Type() == MEDIAMIMETYPE("audio/mpeg")) {
if (aContainerType.Type() == MEDIAMIMETYPE("audio/mp3")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/mpeg")) {
return
IsEnabled()
&& (aContentType.ExtendedType().Codecs().IsEmpty()
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("mp3"));
&& (aContainerType.ExtendedType().Codecs().IsEmpty()
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("mp3"));
}
return false;
}

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

@ -10,7 +10,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
class MP3Decoder : public MediaDecoder
{
@ -23,7 +23,7 @@ public:
// Returns true if the MP3 backend is preffed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsEnabled();
static bool IsSupportedType(const MediaContentType& aContentType);
static bool IsSupportedType(const MediaContainerType& aContainerType);
};
} // namespace mozilla

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

@ -4,41 +4,39 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaContentType.h"
#include "nsContentTypeParser.h"
#include "MediaContainerType.h"
namespace mozilla {
size_t
MediaContentType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
MediaContainerType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
return mExtendedMIMEType.SizeOfExcludingThis(aMallocSizeOf);
}
Maybe<MediaContentType>
MakeMediaContentType(const nsAString& aType)
Maybe<MediaContainerType>
MakeMediaContainerType(const nsAString& aType)
{
Maybe<MediaExtendedMIMEType> mime = MakeMediaExtendedMIMEType(aType);
if (mime) {
return Some(MediaContentType(Move(*mime)));
return Some(MediaContainerType(Move(*mime)));
}
return Nothing();
}
Maybe<MediaContentType>
MakeMediaContentType(const nsACString& aType)
Maybe<MediaContainerType>
MakeMediaContainerType(const nsACString& aType)
{
return MakeMediaContentType(NS_ConvertUTF8toUTF16(aType));
return MakeMediaContainerType(NS_ConvertUTF8toUTF16(aType));
}
Maybe<MediaContentType>
MakeMediaContentType(const char* aType)
Maybe<MediaContainerType>
MakeMediaContainerType(const char* aType)
{
if (!aType) {
return Nothing();
}
return MakeMediaContentType(nsDependentCString(aType));
return MakeMediaContainerType(nsDependentCString(aType));
}
} // namespace mozilla

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

@ -4,8 +4,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MediaContentType_h_
#define MediaContentType_h_
#ifndef MediaContainerType_h_
#define MediaContainerType_h_
#include "MediaMIMETypes.h"
#include "mozilla/Maybe.h"
@ -14,20 +14,20 @@
namespace mozilla {
// Class containing media type information for containers.
class MediaContentType
class MediaContainerType
{
public:
explicit MediaContentType(const MediaMIMEType& aType)
explicit MediaContainerType(const MediaMIMEType& aType)
: mExtendedMIMEType(aType)
{}
explicit MediaContentType(MediaMIMEType&& aType)
explicit MediaContainerType(MediaMIMEType&& aType)
: mExtendedMIMEType(Move(aType))
{}
explicit MediaContentType(const MediaExtendedMIMEType& aType)
explicit MediaContainerType(const MediaExtendedMIMEType& aType)
: mExtendedMIMEType(aType)
{
}
explicit MediaContentType(MediaExtendedMIMEType&& aType)
explicit MediaContainerType(MediaExtendedMIMEType&& aType)
: mExtendedMIMEType(Move(aType))
{
}
@ -45,10 +45,10 @@ private:
MediaExtendedMIMEType mExtendedMIMEType;
};
Maybe<MediaContentType> MakeMediaContentType(const nsAString& aType);
Maybe<MediaContentType> MakeMediaContentType(const nsACString& aType);
Maybe<MediaContentType> MakeMediaContentType(const char* aType);
Maybe<MediaContainerType> MakeMediaContainerType(const nsAString& aType);
Maybe<MediaContainerType> MakeMediaContainerType(const nsACString& aType);
Maybe<MediaContainerType> MakeMediaContainerType(const char* aType);
} // namespace mozilla
#endif // MediaContentType_h_
#endif // MediaContainerType_h_

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

@ -8,7 +8,7 @@
#include "mozilla/TaskQueue.h"
#include "mozilla/Telemetry.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaPrefs.h"
#include "MediaResource.h"
#include "TimeUnits.h"
@ -501,19 +501,19 @@ CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType)
}
UniquePtr<TrackInfo>
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
const nsACString& aCodecMIMEType,
const MediaContentType& aContentType)
const MediaContainerType& aContainerType)
{
UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aCodecMIMEType);
if (trackInfo) {
VideoInfo* videoInfo = trackInfo->GetAsVideoInfo();
if (videoInfo) {
Maybe<int32_t> maybeWidth = aContentType.ExtendedType().GetWidth();
Maybe<int32_t> maybeWidth = aContainerType.ExtendedType().GetWidth();
if (maybeWidth && *maybeWidth > 0) {
videoInfo->mImage.width = *maybeWidth;
}
Maybe<int32_t> maybeHeight = aContentType.ExtendedType().GetHeight();
Maybe<int32_t> maybeHeight = aContainerType.ExtendedType().GetHeight();
if (maybeHeight && *maybeHeight > 0) {
videoInfo->mImage.height = *maybeHeight;
}

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

@ -41,7 +41,7 @@ using mozilla::CheckedUint32;
// mozilla::Monitor non-reentrant.
namespace mozilla {
class MediaContentType;
class MediaContainerType;
// EME Key System String.
extern const nsLiteralCString kEMEKeySystemClearkey;
@ -355,11 +355,11 @@ UniquePtr<TrackInfo>
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType);
// Try and create a TrackInfo with a given codec MIME type, and optional extra
// parameters from a content type (its MIME type and codecs are ignored).
// parameters from a container type (its MIME type and codecs are ignored).
UniquePtr<TrackInfo>
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
const nsACString& aCodecMIMEType,
const MediaContentType& aContentType);
const MediaContainerType& aContainerType);
namespace detail {

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

@ -11,7 +11,7 @@
namespace mozilla {
AndroidMediaDecoder::AndroidMediaDecoder(MediaDecoderOwner* aOwner,
const MediaContentType& aType)
const MediaContainerType& aType)
: MediaDecoder(aOwner), mType(aType)
{
}

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

@ -8,15 +8,15 @@
#include "MediaDecoder.h"
#include "AndroidMediaDecoder.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
namespace mozilla {
class AndroidMediaDecoder : public MediaDecoder
{
MediaContentType mType;
MediaContainerType mType;
public:
AndroidMediaDecoder(MediaDecoderOwner* aOwner, const MediaContentType& aType);
AndroidMediaDecoder(MediaDecoderOwner* aOwner, const MediaContainerType& aType);
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override {
return new AndroidMediaDecoder(aOwner, mType);

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

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Preferences.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaResource.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/Services.h"
@ -227,7 +227,7 @@ AndroidMediaPluginHost::~AndroidMediaPluginHost() {
MOZ_COUNT_DTOR(AndroidMediaPluginHost);
}
bool AndroidMediaPluginHost::FindDecoder(const MediaContentType& aMimeType,
bool AndroidMediaPluginHost::FindDecoder(const MediaContainerType& aMimeType,
MediaCodecs* aCodecs)
{
const char *chars;
@ -253,7 +253,7 @@ bool AndroidMediaPluginHost::FindDecoder(const MediaContentType& aMimeType,
}
MPAPI::Decoder *AndroidMediaPluginHost::CreateDecoder(MediaResource *aResource,
const MediaContentType& aMimeType)
const MediaContainerType& aMimeType)
{
NS_ENSURE_TRUE(aResource, nullptr);

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

@ -13,7 +13,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
class MediaCodecs;
class AndroidMediaPluginHost {
@ -27,8 +27,8 @@ public:
static void Shutdown();
bool FindDecoder(const MediaContentType& aMimeType, MediaCodecs* aCodecs);
MPAPI::Decoder *CreateDecoder(mozilla::MediaResource *aResource, const MediaContentType& aMimeType);
bool FindDecoder(const MediaContainerType& aMimeType, MediaCodecs* aCodecs);
MPAPI::Decoder *CreateDecoder(mozilla::MediaResource *aResource, const MediaContainerType& aMimeType);
void DestroyDecoder(MPAPI::Decoder *aDecoder);
};

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

@ -25,9 +25,9 @@ typedef mozilla::layers::Image Image;
typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
AndroidMediaReader::AndroidMediaReader(AbstractMediaDecoder *aDecoder,
const MediaContentType& aContentType) :
const MediaContainerType& aContainerType) :
MediaDecoderReader(aDecoder),
mType(aContentType),
mType(aContainerType),
mPlugin(nullptr),
mHasAudio(false),
mHasVideo(false),

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

@ -7,7 +7,7 @@
#define AndroidMediaReader_h_
#include "ImageContainer.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderReader.h"
#include "MediaResource.h"
#include "mozilla/Attributes.h"
@ -25,7 +25,7 @@ class ImageContainer;
class AndroidMediaReader : public MediaDecoderReader
{
MediaContentType mType;
MediaContainerType mType;
MPAPI::Decoder *mPlugin;
bool mHasAudio;
bool mHasVideo;
@ -38,7 +38,7 @@ class AndroidMediaReader : public MediaDecoderReader
MozPromiseRequestHolder<MediaDecoderReader::MediaDataPromise> mSeekRequest;
public:
AndroidMediaReader(AbstractMediaDecoder* aDecoder,
const MediaContentType& aContentType);
const MediaContainerType& aContainerType);
nsresult ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
TrackInfo::kVideoTrack)) override;

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

@ -7,7 +7,7 @@
#include "DirectShowDecoder.h"
#include "DirectShowReader.h"
#include "DirectShowUtils.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "mozilla/Preferences.h"
#include "mozilla/WindowsVersion.h"
@ -21,7 +21,7 @@ MediaDecoderStateMachine* DirectShowDecoder::CreateStateMachine()
/* static */
bool
DirectShowDecoder::GetSupportedCodecs(const MediaContentType& aType,
DirectShowDecoder::GetSupportedCodecs(const MediaContainerType& aType,
MediaCodecs* aOutCodecs)
{
if (!IsEnabled()) {

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

@ -12,7 +12,7 @@
namespace mozilla {
class MediaCodecs;
class MediaContentType;
class MediaContainerType;
// Decoder that uses DirectShow to playback MP3 files only.
class DirectShowDecoder : public MediaDecoder
@ -36,7 +36,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 MediaContentType& aType,
static bool GetSupportedCodecs(const MediaContainerType& aType,
MediaCodecs* aOutCodecs);
// Returns true if the DirectShow backend is preffed on.

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

@ -7,7 +7,7 @@
#include "mozilla/dom/MediaKeySystemAccess.h"
#include "mozilla/dom/MediaKeySystemAccessBinding.h"
#include "mozilla/Preferences.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaPrefs.h"
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
@ -574,21 +574,21 @@ GetSupportedCapabilities(const CodecType aCodecType,
}
// If content type is an invalid or unrecognized MIME type, continue
// to the next iteration.
Maybe<MediaContentType> maybeContentType =
MakeMediaContentType(contentTypeString);
if (!maybeContentType) {
Maybe<MediaContainerType> maybeContainerType =
MakeMediaContainerType(contentTypeString);
if (!maybeContainerType) {
EME_LOG("MediaKeySystemConfiguration (label='%s') "
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
"failed to parse contentType as MIME type.",
"failed to parse contentTypeString as MIME type.",
NS_ConvertUTF16toUTF8(aPartialConfig.mLabel).get(),
NS_ConvertUTF16toUTF8(contentTypeString).get(),
NS_ConvertUTF16toUTF8(robustness).get());
continue;
}
const MediaContentType& contentType = *maybeContentType;
const MediaContainerType& containerType = *maybeContainerType;
bool invalid = false;
nsTArray<EMECodecString> codecs;
for (const auto& codecString : contentType.ExtendedType().Codecs().Range()) {
for (const auto& codecString : containerType.ExtendedType().Codecs().Range()) {
EMECodecString emeCodec = ToEMEAPICodecString(nsString(codecString));
if (emeCodec.IsEmpty()) {
invalid = true;
@ -613,7 +613,7 @@ GetSupportedCapabilities(const CodecType aCodecType,
// case-insensitive."'. We're using nsContentTypeParser and that is
// case-insensitive and converts all its parameter outputs to lower case.)
const bool isMP4 =
DecoderTraits::IsMP4SupportedType(contentType, aDiagnostics);
DecoderTraits::IsMP4SupportedType(containerType, aDiagnostics);
if (isMP4 && !aKeySystem.mMP4.IsSupported()) {
EME_LOG("MediaKeySystemConfiguration (label='%s') "
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
@ -623,7 +623,7 @@ GetSupportedCapabilities(const CodecType aCodecType,
NS_ConvertUTF16toUTF8(robustness).get());
continue;
}
const bool isWebM = WebMDecoder::IsSupportedType(contentType);
const bool isWebM = WebMDecoder::IsSupportedType(containerType);
if (isWebM && !aKeySystem.mWebM.IsSupported()) {
EME_LOG("MediaKeySystemConfiguration (label='%s') "
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
@ -677,8 +677,8 @@ GetSupportedCapabilities(const CodecType aCodecType,
// (Note: all containers we support have implied codecs, so don't continue here.)
}
// If content type is not strictly a audio/video type, continue to the next iteration.
const auto majorType = GetMajorType(contentType.Type());
// If container type is not strictly a audio/video type, continue to the next iteration.
const auto majorType = GetMajorType(containerType.Type());
if (majorType == Invalid) {
EME_LOG("MediaKeySystemConfiguration (label='%s') "
"MediaKeySystemMediaCapability('%s','%s') unsupported; "

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

@ -6,7 +6,7 @@
#include "FlacDecoder.h"
#include "FlacDemuxer.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "MediaPrefs.h"
@ -43,12 +43,12 @@ FlacDecoder::IsEnabled()
}
/* static */ bool
FlacDecoder::IsSupportedType(const MediaContentType& aContentType)
FlacDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
return IsEnabled()
&& (aContentType.Type() == MEDIAMIMETYPE("audio/flac")
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-flac")
|| aContentType.Type() == MEDIAMIMETYPE("application/x-flac"));
&& (aContainerType.Type() == MEDIAMIMETYPE("audio/flac")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-flac")
|| aContainerType.Type() == MEDIAMIMETYPE("application/x-flac"));
}
} // namespace mozilla

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

@ -11,7 +11,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
class FlacDecoder : public MediaDecoder
{
@ -24,7 +24,7 @@ public:
// Returns true if the Flac backend is pref'ed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsEnabled();
static bool IsSupportedType(const MediaContentType& aContentType);
static bool IsSupportedType(const MediaContainerType& aContainerType);
};
} // namespace mozilla

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

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MP4Decoder.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MP4Demuxer.h"
#include "mozilla/Preferences.h"
@ -67,7 +67,7 @@ IsWhitelistedH264Codec(const nsAString& aCodec)
/* static */
bool
MP4Decoder::IsSupportedType(const MediaContentType& aType,
MP4Decoder::IsSupportedType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
if (!IsEnabled()) {
@ -96,12 +96,12 @@ MP4Decoder::IsSupportedType(const MediaContentType& aType,
// No codecs specified. Assume H.264
if (isAudio) {
trackInfos.AppendElement(
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
} else {
MOZ_ASSERT(isVideo);
trackInfos.AppendElement(
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("video/avc"), aType));
}
} else {
@ -110,25 +110,25 @@ MP4Decoder::IsSupportedType(const MediaContentType& aType,
for (const auto& codec : aType.ExtendedType().Codecs().Range()) {
if (IsAACCodecString(codec)) {
trackInfos.AppendElement(
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
continue;
}
if (codec.EqualsLiteral("mp3")) {
trackInfos.AppendElement(
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("audio/mpeg"), aType));
continue;
}
if (codec.EqualsLiteral("opus")) {
trackInfos.AppendElement(
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("audio/opus"), aType));
continue;
}
if (codec.EqualsLiteral("flac")) {
trackInfos.AppendElement(
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("audio/flac"), aType));
continue;
}
@ -136,7 +136,7 @@ MP4Decoder::IsSupportedType(const MediaContentType& aType,
// content type.
if (IsWhitelistedH264Codec(codec) && isVideo) {
trackInfos.AppendElement(
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("video/avc"), aType));
continue;
}

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

@ -13,7 +13,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
// Decoder that uses a bundled MP4 demuxer and platform decoders to play MP4.
class MP4Decoder : public MediaDecoder
@ -30,10 +30,10 @@ public:
MediaDecoderStateMachine* CreateStateMachine() override;
// Returns true if aContentType is an MP4 type that we think we can render
// Returns true if aContainerType is an MP4 type that we think we can render
// with the a platform decoder backend.
// If provided, codecs are checked for support.
static bool IsSupportedType(const MediaContentType& aContentType,
static bool IsSupportedType(const MediaContainerType& aContainerType,
DecoderDoctorDiagnostics* aDiagnostics);
// Return true if aMimeType is a one of the strings used by our demuxers to

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

@ -7,7 +7,7 @@
#include "Benchmark.h"
#include "MockMediaResource.h"
#include "DecoderTraits.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MP4Decoder.h"
#include "MP4Demuxer.h"
#include "WebMDecoder.h"
@ -46,7 +46,7 @@ private:
TEST(MediaDataDecoder, H264)
{
if (!DecoderTraits::IsMP4SupportedType(
MediaContentType(MEDIAMIMETYPE("video/mp4")),
MediaContainerType(MEDIAMIMETYPE("video/mp4")),
/* DecoderDoctorDiagnostics* */ nullptr)) {
EXPECT_TRUE(true);
} else {
@ -62,7 +62,7 @@ TEST(MediaDataDecoder, H264)
TEST(MediaDataDecoder, VP9)
{
if (!WebMDecoder::IsSupportedType(MediaContentType(MEDIAMIMETYPE("video/webm")))) {
if (!WebMDecoder::IsSupportedType(MediaContainerType(MEDIAMIMETYPE("video/webm")))) {
EXPECT_TRUE(true);
} else {
RefPtr<MediaResource> resource =

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

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gtest/gtest.h"
#include "MediaContentType.h"
#include "MediaMIMETypes.h"
using namespace mozilla;

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

@ -10,7 +10,7 @@
#include "DecoderTraits.h"
#include "Benchmark.h"
#include "DecoderDoctorDiagnostics.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaResult.h"
#include "MediaSourceUtils.h"
#include "SourceBuffer.h"
@ -72,7 +72,7 @@ static bool
IsWebMForced(DecoderDoctorDiagnostics* aDiagnostics)
{
bool mp4supported =
DecoderTraits::IsMP4SupportedType(MediaContentType(MEDIAMIMETYPE("video/mp4")),
DecoderTraits::IsMP4SupportedType(MediaContainerType(MEDIAMIMETYPE("video/mp4")),
aDiagnostics);
bool hwsupported = gfx::gfxVars::CanUseHardwareVideoDecoding();
#ifdef MOZ_WIDGET_ANDROID
@ -93,19 +93,19 @@ MediaSource::IsTypeSupported(const nsAString& aType, DecoderDoctorDiagnostics* a
return NS_ERROR_DOM_TYPE_ERR;
}
Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
if (!contentType) {
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
if (!containerType) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
if (DecoderTraits::CanHandleContentType(*contentType, aDiagnostics)
if (DecoderTraits::CanHandleContainerType(*containerType, aDiagnostics)
== CANPLAY_NO) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
// Now we know that this media type could be played.
// MediaSource imposes extra restrictions, and some prefs.
const MediaMIMEType& mimeType = contentType->Type();
const MediaMIMEType& mimeType = containerType->Type();
if (mimeType == MEDIAMIMETYPE("video/mp4") ||
mimeType == MEDIAMIMETYPE("audio/mp4")) {
if (!Preferences::GetBool("media.mediasource.mp4.enabled", false)) {
@ -238,12 +238,12 @@ MediaSource::AddSourceBuffer(const nsAString& aType, ErrorResult& aRv)
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
if (!contentType) {
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
if (!containerType) {
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return nullptr;
}
const nsACString& mimeType = contentType->Type().AsString();
const nsACString& mimeType = containerType->Type().AsString();
RefPtr<SourceBuffer> sourceBuffer = new SourceBuffer(this, mimeType);
if (!sourceBuffer) {
aRv.Throw(NS_ERROR_FAILURE); // XXX need a better error here

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

@ -100,7 +100,7 @@ EXPORTS += [
'Intervals.h',
'Latency.h',
'MediaCache.h',
'MediaContentType.h',
'MediaContainerType.h',
'MediaData.h',
'MediaDataDemuxer.h',
'MediaDecoder.h',
@ -208,7 +208,7 @@ UNIFIED_SOURCES += [
'GraphDriver.cpp',
'Latency.cpp',
'MediaCache.cpp',
'MediaContentType.cpp',
'MediaContainerType.cpp',
'MediaData.cpp',
'MediaDecoder.cpp',
'MediaDecoderReader.cpp',

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

@ -5,12 +5,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaPrefs.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "OggDemuxer.h"
#include "OggDecoder.h"
#include "nsContentTypeParser.h"
namespace mozilla {
@ -26,21 +25,21 @@ MediaDecoderStateMachine* OggDecoder::CreateStateMachine()
/* static */
bool
OggDecoder::IsSupportedType(const MediaContentType& aContentType)
OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
if (!MediaPrefs::OggEnabled()) {
return false;
}
if (aContentType.Type() != MEDIAMIMETYPE("audio/ogg") &&
aContentType.Type() != MEDIAMIMETYPE("video/ogg") &&
aContentType.Type() != MEDIAMIMETYPE("application/ogg")) {
if (aContainerType.Type() != MEDIAMIMETYPE("audio/ogg") &&
aContainerType.Type() != MEDIAMIMETYPE("video/ogg") &&
aContainerType.Type() != MEDIAMIMETYPE("application/ogg")) {
return false;
}
const bool isOggVideo = (aContentType.Type() != MEDIAMIMETYPE("audio/ogg"));
const bool isOggVideo = (aContainerType.Type() != MEDIAMIMETYPE("audio/ogg"));
const MediaCodecs& codecs = aContentType.ExtendedType().Codecs();
const MediaCodecs& codecs = aContainerType.ExtendedType().Codecs();
if (codecs.IsEmpty()) {
// WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
return true;
@ -53,8 +52,8 @@ OggDecoder::IsSupportedType(const MediaContentType& aContentType)
(MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
continue;
}
// Note: Only accept Theora in a video content type, not in an audio
// content type.
// Note: Only accept Theora in a video container type, not in an audio
// container type.
if (isOggVideo && codec.EqualsLiteral("theora")) {
continue;
}

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

@ -10,7 +10,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
class OggDecoder : public MediaDecoder
{
@ -39,10 +39,10 @@ public:
return mShutdownBit;
}
// Returns true if aContentType is an Ogg type that we think we can render
// Returns true if aContainerType is an Ogg type that we think we can render
// with an enabled platform decoder backend.
// If provided, codecs are checked for support.
static bool IsSupportedType(const MediaContentType& aContentType);
static bool IsSupportedType(const MediaContainerType& aContainerType);
protected:
void ShutdownBitChanged() override

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

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WaveDemuxer.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "WaveDecoder.h"
#include "MediaFormatReader.h"
@ -27,19 +27,19 @@ WaveDecoder::CreateStateMachine()
}
/* static */ bool
WaveDecoder::IsSupportedType(const MediaContentType& aContentType)
WaveDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
if (!IsWaveEnabled()) {
return false;
}
if (aContentType.Type() == MEDIAMIMETYPE("audio/wave")
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-wav")
|| aContentType.Type() == MEDIAMIMETYPE("audio/wav")
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-pn-wav")) {
return (aContentType.ExtendedType().Codecs().IsEmpty()
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("1")
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("6")
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("7"));
if (aContainerType.Type() == MEDIAMIMETYPE("audio/wave")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-wav")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/wav")
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-pn-wav")) {
return (aContainerType.ExtendedType().Codecs().IsEmpty()
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("1")
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("6")
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("7"));
}
return false;

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

@ -10,7 +10,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
class WaveDecoder : public MediaDecoder
{
@ -22,7 +22,7 @@ public:
// Returns true if the Wave backend is pref'ed on, and we're running on a
// platform that is likely to have decoders for the format.
static bool IsSupportedType(const MediaContentType& aContentType);
static bool IsSupportedType(const MediaContainerType& aContainerType);
};
} // namespace mozilla

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

@ -18,7 +18,7 @@
#include "DecoderTraits.h"
#include "AudioContext.h"
#include "AudioBuffer.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "nsContentUtils.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptError.h"
@ -78,10 +78,10 @@ enum class PhaseEnum : int
class MediaDecodeTask final : public Runnable
{
public:
MediaDecodeTask(const MediaContentType& aContentType, uint8_t* aBuffer,
MediaDecodeTask(const MediaContainerType& aContainerType, uint8_t* aBuffer,
uint32_t aLength,
WebAudioDecodeJob& aDecodeJob)
: mContentType(aContentType)
: mContainerType(aContainerType)
, mBuffer(aBuffer)
, mLength(aLength)
, mDecodeJob(aDecodeJob)
@ -132,7 +132,7 @@ private:
}
private:
MediaContentType mContentType;
MediaContainerType mContainerType;
uint8_t* mBuffer;
uint32_t mLength;
WebAudioDecodeJob& mDecodeJob;
@ -195,7 +195,7 @@ MediaDecodeTask::CreateReader()
RefPtr<BufferMediaResource> resource =
new BufferMediaResource(static_cast<uint8_t*> (mBuffer),
mLength, principal, mContentType.Type().AsString());
mLength, principal, mContainerType.Type().AsString());
MOZ_ASSERT(!mBufferDecoder);
mBufferDecoder = new BufferDecoder(resource,
@ -204,7 +204,7 @@ MediaDecodeTask::CreateReader()
// If you change this list to add support for new decoders, please consider
// updating HTMLMediaElement::CreateDecoder as well.
mDecoderReader = DecoderTraits::CreateReader(mContentType, mBufferDecoder);
mDecoderReader = DecoderTraits::CreateReader(mContainerType, mBufferDecoder);
if (!mDecoderReader) {
return false;
@ -276,7 +276,7 @@ MediaDecodeTask::OnMetadataRead(MetadataHolder* aMetadata)
codec = nsPrintfCString("webaudio; %s", mMediaInfo.mAudio.GetAsAudioInfo()->mMimeType.get());
} else {
codec = nsPrintfCString("webaudio;resource; %s",
mContentType.Type().AsString().Data());
mContainerType.Type().AsString().Data());
}
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([codec]() -> void {
@ -482,12 +482,12 @@ void
AsyncDecodeWebAudio(const char* aContentType, uint8_t* aBuffer,
uint32_t aLength, WebAudioDecodeJob& aDecodeJob)
{
Maybe<MediaContentType> contentType = MakeMediaContentType(aContentType);
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aContentType);
// Do not attempt to decode the media if we were not successful at sniffing
// the content type.
// the container type.
if (!*aContentType ||
strcmp(aContentType, APPLICATION_OCTET_STREAM) == 0 ||
!contentType) {
!containerType) {
nsCOMPtr<nsIRunnable> event =
new ReportResultTask(aDecodeJob,
&WebAudioDecodeJob::OnFailure,
@ -498,7 +498,7 @@ AsyncDecodeWebAudio(const char* aContentType, uint8_t* aBuffer,
}
RefPtr<MediaDecodeTask> task =
new MediaDecodeTask(*contentType, aBuffer, aLength, aDecodeJob);
new MediaDecodeTask(*containerType, aBuffer, aLength, aDecodeJob);
if (!task->CreateReader()) {
nsCOMPtr<nsIRunnable> event =
new ReportResultTask(aDecodeJob,

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

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Preferences.h"
#include "MediaContentType.h"
#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "WebMDemuxer.h"
#include "WebMDecoder.h"
@ -22,18 +22,18 @@ MediaDecoderStateMachine* WebMDecoder::CreateStateMachine()
/* static */
bool
WebMDecoder::IsSupportedType(const MediaContentType& aContentType)
WebMDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
if (!Preferences::GetBool("media.webm.enabled")) {
return false;
}
bool isVideo = aContentType.Type() == MEDIAMIMETYPE("video/webm");
if (aContentType.Type() != MEDIAMIMETYPE("audio/webm") && !isVideo) {
bool isVideo = aContainerType.Type() == MEDIAMIMETYPE("video/webm");
if (aContainerType.Type() != MEDIAMIMETYPE("audio/webm") && !isVideo) {
return false;
}
const MediaCodecs& codecs = aContentType.ExtendedType().Codecs();
const MediaCodecs& codecs = aContainerType.ExtendedType().Codecs();
if (codecs.IsEmpty()) {
// WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
return true;
@ -44,8 +44,8 @@ WebMDecoder::IsSupportedType(const MediaContentType& aContentType)
if (codec.EqualsLiteral("opus") || codec.EqualsLiteral("vorbis")) {
continue;
}
// Note: Only accept VP8/VP9 in a video content type, not in an audio
// content type.
// Note: Only accept VP8/VP9 in a video container type, not in an audio
// container type.
if (isVideo &&
(codec.EqualsLiteral("vp8") || codec.EqualsLiteral("vp8.0") ||
codec.EqualsLiteral("vp9") || codec.EqualsLiteral("vp9.0"))) {

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

@ -11,7 +11,7 @@
namespace mozilla {
class MediaContentType;
class MediaContainerType;
class WebMDecoder : public MediaDecoder
{
@ -25,10 +25,10 @@ public:
}
MediaDecoderStateMachine* CreateStateMachine() override;
// Returns true if aContentType is a WebM type that we think we can render
// Returns true if aContainerType is a WebM type that we think we can render
// with an enabled platform decoder backend.
// If provided, codecs are checked for support.
static bool IsSupportedType(const MediaContentType& aContentType);
static bool IsSupportedType(const MediaContainerType& aContainerType);
void GetMozDebugReaderData(nsAString& aString) override;