--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -90,17 +90,17 @@
#include "mozilla/dom/MediaErrorBinding.h"
#include "mozilla/dom/VideoTrack.h"
#include "mozilla/dom/VideoTrackList.h"
#include "mozilla/dom/TextTrack.h"
#include "nsIContentPolicy.h"
#include "mozilla/Telemetry.h"
#include "DecoderDoctorDiagnostics.h"
#include "DecoderTraits.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "ImageContainer.h"
#include "nsRange.h"
#include <algorithm>
#include <cmath>
static mozilla::LazyLogModule gMediaElementLog("nsMediaElement");
static mozilla::LazyLogModule gMediaElementEventsLog("nsMediaElementEvents");
@@ -4468,21 +4468,21 @@ void HTMLMediaElement::UnbindFromTree(bo
RunInStableState(task);
}
/* static */
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
HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult)
{
DecoderDoctorDiagnostics diagnostics;
CanPlayStatus canPlay = GetCanPlay(aType, &diagnostics);
diagnostics.StoreFormatDiagnostics(
--- a/dom/media/ADTSDecoder.cpp
+++ b/dom/media/ADTSDecoder.cpp
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "ADTSDecoder.h"
#include "ADTSDemuxer.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "PDMFactory.h"
namespace mozilla {
MediaDecoder*
ADTSDecoder::Clone(MediaDecoderOwner* aOwner)
@@ -34,23 +34,23 @@ ADTSDecoder::CreateStateMachine()
ADTSDecoder::IsEnabled()
{
RefPtr<PDMFactory> platform = new PDMFactory();
return platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/mp4a-latm"),
/* DecoderDoctorDiagnostics* */ nullptr);
}
/* 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;
}
} // namespace mozilla
--- a/dom/media/ADTSDecoder.h
+++ b/dom/media/ADTSDecoder.h
@@ -6,27 +6,27 @@
#ifndef ADTS_DECODER_H_
#define ADTS_DECODER_H_
#include "MediaDecoder.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
class ADTSDecoder : public MediaDecoder
{
public:
// MediaDecoder interface.
explicit ADTSDecoder(MediaDecoderOwner* aOwner) : MediaDecoder(aOwner) {}
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override;
MediaDecoderStateMachine* CreateStateMachine() override;
// 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
#endif // !ADTS_DECODER_H_
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "DecoderTraits.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaDecoder.h"
#include "nsMimeTypes.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "OggDecoder.h"
#include "OggDemuxer.h"
@@ -46,73 +46,73 @@
#include "nsPluginHost.h"
#include "MediaPrefs.h"
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
aType.Type() == MEDIAMIMETYPE("application/vnd.apple.mpegurl")
// Some sites serve these as the informal m3u type.
|| aType.Type() == MEDIAMIMETYPE("application/x-mpegurl")
|| aType.Type() == MEDIAMIMETYPE("audio/x-mpegurl");
}
#ifdef MOZ_ANDROID_OMX
static bool
-IsAndroidMediaType(const MediaContentType& aType)
+IsAndroidMediaType(const MediaContainerType& aType)
{
if (!MediaDecoder::IsAndroidMediaPluginEnabled()) {
return false;
}
return aType.Type() == MEDIAMIMETYPE("audio/mpeg")
|| aType.Type() == MEDIAMIMETYPE("audio/mp4")
|| aType.Type() == MEDIAMIMETYPE("video/mp4")
|| aType.Type() == MEDIAMIMETYPE("video/x-m4v");
}
#endif
/* static */ bool
-DecoderTraits::IsMP4SupportedType(const MediaContentType& aType,
+DecoderTraits::IsMP4SupportedType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
#ifdef MOZ_FMP4
return MP4Decoder::IsSupportedType(aType, aDiagnostics);
#else
return false;
#endif
}
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)) {
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 (WaveDecoder::IsSupportedType(MediaContentType(mimeType))) {
+ if (WaveDecoder::IsSupportedType(MediaContainerType(mimeType))) {
if (WaveDecoder::IsSupportedType(aType)) {
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;
}
}
@@ -167,34 +167,34 @@ CanHandleCodecsType(const MediaContentTy
return CANPLAY_NO;
}
return CANPLAY_YES;
}
static
CanPlayStatus
-CanHandleMediaType(const MediaContentType& aType,
+CanHandleMediaType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
MOZ_ASSERT(NS_IsMainThread());
if (IsHttpLiveStreamingType(aType)) {
Telemetry::Accumulate(Telemetry::MEDIA_HLS_CANPLAY_REQUESTED, true);
}
if (aType.ExtendedType().HaveCodecs()) {
CanPlayStatus result = CanHandleCodecsType(aType, aDiagnostics);
if (result == CANPLAY_NO || result == CANPLAY_YES) {
return result;
}
}
- // 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;
}
if (WaveDecoder::IsSupportedType(mimeType)) {
return CANPLAY_MAYBE;
}
#ifdef MOZ_FMP4
@@ -227,58 +227,58 @@ CanHandleMediaType(const MediaContentTyp
return CANPLAY_MAYBE;
}
#endif
return CANPLAY_NO;
}
/* static */
CanPlayStatus
-DecoderTraits::CanHandleContentType(const MediaContentType& aContentType,
- DecoderDoctorDiagnostics* aDiagnostics)
+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.
// Furthermore people can play Wave files on most platforms by other
// means.
return false;
}
// 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)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<MediaDecoder> decoder;
#ifdef MOZ_FMP4
if (MP4Decoder::IsSupportedType(aType, aDiagnostics)) {
@@ -338,26 +338,26 @@ InstantiateDecoder(const MediaContentTyp
/* static */
already_AddRefed<MediaDecoder>
DecoderTraits::CreateDecoder(const nsACString& aType,
MediaDecoderOwner* aOwner,
DecoderDoctorDiagnostics* aDiagnostics)
{
MOZ_ASSERT(NS_IsMainThread());
- Maybe<MediaContentType> type = MakeMediaContentType(aType);
+ Maybe<MediaContainerType> type = MakeMediaContainerType(aType);
if (!type) {
return nullptr;
}
return InstantiateDecoder(*type, aOwner, aDiagnostics);
}
/* static */
MediaDecoderReader*
-DecoderTraits::CreateReader(const MediaContentType& aType,
+DecoderTraits::CreateReader(const MediaContainerType& aType,
AbstractMediaDecoder* aDecoder)
{
MOZ_ASSERT(NS_IsMainThread());
MediaDecoderReader* decoderReader = nullptr;
if (!aDecoder) {
return decoderReader;
}
@@ -409,17 +409,17 @@ bool DecoderTraits::IsSupportedInVideoDo
// Forbid playing media in video documents if the user has opted
// not to, using either the legacy WMF specific pref, or the newer
// catch-all pref.
if (!Preferences::GetBool("media.windows-media-foundation.play-stand-alone", true) ||
!Preferences::GetBool("media.play-stand-alone", true)) {
return false;
}
- Maybe<MediaContentType> type = MakeMediaContentType(aType);
+ Maybe<MediaContainerType> type = MakeMediaContainerType(aType);
if (!type) {
return false;
}
return
OggDecoder::IsSupportedType(*type) ||
WebMDecoder::IsSupportedType(*type) ||
#ifdef MOZ_ANDROID_OMX
--- a/dom/media/DecoderTraits.h
+++ b/dom/media/DecoderTraits.h
@@ -11,58 +11,58 @@
class nsAString;
class nsACString;
namespace mozilla {
class AbstractMediaDecoder;
class DecoderDoctorDiagnostics;
-class MediaContentType;
+class MediaContainerType;
class MediaDecoder;
class MediaDecoderOwner;
class MediaDecoderReader;
enum CanPlayStatus {
CANPLAY_NO,
CANPLAY_MAYBE,
CANPLAY_YES
};
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 container type.
+ static CanPlayStatus CanHandleContainerType(const MediaContainerType& aContainerType,
+ 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
// were unable to create the decoder.
static already_AddRefed<MediaDecoder> CreateDecoder(const nsACString& aType,
MediaDecoderOwner* aOwner,
DecoderDoctorDiagnostics* aDiagnostics);
// 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,
// or false otherwise. Not all platforms support all MIME types, and
// vice versa.
static bool IsSupportedInVideoDocument(const nsACString& aType);
// 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);
};
} // namespace mozilla
#endif
--- a/dom/media/MP3Decoder.cpp
+++ b/dom/media/MP3Decoder.cpp
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "MP3Decoder.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "MP3Demuxer.h"
#include "PDMFactory.h"
namespace mozilla {
MediaDecoder*
@@ -33,21 +33,21 @@ MP3Decoder::CreateStateMachine() {
bool
MP3Decoder::IsEnabled() {
RefPtr<PDMFactory> platform = new PDMFactory();
return platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/mpeg"),
/* DecoderDoctorDiagnostics* */ nullptr);
}
/* 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;
}
} // namespace mozilla
--- a/dom/media/MP3Decoder.h
+++ b/dom/media/MP3Decoder.h
@@ -5,27 +5,27 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MP3Decoder_h_
#define MP3Decoder_h_
#include "MediaDecoder.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
class MP3Decoder : public MediaDecoder
{
public:
// MediaDecoder interface.
explicit MP3Decoder(MediaDecoderOwner* aOwner) : MediaDecoder(aOwner) {}
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override;
MediaDecoderStateMachine* CreateStateMachine() override;
// 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
#endif
rename from dom/media/MediaContentType.cpp
rename to dom/media/MediaContainerType.cpp
--- a/dom/media/MediaContentType.cpp
+++ b/dom/media/MediaContainerType.cpp
@@ -1,44 +1,42 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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
rename from dom/media/MediaContentType.h
rename to dom/media/MediaContainerType.h
--- a/dom/media/MediaContentType.h
+++ b/dom/media/MediaContainerType.h
@@ -1,38 +1,38 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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"
#include "nsString.h"
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))
{
}
const MediaMIMEType& Type() const { return mExtendedMIMEType.Type(); }
const MediaExtendedMIMEType& ExtendedType() const { return mExtendedMIMEType; }
// Original string. Note that "type/subtype" may not be lowercase,
@@ -40,15 +40,15 @@ public:
const nsACString& OriginalString() const { return mExtendedMIMEType.OriginalString(); }
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
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_
--- a/dom/media/VideoUtils.cpp
+++ b/dom/media/VideoUtils.cpp
@@ -3,17 +3,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "VideoUtils.h"
#include "mozilla/Base64.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/Telemetry.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaPrefs.h"
#include "MediaResource.h"
#include "TimeUnits.h"
#include "nsMathUtils.h"
#include "nsSize.h"
#include "VorbisUtils.h"
#include "ImageContainer.h"
#include "mozilla/SharedThreadPool.h"
@@ -497,29 +497,29 @@ CreateTrackInfoWithMIMEType(const nsACSt
} else if (StartsWith(aCodecMIMEType, "video/")) {
trackInfo.reset(new VideoInfo());
trackInfo->mMimeType = aCodecMIMEType;
}
return trackInfo;
}
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;
}
}
}
return trackInfo;
}
--- a/dom/media/VideoUtils.h
+++ b/dom/media/VideoUtils.h
@@ -36,17 +36,17 @@ using mozilla::CheckedUint32;
// dependent on other changes which we don't want to wait for. We plan to
// remove this file in the near future.
// This belongs in xpcom/monitor/Monitor.h, once we've made
// mozilla::Monitor non-reentrant.
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
// EME Key System String.
extern const nsLiteralCString kEMEKeySystemClearkey;
extern const nsLiteralCString kEMEKeySystemWidevine;
extern const nsLiteralCString kEMEKeySystemPrimetime;
/**
* ReentrantMonitorConditionallyEnter
@@ -351,21 +351,21 @@ IsVP8CodecString(const nsAString& aCodec
bool
IsVP9CodecString(const nsAString& aCodec);
// Try and create a TrackInfo with a given codec MIME type.
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 {
// aString should start with aMajor + '/'.
constexpr bool
StartsWithMIMETypeMajor(const char* aString,
const char* aMajor, size_t aMajorRemaining)
{
--- a/dom/media/android/AndroidMediaDecoder.cpp
+++ b/dom/media/android/AndroidMediaDecoder.cpp
@@ -6,17 +6,17 @@
#include "MediaDecoderStateMachine.h"
#include "AndroidMediaDecoder.h"
#include "AndroidMediaReader.h"
namespace mozilla {
AndroidMediaDecoder::AndroidMediaDecoder(MediaDecoderOwner* aOwner,
- const MediaContentType& aType)
+ const MediaContainerType& aType)
: MediaDecoder(aOwner), mType(aType)
{
}
MediaDecoderStateMachine* AndroidMediaDecoder::CreateStateMachine()
{
return new MediaDecoderStateMachine(this, new AndroidMediaReader(this, mType));
}
--- a/dom/media/android/AndroidMediaDecoder.h
+++ b/dom/media/android/AndroidMediaDecoder.h
@@ -3,25 +3,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#if !defined(AndroidMediaDecoder_h_)
#define AndroidMediaDecoder_h_
#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);
}
MediaDecoderStateMachine* CreateStateMachine() override;
};
} // namespace mozilla
--- a/dom/media/android/AndroidMediaPluginHost.cpp
+++ b/dom/media/android/AndroidMediaPluginHost.cpp
@@ -1,15 +1,15 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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"
#include "AndroidMediaPluginHost.h"
#include "nsAutoPtr.h"
#include "nsXPCOMStrings.h"
#include "nsISeekableStream.h"
#include "nsIGfxInfo.h"
@@ -222,17 +222,17 @@ AndroidMediaPluginHost::AndroidMediaPlug
}
}
AndroidMediaPluginHost::~AndroidMediaPluginHost() {
mResourceServer->Stop();
MOZ_COUNT_DTOR(AndroidMediaPluginHost);
}
-bool AndroidMediaPluginHost::FindDecoder(const MediaContentType& aMimeType,
+bool AndroidMediaPluginHost::FindDecoder(const MediaContainerType& aMimeType,
MediaCodecs* aCodecs)
{
const char *chars;
size_t len = NS_CStringGetData(aMimeType.Type().AsString(), &chars, nullptr);
for (size_t n = 0; n < mPlugins.Length(); ++n) {
Manifest *plugin = mPlugins[n];
const char* const *codecs;
if (plugin->CanDecode(chars, len, &codecs)) {
@@ -248,17 +248,17 @@ bool AndroidMediaPluginHost::FindDecoder
}
return true;
}
}
return false;
}
MPAPI::Decoder *AndroidMediaPluginHost::CreateDecoder(MediaResource *aResource,
- const MediaContentType& aMimeType)
+ const MediaContainerType& aMimeType)
{
NS_ENSURE_TRUE(aResource, nullptr);
nsAutoPtr<Decoder> decoder(new Decoder());
if (!decoder) {
return nullptr;
}
--- a/dom/media/android/AndroidMediaPluginHost.h
+++ b/dom/media/android/AndroidMediaPluginHost.h
@@ -8,32 +8,32 @@
#include "nsTArray.h"
#include "MediaResource.h"
#include "MPAPI.h"
#include "AndroidMediaResourceServer.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
class MediaCodecs;
class AndroidMediaPluginHost {
RefPtr<AndroidMediaResourceServer> mResourceServer;
nsTArray<MPAPI::Manifest *> mPlugins;
MPAPI::Manifest *FindPlugin(const nsACString& aMimeType);
public:
AndroidMediaPluginHost();
~AndroidMediaPluginHost();
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);
};
// Must be called on the main thread. Creates the plugin host if it doesn't
// already exist.
AndroidMediaPluginHost *EnsureAndroidMediaPluginHost();
// May be called on any thread after EnsureAndroidMediaPluginHost has been called.
--- a/dom/media/android/AndroidMediaReader.cpp
+++ b/dom/media/android/AndroidMediaReader.cpp
@@ -20,19 +20,19 @@ namespace mozilla {
using namespace mozilla::gfx;
using namespace mozilla::media;
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),
mVideoSeekTimeUs(-1),
mAudioSeekTimeUs(-1)
{
}
--- a/dom/media/android/AndroidMediaReader.h
+++ b/dom/media/android/AndroidMediaReader.h
@@ -2,17 +2,17 @@
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#if !defined(AndroidMediaReader_h_)
#define AndroidMediaReader_h_
#include "ImageContainer.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaDecoderReader.h"
#include "MediaResource.h"
#include "mozilla/Attributes.h"
#include "mozilla/layers/SharedRGBImage.h"
#include "MPAPI.h"
namespace mozilla {
@@ -20,30 +20,30 @@ namespace mozilla {
class AbstractMediaDecoder;
namespace layers {
class ImageContainer;
}
class AndroidMediaReader : public MediaDecoderReader
{
- MediaContentType mType;
+ MediaContainerType mType;
MPAPI::Decoder *mPlugin;
bool mHasAudio;
bool mHasVideo;
nsIntRect mPicture;
nsIntSize mInitialFrame;
int64_t mVideoSeekTimeUs;
int64_t mAudioSeekTimeUs;
RefPtr<VideoData> mLastVideoFrame;
MozPromiseHolder<MediaDecoderReader::SeekPromise> mSeekPromise;
MozPromiseRequestHolder<MediaDecoderReader::MediaDataPromise> mSeekRequest;
public:
AndroidMediaReader(AbstractMediaDecoder* aDecoder,
- const MediaContentType& aContentType);
+ const MediaContainerType& aContainerType);
nsresult ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
TrackInfo::kVideoTrack)) override;
bool DecodeAudioData() override;
bool DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) override;
nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) override;
--- a/dom/media/directshow/DirectShowDecoder.cpp
+++ b/dom/media/directshow/DirectShowDecoder.cpp
@@ -2,31 +2,31 @@
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "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"
namespace mozilla {
MediaDecoderStateMachine* DirectShowDecoder::CreateStateMachine()
{
return new MediaDecoderStateMachine(this, new DirectShowReader(this));
}
/* static */
bool
-DirectShowDecoder::GetSupportedCodecs(const MediaContentType& aType,
+DirectShowDecoder::GetSupportedCodecs(const MediaContainerType& aType,
MediaCodecs* aOutCodecs)
{
if (!IsEnabled()) {
return false;
}
if (aType.Type() == MEDIAMIMETYPE("audio/mpeg")
|| aType.Type() == MEDIAMIMETYPE("audio/mp3")) {
--- a/dom/media/directshow/DirectShowDecoder.h
+++ b/dom/media/directshow/DirectShowDecoder.h
@@ -7,17 +7,17 @@
#if !defined(DirectShowDecoder_h_)
#define DirectShowDecoder_h_
#include "MediaDecoder.h"
namespace mozilla {
class MediaCodecs;
-class MediaContentType;
+class MediaContainerType;
// Decoder that uses DirectShow to playback MP3 files only.
class DirectShowDecoder : public MediaDecoder
{
public:
explicit DirectShowDecoder(MediaDecoderOwner* aOwner);
virtual ~DirectShowDecoder();
@@ -31,17 +31,17 @@ public:
MediaDecoderStateMachine* CreateStateMachine() override;
// Returns true if aType is a MIME type that we render with the
// DirectShow backend. If aCodecList is non null,
// 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.
static bool IsEnabled();
};
} // namespace mozilla
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -2,17 +2,17 @@
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/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"
#endif
#ifdef XP_WIN
#include "WMFDecoderModule.h"
#endif
#include "nsContentCID.h"
@@ -596,31 +596,31 @@ GetSupportedCapabilities(const CodecType
"audio or video capability has empty contentType.",
NS_ConvertUTF16toUTF8(aPartialConfig.mLabel).get(),
NS_ConvertUTF16toUTF8(contentTypeString).get(),
NS_ConvertUTF16toUTF8(robustness).get());
return Sequence<MediaKeySystemMediaCapability>();
}
// 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;
EME_LOG("MediaKeySystemConfiguration (label='%s') "
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
"'%s' is an invalid codec string.",
NS_ConvertUTF16toUTF8(aPartialConfig.mLabel).get(),
NS_ConvertUTF16toUTF8(contentTypeString).get(),
@@ -635,27 +635,27 @@ GetSupportedCapabilities(const CodecType
}
// If the user agent does not support container, continue to the next iteration.
// The case-sensitivity of string comparisons is determined by the appropriate RFC.
// (Note: Per RFC 6838 [RFC6838], "Both top-level type and subtype names are
// 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; "
"MP4 requested but unsupported.",
NS_ConvertUTF16toUTF8(aPartialConfig.mLabel).get(),
NS_ConvertUTF16toUTF8(contentTypeString).get(),
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; "
"WebM requested but unsupported.",
NS_ConvertUTF16toUTF8(aPartialConfig.mLabel).get(),
NS_ConvertUTF16toUTF8(contentTypeString).get(),
NS_ConvertUTF16toUTF8(robustness).get());
continue;
@@ -699,18 +699,18 @@ GetSupportedCapabilities(const CodecType
} else if (aCodecType == Video) {
codecs.AppendElement(EME_CODEC_VP8);
}
}
// Otherwise: Continue to the next iteration.
// (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; "
"MIME type is not an audio or video MIME type.",
NS_ConvertUTF16toUTF8(aPartialConfig.mLabel).get(),
NS_ConvertUTF16toUTF8(contentTypeString).get(),
NS_ConvertUTF16toUTF8(robustness).get());
continue;
--- a/dom/media/flac/FlacDecoder.cpp
+++ b/dom/media/flac/FlacDecoder.cpp
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "FlacDecoder.h"
#include "FlacDemuxer.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MediaFormatReader.h"
#include "MediaPrefs.h"
namespace mozilla {
MediaDecoder*
FlacDecoder::Clone(MediaDecoderOwner* aOwner)
@@ -38,17 +38,17 @@ FlacDecoder::IsEnabled()
return MediaPrefs::FlacEnabled();
#else
// Until bug 1295886 is fixed.
return false;
#endif
}
/* 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
--- a/dom/media/flac/FlacDecoder.h
+++ b/dom/media/flac/FlacDecoder.h
@@ -6,27 +6,27 @@
#ifndef FLAC_DECODER_H_
#define FLAC_DECODER_H_
#include "MediaDecoder.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
class FlacDecoder : public MediaDecoder
{
public:
// MediaDecoder interface.
explicit FlacDecoder(MediaDecoderOwner* aOwner) : MediaDecoder(aOwner) {}
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override;
MediaDecoderStateMachine* CreateStateMachine() override;
// 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
#endif // !FLAC_DECODER_H_
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "MP4Decoder.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "MP4Demuxer.h"
#include "mozilla/Preferences.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/CDMProxy.h"
#include "mozilla/Logging.h"
#include "mozilla/SharedThreadPool.h"
#include "nsMimeTypes.h"
@@ -62,17 +62,17 @@ IsWhitelistedH264Codec(const nsAString&
(profile == H264_PROFILE_BASE ||
profile == H264_PROFILE_MAIN ||
profile == H264_PROFILE_EXTENDED ||
profile == H264_PROFILE_HIGH);
}
/* static */
bool
-MP4Decoder::IsSupportedType(const MediaContentType& aType,
+MP4Decoder::IsSupportedType(const MediaContainerType& aType,
DecoderDoctorDiagnostics* aDiagnostics)
{
if (!IsEnabled()) {
return false;
}
// Whitelist MP4 types, so they explicitly match what we encounter on
// the web, as opposed to what we use internally (i.e. what our demuxers
@@ -91,57 +91,57 @@ MP4Decoder::IsSupportedType(const MediaC
return false;
}
nsTArray<UniquePtr<TrackInfo>> trackInfos;
if (aType.ExtendedType().Codecs().IsEmpty()) {
// 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 {
// Verify that all the codecs specified are ones that we expect that
// we can play.
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;
}
// Note: Only accept H.264 in a video content type, not in an audio
// content type.
if (IsWhitelistedH264Codec(codec) && isVideo) {
trackInfos.AppendElement(
- CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
+ CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
NS_LITERAL_CSTRING("video/avc"), aType));
continue;
}
// Some unsupported codec.
return false;
}
}
--- a/dom/media/fmp4/MP4Decoder.h
+++ b/dom/media/fmp4/MP4Decoder.h
@@ -8,37 +8,37 @@
#include "MediaDecoder.h"
#include "MediaFormatReader.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/layers/KnowsCompositor.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
// Decoder that uses a bundled MP4 demuxer and platform decoders to play MP4.
class MP4Decoder : public MediaDecoder
{
public:
explicit MP4Decoder(MediaDecoderOwner* aOwner);
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override {
if (!IsEnabled()) {
return nullptr;
}
return new MP4Decoder(aOwner);
}
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
// identify H264. Does not parse general content type strings, i.e. white
// space matters.
static bool IsH264(const nsACString& aMimeType);
// Return true if aMimeType is a one of the strings used by our demuxers to
--- a/dom/media/gtest/TestMediaDataDecoder.cpp
+++ b/dom/media/gtest/TestMediaDataDecoder.cpp
@@ -2,17 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "gtest/gtest.h"
#include "Benchmark.h"
#include "MockMediaResource.h"
#include "DecoderTraits.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MP4Decoder.h"
#include "MP4Demuxer.h"
#include "WebMDecoder.h"
#include "WebMDemuxer.h"
using namespace mozilla;
class BenchmarkRunner
@@ -41,33 +41,33 @@ public:
private:
RefPtr<Benchmark> mBenchmark;
};
TEST(MediaDataDecoder, H264)
{
if (!DecoderTraits::IsMP4SupportedType(
- MediaContentType(MEDIAMIMETYPE("video/mp4")),
+ MediaContainerType(MEDIAMIMETYPE("video/mp4")),
/* DecoderDoctorDiagnostics* */ nullptr)) {
EXPECT_TRUE(true);
} else {
RefPtr<MediaResource> resource =
new MockMediaResource("gizmo.mp4", NS_LITERAL_CSTRING("video/mp4"));
nsresult rv = resource->Open(nullptr);
EXPECT_TRUE(NS_SUCCEEDED(rv));
BenchmarkRunner runner(new Benchmark(new MP4Demuxer(resource)));
EXPECT_GT(runner.Run(), 0u);
}
}
TEST(MediaDataDecoder, VP9)
{
- if (!WebMDecoder::IsSupportedType(MediaContentType(MEDIAMIMETYPE("video/webm")))) {
+ if (!WebMDecoder::IsSupportedType(MediaContainerType(MEDIAMIMETYPE("video/webm")))) {
EXPECT_TRUE(true);
} else {
RefPtr<MediaResource> resource =
new MockMediaResource("vp9cake.webm", NS_LITERAL_CSTRING("video/webm"));
nsresult rv = resource->Open(nullptr);
EXPECT_TRUE(NS_SUCCEEDED(rv));
BenchmarkRunner runner(new Benchmark(new WebMDemuxer(resource)));
--- a/dom/media/gtest/TestMediaMIMETypes.cpp
+++ b/dom/media/gtest/TestMediaMIMETypes.cpp
@@ -1,15 +1,15 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "gtest/gtest.h"
-#include "MediaContentType.h"
+#include "MediaMIMETypes.h"
using namespace mozilla;
TEST(MediaMIMETypes, DependentMIMEType)
{
static const struct
{
const char* mString;
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaSource.h"
#include "AsyncEventRunner.h"
#include "DecoderTraits.h"
#include "Benchmark.h"
#include "DecoderDoctorDiagnostics.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaResult.h"
#include "MediaSourceUtils.h"
#include "SourceBuffer.h"
#include "SourceBufferList.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/BindingDeclarations.h"
@@ -67,17 +67,17 @@ namespace mozilla {
// * N/KN editions (Europe and Korea) of Windows 7/8/8.1/10 without the
// optional "Windows Media Feature Pack"
// 2. If H264 hardware acceleration is not available.
// 3. The CPU is considered to be fast enough
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
return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast() ||
java::HardwareCodecCapabilityUtils::HasHWVP9();
#else
return !mp4supported || !hwsupported || VP9Benchmark::IsVP9DecodeFast();
#endif
@@ -88,29 +88,29 @@ namespace dom {
/* static */
nsresult
MediaSource::IsTypeSupported(const nsAString& aType, DecoderDoctorDiagnostics* aDiagnostics)
{
if (aType.IsEmpty()) {
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)) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
return NS_OK;
}
if (mimeType == MEDIAMIMETYPE("video/webm")) {
@@ -233,22 +233,22 @@ MediaSource::AddSourceBuffer(const nsASt
if (mSourceBuffers->Length() >= MAX_SOURCE_BUFFERS) {
aRv.Throw(NS_ERROR_DOM_QUOTA_EXCEEDED_ERR);
return nullptr;
}
if (mReadyState != MediaSourceReadyState::Open) {
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
return nullptr;
}
mSourceBuffers->Append(sourceBuffer);
MSE_DEBUG("sourceBuffer=%p", sourceBuffer.get());
return sourceBuffer.forget();
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -95,17 +95,17 @@ EXPORTS += [
'DecoderTraits.h',
'DOMMediaStream.h',
'EncodedBufferCache.h',
'FileBlockCache.h',
'FrameStatistics.h',
'Intervals.h',
'Latency.h',
'MediaCache.h',
- 'MediaContentType.h',
+ 'MediaContainerType.h',
'MediaData.h',
'MediaDataDemuxer.h',
'MediaDecoder.h',
'MediaDecoderOwner.h',
'MediaDecoderReader.h',
'MediaDecoderStateMachine.h',
'MediaEventSource.h',
'MediaFormatReader.h',
@@ -203,17 +203,17 @@ UNIFIED_SOURCES += [
'DecoderDoctorDiagnostics.cpp',
'DOMMediaStream.cpp',
'EncodedBufferCache.cpp',
'FileBlockCache.cpp',
'GetUserMediaRequest.cpp',
'GraphDriver.cpp',
'Latency.cpp',
'MediaCache.cpp',
- 'MediaContentType.cpp',
+ 'MediaContainerType.cpp',
'MediaData.cpp',
'MediaDecoder.cpp',
'MediaDecoderReader.cpp',
'MediaDecoderReaderWrapper.cpp',
'MediaDecoderStateMachine.cpp',
'MediaDeviceInfo.cpp',
'MediaDevices.cpp',
'MediaFormatReader.cpp',
--- a/dom/media/ogg/OggDecoder.cpp
+++ b/dom/media/ogg/OggDecoder.cpp
@@ -1,65 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "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 {
MediaDecoderStateMachine* OggDecoder::CreateStateMachine()
{
RefPtr<OggDemuxer> demuxer = new OggDemuxer(GetResource());
RefPtr<MediaFormatReader> reader =
new MediaFormatReader(this, demuxer, GetVideoFrameContainer());
demuxer->SetChainingEvents(&reader->TimedMetadataProducer(),
&reader->MediaNotSeekableProducer());
return new MediaDecoderStateMachine(this, reader);
}
/* 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;
}
// Verify that all the codecs specified are ones that we expect that
// we can play.
for (const auto& codec : codecs.Range()) {
if ((IsOpusEnabled() && codec.EqualsLiteral("opus")) ||
codec.EqualsLiteral("vorbis") ||
(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;
}
// Some unsupported codec.
return false;
}
return true;
}
--- a/dom/media/ogg/OggDecoder.h
+++ b/dom/media/ogg/OggDecoder.h
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if !defined(OggDecoder_h_)
#define OggDecoder_h_
#include "MediaDecoder.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
class OggDecoder : public MediaDecoder
{
public:
explicit OggDecoder(MediaDecoderOwner* aOwner)
: MediaDecoder(aOwner)
, mShutdownBitMonitor("mShutdownBitMonitor")
, mShutdownBit(false)
@@ -34,20 +34,20 @@ public:
// protect the general state with a lock, so we make a special copy and a
// special-purpose lock. This method may be called on any thread.
bool IsOggDecoderShutdown() override
{
MonitorAutoLock lock(mShutdownBitMonitor);
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
{
MonitorAutoLock lock(mShutdownBitMonitor);
mShutdownBit = mStateMachineIsShutdown;
}
--- a/dom/media/wave/WaveDecoder.cpp
+++ b/dom/media/wave/WaveDecoder.cpp
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "WaveDemuxer.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "MediaDecoderStateMachine.h"
#include "WaveDecoder.h"
#include "MediaFormatReader.h"
#include "PDMFactory.h"
namespace mozilla {
MediaDecoder*
@@ -22,27 +22,27 @@ WaveDecoder::Clone(MediaDecoderOwner* aO
MediaDecoderStateMachine*
WaveDecoder::CreateStateMachine()
{
return new MediaDecoderStateMachine(
this, new MediaFormatReader(this, new WAVDemuxer(GetResource())));
}
/* 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;
}
} // namespace mozilla
--- a/dom/media/wave/WaveDecoder.h
+++ b/dom/media/wave/WaveDecoder.h
@@ -5,26 +5,26 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if !defined(WaveDecoder_h_)
#define WaveDecoder_h_
#include "MediaDecoder.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
class WaveDecoder : public MediaDecoder
{
public:
// MediaDecoder interface.
explicit WaveDecoder(MediaDecoderOwner* aOwner) : MediaDecoder(aOwner) {}
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override;
MediaDecoderStateMachine* CreateStateMachine() override;
// 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
#endif
--- a/dom/media/webaudio/MediaBufferDecoder.cpp
+++ b/dom/media/webaudio/MediaBufferDecoder.cpp
@@ -13,17 +13,17 @@
#include <speex/speex_resampler.h>
#include "nsXPCOMCIDInternal.h"
#include "nsComponentManagerUtils.h"
#include "MediaDecoderReader.h"
#include "BufferMediaResource.h"
#include "DecoderTraits.h"
#include "AudioContext.h"
#include "AudioBuffer.h"
-#include "MediaContentType.h"
+#include "MediaContainerType.h"
#include "nsContentUtils.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptError.h"
#include "nsMimeTypes.h"
#include "VideoUtils.h"
#include "WebAudioUtils.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/Telemetry.h"
@@ -73,20 +73,20 @@ enum class PhaseEnum : int
Decode,
AllocateBuffer,
Done
};
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)
, mPhase(PhaseEnum::Decode)
, mFirstFrameDecoded(false)
{
MOZ_ASSERT(aBuffer);
MOZ_ASSERT(NS_IsMainThread());
@@ -127,17 +127,17 @@ private:
// MediaDecoderReader expects that BufferDecoder is alive.
// Destruct MediaDecoderReader first.
mDecoderReader = nullptr;
mBufferDecoder = nullptr;
JS_free(nullptr, mBuffer);
}
private:
- MediaContentType mContentType;
+ MediaContainerType mContainerType;
uint8_t* mBuffer;
uint32_t mLength;
WebAudioDecodeJob& mDecodeJob;
PhaseEnum mPhase;
RefPtr<BufferDecoder> mBufferDecoder;
RefPtr<MediaDecoderReader> mDecoderReader;
MediaInfo mMediaInfo;
MediaQueue<MediaData> mAudioQueue;
@@ -190,26 +190,26 @@ MediaDecodeTask::CreateReader()
nsCOMPtr<nsIPrincipal> principal;
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(mDecodeJob.mContext->GetParentObject());
if (sop) {
principal = sop->GetPrincipal();
}
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,
new BufferDecoderGMPCrashHelper(mDecodeJob.mContext->GetParentObject()));
// 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;
}
nsresult rv = mDecoderReader->Init();
if (NS_FAILED(rv)) {
return false;
@@ -271,17 +271,17 @@ MediaDecodeTask::OnMetadataRead(Metadata
return;
}
nsCString codec;
if (!mMediaInfo.mAudio.GetAsAudioInfo()->mMimeType.IsEmpty()) {
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 {
MOZ_ASSERT(!codec.IsEmpty());
MOZ_LOG(gMediaDecoderLog,
LogLevel::Debug,
("Telemetry (WebAudio) MEDIA_CODEC_USED= '%s'", codec.get()));
Telemetry::Accumulate(Telemetry::ID::MEDIA_CODEC_USED, codec);
@@ -477,33 +477,33 @@ WebAudioDecodeJob::AllocateBuffer()
mBuffer.forget(), rv);
return !rv.Failed();
}
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,
WebAudioDecodeJob::UnknownContent);
JS_free(nullptr, aBuffer);
NS_DispatchToMainThread(event);
return;
}
RefPtr<MediaDecodeTask> task =
- new MediaDecodeTask(*contentType, aBuffer, aLength, aDecodeJob);
+ new MediaDecodeTask(*containerType, aBuffer, aLength, aDecodeJob);
if (!task->CreateReader()) {
nsCOMPtr<nsIRunnable> event =
new ReportResultTask(aDecodeJob,
&WebAudioDecodeJob::OnFailure,
WebAudioDecodeJob::UnknownError);
NS_DispatchToMainThread(event);
} else {
// If we did this without a temporary:
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -1,56 +1,56 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 "MediaDecoderStateMachine.h"
#include "WebMDemuxer.h"
#include "WebMDecoder.h"
#include "VideoUtils.h"
namespace mozilla {
MediaDecoderStateMachine* WebMDecoder::CreateStateMachine()
{
mReader =
new MediaFormatReader(this, new WebMDemuxer(GetResource()), GetVideoFrameContainer());
return new MediaDecoderStateMachine(this, mReader);
}
/* 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;
}
// Verify that all the codecs specified are ones that we expect that
// we can play.
for (const auto& codec : codecs.Range()) {
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"))) {
continue;
}
// Some unsupported codec.
return false;
}
--- a/dom/media/webm/WebMDecoder.h
+++ b/dom/media/webm/WebMDecoder.h
@@ -6,34 +6,34 @@
#if !defined(WebMDecoder_h_)
#define WebMDecoder_h_
#include "MediaDecoder.h"
#include "MediaFormatReader.h"
namespace mozilla {
-class MediaContentType;
+class MediaContainerType;
class WebMDecoder : public MediaDecoder
{
public:
explicit WebMDecoder(MediaDecoderOwner* aOwner) : MediaDecoder(aOwner) {}
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override {
if (!IsWebMEnabled()) {
return nullptr;
}
return new WebMDecoder(aOwner);
}
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;
private:
RefPtr<MediaFormatReader> mReader;
};
} // namespace mozilla