[M120 Migration][MM] Framerate calculation
[platform/framework/web/chromium-efl.git] / media / mojo / mojom / media_foundation_service.mojom
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.
4
5 module media.mojom;
6
7 import "gpu/ipc/common/gpu_info.mojom";
8 import "media/mojo/mojom/frame_interface_factory.mojom";
9 import "media/mojo/mojom/interface_factory.mojom";
10 import "media/mojo/mojom/key_system_support.mojom";
11 import "mojo/public/mojom/base/file_path.mojom";
12 import "sandbox/policy/mojom/sandbox.mojom";
13
14 // An observer on GpuInfo updates.
15 interface GpuInfoObserver {
16   // Notifies that a new GpuInfo update is available.
17   OnGpuInfoUpdate(gpu.mojom.GpuInfo gpu_info);
18 };
19
20 // A service to provide Windows MediaFoundation-based InterfaceFactory and
21 // KeySystemCapability. See comments on MediaFoundationServiceBroker for the
22 // process/sandbox model.
23 interface MediaFoundationService {
24   // Queries the capabilities of the MediaFoundation-based CDM. The client lives
25   // in the browser process.
26   IsKeySystemSupported(string key_system)
27     => (bool is_supported, KeySystemCapability? key_system_capability);
28
29   // Requests an InterfaceFactory. `frame_interfaces` can optionally be used to
30   // provide interfaces hosted by the caller to the remote InterfaceFactory
31   // implementation.  The remote `InterfaceFactory` lives in the render process
32   // to support media playback. The interface implementations provided by
33   // the `frame_interfaces` live in the browser process so they are trusted.
34   CreateInterfaceFactory(
35       pending_receiver<InterfaceFactory> factory,
36       pending_remote<FrameInterfaceFactory> frame_interfaces);
37 };
38
39 // A broker service to get the `MediaFoundationService`, needed to pass
40 // parameters to preload the CDM before creating the `MediaFoundationService`.
41 // It runs in the MediaFoundationCdm (utility) process and is connected from the
42 // browser process (see content/browser/media/service_factory.cc). In the
43 // process there should only be one `MediaFoundationServiceBroker` and one
44 // `MediaFoundationService` instance running. As such `GetService()` should only
45 // be called once and the subsequent calls will simply fail. When
46 // `MediaFoundationServiceBroker` is connected the process was not sandboxed to
47 // allow CDM preloading. After `GetService()` the process is fully sandboxed.
48 [ServiceSandbox=sandbox.mojom.Sandbox.kMediaFoundationCdm]
49 interface MediaFoundationServiceBroker {
50   // Updates `GpuInfo` stored in the `MediaFoundationService` process. The
51   // service will also provide a `gpu_info_observer` to get notified of any
52   // future `GpuInfo` updates. This info will be used for crash reporting and
53   // other purposes.
54   UpdateGpuInfo(gpu.mojom.GpuInfo gpu_info)
55     => (pending_remote<GpuInfoObserver> gpu_info_observer);
56
57   // Loads the CDM at `cdm_path` into the process and returns the
58   // `MediaFoundationService`.
59   GetService(
60       mojo_base.mojom.FilePath cdm_path,
61       pending_receiver<MediaFoundationService> receiver);
62 };