Rebaseline global-interface-listing-expected.txt
[chromium-blink-merge.git] / media / base / win / mf_initializer.cc
blobff62a451e92c79943ecb24d35646e3985e2b6c2b
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.
5 #include "media/base/win/mf_initializer.h"
7 #include <mfapi.h>
9 #include "base/lazy_instance.h"
10 #include "base/macros.h"
12 namespace media {
14 namespace {
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) {}
22 ~MFInitializer() {
23 if (mf_started_)
24 MFShutdown();
27 private:
28 const bool mf_started_;
30 DISALLOW_COPY_AND_ASSIGN(MFInitializer);
33 base::LazyInstance<MFInitializer> g_mf_initializer = LAZY_INSTANCE_INITIALIZER;
35 } // namespace
37 void InitializeMediaFoundation() {
38 g_mf_initializer.Get();
41 } // namespace media