2015-10-05 10:08:56 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#if !defined(PDMFactory_h_)
|
|
|
|
#define PDMFactory_h_
|
|
|
|
|
|
|
|
#include "PlatformDecoderModule.h"
|
|
|
|
|
2015-10-06 08:56:29 +00:00
|
|
|
class CDMProxy;
|
|
|
|
|
2015-10-05 10:08:56 +00:00
|
|
|
namespace mozilla {
|
|
|
|
|
2015-10-06 09:10:31 +00:00
|
|
|
class PDMFactory final {
|
2015-10-05 10:08:56 +00:00
|
|
|
public:
|
2015-10-06 09:10:31 +00:00
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PDMFactory)
|
|
|
|
|
2015-10-05 10:08:56 +00:00
|
|
|
PDMFactory();
|
|
|
|
|
|
|
|
// Call on the main thread to initialize the static state
|
|
|
|
// needed by Create().
|
|
|
|
static void Init();
|
|
|
|
|
2015-10-06 09:10:31 +00:00
|
|
|
// Factory method that creates the appropriate PlatformDecoderModule for
|
|
|
|
// the platform we're running on. Caller is responsible for deleting this
|
|
|
|
// instance. It's expected that there will be multiple
|
|
|
|
// PlatformDecoderModules alive at the same time.
|
|
|
|
// This is called on the decode task queue.
|
2015-10-05 10:08:56 +00:00
|
|
|
already_AddRefed<MediaDataDecoder>
|
|
|
|
CreateDecoder(const TrackInfo& aConfig,
|
|
|
|
FlushableTaskQueue* aTaskQueue,
|
|
|
|
MediaDataDecoderCallback* aCallback,
|
|
|
|
layers::LayersBackend aLayersBackend = layers::LayersBackend::LAYERS_NONE,
|
2015-10-06 09:10:31 +00:00
|
|
|
layers::ImageContainer* aImageContainer = nullptr);
|
2015-10-05 10:08:56 +00:00
|
|
|
|
2015-11-04 15:01:51 +00:00
|
|
|
bool SupportsMimeType(const nsACString& aMimeType) const;
|
2015-10-05 10:08:56 +00:00
|
|
|
|
2015-10-06 08:56:29 +00:00
|
|
|
#ifdef MOZ_EME
|
|
|
|
// Creates a PlatformDecoderModule that uses a CDMProxy to decrypt or
|
|
|
|
// decrypt-and-decode EME encrypted content. If the CDM only decrypts and
|
|
|
|
// does not decode, we create a PDM and use that to create MediaDataDecoders
|
|
|
|
// that we use on on aTaskQueue to decode the decrypted stream.
|
|
|
|
// This is called on the decode task queue.
|
|
|
|
void SetCDMProxy(CDMProxy* aProxy);
|
|
|
|
#endif
|
|
|
|
|
2015-10-05 10:08:56 +00:00
|
|
|
private:
|
2015-10-06 09:10:31 +00:00
|
|
|
virtual ~PDMFactory();
|
2015-10-05 22:08:03 +00:00
|
|
|
void CreatePDMs();
|
|
|
|
// Startup the provided PDM and add it to our list if successful.
|
|
|
|
bool StartupPDM(PlatformDecoderModule* aPDM);
|
|
|
|
// Returns the first PDM in our list supporting the mimetype.
|
2015-11-04 15:01:51 +00:00
|
|
|
already_AddRefed<PlatformDecoderModule>
|
|
|
|
GetDecoder(const nsACString& aMimeType) const;
|
|
|
|
|
2015-10-28 13:46:30 +00:00
|
|
|
already_AddRefed<MediaDataDecoder>
|
|
|
|
CreateDecoderWithPDM(PlatformDecoderModule* aPDM,
|
|
|
|
const TrackInfo& aConfig,
|
|
|
|
FlushableTaskQueue* aTaskQueue,
|
|
|
|
MediaDataDecoderCallback* aCallback,
|
|
|
|
layers::LayersBackend aLayersBackend,
|
|
|
|
layers::ImageContainer* aImageContainer);
|
2015-10-05 10:08:56 +00:00
|
|
|
|
2015-10-15 01:51:31 +00:00
|
|
|
// PDM pref caches...
|
2015-10-05 10:08:56 +00:00
|
|
|
static bool sUseBlankDecoder;
|
2015-10-15 01:51:31 +00:00
|
|
|
#ifdef MOZ_GONK_MEDIACODEC
|
2015-10-05 10:08:56 +00:00
|
|
|
static bool sGonkDecoderEnabled;
|
2015-10-15 01:51:31 +00:00
|
|
|
#endif
|
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2015-10-05 10:08:56 +00:00
|
|
|
static bool sAndroidMCDecoderPreferred;
|
|
|
|
static bool sAndroidMCDecoderEnabled;
|
2015-10-15 01:51:31 +00:00
|
|
|
#endif
|
2015-10-05 10:08:56 +00:00
|
|
|
static bool sGMPDecoderEnabled;
|
2016-01-19 06:31:25 +00:00
|
|
|
#ifdef MOZ_FFVPX
|
|
|
|
static bool sFFVPXDecoderEnabled;
|
|
|
|
#endif
|
2015-10-15 01:51:31 +00:00
|
|
|
#ifdef MOZ_FFMPEG
|
2015-10-11 23:00:04 +00:00
|
|
|
static bool sFFmpegDecoderEnabled;
|
2015-10-15 01:51:34 +00:00
|
|
|
#endif
|
|
|
|
#ifdef XP_WIN
|
|
|
|
static bool sWMFDecoderEnabled;
|
2015-10-15 01:51:31 +00:00
|
|
|
#endif
|
2015-10-05 10:08:56 +00:00
|
|
|
static bool sEnableFuzzingWrapper;
|
|
|
|
static uint32_t sVideoOutputMinimumInterval_ms;
|
|
|
|
static bool sDontDelayInputExhausted;
|
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs;
|
|
|
|
RefPtr<PlatformDecoderModule> mEMEPDM;
|
2015-10-05 10:08:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* PDMFactory_h_ */
|