Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | #if !defined(WMFDecoder_h_) |
michael@0 | 7 | #define WMFDecoder_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "MediaDecoder.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | |
michael@0 | 13 | // Decoder that uses Windows Media Foundation to playback H.264/AAC in MP4 |
michael@0 | 14 | // and M4A files, and MP3 files if the DirectShow backend is disabled. |
michael@0 | 15 | // Playback is strictly limited to only those codecs. |
michael@0 | 16 | class WMFDecoder : public MediaDecoder |
michael@0 | 17 | { |
michael@0 | 18 | public: |
michael@0 | 19 | |
michael@0 | 20 | virtual MediaDecoder* Clone() { |
michael@0 | 21 | if (!IsWMFEnabled()) { |
michael@0 | 22 | return nullptr; |
michael@0 | 23 | } |
michael@0 | 24 | return new WMFDecoder(); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | virtual MediaDecoderStateMachine* CreateStateMachine(); |
michael@0 | 28 | |
michael@0 | 29 | // Loads the DLLs required by Windows Media Foundation. If this returns |
michael@0 | 30 | // failure, you can assume that WMF is not available on the user's system. |
michael@0 | 31 | static nsresult LoadDLLs(); |
michael@0 | 32 | static void UnloadDLLs(); |
michael@0 | 33 | |
michael@0 | 34 | // Returns true if the WMF backend is preffed on, and we're running on a |
michael@0 | 35 | // version of Windows which is likely to support WMF. |
michael@0 | 36 | static bool IsEnabled(); |
michael@0 | 37 | |
michael@0 | 38 | // Returns true if MP3 decoding is enabled on this system. We block |
michael@0 | 39 | // MP3 playback on Windows 7 SP0, since it's crashy on that platform. |
michael@0 | 40 | static bool IsMP3Supported(); |
michael@0 | 41 | |
michael@0 | 42 | // Returns the HTMLMediaElement.canPlayType() result for the mime type |
michael@0 | 43 | // and codecs parameter. aCodecs can be empty. |
michael@0 | 44 | static bool CanPlayType(const nsACString& aType, |
michael@0 | 45 | const nsAString& aCodecs); |
michael@0 | 46 | |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | } // namespace mozilla |
michael@0 | 50 | |
michael@0 | 51 | #endif |