зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 10 changesets (bug 1390748) for build bustage
Backed out changeset 02b36ee5fb17 (bug 1390748) Backed out changeset 84e8bf01c856 (bug 1390748) Backed out changeset fc8989be30f3 (bug 1390748) Backed out changeset 14d421ace6cc (bug 1390748) Backed out changeset 7dadac869038 (bug 1390748) Backed out changeset 0e77809e7bc2 (bug 1390748) Backed out changeset bf78a8dce9c5 (bug 1390748) Backed out changeset 5fa77990472e (bug 1390748) Backed out changeset 5d3b637d2485 (bug 1390748) Backed out changeset 634fe076d134 (bug 1390748) MozReview-Commit-ID: Dxio8vXDCHg
This commit is contained in:
Родитель
4748ebca90
Коммит
38ce1ea2a0
|
@ -22,6 +22,7 @@
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
|
#include "MediaDecoder.h"
|
||||||
#include "nsAppRunner.h"
|
#include "nsAppRunner.h"
|
||||||
// nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h.
|
// nsNPAPIPluginInstance must be included before nsIDocument.h, which is included in mozAutoDocUpdate.h.
|
||||||
#include "nsNPAPIPluginInstance.h"
|
#include "nsNPAPIPluginInstance.h"
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
#include "mozilla/dom/FileSystemSecurity.h"
|
#include "mozilla/dom/FileSystemSecurity.h"
|
||||||
#include "mozilla/dom/FileBlobImpl.h"
|
#include "mozilla/dom/FileBlobImpl.h"
|
||||||
#include "mozilla/dom/HTMLInputElement.h"
|
#include "mozilla/dom/HTMLInputElement.h"
|
||||||
|
#include "mozilla/dom/HTMLMediaElement.h"
|
||||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||||
#include "mozilla/dom/HTMLContentElement.h"
|
#include "mozilla/dom/HTMLContentElement.h"
|
||||||
#include "mozilla/dom/HTMLShadowElement.h"
|
#include "mozilla/dom/HTMLShadowElement.h"
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||||
#include "ClientLayerManager.h"
|
#include "ClientLayerManager.h"
|
||||||
#include "nsQueryObject.h"
|
#include "nsQueryObject.h"
|
||||||
|
#ifdef MOZ_FMP4
|
||||||
|
#include "MP4Decoder.h"
|
||||||
|
#endif
|
||||||
#include "CubebUtils.h"
|
#include "CubebUtils.h"
|
||||||
|
|
||||||
#include "nsIScrollableFrame.h"
|
#include "nsIScrollableFrame.h"
|
||||||
|
|
|
@ -7153,17 +7153,6 @@ HTMLMediaElement::NextFrameStatus()
|
||||||
return NEXT_FRAME_UNINITIALIZED;
|
return NEXT_FRAME_UNINITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
HTMLMediaElement::SetDecoder(MediaDecoder* aDecoder)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aDecoder); // Use ShutdownDecoder() to clear.
|
|
||||||
if (mDecoder) {
|
|
||||||
ShutdownDecoder();
|
|
||||||
}
|
|
||||||
mDecoder = aDecoder;
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
float
|
||||||
HTMLMediaElement::ComputedVolume() const
|
HTMLMediaElement::ComputedVolume() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nsIDOMHTMLMediaElement.h"
|
#include "nsIDOMHTMLMediaElement.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "MediaEventSource.h"
|
|
||||||
#include "SeekTarget.h"
|
|
||||||
#include "MediaDecoderOwner.h"
|
#include "MediaDecoderOwner.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
|
@ -20,6 +18,7 @@
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/dom/TextTrackManager.h"
|
#include "mozilla/dom/TextTrackManager.h"
|
||||||
#include "mozilla/WeakPtr.h"
|
#include "mozilla/WeakPtr.h"
|
||||||
|
#include "MediaDecoder.h"
|
||||||
#include "mozilla/dom/MediaKeys.h"
|
#include "mozilla/dom/MediaKeys.h"
|
||||||
#include "mozilla/StateWatching.h"
|
#include "mozilla/StateWatching.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
|
@ -50,9 +49,6 @@ class DOMMediaStream;
|
||||||
class ErrorResult;
|
class ErrorResult;
|
||||||
class MediaResource;
|
class MediaResource;
|
||||||
class MediaDecoder;
|
class MediaDecoder;
|
||||||
class MediaInputPort;
|
|
||||||
class MediaStream;
|
|
||||||
class MediaStreamGraph;
|
|
||||||
class VideoFrameContainer;
|
class VideoFrameContainer;
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class MediaKeys;
|
class MediaKeys;
|
||||||
|
@ -812,7 +808,13 @@ protected:
|
||||||
|
|
||||||
MediaDecoderOwner::NextFrameStatus NextFrameStatus();
|
MediaDecoderOwner::NextFrameStatus NextFrameStatus();
|
||||||
|
|
||||||
void SetDecoder(MediaDecoder* aDecoder);
|
void SetDecoder(MediaDecoder* aDecoder) {
|
||||||
|
MOZ_ASSERT(aDecoder); // Use ShutdownDecoder() to clear.
|
||||||
|
if (mDecoder) {
|
||||||
|
ShutdownDecoder();
|
||||||
|
}
|
||||||
|
mDecoder = aDecoder;
|
||||||
|
}
|
||||||
|
|
||||||
class WakeLockBoolWrapper {
|
class WakeLockBoolWrapper {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
#include "mozilla/dom/HTMLMediaElement.h"
|
#include "mozilla/dom/HTMLMediaElement.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class FrameStatistics;
|
|
||||||
|
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class WakeLock;
|
class WakeLock;
|
||||||
|
|
|
@ -5,11 +5,21 @@
|
||||||
* 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 "ADTSDecoder.h"
|
#include "ADTSDecoder.h"
|
||||||
|
#include "ADTSDemuxer.h"
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "PDMFactory.h"
|
#include "PDMFactory.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
ChannelMediaDecoder*
|
||||||
|
ADTSDecoder::CloneImpl(MediaDecoderInit& aInit)
|
||||||
|
{
|
||||||
|
if (!IsEnabled())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return new ADTSDecoder(aInit);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
ADTSDecoder::IsEnabled()
|
ADTSDecoder::IsEnabled()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,17 +7,28 @@
|
||||||
#ifndef ADTS_DECODER_H_
|
#ifndef ADTS_DECODER_H_
|
||||||
#define ADTS_DECODER_H_
|
#define ADTS_DECODER_H_
|
||||||
|
|
||||||
|
#include "ChannelMediaDecoder.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContainerType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class ADTSDecoder
|
class ADTSDecoder : public ChannelMediaDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// MediaDecoder interface.
|
||||||
|
explicit ADTSDecoder(MediaDecoderInit& aInit)
|
||||||
|
: ChannelMediaDecoder(aInit)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// 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 MediaContainerType& aContainerType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -174,10 +174,10 @@ ChannelMediaDecoder::CanClone()
|
||||||
already_AddRefed<ChannelMediaDecoder>
|
already_AddRefed<ChannelMediaDecoder>
|
||||||
ChannelMediaDecoder::Clone(MediaDecoderInit& aInit)
|
ChannelMediaDecoder::Clone(MediaDecoderInit& aInit)
|
||||||
{
|
{
|
||||||
if (!mResource || !DecoderTraits::IsSupportedType(aInit.mContainerType)) {
|
if (!mResource) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
RefPtr<ChannelMediaDecoder> decoder = new ChannelMediaDecoder(aInit);
|
RefPtr<ChannelMediaDecoder> decoder = CloneImpl(aInit);
|
||||||
if (!decoder) {
|
if (!decoder) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
explicit ChannelMediaDecoder(MediaDecoderInit& aInit);
|
explicit ChannelMediaDecoder(MediaDecoderInit& aInit);
|
||||||
|
|
||||||
|
MediaDecoderStateMachine* CreateStateMachine() override;
|
||||||
|
|
||||||
MediaResource* GetResource() const override final;
|
MediaResource* GetResource() const override final;
|
||||||
|
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
@ -85,9 +87,7 @@ public:
|
||||||
void Resume() override;
|
void Resume() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Create a new state machine to run this decoder.
|
virtual ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) = 0;
|
||||||
MediaDecoderStateMachine* CreateStateMachine();
|
|
||||||
|
|
||||||
nsresult OpenResource(nsIStreamListener** aStreamListener);
|
nsresult OpenResource(nsIStreamListener** aStreamListener);
|
||||||
nsresult Load(BaseMediaResource* aOriginal);
|
nsresult Load(BaseMediaResource* aOriginal);
|
||||||
|
|
||||||
|
|
|
@ -233,8 +233,36 @@ InstantiateDecoder(MediaDecoderInit& aInit,
|
||||||
RefPtr<ChannelMediaDecoder> decoder;
|
RefPtr<ChannelMediaDecoder> decoder;
|
||||||
|
|
||||||
const MediaContainerType& type = aInit.mContainerType;
|
const MediaContainerType& type = aInit.mContainerType;
|
||||||
if (DecoderTraits::IsSupportedType(type)) {
|
|
||||||
decoder = new ChannelMediaDecoder(aInit);
|
#ifdef MOZ_FMP4
|
||||||
|
if (MP4Decoder::IsSupportedType(type, aDiagnostics)) {
|
||||||
|
decoder = new MP4Decoder(aInit);
|
||||||
|
return decoder.forget();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (MP3Decoder::IsSupportedType(type)) {
|
||||||
|
decoder = new MP3Decoder(aInit);
|
||||||
|
return decoder.forget();
|
||||||
|
}
|
||||||
|
if (ADTSDecoder::IsSupportedType(type)) {
|
||||||
|
decoder = new ADTSDecoder(aInit);
|
||||||
|
return decoder.forget();
|
||||||
|
}
|
||||||
|
if (OggDecoder::IsSupportedType(type)) {
|
||||||
|
decoder = new OggDecoder(aInit);
|
||||||
|
return decoder.forget();
|
||||||
|
}
|
||||||
|
if (WaveDecoder::IsSupportedType(type)) {
|
||||||
|
decoder = new WaveDecoder(aInit);
|
||||||
|
return decoder.forget();
|
||||||
|
}
|
||||||
|
if (FlacDecoder::IsSupportedType(type)) {
|
||||||
|
decoder = new FlacDecoder(aInit);
|
||||||
|
return decoder.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WebMDecoder::IsSupportedType(type)) {
|
||||||
|
decoder = new WebMDecoder(aInit);
|
||||||
return decoder.forget();
|
return decoder.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,10 +311,7 @@ DecoderTraits::CreateReader(const MediaContainerType& aType,
|
||||||
decoderReader = new MediaFormatReader(aInit, new FlacDemuxer(resource));
|
decoderReader = new MediaFormatReader(aInit, new FlacDemuxer(resource));
|
||||||
} else
|
} else
|
||||||
if (OggDecoder::IsSupportedType(aType)) {
|
if (OggDecoder::IsSupportedType(aType)) {
|
||||||
RefPtr<OggDemuxer> demuxer = new OggDemuxer(resource);
|
decoderReader = new MediaFormatReader(aInit, new OggDemuxer(resource));
|
||||||
decoderReader = new MediaFormatReader(aInit, demuxer);
|
|
||||||
demuxer->SetChainingEvents(&decoderReader->TimedMetadataProducer(),
|
|
||||||
&decoderReader->MediaNotSeekableProducer());
|
|
||||||
} else
|
} else
|
||||||
if (WebMDecoder::IsSupportedType(aType)) {
|
if (WebMDecoder::IsSupportedType(aType)) {
|
||||||
decoderReader = new MediaFormatReader(aInit, new WebMDemuxer(resource));
|
decoderReader = new MediaFormatReader(aInit, new WebMDemuxer(resource));
|
||||||
|
@ -295,30 +320,6 @@ DecoderTraits::CreateReader(const MediaContainerType& aType,
|
||||||
return decoderReader;
|
return decoderReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool
|
|
||||||
DecoderTraits::IsSupportedType(const MediaContainerType& aType)
|
|
||||||
{
|
|
||||||
typedef bool (*IsSupportedFunction)(const MediaContainerType& aType);
|
|
||||||
static const IsSupportedFunction funcs[] = {
|
|
||||||
&ADTSDecoder::IsSupportedType,
|
|
||||||
&FlacDecoder::IsSupportedType,
|
|
||||||
&MP3Decoder::IsSupportedType,
|
|
||||||
#ifdef MOZ_FMP4
|
|
||||||
&MP4Decoder::IsSupportedTypeWithoutDiagnostics,
|
|
||||||
#endif
|
|
||||||
&OggDecoder::IsSupportedType,
|
|
||||||
&WaveDecoder::IsSupportedType,
|
|
||||||
&WebMDecoder::IsSupportedType,
|
|
||||||
};
|
|
||||||
for (IsSupportedFunction func : funcs) {
|
|
||||||
if (func(aType)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
|
bool DecoderTraits::IsSupportedInVideoDocument(const nsACString& aType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,8 +65,6 @@ public:
|
||||||
|
|
||||||
// Returns true if aType is MIME type of hls.
|
// Returns true if aType is MIME type of hls.
|
||||||
static bool IsHttpLiveStreamingType(const MediaContainerType& aType);
|
static bool IsHttpLiveStreamingType(const MediaContainerType& aType);
|
||||||
|
|
||||||
static bool IsSupportedType(const MediaContainerType& aType);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -1621,14 +1621,6 @@ MediaDecoder::RequestDebugInfo()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MediaDecoder::GetMozDebugReaderData(nsACString& aString)
|
|
||||||
{
|
|
||||||
if (mReader) {
|
|
||||||
mReader->GetMozDebugReaderData(aString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaDecoder::NotifyAudibleStateChanged()
|
MediaDecoder::NotifyAudibleStateChanged()
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,6 +108,10 @@ public:
|
||||||
// Safe to call from any thread.
|
// Safe to call from any thread.
|
||||||
const MediaContainerType& ContainerType() const { return mContainerType; }
|
const MediaContainerType& ContainerType() const { return mContainerType; }
|
||||||
|
|
||||||
|
// Create a new state machine to run this decoder.
|
||||||
|
// Subclasses must implement this.
|
||||||
|
virtual MediaDecoderStateMachine* CreateStateMachine() = 0;
|
||||||
|
|
||||||
// Cleanup internal data structures. Must be called on the main
|
// Cleanup internal data structures. Must be called on the main
|
||||||
// thread by the owning object before that object disposes of this object.
|
// thread by the owning object before that object disposes of this object.
|
||||||
virtual void Shutdown();
|
virtual void Shutdown();
|
||||||
|
@ -203,6 +207,7 @@ public:
|
||||||
// Must be called before Shutdown().
|
// Must be called before Shutdown().
|
||||||
bool OwnerHasError() const;
|
bool OwnerHasError() const;
|
||||||
|
|
||||||
|
public:
|
||||||
// Returns true if this media supports random seeking. False for example with
|
// Returns true if this media supports random seeking. False for example with
|
||||||
// chained ogg files.
|
// chained ogg files.
|
||||||
bool IsMediaSeekable();
|
bool IsMediaSeekable();
|
||||||
|
@ -406,7 +411,7 @@ private:
|
||||||
|
|
||||||
// Returns a string describing the state of the media player internal
|
// Returns a string describing the state of the media player internal
|
||||||
// data. Used for debugging purposes.
|
// data. Used for debugging purposes.
|
||||||
virtual void GetMozDebugReaderData(nsACString& aString);
|
virtual void GetMozDebugReaderData(nsACString& aString) { }
|
||||||
|
|
||||||
virtual void DumpDebugInfo();
|
virtual void DumpDebugInfo();
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "nsProxyRelease.h"
|
#include "nsProxyRelease.h"
|
||||||
#include "nsIContentPolicy.h"
|
#include "nsIContentPolicy.h"
|
||||||
#include "mozilla/ErrorNames.h"
|
|
||||||
|
|
||||||
using mozilla::media::TimeUnit;
|
using mozilla::media::TimeUnit;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
|
#ifdef MOZ_FMP4
|
||||||
|
#include "MP4Decoder.h"
|
||||||
|
#endif
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include "WMFDecoderModule.h"
|
#include "WMFDecoderModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsContentTypeParser.h"
|
#include "nsContentTypeParser.h"
|
||||||
|
#ifdef MOZ_FMP4
|
||||||
|
#include "MP4Decoder.h"
|
||||||
|
#endif
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include "mozilla/WindowsVersion.h"
|
#include "mozilla/WindowsVersion.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,11 +5,22 @@
|
||||||
* 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 "FlacDecoder.h"
|
#include "FlacDecoder.h"
|
||||||
|
#include "FlacDemuxer.h"
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
ChannelMediaDecoder*
|
||||||
|
FlacDecoder::CloneImpl(MediaDecoderInit& aInit)
|
||||||
|
{
|
||||||
|
if (!IsEnabled()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new FlacDecoder(aInit);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
FlacDecoder::IsEnabled()
|
FlacDecoder::IsEnabled()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,17 +7,28 @@
|
||||||
#ifndef FLAC_DECODER_H_
|
#ifndef FLAC_DECODER_H_
|
||||||
#define FLAC_DECODER_H_
|
#define FLAC_DECODER_H_
|
||||||
|
|
||||||
|
#include "ChannelMediaDecoder.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContainerType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class FlacDecoder
|
class FlacDecoder : public ChannelMediaDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// MediaDecoder interface.
|
||||||
|
explicit FlacDecoder(MediaDecoderInit& aInit)
|
||||||
|
: ChannelMediaDecoder(aInit)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// 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 MediaContainerType& aContainerType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -6,14 +6,30 @@
|
||||||
|
|
||||||
#include "MP4Decoder.h"
|
#include "MP4Decoder.h"
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
|
#include "MediaFormatReader.h"
|
||||||
#include "MP4Demuxer.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"
|
#include "nsMimeTypes.h"
|
||||||
#include "VideoUtils.h"
|
#include "VideoUtils.h"
|
||||||
|
|
||||||
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
|
#include "nsIGfxInfo.h"
|
||||||
|
#endif
|
||||||
|
#include "mozilla/layers/LayersTypes.h"
|
||||||
|
|
||||||
#include "PDMFactory.h"
|
#include "PDMFactory.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
MP4Decoder::MP4Decoder(MediaDecoderInit& aInit)
|
||||||
|
: ChannelMediaDecoder(aInit)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsWhitelistedH264Codec(const nsAString& aCodec)
|
IsWhitelistedH264Codec(const nsAString& aCodec)
|
||||||
{
|
{
|
||||||
|
@ -39,14 +55,6 @@ IsWhitelistedH264Codec(const nsAString& aCodec)
|
||||||
profile == H264_PROFILE_HIGH);
|
profile == H264_PROFILE_HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool
|
|
||||||
MP4Decoder::IsSupportedTypeWithoutDiagnostics(
|
|
||||||
const MediaContainerType& aContainerType)
|
|
||||||
{
|
|
||||||
return IsSupportedType(aContainerType, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
MP4Decoder::IsSupportedType(const MediaContainerType& aType,
|
MP4Decoder::IsSupportedType(const MediaContainerType& aType,
|
||||||
|
@ -270,4 +278,12 @@ MP4Decoder::IsVideoAccelerated(layers::KnowsCompositor* aKnowsCompositor, nsIGlo
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MP4Decoder::GetMozDebugReaderData(nsACString& aString)
|
||||||
|
{
|
||||||
|
if (mReader) {
|
||||||
|
mReader->GetMozDebugReaderData(aString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -6,26 +6,26 @@
|
||||||
#if !defined(MP4Decoder_h_)
|
#if !defined(MP4Decoder_h_)
|
||||||
#define MP4Decoder_h_
|
#define MP4Decoder_h_
|
||||||
|
|
||||||
class nsACString;
|
#include "ChannelMediaDecoder.h"
|
||||||
|
#include "mozilla/dom/Promise.h"
|
||||||
|
#include "mozilla/layers/KnowsCompositor.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContainerType;
|
class MediaContainerType;
|
||||||
class DecoderDoctorDiagnostics;
|
|
||||||
|
|
||||||
// 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
|
class MP4Decoder : public ChannelMediaDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit MP4Decoder(MediaDecoderInit& aInit);
|
||||||
|
|
||||||
// Returns true if aContainerType 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 MediaContainerType& aContainerType,
|
static bool IsSupportedType(const MediaContainerType& aContainerType,
|
||||||
DecoderDoctorDiagnostics* aDiagnostics);
|
DecoderDoctorDiagnostics* aDiagnostics);
|
||||||
|
|
||||||
static bool IsSupportedTypeWithoutDiagnostics(
|
|
||||||
const MediaContainerType& aContainerType);
|
|
||||||
|
|
||||||
// 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
|
||||||
// identify H264. Does not parse general content type strings, i.e. white
|
// identify H264. Does not parse general content type strings, i.e. white
|
||||||
// space matters.
|
// space matters.
|
||||||
|
@ -42,6 +42,16 @@ public:
|
||||||
static already_AddRefed<dom::Promise>
|
static already_AddRefed<dom::Promise>
|
||||||
IsVideoAccelerated(layers::KnowsCompositor* aKnowsCompositor, nsIGlobalObject* aParent);
|
IsVideoAccelerated(layers::KnowsCompositor* aKnowsCompositor, nsIGlobalObject* aParent);
|
||||||
|
|
||||||
|
void GetMozDebugReaderData(nsACString& aString) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override
|
||||||
|
{
|
||||||
|
if (!IsEnabled()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return new MP4Decoder(aInit);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "MockMediaResource.h"
|
#include "MockMediaResource.h"
|
||||||
#include "DecoderTraits.h"
|
#include "DecoderTraits.h"
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
|
#include "MP4Decoder.h"
|
||||||
#include "MP4Demuxer.h"
|
#include "MP4Demuxer.h"
|
||||||
#include "WebMDecoder.h"
|
#include "WebMDecoder.h"
|
||||||
#include "WebMDemuxer.h"
|
#include "WebMDemuxer.h"
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
|
|
||||||
MediaResource* GetResource() const override final;
|
MediaResource* GetResource() const override final;
|
||||||
|
|
||||||
|
MediaDecoderStateMachine* CreateStateMachine() override;
|
||||||
nsresult Load(nsIPrincipal* aPrincipal);
|
nsresult Load(nsIPrincipal* aPrincipal);
|
||||||
media::TimeIntervals GetSeekable() override;
|
media::TimeIntervals GetSeekable() override;
|
||||||
media::TimeIntervals GetBuffered() override;
|
media::TimeIntervals GetBuffered() override;
|
||||||
|
@ -64,7 +65,6 @@ public:
|
||||||
void NotifyInitDataArrived();
|
void NotifyInitDataArrived();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MediaDecoderStateMachine* CreateStateMachine();
|
|
||||||
void DoSetMediaSourceDuration(double aDuration);
|
void DoSetMediaSourceDuration(double aDuration);
|
||||||
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
|
media::TimeInterval ClampIntervalToEnd(const media::TimeInterval& aInterval);
|
||||||
bool CanPlayThroughImpl() override;
|
bool CanPlayThroughImpl() override;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
@ -5,11 +6,22 @@
|
||||||
* 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 "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
|
#include "MP3Demuxer.h"
|
||||||
#include "PDMFactory.h"
|
#include "PDMFactory.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
ChannelMediaDecoder*
|
||||||
|
MP3Decoder::CloneImpl(MediaDecoderInit& aInit)
|
||||||
|
{
|
||||||
|
if (!IsEnabled()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return new MP3Decoder(aInit);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
MP3Decoder::IsEnabled() {
|
MP3Decoder::IsEnabled() {
|
||||||
|
|
|
@ -6,17 +6,28 @@
|
||||||
#ifndef MP3Decoder_h_
|
#ifndef MP3Decoder_h_
|
||||||
#define MP3Decoder_h_
|
#define MP3Decoder_h_
|
||||||
|
|
||||||
|
#include "ChannelMediaDecoder.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContainerType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class MP3Decoder
|
class MP3Decoder : public ChannelMediaDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// MediaDecoder interface.
|
||||||
|
explicit MP3Decoder(MediaDecoderInit& aInit)
|
||||||
|
: ChannelMediaDecoder(aInit)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// 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 MediaContainerType& aContainerType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -4,13 +4,29 @@
|
||||||
* 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 "OggDecoder.h"
|
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoder.h"
|
#include "MediaDecoderStateMachine.h"
|
||||||
|
#include "MediaFormatReader.h"
|
||||||
|
#include "OggDemuxer.h"
|
||||||
|
#include "OggDecoder.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
MediaDecoderStateMachine* OggDecoder::CreateStateMachine()
|
||||||
|
{
|
||||||
|
RefPtr<OggDemuxer> demuxer = new OggDemuxer(mResource);
|
||||||
|
MediaFormatReaderInit init;
|
||||||
|
init.mVideoFrameContainer = GetVideoFrameContainer();
|
||||||
|
init.mKnowsCompositor = GetCompositor();
|
||||||
|
init.mCrashHelper = GetOwner()->CreateGMPCrashHelper();
|
||||||
|
init.mFrameStats = mFrameStats;
|
||||||
|
mReader = new MediaFormatReader(init, demuxer);
|
||||||
|
demuxer->SetChainingEvents(&mReader->TimedMetadataProducer(),
|
||||||
|
&mReader->MediaNotSeekableProducer());
|
||||||
|
return new MediaDecoderStateMachine(this, mReader);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
|
@ -35,7 +51,7 @@ OggDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
// Verify that all the codecs specified are ones that we expect that
|
// Verify that all the codecs specified are ones that we expect that
|
||||||
// we can play.
|
// we can play.
|
||||||
for (const auto& codec : codecs.Range()) {
|
for (const auto& codec : codecs.Range()) {
|
||||||
if ((MediaDecoder::IsOpusEnabled() && codec.EqualsLiteral("opus")) ||
|
if ((IsOpusEnabled() && codec.EqualsLiteral("opus")) ||
|
||||||
codec.EqualsLiteral("vorbis") ||
|
codec.EqualsLiteral("vorbis") ||
|
||||||
(MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
|
(MediaPrefs::FlacInOgg() && codec.EqualsLiteral("flac"))) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -6,17 +6,34 @@
|
||||||
#if !defined(OggDecoder_h_)
|
#if !defined(OggDecoder_h_)
|
||||||
#define OggDecoder_h_
|
#define OggDecoder_h_
|
||||||
|
|
||||||
|
#include "ChannelMediaDecoder.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContainerType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class OggDecoder
|
class OggDecoder : public ChannelMediaDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit OggDecoder(MediaDecoderInit& aInit)
|
||||||
|
: ChannelMediaDecoder(aInit)
|
||||||
|
{}
|
||||||
|
|
||||||
|
MediaDecoderStateMachine* CreateStateMachine() override;
|
||||||
|
|
||||||
// Returns true if aContainerType 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 MediaContainerType& aContainerType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override
|
||||||
|
{
|
||||||
|
if (!IsOggEnabled()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return new OggDecoder(aInit);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "EMEVideoDecoder.h"
|
#include "EMEVideoDecoder.h"
|
||||||
#include "GMPDecoderModule.h"
|
#include "GMPDecoderModule.h"
|
||||||
#include "GMPService.h"
|
#include "GMPService.h"
|
||||||
|
#include "MP4Decoder.h"
|
||||||
#include "MediaInfo.h"
|
#include "MediaInfo.h"
|
||||||
#include "MediaPrefs.h"
|
#include "MediaPrefs.h"
|
||||||
#include "PDMFactory.h"
|
#include "PDMFactory.h"
|
||||||
|
|
|
@ -4,16 +4,23 @@
|
||||||
* 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 "WaveDecoder.h"
|
#include "WaveDemuxer.h"
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
#include "MediaDecoder.h"
|
#include "WaveDecoder.h"
|
||||||
|
#include "PDMFactory.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
ChannelMediaDecoder*
|
||||||
|
WaveDecoder::CloneImpl(MediaDecoderInit& aInit)
|
||||||
|
{
|
||||||
|
return new WaveDecoder(aInit);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
WaveDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
WaveDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
{
|
{
|
||||||
if (!MediaDecoder::IsWaveEnabled()) {
|
if (!IsWaveEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (aContainerType.Type() == MEDIAMIMETYPE("audio/wave")
|
if (aContainerType.Type() == MEDIAMIMETYPE("audio/wave")
|
||||||
|
|
|
@ -6,16 +6,27 @@
|
||||||
#if !defined(WaveDecoder_h_)
|
#if !defined(WaveDecoder_h_)
|
||||||
#define WaveDecoder_h_
|
#define WaveDecoder_h_
|
||||||
|
|
||||||
|
#include "ChannelMediaDecoder.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContainerType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class WaveDecoder
|
class WaveDecoder : public ChannelMediaDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// MediaDecoder interface.
|
||||||
|
explicit WaveDecoder(MediaDecoderInit& aInit)
|
||||||
|
: ChannelMediaDecoder(aInit)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// 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 MediaContainerType& aContainerType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -11,13 +11,14 @@
|
||||||
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
#include "mozilla/EndianUtils.h"
|
#include "mozilla/EndianUtils.h"
|
||||||
#include "mp4_demuxer/ByteReader.h"
|
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "VideoUtils.h"
|
#include "VideoUtils.h"
|
||||||
#include "TimeUnits.h"
|
#include "TimeUnits.h"
|
||||||
|
#include "prenv.h"
|
||||||
|
|
||||||
using mozilla::media::TimeUnit;
|
using mozilla::media::TimeUnit;
|
||||||
using mozilla::media::TimeIntervals;
|
using mozilla::media::TimeIntervals;
|
||||||
|
using mp4_demuxer::ByteReader;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
#ifndef WAV_DEMUXER_H_
|
#ifndef WAV_DEMUXER_H_
|
||||||
#define WAV_DEMUXER_H_
|
#define WAV_DEMUXER_H_
|
||||||
|
|
||||||
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "mozilla/Maybe.h"
|
||||||
#include "MediaDataDemuxer.h"
|
#include "MediaDataDemuxer.h"
|
||||||
#include "MediaResource.h"
|
#include "MediaResource.h"
|
||||||
|
#include "mp4_demuxer/ByteReader.h"
|
||||||
|
|
||||||
namespace mp4_demuxer {
|
|
||||||
class ByteReader;
|
|
||||||
}
|
|
||||||
using mp4_demuxer::ByteReader;
|
using mp4_demuxer::ByteReader;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
|
@ -4,12 +4,15 @@
|
||||||
* 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 "WebMDecoder.h"
|
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#ifdef MOZ_AV1
|
#ifdef MOZ_AV1
|
||||||
#include "AOMDecoder.h"
|
#include "AOMDecoder.h"
|
||||||
#endif
|
#endif
|
||||||
#include "MediaContainerType.h"
|
#include "MediaContainerType.h"
|
||||||
|
#include "MediaFormatReader.h"
|
||||||
|
#include "WebMDemuxer.h"
|
||||||
|
#include "WebMDecoder.h"
|
||||||
|
#include "VideoUtils.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
@ -55,5 +58,13 @@ WebMDecoder::IsSupportedType(const MediaContainerType& aContainerType)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WebMDecoder::GetMozDebugReaderData(nsACString& aString)
|
||||||
|
{
|
||||||
|
if (mReader) {
|
||||||
|
mReader->GetMozDebugReaderData(aString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,35 @@
|
||||||
#if !defined(WebMDecoder_h_)
|
#if !defined(WebMDecoder_h_)
|
||||||
#define WebMDecoder_h_
|
#define WebMDecoder_h_
|
||||||
|
|
||||||
|
#include "ChannelMediaDecoder.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class MediaContainerType;
|
class MediaContainerType;
|
||||||
|
|
||||||
class WebMDecoder
|
class WebMDecoder : public ChannelMediaDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit WebMDecoder(MediaDecoderInit& aInit)
|
||||||
|
: ChannelMediaDecoder(aInit)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if aContainerType 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 MediaContainerType& aContainerType);
|
static bool IsSupportedType(const MediaContainerType& aContainerType);
|
||||||
|
|
||||||
|
void GetMozDebugReaderData(nsACString& aString) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ChannelMediaDecoder* CloneImpl(MediaDecoderInit& aInit) override
|
||||||
|
{
|
||||||
|
if (!IsWebMEnabled()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return new WebMDecoder(aInit);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define BYTE_READER_H_
|
#define BYTE_READER_H_
|
||||||
|
|
||||||
#include "mozilla/EndianUtils.h"
|
#include "mozilla/EndianUtils.h"
|
||||||
|
#include "mozilla/Vector.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "MediaData.h"
|
#include "MediaData.h"
|
||||||
|
|
||||||
|
@ -15,6 +16,10 @@ class MOZ_RAII ByteReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ByteReader() : mPtr(nullptr), mRemaining(0) {}
|
ByteReader() : mPtr(nullptr), mRemaining(0) {}
|
||||||
|
explicit ByteReader(const mozilla::Vector<uint8_t>& aData)
|
||||||
|
: mPtr(aData.begin()), mRemaining(aData.length()), mLength(aData.length())
|
||||||
|
{
|
||||||
|
}
|
||||||
ByteReader(const uint8_t* aData, size_t aSize)
|
ByteReader(const uint8_t* aData, size_t aSize)
|
||||||
: mPtr(aData), mRemaining(aSize), mLength(aSize)
|
: mPtr(aData), mRemaining(aSize), mLength(aSize)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче