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(WMFPlatformDecoderModule_h_)
8 #  define WMFPlatformDecoderModule_h_
9 
10 #  include "PlatformDecoderModule.h"
11 
12 namespace mozilla {
13 
14 class WMFDecoderModule : public PlatformDecoderModule {
15  public:
16   static already_AddRefed<PlatformDecoderModule> Create();
17 
18   // Initializes the module, loads required dynamic libraries, etc.
19   nsresult Startup() override;
20 
21   already_AddRefed<MediaDataDecoder> CreateVideoDecoder(
22       const CreateDecoderParams& aParams) override;
23 
24   already_AddRefed<MediaDataDecoder> CreateAudioDecoder(
25       const CreateDecoderParams& aParams) override;
26 
27   bool SupportsMimeType(const nsACString& aMimeType,
28                         DecoderDoctorDiagnostics* aDiagnostics) const override;
29   bool Supports(const SupportDecoderParams& aParams,
30                 DecoderDoctorDiagnostics* aDiagnostics) const override;
31 
32   // Called on main thread.
33   static void Init();
34 
35   // Called from any thread, must call init first
36   static int GetNumDecoderThreads();
37 
38   // Accessors that report whether we have the required MFTs available
39   // on the system to play various codecs. Windows Vista doesn't have the
40   // H.264/AAC decoders if the "Platform Update Supplement for Windows Vista"
41   // is not installed, and Window N and KN variants also require a "Media
42   // Feature Pack" to be installed. Windows XP doesn't have WMF.
43   static bool HasH264();
44   static bool HasVP8();
45   static bool HasVP9();
46   static bool HasAAC();
47   static bool HasMP3();
48 
49  private:
50   WMFDecoderModule() = default;
51   virtual ~WMFDecoderModule();
52 
53   void ReportUsageForTelemetry() const;
54 
55   bool mWMFInitialized = false;
56 };
57 
58 }  // namespace mozilla
59 
60 #endif
61