|
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 #if !defined(WMFDecoder_h_) |
|
7 #define WMFDecoder_h_ |
|
8 |
|
9 #include "MediaDecoder.h" |
|
10 |
|
11 namespace mozilla { |
|
12 |
|
13 // Decoder that uses Windows Media Foundation to playback H.264/AAC in MP4 |
|
14 // and M4A files, and MP3 files if the DirectShow backend is disabled. |
|
15 // Playback is strictly limited to only those codecs. |
|
16 class WMFDecoder : public MediaDecoder |
|
17 { |
|
18 public: |
|
19 |
|
20 virtual MediaDecoder* Clone() { |
|
21 if (!IsWMFEnabled()) { |
|
22 return nullptr; |
|
23 } |
|
24 return new WMFDecoder(); |
|
25 } |
|
26 |
|
27 virtual MediaDecoderStateMachine* CreateStateMachine(); |
|
28 |
|
29 // Loads the DLLs required by Windows Media Foundation. If this returns |
|
30 // failure, you can assume that WMF is not available on the user's system. |
|
31 static nsresult LoadDLLs(); |
|
32 static void UnloadDLLs(); |
|
33 |
|
34 // Returns true if the WMF backend is preffed on, and we're running on a |
|
35 // version of Windows which is likely to support WMF. |
|
36 static bool IsEnabled(); |
|
37 |
|
38 // Returns true if MP3 decoding is enabled on this system. We block |
|
39 // MP3 playback on Windows 7 SP0, since it's crashy on that platform. |
|
40 static bool IsMP3Supported(); |
|
41 |
|
42 // Returns the HTMLMediaElement.canPlayType() result for the mime type |
|
43 // and codecs parameter. aCodecs can be empty. |
|
44 static bool CanPlayType(const nsACString& aType, |
|
45 const nsAString& aCodecs); |
|
46 |
|
47 }; |
|
48 |
|
49 } // namespace mozilla |
|
50 |
|
51 #endif |