content/media/directshow/DirectShowDecoder.cpp

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:cc5ec275667e
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 #include "DirectShowDecoder.h"
8 #include "DirectShowReader.h"
9 #include "MediaDecoderStateMachine.h"
10 #include "mozilla/Preferences.h"
11 #include "mozilla/WindowsVersion.h"
12
13 namespace mozilla {
14
15 MediaDecoderStateMachine* DirectShowDecoder::CreateStateMachine()
16 {
17 return new MediaDecoderStateMachine(this, new DirectShowReader(this));
18 }
19
20 /* static */
21 bool
22 DirectShowDecoder::GetSupportedCodecs(const nsACString& aType,
23 char const *const ** aCodecList)
24 {
25 if (!IsEnabled()) {
26 return false;
27 }
28
29 static char const *const mp3AudioCodecs[] = {
30 "mp3",
31 nullptr
32 };
33 if (aType.EqualsASCII("audio/mpeg") ||
34 aType.EqualsASCII("audio/mp3")) {
35 if (aCodecList) {
36 *aCodecList = mp3AudioCodecs;
37 }
38 return true;
39 }
40
41 return false;
42 }
43
44 /* static */
45 bool
46 DirectShowDecoder::IsEnabled()
47 {
48 return Preferences::GetBool("media.directshow.enabled");
49 }
50
51 DirectShowDecoder::DirectShowDecoder()
52 {
53 MOZ_COUNT_CTOR(DirectShowDecoder);
54 }
55
56 DirectShowDecoder::~DirectShowDecoder()
57 {
58 MOZ_COUNT_DTOR(DirectShowDecoder);
59 }
60
61 } // namespace mozilla
62

mercurial