# 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. import("//build/buildflag_header.gni") import("//build/config/chromecast_build.gni") import("//chromecast/chromecast.gni") import("//media/media_options.gni") import("//testing/test.gni") declare_args() { # Set true to use raw timestamps on non-desktop cast build. # ALSA version equal or later than 1.0.29 support this function. use_alsa_monotonic_raw_tstamps = !is_cast_desktop_build } # Alsa must be used for these targets to build. assert(use_alsa) cast_shared_library("libcast_media_1.0_audio") { sources = [ "cast_media_shlib.cc", "media_codec_support_cast_audio.cc", "post_processing_pipeline_impl.cc", "post_processing_pipeline_impl.h", ] deps = [ ":alsa_cma_backend", ":post_processor_factory", "//base", "//chromecast/base", "//chromecast/public", "//chromecast/public/media", "//media", ] } source_set("alsa_cma_backend") { sources = [ "alsa_volume_control.cc", "alsa_volume_control.h", "alsa_wrapper.cc", "alsa_wrapper.h", "audio_decoder_alsa.cc", "audio_decoder_alsa.h", "filter_group.cc", "filter_group.h", "media_pipeline_backend_alsa.cc", "media_pipeline_backend_alsa.h", "post_processing_pipeline.h", "post_processing_pipeline_parser.cc", "post_processing_pipeline_parser.h", "stream_mixer_alsa.cc", "stream_mixer_alsa.h", "stream_mixer_alsa_input.cc", "stream_mixer_alsa_input.h", "stream_mixer_alsa_input_impl.cc", "stream_mixer_alsa_input_impl.h", "volume_control.cc", ] libs = [ "asound" ] deps = [ ":alsa_features", ":slew_volume", ":volume_map", "//base", "//chromecast/base", "//chromecast/media/base", "//chromecast/media/cma/backend:null", "//chromecast/media/cma/base", "//chromecast/media/cma/decoder", "//chromecast/public/media", "//media", "//media:shared_memory_support", ] } source_set("volume_map") { sources = [ "cast_audio_json.cc", "cast_audio_json.h", "volume_map.cc", "volume_map.h", ] deps = [ "//base", "//chromecast/base", ] } source_set("slew_volume") { sources = [ "slew_volume.cc", "slew_volume.h", ] deps = [ "//base", "//media:shared_memory_support", ] } alsa_owns_volume = !enable_assistant && chromecast_branding != "google" buildflag_header("alsa_features") { header = "alsa_features.h" flags = [ "ALSA_MONOTONIC_RAW_TSTAMPS=$use_alsa_monotonic_raw_tstamps", "ALSA_OWNS_VOLUME=$alsa_owns_volume", ] } test("cast_alsa_cma_backend_unittests") { sources = [ "filter_group_unittest.cc", "post_processors/governor_unittest.cc", "post_processors/saturated_gain_unittest.cc", "slew_volume_unittests.cc", "stream_mixer_alsa_unittest.cc", ] deps = [ ":governor", ":libcast_governor_1.0", ":libcast_saturated_gain_1.0", ":post_processor_factory", ":post_processor_test_support", ":slew_volume", ":test_support", "//base", "//base/test:run_all_unittests", "//chromecast/media", "//chromecast/public", "//media", "//media:shared_memory_support", "//testing/gmock", "//testing/gtest", ] } source_set("test_support") { testonly = true sources = [ "mock_alsa_wrapper.cc", "mock_alsa_wrapper.h", ] public_deps = [ ":alsa_cma_backend", ] deps = [ "//base", "//media", "//testing/gmock", ] } # This is separate from ":governor" because the associated unittest needs # to create a Governor directly (to use test functions). cast_shared_library("libcast_governor_1.0") { sources = [ "post_processors/governor_create.cc", ] deps = [ ":governor", "//chromecast/public/media", ] } source_set("governor") { sources = [ "post_processors/governor.cc", "post_processors/governor.h", ] deps = [ ":slew_volume", "//base", "//chromecast/base", "//chromecast/public/media", ] public_configs = [ "//chromecast/public:public_config" ] } cast_shared_library("libcast_saturated_gain_1.0") { sources = [ "post_processors/saturated_gain.cc", "post_processors/saturated_gain.h", ] deps = [ ":slew_volume", "//base", "//chromecast/base", "//chromecast/public/media", ] } source_set("post_processor_test_support") { testonly = true sources = [ "post_processors/post_processor_unittest.cc", "post_processors/post_processor_unittest.h", ] deps = [ "//base", "//chromecast/public/media", "//testing/gtest", ] } source_set("post_processor_factory") { sources = [ "post_processor_factory.cc", "post_processor_factory.h", ] deps = [ "//base", "//chromecast/public/media", ] }