tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

EMEDecoderModule.h (2673B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #if !defined(EMEDecoderModule_h_)
      8 #  define EMEDecoderModule_h_
      9 
     10 #  include "MediaDataDecoderProxy.h"
     11 #  include "PlatformDecoderModule.h"
     12 #  include "SamplesWaitingForKey.h"
     13 
     14 namespace mozilla {
     15 
     16 class CDMProxy;
     17 class PDMFactory;
     18 
     19 class EMEDecoderModule : public PlatformDecoderModule {
     20 public:
     21  const char* Name() const override { return "EME"; }
     22  EMEDecoderModule(CDMProxy* aProxy, PDMFactory* aPDM);
     23 
     24 protected:
     25  RefPtr<CreateDecoderPromise> AsyncCreateDecoder(
     26      const CreateDecoderParams& aParams) override;
     27 
     28  // Decode thread.
     29  already_AddRefed<MediaDataDecoder> CreateVideoDecoder(
     30      const CreateDecoderParams& aParams) override {
     31    MOZ_CRASH("Not used");
     32  }
     33 
     34  // Decode thread.
     35  already_AddRefed<MediaDataDecoder> CreateAudioDecoder(
     36      const CreateDecoderParams& aParams) override {
     37    MOZ_CRASH("Not used");
     38  }
     39 
     40  media::DecodeSupportSet SupportsMimeType(
     41      const nsACString& aMimeType,
     42      DecoderDoctorDiagnostics* aDiagnostics) const override;
     43 
     44 private:
     45  virtual ~EMEDecoderModule();
     46  RefPtr<CDMProxy> mProxy;
     47  // Will be null if CDM has decoding capability.
     48  RefPtr<PDMFactory> mPDM;
     49 };
     50 
     51 DDLoggedTypeDeclNameAndBase(EMEMediaDataDecoderProxy, MediaDataDecoderProxy);
     52 
     53 class EMEMediaDataDecoderProxy
     54    : public MediaDataDecoderProxy,
     55      public DecoderDoctorLifeLogger<EMEMediaDataDecoderProxy> {
     56 public:
     57  EMEMediaDataDecoderProxy(const CreateDecoderParams& aParams,
     58                           already_AddRefed<MediaDataDecoder> aProxyDecoder,
     59                           already_AddRefed<nsISerialEventTarget> aProxyThread,
     60                           CDMProxy* aProxy);
     61  EMEMediaDataDecoderProxy(const CreateDecoderParams& aParams,
     62                           already_AddRefed<MediaDataDecoder> aProxyDecoder,
     63                           CDMProxy* aProxy);
     64 
     65  RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
     66  RefPtr<FlushPromise> Flush() override;
     67  RefPtr<ShutdownPromise> Shutdown() override;
     68 
     69 private:
     70  nsCOMPtr<nsISerialEventTarget> mThread;
     71  RefPtr<SamplesWaitingForKey> mSamplesWaitingForKey;
     72  MozPromiseRequestHolder<SamplesWaitingForKey::WaitForKeyPromise> mKeyRequest;
     73  MozPromiseHolder<DecodePromise> mDecodePromise;
     74  MozPromiseRequestHolder<DecodePromise> mDecodeRequest;
     75  RefPtr<CDMProxy> mProxy;
     76 };
     77 
     78 }  // namespace mozilla
     79 
     80 #endif  // EMEDecoderModule_h_