xref: /aosp_15_r20/external/cronet/build/config/cast.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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# The args declared in this file should be referenced by components outside of
6# //chromecast. Args needed only in //chromecast should be declared in
7# //chromecast/chromecast.gni.
8declare_args() {
9  # Set this true for an audio-only Chromecast build.
10  # TODO(https://crbug.com/1516671): Remove this arg as CastOS builds are no
11  # longer supported.
12  is_cast_audio_only = false
13
14  # If non empty, rpath of executables is set to this.
15  # If empty, default value is used.
16  target_rpath = ""
17
18  # Set true to enable modular_updater.
19  enable_modular_updater = false
20
21  # True to enable the cast audio renderer.
22  #
23  # TODO(crbug.com/1293520): Remove this buildflag.
24  enable_cast_audio_renderer = false
25
26  # Set this to true to build for Nest hardware running Linux (aka "CastOS").
27  # Set this to false to use the defaults for Linux.
28  is_castos = false
29
30  # Set this to true to build for Android-based Cast devices.
31  # Set this to false to use the defaults for Android.
32  is_cast_android = false
33}
34
35# Restrict is_castos and is_cast_android to only be set on the target toolchain.
36is_castos = is_castos && current_toolchain == default_toolchain
37is_cast_android = is_cast_android && current_toolchain == default_toolchain
38
39declare_args() {
40  # Set this true for a Chromecast build. Chromecast builds are supported on
41  # Linux, Android, ChromeOS, and Fuchsia.
42  enable_cast_receiver = false
43}
44
45declare_args() {
46  # True to enable the cast renderer.  It is enabled by default for Linux and
47  # Android audio only builds.
48  #
49  # TODO(crbug.com/1293520):  Remove this buildflag.
50  enable_cast_renderer =
51      enable_cast_receiver &&
52      (is_linux || is_chromeos || (is_cast_audio_only && is_android))
53}
54
55# Configures media options for cast.  See media/media_options.gni
56cast_mojo_media_services = []
57cast_mojo_media_host = ""
58
59if (enable_cast_audio_renderer) {
60  if (is_android) {
61    cast_mojo_media_services = [
62      "cdm",
63      "audio_decoder",
64    ]
65  }
66
67  if (!is_cast_audio_only) {
68    cast_mojo_media_services += [ "video_decoder" ]
69  }
70
71  if (is_android && is_cast_audio_only) {
72    cast_mojo_media_host = "browser"
73  } else {
74    cast_mojo_media_host = "gpu"
75  }
76} else if (enable_cast_renderer) {
77  # In this path, mojo media services are hosted in two processes:
78  # 1. "renderer" and "cdm" run in browser process. This is hard coded in the
79  # code.
80  # 2. "video_decoder" runs in the process specified by "cast_mojo_media_host".
81  cast_mojo_media_services = [
82    "cdm",
83    "renderer",
84  ]
85  if (!is_cast_audio_only) {
86    cast_mojo_media_services += [ "video_decoder" ]
87  }
88
89  cast_mojo_media_host = "gpu"
90} else if (is_android) {
91  # On Android, all the enabled mojo media services run in the process specified
92  # by "cast_mojo_media_host".
93  cast_mojo_media_services = [
94    "cdm",
95    "audio_decoder",
96  ]
97  if (!is_cast_audio_only) {
98    # These are Cast/Android devices with Video capabilities (and GPU)
99    cast_mojo_media_services += [ "video_decoder" ]
100    cast_mojo_media_host = "gpu"
101  } else {
102    # These are Cast/Android devices with only Audio capabilities (no GPU)
103    cast_mojo_media_host = "browser"
104  }
105}
106
107# Assert that Chromecast is being built for a supported platform.
108assert(is_linux || is_chromeos || is_android || is_fuchsia ||
109           !enable_cast_receiver,
110       "Cast receiver builds are not supported on $current_os")
111
112assert(enable_cast_receiver || !is_cast_audio_only,
113       "is_cast_audio_only = true requires enable_cast_receiver = true.")
114
115assert(enable_cast_receiver || !is_castos,
116       "is_castos = true requires enable_cast_receiver = true.")
117assert(is_linux || !is_castos, "is_castos = true requires is_linux = true.")
118
119assert(enable_cast_receiver || !is_cast_android,
120       "is_cast_android = true requires enable_cast_receiver = true.")
121assert(is_android || !is_cast_android,
122       "is_cast_android = true requires is_android = true.")
123