summaryrefslogtreecommitdiff
path: root/chromium/media/base/win/mf_initializer.cc
blob: a19f79f6ff4aa06b76f9a81e50c6801f2ce5e41d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/win/mf_initializer.h"

#include <mfapi.h>

#include "base/logging.h"

#include "base/optional.h"

namespace media {

MFSessionLifetime InitializeMediaFoundation() {
  if (MFStartup(MF_VERSION, MFSTARTUP_LITE) == S_OK)
    return std::make_unique<MFSession>();
  DVLOG(1) << "Media Foundation unavailable or it failed to initialize";
  return nullptr;
}

MFSession::~MFSession() {
  MFShutdown();
}

}  // namespace media