[M120 Migration][MM] Framerate calculation
[platform/framework/web/chromium-efl.git] / media / mojo / mojom / interface_factory.mojom
1 // Copyright 2015 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 "media/mojo/mojom/audio_decoder.mojom";
8 import "media/mojo/mojom/audio_encoder.mojom";
9 import "media/mojo/mojom/decryptor.mojom";
10 import "media/mojo/mojom/content_decryption_module.mojom";
11 import "media/mojo/mojom/media_log.mojom";
12 import "media/mojo/mojom/renderer.mojom";
13 import "media/mojo/mojom/renderer_extensions.mojom";
14 import "media/mojo/mojom/stable/stable_video_decoder.mojom";
15 import "media/mojo/mojom/video_decoder.mojom";
16 import "mojo/public/mojom/base/token.mojom";
17 import "mojo/public/mojom/base/unguessable_token.mojom";
18
19 // A factory for creating media mojo interfaces. Renderers can only access
20 // ContentDecryptionModules created with the same factory.
21 interface InterfaceFactory {
22   CreateAudioDecoder(pending_receiver<AudioDecoder> audio_decoder);
23
24   // Creates a VideoDecoder (|video_decoder|). If |dst_video_decoder| is
25   // provided and supported by the implementation, VideoDecoder calls on
26   // |video_decoder| should be forwarded to |dst_video_decoder|. This is
27   // intended to be used for out-of-process video decoding and LaCrOS in which
28   // the GPU process acts a proxy between a renderer and a video decoder process
29   // so that it can create a gpu::Mailbox for each decoded frame. As such, only
30   // the GPU process should be provided with a valid |dst_video_decoder|.
31   CreateVideoDecoder(
32       pending_receiver<VideoDecoder> video_decoder,
33       pending_remote<media.stable.mojom.StableVideoDecoder>? dst_video_decoder);
34
35   // Creates an AudioEncoder bound to a given receiver.
36   CreateAudioEncoder(pending_receiver<AudioEncoder> audio_encoder);
37
38   // Creates a regular media::Renderer (RendererImplFactory).
39   // TODO(guohuideng): remove |audio_device_id|, it's not used.
40   // TODO(crbug.com/1374532): Rename this call.
41   CreateDefaultRenderer(string audio_device_id,
42                         pending_receiver<Renderer> renderer);
43
44   [EnableIf=enable_cast_renderer]
45   // Creates a CastRenderer (CastRendererClientFactory).
46   // This is used on Chromecast only. The |overlay_plane_id| is generated by
47   // VideoOverlayFactory owned by MojoRenderer, therefore identifies the
48   // MojoRenderer. With |overlay_plane_id|, The service can keep track of
49   // which hosted CastRenderer is associated with which client.
50   // This is necessary because MediaService will need to look up CastRenderer
51   // by the |overlay_plane_id| to set video geometry on.
52   CreateCastRenderer(mojo_base.mojom.UnguessableToken overlay_plane_id,
53                      pending_receiver<Renderer> renderer);
54
55   [EnableIf=is_android]
56   // Creates a MediaPlayerRenderer (MediaPlayerRendererClientFactory).
57   // - |renderer_extension| is bound in MediaPlayerRenderer, and receives calls
58   //   from MediaPlayerRendererClient.
59   // - |client_extension| is bound in MediaPlayerRendererClient, and receives
60   //   calls from the MediaPlayerRenderer.
61   CreateMediaPlayerRenderer(
62       pending_remote<MediaPlayerRendererClientExtension> client_extension,
63       pending_receiver<Renderer> renderer,
64       pending_receiver<MediaPlayerRendererExtension> renderer_extension);
65
66   [EnableIf=is_win]
67   // Creates a MediaFoundationRenderer (MediaFoundationRendererClientFactory).
68   // - |renderer_extension| is bound in MediaFoundationRenderer, and receives
69   //   calls from MediaFoundationRendererClient.
70   // - |client_extension| is bound in MediaFoundationRendererClient, and
71   //   received calls from MediaFoundationRenderer.
72   CreateMediaFoundationRenderer(
73       pending_remote<MediaLog> media_log,
74       pending_receiver<Renderer> renderer,
75       pending_receiver<MediaFoundationRendererExtension> renderer_extension,
76       pending_remote<MediaFoundationRendererClientExtension> client_extension);
77
78   [EnableIf=is_android]
79   // Creates a FlingingRenderer (FlingingRendererClientFactory).
80   // The |presentation_id| is used to find an already set-up RemotePlayback
81   // session (see blink::RemotePlayback).
82   CreateFlingingRenderer(
83       string presentation_id,
84       pending_remote<FlingingRendererClientExtension> client_extension,
85       pending_receiver<Renderer> renderer);
86
87   // Creates a CDM based on the `cdm_config` provided. The `key_system` in the
88   // `cdm_config` is a generic term for a decryption mechanism and/or content
89   // protection provider. It should be a reverse domain name,
90   // e.g. "com.example.somesystem". However, this call may be initiated by an
91   // untrusted process (e.g. renderer), so the implementation must fully
92   // validate `key_system` before creating the CDM. `cdm_config` specifies other
93   // properties of the CDM which may influence creation. Upon failure, the
94   // returned `cdm` and `cdm_context` will be null, and `error_message` will
95   // specify the error reason. Upon success, `cdm` and `cdm_context` will be
96   // valid, and `error_message` will be empty.
97   CreateCdm(CdmConfig cdm_config) =>
98             (pending_remote<ContentDecryptionModule>? cdm,
99              CdmContext? cdm_context,
100              string error_message);
101
102   [EnableIf=tizen_multimedia]
103   // Creates a MediaPlayerRenderer (MediaPlayerRendererClientFactory).
104   // - |renderer_extension| is bound in MediaPlayerRenderer, and receives calls
105   //   from MediaPlayerRendererClient.
106   // - |client_extension| is bound in MediaPlayerRendererClient, and receives
107   //   calls from the MediaPlayerRenderer.
108   CreateMediaPlayerRenderer(
109       pending_remote<MediaPlayerRendererClientExtension> client_extension,
110       pending_receiver<Renderer> renderer,
111       pending_receiver<MediaPlayerRendererExtension> renderer_extension);
112 };