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