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