1 // Copyright 2016 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 #ifndef MEDIA_MOJO_SERVICES_MEDIA_SERVICE_FACTORY_H_
6 #define MEDIA_MOJO_SERVICES_MEDIA_SERVICE_FACTORY_H_
10 #include "base/memory/scoped_refptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/task/single_thread_task_runner.h"
13 #include "build/build_config.h"
14 #include "gpu/config/gpu_driver_bug_workarounds.h"
15 #include "gpu/config/gpu_feature_info.h"
16 #include "gpu/config/gpu_info.h"
17 #include "gpu/config/gpu_preferences.h"
18 #include "media/base/android_overlay_mojo_factory.h"
19 #include "media/mojo/mojom/media_service.mojom.h"
20 #include "media/mojo/services/media_mojo_export.h"
21 #include "media/mojo/services/media_service.h"
22 #include "mojo/public/cpp/bindings/pending_receiver.h"
25 class GpuMemoryBufferFactory;
30 class MediaGpuChannelManager;
32 // Creates a MediaService instance using the default MojoMediaClient on each
34 std::unique_ptr<MediaService> MEDIA_MOJO_EXPORT
35 CreateMediaService(mojo::PendingReceiver<mojom::MediaService> receiver);
37 // Creates a MediaService instance using the GpuMojoMediaClient.
38 // |media_gpu_channel_manager| must only be used on |task_runner|, which is
39 // expected to be the GPU main thread task runner.
40 std::unique_ptr<MediaService> MEDIA_MOJO_EXPORT CreateGpuMediaService(
41 mojo::PendingReceiver<mojom::MediaService> receiver,
42 const gpu::GpuPreferences& gpu_preferences,
43 const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
44 const gpu::GpuFeatureInfo& gpu_feature_info,
45 const gpu::GPUInfo& gpu_info,
46 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
47 base::WeakPtr<MediaGpuChannelManager> media_gpu_channel_manager,
48 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
49 AndroidOverlayMojoFactoryCB android_overlay_factory_cb);
51 // Creates a MediaService instance using the TestMojoMediaClient.
52 std::unique_ptr<MediaService> MEDIA_MOJO_EXPORT CreateMediaServiceForTesting(
53 mojo::PendingReceiver<mojom::MediaService> receiver);
57 #endif // MEDIA_MOJO_SERVICES_MEDIA_SERVICE_FACTORY_H_