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"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class PDMFactory : public PlatformDecoderModule {
|
|
|
|
public:
|
|
|
|
PDMFactory();
|
|
|
|
virtual ~PDMFactory();
|
|
|
|
|
|
|
|
// Call on the main thread to initialize the static state
|
|
|
|
// needed by Create().
|
|
|
|
static void Init();
|
|
|
|
|
|
|
|
already_AddRefed<MediaDataDecoder>
|
|
|
|
CreateDecoder(const TrackInfo& aConfig,
|
|
|
|
FlushableTaskQueue* aTaskQueue,
|
|
|
|
MediaDataDecoderCallback* aCallback,
|
|
|
|
layers::LayersBackend aLayersBackend = layers::LayersBackend::LAYERS_NONE,
|
|
|
|
layers::ImageContainer* aImageContainer = nullptr) override;
|
|
|
|
|
|
|
|
bool SupportsMimeType(const nsACString& aMimeType) override;
|
|
|
|
|
|
|
|
ConversionRequired
|
|
|
|
DecoderNeedsConversion(const TrackInfo& aConfig) const override
|
|
|
|
{
|
|
|
|
MOZ_CRASH("Should never reach this function");
|
|
|
|
return ConversionRequired::kNeedNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Decode thread.
|
|
|
|
already_AddRefed<MediaDataDecoder>
|
|
|
|
CreateVideoDecoder(const VideoInfo& aConfig,
|
|
|
|
layers::LayersBackend aLayersBackend,
|
|
|
|
layers::ImageContainer* aImageContainer,
|
|
|
|
FlushableTaskQueue* aVideoTaskQueue,
|
|
|
|
MediaDataDecoderCallback* aCallback) override
|
|
|
|
{
|
|
|
|
MOZ_CRASH("Should never reach this function");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Decode thread.
|
|
|
|
already_AddRefed<MediaDataDecoder>
|
|
|
|
CreateAudioDecoder(const AudioInfo& aConfig,
|
|
|
|
FlushableTaskQueue* aAudioTaskQueue,
|
|
|
|
MediaDataDecoderCallback* aCallback) override
|
|
|
|
{
|
|
|
|
MOZ_CRASH("Should never reach this function");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
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.
|
|
|
|
already_AddRefed<PlatformDecoderModule> GetDecoder(const nsACString& aMimeType);
|
2015-10-05 10:08:56 +00:00
|
|
|
|
|
|
|
// Caches pref media.fragmented-mp4.use-blank-decoder
|
|
|
|
static bool sUseBlankDecoder;
|
|
|
|
static bool sGonkDecoderEnabled;
|
|
|
|
static bool sAndroidMCDecoderPreferred;
|
|
|
|
static bool sAndroidMCDecoderEnabled;
|
|
|
|
static bool sGMPDecoderEnabled;
|
|
|
|
static bool sEnableFuzzingWrapper;
|
|
|
|
static uint32_t sVideoOutputMinimumInterval_ms;
|
|
|
|
static bool sDontDelayInputExhausted;
|
|
|
|
|
2015-10-05 22:08:03 +00:00
|
|
|
nsTArray<nsRefPtr<PlatformDecoderModule>> mCurrentPDMs;
|
2015-10-05 10:08:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* PDMFactory_h_ */
|