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