1 // Copyright 2017 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_MOJO_VIDEO_ENCODE_ACCELERATOR_PROVIDER_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_VIDEO_ENCODE_ACCELERATOR_PROVIDER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_refptr.h"
10 #include "gpu/config/gpu_driver_bug_workarounds.h"
11 #include "gpu/config/gpu_info.h"
12 #include "gpu/config/gpu_preferences.h"
13 #include "media/mojo/mojom/video_encode_accelerator.mojom.h"
14 #include "media/mojo/services/media_mojo_export.h"
15 #include "media/mojo/services/mojo_video_encode_accelerator_service.h"
16 #include "mojo/public/cpp/bindings/pending_receiver.h"
19 class SequencedTaskRunner;
24 // This class implements the interface mojom::VideoEncodeAcceleratorProvider,
25 // holds on to the necessary objects to create mojom::VideoEncodeAccelerators.
26 class MEDIA_MOJO_EXPORT MojoVideoEncodeAcceleratorProvider
27 : public mojom::VideoEncodeAcceleratorProvider {
29 using CreateAndInitializeVideoEncodeAcceleratorCallback =
30 base::RepeatingCallback<std::unique_ptr<::media::VideoEncodeAccelerator>(
31 const ::media::VideoEncodeAccelerator::Config& config,
32 VideoEncodeAccelerator::Client* client,
33 const gpu::GpuPreferences& gpu_preferences,
34 const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
35 const gpu::GPUInfo::GPUDevice& gpu_device,
36 std::unique_ptr<MediaLog> media_log)>;
39 mojo::PendingReceiver<mojom::VideoEncodeAcceleratorProvider> receiver,
40 CreateAndInitializeVideoEncodeAcceleratorCallback create_vea_callback,
41 const gpu::GpuPreferences& gpu_preferences,
42 const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
43 const gpu::GPUInfo::GPUDevice& gpu_device,
44 scoped_refptr<base::SequencedTaskRunner> runner);
46 MojoVideoEncodeAcceleratorProvider(
47 CreateAndInitializeVideoEncodeAcceleratorCallback create_vea_callback,
48 const gpu::GpuPreferences& gpu_preferences,
49 const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
50 const gpu::GPUInfo::GPUDevice& gpu_device);
52 MojoVideoEncodeAcceleratorProvider(
53 const MojoVideoEncodeAcceleratorProvider&) = delete;
54 MojoVideoEncodeAcceleratorProvider& operator=(
55 const MojoVideoEncodeAcceleratorProvider&) = delete;
57 ~MojoVideoEncodeAcceleratorProvider() override;
59 // mojom::VideoEncodeAcceleratorProvider impl.
60 void CreateVideoEncodeAccelerator(
61 mojo::PendingReceiver<mojom::VideoEncodeAccelerator> receiver) override;
62 void GetVideoEncodeAcceleratorSupportedProfiles(
63 GetVideoEncodeAcceleratorSupportedProfilesCallback callback) override;
66 const CreateAndInitializeVideoEncodeAcceleratorCallback create_vea_callback_;
67 const gpu::GpuPreferences gpu_preferences_;
68 const gpu::GpuDriverBugWorkarounds gpu_workarounds_;
69 const gpu::GPUInfo::GPUDevice gpu_device_;
74 #endif // MEDIA_MOJO_SERVICES_MOJO_VIDEO_ENCODE_ACCELERATOR_PROVIDER_H_