/* -*- 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(EMEDecoderModule_h_) # define EMEDecoderModule_h_ # include "MediaDataDecoderProxy.h" # include "PlatformDecoderModule.h" # include "SamplesWaitingForKey.h" namespace mozilla { class CDMProxy; class PDMFactory; class EMEDecoderModule : public PlatformDecoderModule { public: EMEDecoderModule(CDMProxy* aProxy, PDMFactory* aPDM); protected: RefPtr AsyncCreateDecoder( const CreateDecoderParams& aParams) override; // Decode thread. already_AddRefed CreateVideoDecoder( const CreateDecoderParams& aParams) override { MOZ_CRASH("Not used"); } // Decode thread. already_AddRefed CreateAudioDecoder( const CreateDecoderParams& aParams) override { MOZ_CRASH("Not used"); } media::DecodeSupportSet SupportsMimeType( const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const override; private: virtual ~EMEDecoderModule(); RefPtr mProxy; // Will be null if CDM has decoding capability. RefPtr mPDM; }; DDLoggedTypeDeclNameAndBase(EMEMediaDataDecoderProxy, MediaDataDecoderProxy); class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy, public DecoderDoctorLifeLogger { public: EMEMediaDataDecoderProxy(const CreateDecoderParams& aParams, already_AddRefed aProxyDecoder, already_AddRefed aProxyThread, CDMProxy* aProxy); EMEMediaDataDecoderProxy(const CreateDecoderParams& aParams, already_AddRefed aProxyDecoder, CDMProxy* aProxy); RefPtr Decode(MediaRawData* aSample) override; RefPtr Flush() override; RefPtr Shutdown() override; private: nsCOMPtr mThread; RefPtr mSamplesWaitingForKey; MozPromiseRequestHolder mKeyRequest; MozPromiseHolder mDecodePromise; MozPromiseRequestHolder mDecodeRequest; RefPtr mProxy; }; } // namespace mozilla #endif // EMEDecoderModule_h_