1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/wmf/WMFDecoder.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 +#if !defined(WMFDecoder_h_) 1.10 +#define WMFDecoder_h_ 1.11 + 1.12 +#include "MediaDecoder.h" 1.13 + 1.14 +namespace mozilla { 1.15 + 1.16 +// Decoder that uses Windows Media Foundation to playback H.264/AAC in MP4 1.17 +// and M4A files, and MP3 files if the DirectShow backend is disabled. 1.18 +// Playback is strictly limited to only those codecs. 1.19 +class WMFDecoder : public MediaDecoder 1.20 +{ 1.21 +public: 1.22 + 1.23 + virtual MediaDecoder* Clone() { 1.24 + if (!IsWMFEnabled()) { 1.25 + return nullptr; 1.26 + } 1.27 + return new WMFDecoder(); 1.28 + } 1.29 + 1.30 + virtual MediaDecoderStateMachine* CreateStateMachine(); 1.31 + 1.32 + // Loads the DLLs required by Windows Media Foundation. If this returns 1.33 + // failure, you can assume that WMF is not available on the user's system. 1.34 + static nsresult LoadDLLs(); 1.35 + static void UnloadDLLs(); 1.36 + 1.37 + // Returns true if the WMF backend is preffed on, and we're running on a 1.38 + // version of Windows which is likely to support WMF. 1.39 + static bool IsEnabled(); 1.40 + 1.41 + // Returns true if MP3 decoding is enabled on this system. We block 1.42 + // MP3 playback on Windows 7 SP0, since it's crashy on that platform. 1.43 + static bool IsMP3Supported(); 1.44 + 1.45 + // Returns the HTMLMediaElement.canPlayType() result for the mime type 1.46 + // and codecs parameter. aCodecs can be empty. 1.47 + static bool CanPlayType(const nsACString& aType, 1.48 + const nsAString& aCodecs); 1.49 + 1.50 +}; 1.51 + 1.52 +} // namespace mozilla 1.53 + 1.54 +#endif