Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: media/base/win/mf_initializer.cc

Issue 1149203002: Extract re-usable InitializeMediaFoundation() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No need to ever mutate member Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "media/base/win/mf_initializer.h"
6
7 #include <mfapi.h>
8
9 #include "base/lazy_instance.h"
10 #include "base/macros.h"
11
12 namespace media {
13
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 EnsureMediaFoundationInitialized() {
38 g_mf_initializer.Get();
39 }
40
41 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698