| // Copyright 2021 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module media.mojom; |
| |
| import "gpu/ipc/common/gpu_info.mojom"; |
| import "media/mojo/mojom/frame_interface_factory.mojom"; |
| import "media/mojo/mojom/interface_factory.mojom"; |
| import "media/mojo/mojom/key_system_support.mojom"; |
| import "mojo/public/mojom/base/file_path.mojom"; |
| import "sandbox/policy/mojom/sandbox.mojom"; |
| |
| // An observer on GpuInfo updates. |
| interface GpuInfoObserver { |
| // Notifies that a new GpuInfo update is available. |
| OnGpuInfoUpdate(gpu.mojom.GpuInfo gpu_info); |
| }; |
| |
| // A service to provide Windows MediaFoundation-based InterfaceFactory and |
| // KeySystemCapability. See comments on MediaFoundationServiceBroker for the |
| // process/sandbox model. |
| interface MediaFoundationService { |
| // Queries the capabilities of the MediaFoundation-based CDM. The client lives |
| // in the browser process. |
| IsKeySystemSupported(string key_system) |
| => (bool is_supported, KeySystemCapability? key_system_capability); |
| |
| // Requests an InterfaceFactory. `frame_interfaces` can optionally be used to |
| // provide interfaces hosted by the caller to the remote InterfaceFactory |
| // implementation. The remote `InterfaceFactory` lives in the render process |
| // to support media playback. The interface implementations provided by |
| // the `frame_interfaces` live in the browser process so they are trusted. |
| CreateInterfaceFactory( |
| pending_receiver<InterfaceFactory> factory, |
| pending_remote<FrameInterfaceFactory> frame_interfaces); |
| }; |
| |
| // A broker service to get the `MediaFoundationService`, needed to pass |
| // parameters to preload the CDM before creating the `MediaFoundationService`. |
| // It runs in the MediaFoundationCdm (utility) process and is connected from the |
| // browser process (see content/browser/media/service_factory.cc). In the |
| // process there should only be one `MediaFoundationServiceBroker` and one |
| // `MediaFoundationService` instance running. As such `GetService()` should only |
| // be called once and the subsequent calls will simply fail. When |
| // `MediaFoundationServiceBroker` is connected the process was not sandboxed to |
| // allow CDM preloading. After `GetService()` the process is fully sandboxed. |
| [ServiceSandbox=sandbox.mojom.Sandbox.kMediaFoundationCdm] |
| interface MediaFoundationServiceBroker { |
| // Updates `GpuInfo` stored in the `MediaFoundationService` process. The |
| // service will also provide a `gpu_info_observer` to get notified of any |
| // future `GpuInfo` updates. This info will be used for crash reporting and |
| // other purposes. |
| UpdateGpuInfo(gpu.mojom.GpuInfo gpu_info) |
| => (pending_remote<GpuInfoObserver> gpu_info_observer); |
| |
| // Loads the CDM at `cdm_path` into the process and returns the |
| // `MediaFoundationService`. |
| GetService( |
| mojo_base.mojom.FilePath cdm_path, |
| pending_receiver<MediaFoundationService> receiver); |
| }; |