OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/base/win/mf_initializer.h" | 5 #include "media/base/win/mf_initializer.h" |
6 | 6 |
7 #include <mfapi.h> | 7 #include <mfapi.h> |
8 | 8 |
9 #include "base/lazy_instance.h" | |
10 #include "base/macros.h" | |
11 | |
12 namespace media { | 9 namespace media { |
13 | 10 |
14 namespace { | |
15 | |
16 // LazyInstance to initialize the Media Foundation Library. | |
17 class MFInitializer { | |
18 public: | |
19 MFInitializer() | |
20 : mf_started_(MFStartup(MF_VERSION, MFSTARTUP_LITE) == S_OK) {} | |
21 | |
22 ~MFInitializer() { | |
23 if (mf_started_) | |
24 MFShutdown(); | |
25 } | |
26 | |
27 private: | |
28 const bool mf_started_; | |
29 | |
30 DISALLOW_COPY_AND_ASSIGN(MFInitializer); | |
31 }; | |
32 | |
33 base::LazyInstance<MFInitializer> g_mf_initializer = LAZY_INSTANCE_INITIALIZER; | |
34 | |
35 } // namespace | |
36 | |
37 void InitializeMediaFoundation() { | 11 void InitializeMediaFoundation() { |
38 g_mf_initializer.Get(); | 12 static bool mf_started = MFStartup(MF_VERSION, MFSTARTUP_LITE) == S_OK; |
scottmg
2017/01/31 21:10:34
Probably going to be a warning here on some compil
DaleCurtis
2017/01/31 22:04:33
Ah, win_clang complains about unused variable. Add
| |
39 } | 13 } |
40 | 14 |
41 } // namespace media | 15 } // namespace media |
OLD | NEW |