tor-browser

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

WMFDecoderModule.h (2303B)


      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 #ifndef WMFPlatformDecoderModule_h_
      8 #define WMFPlatformDecoderModule_h_
      9 
     10 #include "PlatformDecoderModule.h"
     11 #include "WMF.h"
     12 #include "WMFUtils.h"
     13 
     14 namespace mozilla {
     15 
     16 class MFTDecoder;
     17 
     18 class WMFDecoderModule : public PlatformDecoderModule {
     19 public:
     20  const char* Name() const override { return "WMF"; }
     21  static already_AddRefed<PlatformDecoderModule> Create();
     22 
     23  // Initializes the module, loads required dynamic libraries, etc.
     24  nsresult Startup() override;
     25 
     26  already_AddRefed<MediaDataDecoder> CreateVideoDecoder(
     27      const CreateDecoderParams& aParams) override;
     28 
     29  already_AddRefed<MediaDataDecoder> CreateAudioDecoder(
     30      const CreateDecoderParams& aParams) override;
     31 
     32  bool SupportsColorDepth(
     33      gfx::ColorDepth aColorDepth,
     34      DecoderDoctorDiagnostics* aDiagnostics) const override;
     35  media::DecodeSupportSet SupportsMimeType(
     36      const nsACString& aMimeType,
     37      DecoderDoctorDiagnostics* aDiagnostics) const override;
     38  media::DecodeSupportSet Supports(
     39      const SupportDecoderParams& aParams,
     40      DecoderDoctorDiagnostics* aDiagnostics) const override;
     41 
     42  // Can be called on any thread, but avoid calling this on the main thread
     43  // because the initialization takes long time and we don't want to block the
     44  // main thread.
     45  static void Init();
     46 
     47  // Called from any thread, must call init first
     48  static int GetNumDecoderThreads();
     49 
     50  static HRESULT CreateMFTDecoder(const WMFStreamType& aType,
     51                                  RefPtr<MFTDecoder>& aDecoder);
     52  static bool CanCreateMFTDecoder(const WMFStreamType& aType);
     53 
     54 private:
     55  WMFDecoderModule() = default;
     56  virtual ~WMFDecoderModule() = default;
     57 
     58  static inline StaticMutex sMutex;
     59  static inline bool sSupportedTypesInitialized MOZ_GUARDED_BY(sMutex) = false;
     60  static inline EnumSet<WMFStreamType> sSupportedTypes MOZ_GUARDED_BY(sMutex);
     61  static inline EnumSet<WMFStreamType> sLackOfExtensionTypes
     62      MOZ_GUARDED_BY(sMutex);
     63 };
     64 
     65 }  // namespace mozilla
     66 
     67 #endif