1 // Copyright 2021 The Chromium Authors
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/mojo/services/media_foundation_mojo_media_client.h"
7 #include "base/task/single_thread_task_runner.h"
8 #include "media/base/media_log.h"
9 #include "media/base/win/mf_helpers.h"
10 #include "media/cdm/win/media_foundation_cdm_factory.h"
11 #include "media/filters/win/media_foundation_audio_decoder.h"
12 #include "media/mojo/services/media_foundation_renderer_wrapper.h"
13 #include "media/mojo/services/mojo_cdm_helper.h"
17 MediaFoundationMojoMediaClient::MediaFoundationMojoMediaClient() {
21 MediaFoundationMojoMediaClient::~MediaFoundationMojoMediaClient() {
25 std::unique_ptr<AudioDecoder>
26 MediaFoundationMojoMediaClient::CreateAudioDecoder(
27 scoped_refptr<base::SequencedTaskRunner> task_runner,
28 std::unique_ptr<MediaLog> media_log) {
29 return MediaFoundationAudioDecoder::Create();
32 std::unique_ptr<Renderer>
33 MediaFoundationMojoMediaClient::CreateMediaFoundationRenderer(
34 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
35 mojom::FrameInterfaceFactory* frame_interfaces,
36 mojo::PendingRemote<mojom::MediaLog> media_log_remote,
37 mojo::PendingReceiver<mojom::MediaFoundationRendererExtension>
38 renderer_extension_receiver,
39 mojo::PendingRemote<media::mojom::MediaFoundationRendererClientExtension>
40 client_extension_remote) {
42 return std::make_unique<MediaFoundationRendererWrapper>(
43 std::move(task_runner), frame_interfaces, std::move(media_log_remote),
44 std::move(renderer_extension_receiver),
45 std::move(client_extension_remote));
48 std::unique_ptr<CdmFactory> MediaFoundationMojoMediaClient::CreateCdmFactory(
49 mojom::FrameInterfaceFactory* frame_interfaces) {
51 return std::make_unique<MediaFoundationCdmFactory>(
52 std::make_unique<MojoCdmHelper>(frame_interfaces));