summaryrefslogtreecommitdiff
path: root/chromium/media/mojo/mojom/interface_factory.mojom
blob: 09e7328dd7c40e1824458bad28f33ece180202a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module media.mojom;

import "media/mojo/mojom/audio_decoder.mojom";
import "media/mojo/mojom/decryptor.mojom";
import "media/mojo/mojom/content_decryption_module.mojom";
import "media/mojo/mojom/renderer.mojom";
import "media/mojo/mojom/renderer_extensions.mojom";
import "media/mojo/mojom/video_decoder.mojom";
import "mojo/public/mojom/base/token.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";

// A factory for creating media mojo interfaces. Renderers can only access
// ContentDecryptionModules created with the same factory.
interface InterfaceFactory {
  CreateAudioDecoder(pending_receiver<AudioDecoder> audio_decoder);
  CreateVideoDecoder(pending_receiver<VideoDecoder> video_decoder);

  // Creates a regular media::Renderer (DefaultRendererFactory).
  // TODO(guohuideng): remove |audio_device_id|, it's not used.
  CreateDefaultRenderer(string audio_device_id,
                        pending_receiver<Renderer> renderer);

  [EnableIf=enable_cast_renderer]
  // Creates a CastRenderer (CastRendererClientFactory).
  // This is used on Chromecast only. The |overlay_plane_id| is generated by
  // VideoOverlayFactory owned by MojoRenderer, therefore identifies the
  // MojoRenderer. With |overlay_plane_id|, The service can keep track of
  // which hosted CastRenderer is associated with which client.
  // This is necessary because MediaService will need to look up CastRenderer
  // by the |overlay_plane_id| to set video geometry on.
  CreateCastRenderer(mojo_base.mojom.UnguessableToken overlay_plane_id,
                     pending_receiver<Renderer> renderer);

  [EnableIf=is_android]
  // Creates a MediaPlayerRenderer (MediaPlayerRendererClientFactory).
  // - |renderer_extension| is bound in MediaPlayerRenderer, and receives calls
  //   from MediaPlayerRendererClient.
  // - |client_extension| is bound in MediaPlayerRendererClient, and receives
  //   calls from the MediaPlayerRenderer.
  CreateMediaPlayerRenderer(
      pending_remote<MediaPlayerRendererClientExtension> client_extension,
      pending_receiver<Renderer> renderer,
      pending_receiver<MediaPlayerRendererExtension> renderer_extension);

  [EnableIf=is_win]
  // Creates a MediaFoundationRenderer (MediaFoundationRendererClientFactory).
  // - |renderer_extension| is bound in MediaFoundationRenderer, and receives
  //   calls from MediaFoundationRendererClient.
  CreateMediaFoundationRenderer(
      pending_receiver<Renderer> renderer,
      pending_receiver<MediaFoundationRendererExtension> renderer_extension);

  [EnableIf=is_android]
  // Creates a FlingingRenderer (FlingingRendererClientFactory).
  // The |presentation_id| is used to find an already set-up RemotePlayback
  // session (see blink::RemotePlayback).
  CreateFlingingRenderer(
      string presentation_id,
      pending_remote<FlingingRendererClientExtension> client_extension,
      pending_receiver<Renderer> renderer);

  // Creates a CDM based on the |key_system| and |cdm_config| provided. A
  // |key_system| is a generic term for a decryption mechanism and/or content
  // protection provider. It should be a reverse domain name,
  // e.g. "com.example.somesystem". However, this call may be initiated by an
  // untrusted process (e.g. renderer), so the implementation must fully
  // validate |key_system| before creating the CDM. |cdm_config| specifies other
  // properties of the CDM which may influence creation. Upon failure, the
  // returned |cdm| and |decryptor| will be null, |cdm_id| will be zero and
  // |error_message| will specify the error reason. Upon success, |cdm| will be
  // valid, |cdm_id| will be non-zero and will later be used to locate the CDM
  // at the remote side and |error_message| will be empty. |decryptor| will be
  // the remote Decryptor if the CDM implementation provides one.
  CreateCdm(string key_system, CdmConfig cdm_config) =>
            (pending_remote<ContentDecryptionModule>? cdm,
             mojo_base.mojom.UnguessableToken? cdm_id,
             pending_remote<Decryptor>? decryptor,
             string error_message);
};