зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
509bc64559
Коммит
5745998021
|
@ -95,7 +95,7 @@
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
#include "DecoderDoctorDiagnostics.h"
|
#include "DecoderDoctorDiagnostics.h"
|
||||||
#include "DecoderTraits.h"
|
#include "DecoderTraits.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
|
|
||||||
#include "ImageContainer.h"
|
#include "ImageContainer.h"
|
||||||
#include "nsRange.h"
|
#include "nsRange.h"
|
||||||
|
@ -4473,11 +4473,11 @@ CanPlayStatus
|
||||||
HTMLMediaElement::GetCanPlay(const nsAString& aType,
|
HTMLMediaElement::GetCanPlay(const nsAString& aType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
|
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
|
||||||
if (!contentType) {
|
if (!containerType) {
|
||||||
return CANPLAY_NO;
|
return CANPLAY_NO;
|
||||||
}
|
}
|
||||||
return DecoderTraits::CanHandleContentType(*contentType, aDiagnostics);
|
return DecoderTraits::CanHandleContainerType(*containerType, aDiagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "ADTSDecoder.h"
|
#include "ADTSDecoder.h"
|
||||||
#include "ADTSDemuxer.h"
|
#include "ADTSDemuxer.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "MediaFormatReader.h"
|
#include "MediaFormatReader.h"
|
||||||
#include "PDMFactory.h"
|
#include "PDMFactory.h"
|
||||||
|
@ -39,15 +39,15 @@ ADTSDecoder::IsEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
ADTSDecoder::IsSupportedType(const MediaContentType& aContentType)
|
ADTSDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
if (aContentType.Type() == MEDIAMIMETYPE("audio/aac")
|
if (aContainerType.Type() == MEDIAMIMETYPE("audio/aac")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("audio/aacp")
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/aacp")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-aac")) {
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-aac")) {
|
||||||
return
|
return
|
||||||
IsEnabled()
|
IsEnabled()
|
||||||
&& (aContentType.ExtendedType().Codecs().IsEmpty()
|
&& (aContainerType.ExtendedType().Codecs().IsEmpty()
|
||||||
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("aac"));
|
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("aac"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class ADTSDecoder : public MediaDecoder
|
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
|
// 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.
|
// platform that is likely to have decoders for the format.
|
||||||
static bool IsEnabled();
|
static bool IsEnabled();
|
||||||
static bool IsSupportedType(const MediaContentType& aContentType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "DecoderTraits.h"
|
#include "DecoderTraits.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoder.h"
|
#include "MediaDecoder.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
@ -51,7 +51,7 @@ namespace mozilla
|
||||||
{
|
{
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsHttpLiveStreamingType(const MediaContentType& aType)
|
IsHttpLiveStreamingType(const MediaContainerType& aType)
|
||||||
{
|
{
|
||||||
return // For m3u8.
|
return // For m3u8.
|
||||||
// https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-10
|
// 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
|
#ifdef MOZ_ANDROID_OMX
|
||||||
static bool
|
static bool
|
||||||
IsAndroidMediaType(const MediaContentType& aType)
|
IsAndroidMediaType(const MediaContainerType& aType)
|
||||||
{
|
{
|
||||||
if (!MediaDecoder::IsAndroidMediaPluginEnabled()) {
|
if (!MediaDecoder::IsAndroidMediaPluginEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,7 +77,7 @@ IsAndroidMediaType(const MediaContentType& aType)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
DecoderTraits::IsMP4SupportedType(const MediaContentType& aType,
|
DecoderTraits::IsMP4SupportedType(const MediaContainerType& aType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
#ifdef MOZ_FMP4
|
#ifdef MOZ_FMP4
|
||||||
|
@ -89,14 +89,14 @@ DecoderTraits::IsMP4SupportedType(const MediaContentType& aType,
|
||||||
|
|
||||||
static
|
static
|
||||||
CanPlayStatus
|
CanPlayStatus
|
||||||
CanHandleCodecsType(const MediaContentType& aType,
|
CanHandleCodecsType(const MediaContainerType& aType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
// We should have been given a codecs string, though it may be empty.
|
// We should have been given a codecs string, though it may be empty.
|
||||||
MOZ_ASSERT(aType.ExtendedType().HaveCodecs());
|
MOZ_ASSERT(aType.ExtendedType().HaveCodecs());
|
||||||
|
|
||||||
// Content type with the the MIME type, no codecs.
|
// Container type with the MIME type, no codecs.
|
||||||
const MediaContentType mimeType(aType.Type());
|
const MediaContainerType mimeType(aType.Type());
|
||||||
|
|
||||||
if (OggDecoder::IsSupportedType(mimeType)) {
|
if (OggDecoder::IsSupportedType(mimeType)) {
|
||||||
if (OggDecoder::IsSupportedType(aType)) {
|
if (OggDecoder::IsSupportedType(aType)) {
|
||||||
|
@ -107,7 +107,7 @@ CanHandleCodecsType(const MediaContentType& aType,
|
||||||
return CANPLAY_NO;
|
return CANPLAY_NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (WaveDecoder::IsSupportedType(MediaContentType(mimeType))) {
|
if (WaveDecoder::IsSupportedType(MediaContainerType(mimeType))) {
|
||||||
if (WaveDecoder::IsSupportedType(aType)) {
|
if (WaveDecoder::IsSupportedType(aType)) {
|
||||||
return CANPLAY_YES;
|
return CANPLAY_YES;
|
||||||
} else {
|
} else {
|
||||||
|
@ -172,7 +172,7 @@ CanHandleCodecsType(const MediaContentType& aType,
|
||||||
|
|
||||||
static
|
static
|
||||||
CanPlayStatus
|
CanPlayStatus
|
||||||
CanHandleMediaType(const MediaContentType& aType,
|
CanHandleMediaType(const MediaContainerType& aType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
@ -188,8 +188,8 @@ CanHandleMediaType(const MediaContentType& aType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Content type with just the MIME type/subtype, no codecs.
|
// Container type with just the MIME type/subtype, no codecs.
|
||||||
const MediaContentType mimeType(aType.Type());
|
const MediaContainerType mimeType(aType.Type());
|
||||||
|
|
||||||
if (OggDecoder::IsSupportedType(mimeType)) {
|
if (OggDecoder::IsSupportedType(mimeType)) {
|
||||||
return CANPLAY_MAYBE;
|
return CANPLAY_MAYBE;
|
||||||
|
@ -232,22 +232,22 @@ CanHandleMediaType(const MediaContentType& aType,
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
CanPlayStatus
|
CanPlayStatus
|
||||||
DecoderTraits::CanHandleContentType(const MediaContentType& aContentType,
|
DecoderTraits::CanHandleContainerType(const MediaContainerType& aContainerType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
return CanHandleMediaType(aContentType, aDiagnostics);
|
return CanHandleMediaType(aContainerType, aDiagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
|
bool DecoderTraits::ShouldHandleMediaType(const char* aMIMEType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
Maybe<MediaContentType> contentType = MakeMediaContentType(aMIMEType);
|
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aMIMEType);
|
||||||
if (!contentType) {
|
if (!containerType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaveDecoder::IsSupportedType(*contentType)) {
|
if (WaveDecoder::IsSupportedType(*containerType)) {
|
||||||
// We should not return true for Wave types, since there are some
|
// 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
|
// 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.
|
// 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
|
// If an external plugin which can handle quicktime video is available
|
||||||
// (and not disabled), prefer it over native playback as there several
|
// (and not disabled), prefer it over native playback as there several
|
||||||
// codecs found in the wild that we do not handle.
|
// 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();
|
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
|
||||||
if (pluginHost &&
|
if (pluginHost &&
|
||||||
pluginHost->HavePluginForType(contentType->Type().AsString())) {
|
pluginHost->HavePluginForType(containerType->Type().AsString())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CanHandleMediaType(*contentType, aDiagnostics) != CANPLAY_NO;
|
return CanHandleMediaType(*containerType, aDiagnostics) != CANPLAY_NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiates but does not initialize decoder.
|
// Instantiates but does not initialize decoder.
|
||||||
static
|
static
|
||||||
already_AddRefed<MediaDecoder>
|
already_AddRefed<MediaDecoder>
|
||||||
InstantiateDecoder(const MediaContentType& aType,
|
InstantiateDecoder(const MediaContainerType& aType,
|
||||||
MediaDecoderOwner* aOwner,
|
MediaDecoderOwner* aOwner,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ DecoderTraits::CreateDecoder(const nsACString& aType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
Maybe<MediaContentType> type = MakeMediaContentType(aType);
|
Maybe<MediaContainerType> type = MakeMediaContainerType(aType);
|
||||||
if (!type) {
|
if (!type) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ DecoderTraits::CreateDecoder(const nsACString& aType,
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
MediaDecoderReader*
|
MediaDecoderReader*
|
||||||
DecoderTraits::CreateReader(const MediaContentType& aType,
|
DecoderTraits::CreateReader(const MediaContainerType& aType,
|
||||||
AbstractMediaDecoder* aDecoder)
|
AbstractMediaDecoder* aDecoder)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
@ -414,7 +414,7 @@ bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<MediaContentType> type = MakeMediaContentType(aType);
|
Maybe<MediaContainerType> type = MakeMediaContainerType(aType);
|
||||||
if (!type) {
|
if (!type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace mozilla {
|
||||||
|
|
||||||
class AbstractMediaDecoder;
|
class AbstractMediaDecoder;
|
||||||
class DecoderDoctorDiagnostics;
|
class DecoderDoctorDiagnostics;
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
class MediaDecoder;
|
class MediaDecoder;
|
||||||
class MediaDecoderOwner;
|
class MediaDecoderOwner;
|
||||||
class MediaDecoderReader;
|
class MediaDecoderReader;
|
||||||
|
@ -29,9 +29,9 @@ enum CanPlayStatus {
|
||||||
|
|
||||||
class DecoderTraits {
|
class DecoderTraits {
|
||||||
public:
|
public:
|
||||||
// Returns the CanPlayStatus indicating if we can handle this content type.
|
// Returns the CanPlayStatus indicating if we can handle this container type.
|
||||||
static CanPlayStatus CanHandleContentType(const MediaContentType& aContentType,
|
static CanPlayStatus CanHandleContainerType(const MediaContainerType& aContainerType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics);
|
DecoderDoctorDiagnostics* aDiagnostics);
|
||||||
|
|
||||||
// Returns true if we should handle this MIME type when it appears
|
// 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
|
// as an <object> or as a toplevel page. If, in practice, our support
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
|
|
||||||
// Create a reader for thew given MIME type aType. Returns null
|
// Create a reader for thew given MIME type aType. Returns null
|
||||||
// if we were unable to create the reader.
|
// if we were unable to create the reader.
|
||||||
static MediaDecoderReader* CreateReader(const MediaContentType& aType,
|
static MediaDecoderReader* CreateReader(const MediaContainerType& aType,
|
||||||
AbstractMediaDecoder* aDecoder);
|
AbstractMediaDecoder* aDecoder);
|
||||||
|
|
||||||
// Returns true if MIME type aType is supported in video documents,
|
// 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,
|
// Convenience function that returns false if MOZ_FMP4 is not defined,
|
||||||
// otherwise defers to MP4Decoder::IsSupportedType().
|
// otherwise defers to MP4Decoder::IsSupportedType().
|
||||||
static bool IsMP4SupportedType(const MediaContentType& aType,
|
static bool IsMP4SupportedType(const MediaContainerType& aType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics);
|
DecoderDoctorDiagnostics* aDiagnostics);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "MP3Decoder.h"
|
#include "MP3Decoder.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "MediaFormatReader.h"
|
#include "MediaFormatReader.h"
|
||||||
#include "MP3Demuxer.h"
|
#include "MP3Demuxer.h"
|
||||||
|
@ -38,14 +38,14 @@ MP3Decoder::IsEnabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool MP3Decoder::IsSupportedType(const MediaContentType& aContentType)
|
bool MP3Decoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
if (aContentType.Type() == MEDIAMIMETYPE("audio/mp3")
|
if (aContainerType.Type() == MEDIAMIMETYPE("audio/mp3")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("audio/mpeg")) {
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/mpeg")) {
|
||||||
return
|
return
|
||||||
IsEnabled()
|
IsEnabled()
|
||||||
&& (aContentType.ExtendedType().Codecs().IsEmpty()
|
&& (aContainerType.ExtendedType().Codecs().IsEmpty()
|
||||||
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("mp3"));
|
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("mp3"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class MP3Decoder : public MediaDecoder
|
class MP3Decoder : public MediaDecoder
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ public:
|
||||||
// Returns true if the MP3 backend is preffed on, and we're running on a
|
// 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.
|
// platform that is likely to have decoders for the format.
|
||||||
static bool IsEnabled();
|
static bool IsEnabled();
|
||||||
static bool IsSupportedType(const MediaContentType& aContentType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -4,41 +4,39 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
|
|
||||||
#include "nsContentTypeParser.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
MediaContentType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
MediaContainerType::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||||
{
|
{
|
||||||
return mExtendedMIMEType.SizeOfExcludingThis(aMallocSizeOf);
|
return mExtendedMIMEType.SizeOfExcludingThis(aMallocSizeOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<MediaContentType>
|
Maybe<MediaContainerType>
|
||||||
MakeMediaContentType(const nsAString& aType)
|
MakeMediaContainerType(const nsAString& aType)
|
||||||
{
|
{
|
||||||
Maybe<MediaExtendedMIMEType> mime = MakeMediaExtendedMIMEType(aType);
|
Maybe<MediaExtendedMIMEType> mime = MakeMediaExtendedMIMEType(aType);
|
||||||
if (mime) {
|
if (mime) {
|
||||||
return Some(MediaContentType(Move(*mime)));
|
return Some(MediaContainerType(Move(*mime)));
|
||||||
}
|
}
|
||||||
return Nothing();
|
return Nothing();
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<MediaContentType>
|
Maybe<MediaContainerType>
|
||||||
MakeMediaContentType(const nsACString& aType)
|
MakeMediaContainerType(const nsACString& aType)
|
||||||
{
|
{
|
||||||
return MakeMediaContentType(NS_ConvertUTF8toUTF16(aType));
|
return MakeMediaContainerType(NS_ConvertUTF8toUTF16(aType));
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<MediaContentType>
|
Maybe<MediaContainerType>
|
||||||
MakeMediaContentType(const char* aType)
|
MakeMediaContainerType(const char* aType)
|
||||||
{
|
{
|
||||||
if (!aType) {
|
if (!aType) {
|
||||||
return Nothing();
|
return Nothing();
|
||||||
}
|
}
|
||||||
return MakeMediaContentType(nsDependentCString(aType));
|
return MakeMediaContainerType(nsDependentCString(aType));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
|
@ -4,8 +4,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef MediaContentType_h_
|
#ifndef MediaContainerType_h_
|
||||||
#define MediaContentType_h_
|
#define MediaContainerType_h_
|
||||||
|
|
||||||
#include "MediaMIMETypes.h"
|
#include "MediaMIMETypes.h"
|
||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
|
@ -14,20 +14,20 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
// Class containing media type information for containers.
|
// Class containing media type information for containers.
|
||||||
class MediaContentType
|
class MediaContainerType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MediaContentType(const MediaMIMEType& aType)
|
explicit MediaContainerType(const MediaMIMEType& aType)
|
||||||
: mExtendedMIMEType(aType)
|
: mExtendedMIMEType(aType)
|
||||||
{}
|
{}
|
||||||
explicit MediaContentType(MediaMIMEType&& aType)
|
explicit MediaContainerType(MediaMIMEType&& aType)
|
||||||
: mExtendedMIMEType(Move(aType))
|
: mExtendedMIMEType(Move(aType))
|
||||||
{}
|
{}
|
||||||
explicit MediaContentType(const MediaExtendedMIMEType& aType)
|
explicit MediaContainerType(const MediaExtendedMIMEType& aType)
|
||||||
: mExtendedMIMEType(aType)
|
: mExtendedMIMEType(aType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
explicit MediaContentType(MediaExtendedMIMEType&& aType)
|
explicit MediaContainerType(MediaExtendedMIMEType&& aType)
|
||||||
: mExtendedMIMEType(Move(aType))
|
: mExtendedMIMEType(Move(aType))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,10 @@ private:
|
||||||
MediaExtendedMIMEType mExtendedMIMEType;
|
MediaExtendedMIMEType mExtendedMIMEType;
|
||||||
};
|
};
|
||||||
|
|
||||||
Maybe<MediaContentType> MakeMediaContentType(const nsAString& aType);
|
Maybe<MediaContainerType> MakeMediaContainerType(const nsAString& aType);
|
||||||
Maybe<MediaContentType> MakeMediaContentType(const nsACString& aType);
|
Maybe<MediaContainerType> MakeMediaContainerType(const nsACString& aType);
|
||||||
Maybe<MediaContentType> MakeMediaContentType(const char* aType);
|
Maybe<MediaContainerType> MakeMediaContainerType(const char* aType);
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // MediaContentType_h_
|
#endif // MediaContainerType_h_
|
|
@ -8,7 +8,7 @@
|
||||||
#include "mozilla/TaskQueue.h"
|
#include "mozilla/TaskQueue.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
|
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
#include "MediaResource.h"
|
#include "MediaResource.h"
|
||||||
#include "TimeUnits.h"
|
#include "TimeUnits.h"
|
||||||
|
@ -501,19 +501,19 @@ CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType)
|
||||||
}
|
}
|
||||||
|
|
||||||
UniquePtr<TrackInfo>
|
UniquePtr<TrackInfo>
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
const nsACString& aCodecMIMEType,
|
const nsACString& aCodecMIMEType,
|
||||||
const MediaContentType& aContentType)
|
const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aCodecMIMEType);
|
UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aCodecMIMEType);
|
||||||
if (trackInfo) {
|
if (trackInfo) {
|
||||||
VideoInfo* videoInfo = trackInfo->GetAsVideoInfo();
|
VideoInfo* videoInfo = trackInfo->GetAsVideoInfo();
|
||||||
if (videoInfo) {
|
if (videoInfo) {
|
||||||
Maybe<int32_t> maybeWidth = aContentType.ExtendedType().GetWidth();
|
Maybe<int32_t> maybeWidth = aContainerType.ExtendedType().GetWidth();
|
||||||
if (maybeWidth && *maybeWidth > 0) {
|
if (maybeWidth && *maybeWidth > 0) {
|
||||||
videoInfo->mImage.width = *maybeWidth;
|
videoInfo->mImage.width = *maybeWidth;
|
||||||
}
|
}
|
||||||
Maybe<int32_t> maybeHeight = aContentType.ExtendedType().GetHeight();
|
Maybe<int32_t> maybeHeight = aContainerType.ExtendedType().GetHeight();
|
||||||
if (maybeHeight && *maybeHeight > 0) {
|
if (maybeHeight && *maybeHeight > 0) {
|
||||||
videoInfo->mImage.height = *maybeHeight;
|
videoInfo->mImage.height = *maybeHeight;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ using mozilla::CheckedUint32;
|
||||||
// mozilla::Monitor non-reentrant.
|
// mozilla::Monitor non-reentrant.
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
// EME Key System String.
|
// EME Key System String.
|
||||||
extern const nsLiteralCString kEMEKeySystemClearkey;
|
extern const nsLiteralCString kEMEKeySystemClearkey;
|
||||||
|
@ -355,11 +355,11 @@ UniquePtr<TrackInfo>
|
||||||
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType);
|
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType);
|
||||||
|
|
||||||
// Try and create a TrackInfo with a given codec MIME type, and optional extra
|
// 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>
|
UniquePtr<TrackInfo>
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
const nsACString& aCodecMIMEType,
|
const nsACString& aCodecMIMEType,
|
||||||
const MediaContentType& aContentType);
|
const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
AndroidMediaDecoder::AndroidMediaDecoder(MediaDecoderOwner* aOwner,
|
AndroidMediaDecoder::AndroidMediaDecoder(MediaDecoderOwner* aOwner,
|
||||||
const MediaContentType& aType)
|
const MediaContainerType& aType)
|
||||||
: MediaDecoder(aOwner), mType(aType)
|
: MediaDecoder(aOwner), mType(aType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,15 @@
|
||||||
|
|
||||||
#include "MediaDecoder.h"
|
#include "MediaDecoder.h"
|
||||||
#include "AndroidMediaDecoder.h"
|
#include "AndroidMediaDecoder.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class AndroidMediaDecoder : public MediaDecoder
|
class AndroidMediaDecoder : public MediaDecoder
|
||||||
{
|
{
|
||||||
MediaContentType mType;
|
MediaContainerType mType;
|
||||||
public:
|
public:
|
||||||
AndroidMediaDecoder(MediaDecoderOwner* aOwner, const MediaContentType& aType);
|
AndroidMediaDecoder(MediaDecoderOwner* aOwner, const MediaContainerType& aType);
|
||||||
|
|
||||||
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override {
|
MediaDecoder* Clone(MediaDecoderOwner* aOwner) override {
|
||||||
return new AndroidMediaDecoder(aOwner, mType);
|
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,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaResource.h"
|
#include "MediaResource.h"
|
||||||
#include "mozilla/dom/HTMLMediaElement.h"
|
#include "mozilla/dom/HTMLMediaElement.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
|
@ -227,7 +227,7 @@ AndroidMediaPluginHost::~AndroidMediaPluginHost() {
|
||||||
MOZ_COUNT_DTOR(AndroidMediaPluginHost);
|
MOZ_COUNT_DTOR(AndroidMediaPluginHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AndroidMediaPluginHost::FindDecoder(const MediaContentType& aMimeType,
|
bool AndroidMediaPluginHost::FindDecoder(const MediaContainerType& aMimeType,
|
||||||
MediaCodecs* aCodecs)
|
MediaCodecs* aCodecs)
|
||||||
{
|
{
|
||||||
const char *chars;
|
const char *chars;
|
||||||
|
@ -253,7 +253,7 @@ bool AndroidMediaPluginHost::FindDecoder(const MediaContentType& aMimeType,
|
||||||
}
|
}
|
||||||
|
|
||||||
MPAPI::Decoder *AndroidMediaPluginHost::CreateDecoder(MediaResource *aResource,
|
MPAPI::Decoder *AndroidMediaPluginHost::CreateDecoder(MediaResource *aResource,
|
||||||
const MediaContentType& aMimeType)
|
const MediaContainerType& aMimeType)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(aResource, nullptr);
|
NS_ENSURE_TRUE(aResource, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
class MediaCodecs;
|
class MediaCodecs;
|
||||||
|
|
||||||
class AndroidMediaPluginHost {
|
class AndroidMediaPluginHost {
|
||||||
|
@ -27,8 +27,8 @@ public:
|
||||||
|
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
|
||||||
bool FindDecoder(const MediaContentType& aMimeType, MediaCodecs* aCodecs);
|
bool FindDecoder(const MediaContainerType& aMimeType, MediaCodecs* aCodecs);
|
||||||
MPAPI::Decoder *CreateDecoder(mozilla::MediaResource *aResource, const MediaContentType& aMimeType);
|
MPAPI::Decoder *CreateDecoder(mozilla::MediaResource *aResource, const MediaContainerType& aMimeType);
|
||||||
void DestroyDecoder(MPAPI::Decoder *aDecoder);
|
void DestroyDecoder(MPAPI::Decoder *aDecoder);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ typedef mozilla::layers::Image Image;
|
||||||
typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
|
typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
|
||||||
|
|
||||||
AndroidMediaReader::AndroidMediaReader(AbstractMediaDecoder *aDecoder,
|
AndroidMediaReader::AndroidMediaReader(AbstractMediaDecoder *aDecoder,
|
||||||
const MediaContentType& aContentType) :
|
const MediaContainerType& aContainerType) :
|
||||||
MediaDecoderReader(aDecoder),
|
MediaDecoderReader(aDecoder),
|
||||||
mType(aContentType),
|
mType(aContainerType),
|
||||||
mPlugin(nullptr),
|
mPlugin(nullptr),
|
||||||
mHasAudio(false),
|
mHasAudio(false),
|
||||||
mHasVideo(false),
|
mHasVideo(false),
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#define AndroidMediaReader_h_
|
#define AndroidMediaReader_h_
|
||||||
|
|
||||||
#include "ImageContainer.h"
|
#include "ImageContainer.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderReader.h"
|
#include "MediaDecoderReader.h"
|
||||||
#include "MediaResource.h"
|
#include "MediaResource.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
@ -25,7 +25,7 @@ class ImageContainer;
|
||||||
|
|
||||||
class AndroidMediaReader : public MediaDecoderReader
|
class AndroidMediaReader : public MediaDecoderReader
|
||||||
{
|
{
|
||||||
MediaContentType mType;
|
MediaContainerType mType;
|
||||||
MPAPI::Decoder *mPlugin;
|
MPAPI::Decoder *mPlugin;
|
||||||
bool mHasAudio;
|
bool mHasAudio;
|
||||||
bool mHasVideo;
|
bool mHasVideo;
|
||||||
|
@ -38,7 +38,7 @@ class AndroidMediaReader : public MediaDecoderReader
|
||||||
MozPromiseRequestHolder<MediaDecoderReader::MediaDataPromise> mSeekRequest;
|
MozPromiseRequestHolder<MediaDecoderReader::MediaDataPromise> mSeekRequest;
|
||||||
public:
|
public:
|
||||||
AndroidMediaReader(AbstractMediaDecoder* aDecoder,
|
AndroidMediaReader(AbstractMediaDecoder* aDecoder,
|
||||||
const MediaContentType& aContentType);
|
const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
nsresult ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
|
nsresult ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
|
||||||
TrackInfo::kVideoTrack)) override;
|
TrackInfo::kVideoTrack)) override;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "DirectShowDecoder.h"
|
#include "DirectShowDecoder.h"
|
||||||
#include "DirectShowReader.h"
|
#include "DirectShowReader.h"
|
||||||
#include "DirectShowUtils.h"
|
#include "DirectShowUtils.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/WindowsVersion.h"
|
#include "mozilla/WindowsVersion.h"
|
||||||
|
@ -21,7 +21,7 @@ MediaDecoderStateMachine* DirectShowDecoder::CreateStateMachine()
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
DirectShowDecoder::GetSupportedCodecs(const MediaContentType& aType,
|
DirectShowDecoder::GetSupportedCodecs(const MediaContainerType& aType,
|
||||||
MediaCodecs* aOutCodecs)
|
MediaCodecs* aOutCodecs)
|
||||||
{
|
{
|
||||||
if (!IsEnabled()) {
|
if (!IsEnabled()) {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaCodecs;
|
class MediaCodecs;
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
// Decoder that uses DirectShow to playback MP3 files only.
|
// Decoder that uses DirectShow to playback MP3 files only.
|
||||||
class DirectShowDecoder : public MediaDecoder
|
class DirectShowDecoder : public MediaDecoder
|
||||||
|
@ -36,7 +36,7 @@ public:
|
||||||
// it is filled with a (static const) null-terminated list of strings
|
// it is filled with a (static const) null-terminated list of strings
|
||||||
// denoting the codecs we'll playback. Note that playback is strictly
|
// denoting the codecs we'll playback. Note that playback is strictly
|
||||||
// limited to MP3 only.
|
// limited to MP3 only.
|
||||||
static bool GetSupportedCodecs(const MediaContentType& aType,
|
static bool GetSupportedCodecs(const MediaContainerType& aType,
|
||||||
MediaCodecs* aOutCodecs);
|
MediaCodecs* aOutCodecs);
|
||||||
|
|
||||||
// Returns true if the DirectShow backend is preffed on.
|
// Returns true if the DirectShow backend is preffed on.
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "mozilla/dom/MediaKeySystemAccess.h"
|
#include "mozilla/dom/MediaKeySystemAccess.h"
|
||||||
#include "mozilla/dom/MediaKeySystemAccessBinding.h"
|
#include "mozilla/dom/MediaKeySystemAccessBinding.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
#ifdef MOZ_FMP4
|
#ifdef MOZ_FMP4
|
||||||
#include "MP4Decoder.h"
|
#include "MP4Decoder.h"
|
||||||
|
@ -574,21 +574,21 @@ GetSupportedCapabilities(const CodecType aCodecType,
|
||||||
}
|
}
|
||||||
// If content type is an invalid or unrecognized MIME type, continue
|
// If content type is an invalid or unrecognized MIME type, continue
|
||||||
// to the next iteration.
|
// to the next iteration.
|
||||||
Maybe<MediaContentType> maybeContentType =
|
Maybe<MediaContainerType> maybeContainerType =
|
||||||
MakeMediaContentType(contentTypeString);
|
MakeMediaContainerType(contentTypeString);
|
||||||
if (!maybeContentType) {
|
if (!maybeContainerType) {
|
||||||
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
||||||
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
|
"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(aPartialConfig.mLabel).get(),
|
||||||
NS_ConvertUTF16toUTF8(contentTypeString).get(),
|
NS_ConvertUTF16toUTF8(contentTypeString).get(),
|
||||||
NS_ConvertUTF16toUTF8(robustness).get());
|
NS_ConvertUTF16toUTF8(robustness).get());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const MediaContentType& contentType = *maybeContentType;
|
const MediaContainerType& containerType = *maybeContainerType;
|
||||||
bool invalid = false;
|
bool invalid = false;
|
||||||
nsTArray<EMECodecString> codecs;
|
nsTArray<EMECodecString> codecs;
|
||||||
for (const auto& codecString : contentType.ExtendedType().Codecs().Range()) {
|
for (const auto& codecString : containerType.ExtendedType().Codecs().Range()) {
|
||||||
EMECodecString emeCodec = ToEMEAPICodecString(nsString(codecString));
|
EMECodecString emeCodec = ToEMEAPICodecString(nsString(codecString));
|
||||||
if (emeCodec.IsEmpty()) {
|
if (emeCodec.IsEmpty()) {
|
||||||
invalid = true;
|
invalid = true;
|
||||||
|
@ -613,7 +613,7 @@ GetSupportedCapabilities(const CodecType aCodecType,
|
||||||
// case-insensitive."'. We're using nsContentTypeParser and that is
|
// case-insensitive."'. We're using nsContentTypeParser and that is
|
||||||
// case-insensitive and converts all its parameter outputs to lower case.)
|
// case-insensitive and converts all its parameter outputs to lower case.)
|
||||||
const bool isMP4 =
|
const bool isMP4 =
|
||||||
DecoderTraits::IsMP4SupportedType(contentType, aDiagnostics);
|
DecoderTraits::IsMP4SupportedType(containerType, aDiagnostics);
|
||||||
if (isMP4 && !aKeySystem.mMP4.IsSupported()) {
|
if (isMP4 && !aKeySystem.mMP4.IsSupported()) {
|
||||||
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
||||||
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
|
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
|
||||||
|
@ -623,7 +623,7 @@ GetSupportedCapabilities(const CodecType aCodecType,
|
||||||
NS_ConvertUTF16toUTF8(robustness).get());
|
NS_ConvertUTF16toUTF8(robustness).get());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const bool isWebM = WebMDecoder::IsSupportedType(contentType);
|
const bool isWebM = WebMDecoder::IsSupportedType(containerType);
|
||||||
if (isWebM && !aKeySystem.mWebM.IsSupported()) {
|
if (isWebM && !aKeySystem.mWebM.IsSupported()) {
|
||||||
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
||||||
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
|
"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.)
|
// (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.
|
// If container type is not strictly a audio/video type, continue to the next iteration.
|
||||||
const auto majorType = GetMajorType(contentType.Type());
|
const auto majorType = GetMajorType(containerType.Type());
|
||||||
if (majorType == Invalid) {
|
if (majorType == Invalid) {
|
||||||
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
EME_LOG("MediaKeySystemConfiguration (label='%s') "
|
||||||
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
|
"MediaKeySystemMediaCapability('%s','%s') unsupported; "
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "FlacDecoder.h"
|
#include "FlacDecoder.h"
|
||||||
#include "FlacDemuxer.h"
|
#include "FlacDemuxer.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "MediaFormatReader.h"
|
#include "MediaFormatReader.h"
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
|
@ -43,12 +43,12 @@ FlacDecoder::IsEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
FlacDecoder::IsSupportedType(const MediaContentType& aContentType)
|
FlacDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
return IsEnabled()
|
return IsEnabled()
|
||||||
&& (aContentType.Type() == MEDIAMIMETYPE("audio/flac")
|
&& (aContainerType.Type() == MEDIAMIMETYPE("audio/flac")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-flac")
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-flac")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("application/x-flac"));
|
|| aContainerType.Type() == MEDIAMIMETYPE("application/x-flac"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class FlacDecoder : public MediaDecoder
|
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
|
// 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.
|
// platform that is likely to have decoders for the format.
|
||||||
static bool IsEnabled();
|
static bool IsEnabled();
|
||||||
static bool IsSupportedType(const MediaContentType& aContentType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "MP4Decoder.h"
|
#include "MP4Decoder.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "MP4Demuxer.h"
|
#include "MP4Demuxer.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
@ -67,7 +67,7 @@ IsWhitelistedH264Codec(const nsAString& aCodec)
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
MP4Decoder::IsSupportedType(const MediaContentType& aType,
|
MP4Decoder::IsSupportedType(const MediaContainerType& aType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics)
|
DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
if (!IsEnabled()) {
|
if (!IsEnabled()) {
|
||||||
|
@ -96,12 +96,12 @@ MP4Decoder::IsSupportedType(const MediaContentType& aType,
|
||||||
// No codecs specified. Assume H.264
|
// No codecs specified. Assume H.264
|
||||||
if (isAudio) {
|
if (isAudio) {
|
||||||
trackInfos.AppendElement(
|
trackInfos.AppendElement(
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
|
NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(isVideo);
|
MOZ_ASSERT(isVideo);
|
||||||
trackInfos.AppendElement(
|
trackInfos.AppendElement(
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
NS_LITERAL_CSTRING("video/avc"), aType));
|
NS_LITERAL_CSTRING("video/avc"), aType));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,25 +110,25 @@ MP4Decoder::IsSupportedType(const MediaContentType& aType,
|
||||||
for (const auto& codec : aType.ExtendedType().Codecs().Range()) {
|
for (const auto& codec : aType.ExtendedType().Codecs().Range()) {
|
||||||
if (IsAACCodecString(codec)) {
|
if (IsAACCodecString(codec)) {
|
||||||
trackInfos.AppendElement(
|
trackInfos.AppendElement(
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
|
NS_LITERAL_CSTRING("audio/mp4a-latm"), aType));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (codec.EqualsLiteral("mp3")) {
|
if (codec.EqualsLiteral("mp3")) {
|
||||||
trackInfos.AppendElement(
|
trackInfos.AppendElement(
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
NS_LITERAL_CSTRING("audio/mpeg"), aType));
|
NS_LITERAL_CSTRING("audio/mpeg"), aType));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (codec.EqualsLiteral("opus")) {
|
if (codec.EqualsLiteral("opus")) {
|
||||||
trackInfos.AppendElement(
|
trackInfos.AppendElement(
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
NS_LITERAL_CSTRING("audio/opus"), aType));
|
NS_LITERAL_CSTRING("audio/opus"), aType));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (codec.EqualsLiteral("flac")) {
|
if (codec.EqualsLiteral("flac")) {
|
||||||
trackInfos.AppendElement(
|
trackInfos.AppendElement(
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
NS_LITERAL_CSTRING("audio/flac"), aType));
|
NS_LITERAL_CSTRING("audio/flac"), aType));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ MP4Decoder::IsSupportedType(const MediaContentType& aType,
|
||||||
// content type.
|
// content type.
|
||||||
if (IsWhitelistedH264Codec(codec) && isVideo) {
|
if (IsWhitelistedH264Codec(codec) && isVideo) {
|
||||||
trackInfos.AppendElement(
|
trackInfos.AppendElement(
|
||||||
CreateTrackInfoWithMIMETypeAndContentTypeExtraParameters(
|
CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters(
|
||||||
NS_LITERAL_CSTRING("video/avc"), aType));
|
NS_LITERAL_CSTRING("video/avc"), aType));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
// Decoder that uses a bundled MP4 demuxer and platform decoders to play MP4.
|
// Decoder that uses a bundled MP4 demuxer and platform decoders to play MP4.
|
||||||
class MP4Decoder : public MediaDecoder
|
class MP4Decoder : public MediaDecoder
|
||||||
|
@ -30,10 +30,10 @@ public:
|
||||||
|
|
||||||
MediaDecoderStateMachine* CreateStateMachine() override;
|
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.
|
// with the a platform decoder backend.
|
||||||
// If provided, codecs are checked for support.
|
// If provided, codecs are checked for support.
|
||||||
static bool IsSupportedType(const MediaContentType& aContentType,
|
static bool IsSupportedType(const MediaContainerType& aContainerType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics);
|
DecoderDoctorDiagnostics* aDiagnostics);
|
||||||
|
|
||||||
// Return true if aMimeType is a one of the strings used by our demuxers to
|
// Return true if aMimeType is a one of the strings used by our demuxers to
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Benchmark.h"
|
#include "Benchmark.h"
|
||||||
#include "MockMediaResource.h"
|
#include "MockMediaResource.h"
|
||||||
#include "DecoderTraits.h"
|
#include "DecoderTraits.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MP4Decoder.h"
|
#include "MP4Decoder.h"
|
||||||
#include "MP4Demuxer.h"
|
#include "MP4Demuxer.h"
|
||||||
#include "WebMDecoder.h"
|
#include "WebMDecoder.h"
|
||||||
|
@ -46,7 +46,7 @@ private:
|
||||||
TEST(MediaDataDecoder, H264)
|
TEST(MediaDataDecoder, H264)
|
||||||
{
|
{
|
||||||
if (!DecoderTraits::IsMP4SupportedType(
|
if (!DecoderTraits::IsMP4SupportedType(
|
||||||
MediaContentType(MEDIAMIMETYPE("video/mp4")),
|
MediaContainerType(MEDIAMIMETYPE("video/mp4")),
|
||||||
/* DecoderDoctorDiagnostics* */ nullptr)) {
|
/* DecoderDoctorDiagnostics* */ nullptr)) {
|
||||||
EXPECT_TRUE(true);
|
EXPECT_TRUE(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,7 +62,7 @@ TEST(MediaDataDecoder, H264)
|
||||||
|
|
||||||
TEST(MediaDataDecoder, VP9)
|
TEST(MediaDataDecoder, VP9)
|
||||||
{
|
{
|
||||||
if (!WebMDecoder::IsSupportedType(MediaContentType(MEDIAMIMETYPE("video/webm")))) {
|
if (!WebMDecoder::IsSupportedType(MediaContainerType(MEDIAMIMETYPE("video/webm")))) {
|
||||||
EXPECT_TRUE(true);
|
EXPECT_TRUE(true);
|
||||||
} else {
|
} else {
|
||||||
RefPtr<MediaResource> resource =
|
RefPtr<MediaResource> resource =
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaMIMETypes.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "DecoderTraits.h"
|
#include "DecoderTraits.h"
|
||||||
#include "Benchmark.h"
|
#include "Benchmark.h"
|
||||||
#include "DecoderDoctorDiagnostics.h"
|
#include "DecoderDoctorDiagnostics.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaResult.h"
|
#include "MediaResult.h"
|
||||||
#include "MediaSourceUtils.h"
|
#include "MediaSourceUtils.h"
|
||||||
#include "SourceBuffer.h"
|
#include "SourceBuffer.h"
|
||||||
|
@ -72,7 +72,7 @@ static bool
|
||||||
IsWebMForced(DecoderDoctorDiagnostics* aDiagnostics)
|
IsWebMForced(DecoderDoctorDiagnostics* aDiagnostics)
|
||||||
{
|
{
|
||||||
bool mp4supported =
|
bool mp4supported =
|
||||||
DecoderTraits::IsMP4SupportedType(MediaContentType(MEDIAMIMETYPE("video/mp4")),
|
DecoderTraits::IsMP4SupportedType(MediaContainerType(MEDIAMIMETYPE("video/mp4")),
|
||||||
aDiagnostics);
|
aDiagnostics);
|
||||||
bool hwsupported = gfx::gfxVars::CanUseHardwareVideoDecoding();
|
bool hwsupported = gfx::gfxVars::CanUseHardwareVideoDecoding();
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
|
@ -93,19 +93,19 @@ MediaSource::IsTypeSupported(const nsAString& aType, DecoderDoctorDiagnostics* a
|
||||||
return NS_ERROR_DOM_TYPE_ERR;
|
return NS_ERROR_DOM_TYPE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
|
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
|
||||||
if (!contentType) {
|
if (!containerType) {
|
||||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DecoderTraits::CanHandleContentType(*contentType, aDiagnostics)
|
if (DecoderTraits::CanHandleContainerType(*containerType, aDiagnostics)
|
||||||
== CANPLAY_NO) {
|
== CANPLAY_NO) {
|
||||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we know that this media type could be played.
|
// Now we know that this media type could be played.
|
||||||
// MediaSource imposes extra restrictions, and some prefs.
|
// MediaSource imposes extra restrictions, and some prefs.
|
||||||
const MediaMIMEType& mimeType = contentType->Type();
|
const MediaMIMEType& mimeType = containerType->Type();
|
||||||
if (mimeType == MEDIAMIMETYPE("video/mp4") ||
|
if (mimeType == MEDIAMIMETYPE("video/mp4") ||
|
||||||
mimeType == MEDIAMIMETYPE("audio/mp4")) {
|
mimeType == MEDIAMIMETYPE("audio/mp4")) {
|
||||||
if (!Preferences::GetBool("media.mediasource.mp4.enabled", false)) {
|
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);
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
Maybe<MediaContentType> contentType = MakeMediaContentType(aType);
|
Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
|
||||||
if (!contentType) {
|
if (!containerType) {
|
||||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const nsACString& mimeType = contentType->Type().AsString();
|
const nsACString& mimeType = containerType->Type().AsString();
|
||||||
RefPtr<SourceBuffer> sourceBuffer = new SourceBuffer(this, mimeType);
|
RefPtr<SourceBuffer> sourceBuffer = new SourceBuffer(this, mimeType);
|
||||||
if (!sourceBuffer) {
|
if (!sourceBuffer) {
|
||||||
aRv.Throw(NS_ERROR_FAILURE); // XXX need a better error here
|
aRv.Throw(NS_ERROR_FAILURE); // XXX need a better error here
|
||||||
|
|
|
@ -100,7 +100,7 @@ EXPORTS += [
|
||||||
'Intervals.h',
|
'Intervals.h',
|
||||||
'Latency.h',
|
'Latency.h',
|
||||||
'MediaCache.h',
|
'MediaCache.h',
|
||||||
'MediaContentType.h',
|
'MediaContainerType.h',
|
||||||
'MediaData.h',
|
'MediaData.h',
|
||||||
'MediaDataDemuxer.h',
|
'MediaDataDemuxer.h',
|
||||||
'MediaDecoder.h',
|
'MediaDecoder.h',
|
||||||
|
@ -208,7 +208,7 @@ UNIFIED_SOURCES += [
|
||||||
'GraphDriver.cpp',
|
'GraphDriver.cpp',
|
||||||
'Latency.cpp',
|
'Latency.cpp',
|
||||||
'MediaCache.cpp',
|
'MediaCache.cpp',
|
||||||
'MediaContentType.cpp',
|
'MediaContainerType.cpp',
|
||||||
'MediaData.cpp',
|
'MediaData.cpp',
|
||||||
'MediaDecoder.cpp',
|
'MediaDecoder.cpp',
|
||||||
'MediaDecoderReader.cpp',
|
'MediaDecoderReader.cpp',
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "MediaFormatReader.h"
|
#include "MediaFormatReader.h"
|
||||||
#include "OggDemuxer.h"
|
#include "OggDemuxer.h"
|
||||||
#include "OggDecoder.h"
|
#include "OggDecoder.h"
|
||||||
#include "nsContentTypeParser.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
@ -26,21 +25,21 @@ MediaDecoderStateMachine* OggDecoder::CreateStateMachine()
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
OggDecoder::IsSupportedType(const MediaContentType& aContentType)
|
OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
if (!MediaPrefs::OggEnabled()) {
|
if (!MediaPrefs::OggEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aContentType.Type() != MEDIAMIMETYPE("audio/ogg") &&
|
if (aContainerType.Type() != MEDIAMIMETYPE("audio/ogg") &&
|
||||||
aContentType.Type() != MEDIAMIMETYPE("video/ogg") &&
|
aContainerType.Type() != MEDIAMIMETYPE("video/ogg") &&
|
||||||
aContentType.Type() != MEDIAMIMETYPE("application/ogg")) {
|
aContainerType.Type() != MEDIAMIMETYPE("application/ogg")) {
|
||||||
return false;
|
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()) {
|
if (codecs.IsEmpty()) {
|
||||||
// WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
|
// WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
|
||||||
return true;
|
return true;
|
||||||
|
@ -53,8 +52,8 @@ OggDecoder::IsSupportedType(const MediaContentType& aContentType)
|
||||||
(MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
|
(MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Note: Only accept Theora in a video content type, not in an audio
|
// Note: Only accept Theora in a video container type, not in an audio
|
||||||
// content type.
|
// container type.
|
||||||
if (isOggVideo && codec.EqualsLiteral("theora")) {
|
if (isOggVideo && codec.EqualsLiteral("theora")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class OggDecoder : public MediaDecoder
|
class OggDecoder : public MediaDecoder
|
||||||
{
|
{
|
||||||
|
@ -39,10 +39,10 @@ public:
|
||||||
return mShutdownBit;
|
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.
|
// with an enabled platform decoder backend.
|
||||||
// If provided, codecs are checked for support.
|
// If provided, codecs are checked for support.
|
||||||
static bool IsSupportedType(const MediaContentType& aContentType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ShutdownBitChanged() override
|
void ShutdownBitChanged() override
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "WaveDemuxer.h"
|
#include "WaveDemuxer.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "WaveDecoder.h"
|
#include "WaveDecoder.h"
|
||||||
#include "MediaFormatReader.h"
|
#include "MediaFormatReader.h"
|
||||||
|
@ -27,19 +27,19 @@ WaveDecoder::CreateStateMachine()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
WaveDecoder::IsSupportedType(const MediaContentType& aContentType)
|
WaveDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
if (!IsWaveEnabled()) {
|
if (!IsWaveEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (aContentType.Type() == MEDIAMIMETYPE("audio/wave")
|
if (aContainerType.Type() == MEDIAMIMETYPE("audio/wave")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-wav")
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-wav")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("audio/wav")
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/wav")
|
||||||
|| aContentType.Type() == MEDIAMIMETYPE("audio/x-pn-wav")) {
|
|| aContainerType.Type() == MEDIAMIMETYPE("audio/x-pn-wav")) {
|
||||||
return (aContentType.ExtendedType().Codecs().IsEmpty()
|
return (aContainerType.ExtendedType().Codecs().IsEmpty()
|
||||||
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("1")
|
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("1")
|
||||||
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("6")
|
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("6")
|
||||||
|| aContentType.ExtendedType().Codecs().AsString().EqualsASCII("7"));
|
|| aContainerType.ExtendedType().Codecs().AsString().EqualsASCII("7"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class WaveDecoder : public MediaDecoder
|
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
|
// 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.
|
// platform that is likely to have decoders for the format.
|
||||||
static bool IsSupportedType(const MediaContentType& aContentType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "DecoderTraits.h"
|
#include "DecoderTraits.h"
|
||||||
#include "AudioContext.h"
|
#include "AudioContext.h"
|
||||||
#include "AudioBuffer.h"
|
#include "AudioBuffer.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
|
@ -78,10 +78,10 @@ enum class PhaseEnum : int
|
||||||
class MediaDecodeTask final : public Runnable
|
class MediaDecodeTask final : public Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MediaDecodeTask(const MediaContentType& aContentType, uint8_t* aBuffer,
|
MediaDecodeTask(const MediaContainerType& aContainerType, uint8_t* aBuffer,
|
||||||
uint32_t aLength,
|
uint32_t aLength,
|
||||||
WebAudioDecodeJob& aDecodeJob)
|
WebAudioDecodeJob& aDecodeJob)
|
||||||
: mContentType(aContentType)
|
: mContainerType(aContainerType)
|
||||||
, mBuffer(aBuffer)
|
, mBuffer(aBuffer)
|
||||||
, mLength(aLength)
|
, mLength(aLength)
|
||||||
, mDecodeJob(aDecodeJob)
|
, mDecodeJob(aDecodeJob)
|
||||||
|
@ -132,7 +132,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MediaContentType mContentType;
|
MediaContainerType mContainerType;
|
||||||
uint8_t* mBuffer;
|
uint8_t* mBuffer;
|
||||||
uint32_t mLength;
|
uint32_t mLength;
|
||||||
WebAudioDecodeJob& mDecodeJob;
|
WebAudioDecodeJob& mDecodeJob;
|
||||||
|
@ -195,7 +195,7 @@ MediaDecodeTask::CreateReader()
|
||||||
|
|
||||||
RefPtr<BufferMediaResource> resource =
|
RefPtr<BufferMediaResource> resource =
|
||||||
new BufferMediaResource(static_cast<uint8_t*> (mBuffer),
|
new BufferMediaResource(static_cast<uint8_t*> (mBuffer),
|
||||||
mLength, principal, mContentType.Type().AsString());
|
mLength, principal, mContainerType.Type().AsString());
|
||||||
|
|
||||||
MOZ_ASSERT(!mBufferDecoder);
|
MOZ_ASSERT(!mBufferDecoder);
|
||||||
mBufferDecoder = new BufferDecoder(resource,
|
mBufferDecoder = new BufferDecoder(resource,
|
||||||
|
@ -204,7 +204,7 @@ MediaDecodeTask::CreateReader()
|
||||||
// If you change this list to add support for new decoders, please consider
|
// If you change this list to add support for new decoders, please consider
|
||||||
// updating HTMLMediaElement::CreateDecoder as well.
|
// updating HTMLMediaElement::CreateDecoder as well.
|
||||||
|
|
||||||
mDecoderReader = DecoderTraits::CreateReader(mContentType, mBufferDecoder);
|
mDecoderReader = DecoderTraits::CreateReader(mContainerType, mBufferDecoder);
|
||||||
|
|
||||||
if (!mDecoderReader) {
|
if (!mDecoderReader) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -276,7 +276,7 @@ MediaDecodeTask::OnMetadataRead(MetadataHolder* aMetadata)
|
||||||
codec = nsPrintfCString("webaudio; %s", mMediaInfo.mAudio.GetAsAudioInfo()->mMimeType.get());
|
codec = nsPrintfCString("webaudio; %s", mMediaInfo.mAudio.GetAsAudioInfo()->mMimeType.get());
|
||||||
} else {
|
} else {
|
||||||
codec = nsPrintfCString("webaudio;resource; %s",
|
codec = nsPrintfCString("webaudio;resource; %s",
|
||||||
mContentType.Type().AsString().Data());
|
mContainerType.Type().AsString().Data());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([codec]() -> void {
|
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([codec]() -> void {
|
||||||
|
@ -482,12 +482,12 @@ void
|
||||||
AsyncDecodeWebAudio(const char* aContentType, uint8_t* aBuffer,
|
AsyncDecodeWebAudio(const char* aContentType, uint8_t* aBuffer,
|
||||||
uint32_t aLength, WebAudioDecodeJob& aDecodeJob)
|
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
|
// Do not attempt to decode the media if we were not successful at sniffing
|
||||||
// the content type.
|
// the container type.
|
||||||
if (!*aContentType ||
|
if (!*aContentType ||
|
||||||
strcmp(aContentType, APPLICATION_OCTET_STREAM) == 0 ||
|
strcmp(aContentType, APPLICATION_OCTET_STREAM) == 0 ||
|
||||||
!contentType) {
|
!containerType) {
|
||||||
nsCOMPtr<nsIRunnable> event =
|
nsCOMPtr<nsIRunnable> event =
|
||||||
new ReportResultTask(aDecodeJob,
|
new ReportResultTask(aDecodeJob,
|
||||||
&WebAudioDecodeJob::OnFailure,
|
&WebAudioDecodeJob::OnFailure,
|
||||||
|
@ -498,7 +498,7 @@ AsyncDecodeWebAudio(const char* aContentType, uint8_t* aBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<MediaDecodeTask> task =
|
RefPtr<MediaDecodeTask> task =
|
||||||
new MediaDecodeTask(*contentType, aBuffer, aLength, aDecodeJob);
|
new MediaDecodeTask(*containerType, aBuffer, aLength, aDecodeJob);
|
||||||
if (!task->CreateReader()) {
|
if (!task->CreateReader()) {
|
||||||
nsCOMPtr<nsIRunnable> event =
|
nsCOMPtr<nsIRunnable> event =
|
||||||
new ReportResultTask(aDecodeJob,
|
new ReportResultTask(aDecodeJob,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "MediaContentType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoderStateMachine.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
#include "WebMDemuxer.h"
|
#include "WebMDemuxer.h"
|
||||||
#include "WebMDecoder.h"
|
#include "WebMDecoder.h"
|
||||||
|
@ -22,18 +22,18 @@ MediaDecoderStateMachine* WebMDecoder::CreateStateMachine()
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
WebMDecoder::IsSupportedType(const MediaContentType& aContentType)
|
WebMDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
if (!Preferences::GetBool("media.webm.enabled")) {
|
if (!Preferences::GetBool("media.webm.enabled")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isVideo = aContentType.Type() == MEDIAMIMETYPE("video/webm");
|
bool isVideo = aContainerType.Type() == MEDIAMIMETYPE("video/webm");
|
||||||
if (aContentType.Type() != MEDIAMIMETYPE("audio/webm") && !isVideo) {
|
if (aContainerType.Type() != MEDIAMIMETYPE("audio/webm") && !isVideo) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MediaCodecs& codecs = aContentType.ExtendedType().Codecs();
|
const MediaCodecs& codecs = aContainerType.ExtendedType().Codecs();
|
||||||
if (codecs.IsEmpty()) {
|
if (codecs.IsEmpty()) {
|
||||||
// WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
|
// WebM guarantees that the only codecs it contained are vp8, vp9, opus or vorbis.
|
||||||
return true;
|
return true;
|
||||||
|
@ -44,8 +44,8 @@ WebMDecoder::IsSupportedType(const MediaContentType& aContentType)
|
||||||
if (codec.EqualsLiteral("opus") || codec.EqualsLiteral("vorbis")) {
|
if (codec.EqualsLiteral("opus") || codec.EqualsLiteral("vorbis")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Note: Only accept VP8/VP9 in a video content type, not in an audio
|
// Note: Only accept VP8/VP9 in a video container type, not in an audio
|
||||||
// content type.
|
// container type.
|
||||||
if (isVideo &&
|
if (isVideo &&
|
||||||
(codec.EqualsLiteral("vp8") || codec.EqualsLiteral("vp8.0") ||
|
(codec.EqualsLiteral("vp8") || codec.EqualsLiteral("vp8.0") ||
|
||||||
codec.EqualsLiteral("vp9") || codec.EqualsLiteral("vp9.0"))) {
|
codec.EqualsLiteral("vp9") || codec.EqualsLiteral("vp9.0"))) {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContentType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class WebMDecoder : public MediaDecoder
|
class WebMDecoder : public MediaDecoder
|
||||||
{
|
{
|
||||||
|
@ -25,10 +25,10 @@ public:
|
||||||
}
|
}
|
||||||
MediaDecoderStateMachine* CreateStateMachine() override;
|
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.
|
// with an enabled platform decoder backend.
|
||||||
// If provided, codecs are checked for support.
|
// If provided, codecs are checked for support.
|
||||||
static bool IsSupportedType(const MediaContentType& aContentType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
void GetMozDebugReaderData(nsAString& aString) override;
|
void GetMozDebugReaderData(nsAString& aString) override;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче