chromium/chromecast/media/cma/backend/mixer/BUILD.gn

# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/cast.gni")
import("//chromecast/chromecast.gni")
import("//media/media_options.gni")

declare_args() {
  mixer_output = ""
}

cast_source_set("post_processor_paths") {
  sources = [
    "post_processor_paths.cc",
    "post_processor_paths.h",
  ]
  deps = [ "//base" ]
}

cast_source_set("post_processor_registry") {
  sources = [
    "post_processor_registry.cc",
    "post_processor_registry.h",
  ]
  deps = [
    "//base",
    "//chromecast/public/media",
  ]
}

cast_source_set("loopback") {
  sources = [
    "loopback_handler.cc",
    "loopback_handler.h",
    "mixer_loopback_connection.cc",
    "mixer_loopback_connection.h",
  ]

  deps = [
    "//base",
    "//chromecast/media/audio:libcast_external_audio_pipeline_1.0",
    "//chromecast/media/audio/mixer_service:common",
    "//chromecast/media/audio/mixer_service:proto",
    "//chromecast/media/audio/net:common",
    "//chromecast/media/audio/net:proto",
    "//chromecast/net:io_buffer_pool",
    "//chromecast/public/media",
  ]
}

cast_source_set("mixer") {
  sources = [
    "audio_output_redirector.cc",
    "audio_output_redirector.h",
    "audio_output_redirector_input.h",
    "channel_layout.cc",
    "channel_layout.h",
    "filter_group.cc",
    "filter_group.h",
    "mixer_input.cc",
    "mixer_input.h",
    "mixer_input_connection.cc",
    "mixer_input_connection.h",
    "mixer_pipeline.cc",
    "mixer_pipeline.h",
    "mixer_service_receiver.cc",
    "mixer_service_receiver.h",
    "post_processing_pipeline.h",
    "post_processing_pipeline_impl.cc",
    "post_processing_pipeline_impl.h",
    "post_processing_pipeline_parser.cc",
    "post_processing_pipeline_parser.h",
    "post_processor_factory.cc",
    "post_processor_factory.h",
    "stream_mixer.cc",
    "stream_mixer.h",
  ]

  deps = [
    ":loopback",
    ":post_processor_paths",
    ":post_processor_registry",
    "//base",
    "//chromecast/base",
    "//chromecast/base:chromecast_switches",
    "//chromecast/base:thread_health_checker",
    "//chromecast/media/api",
    "//chromecast/media/audio:audio_io_thread",
    "//chromecast/media/audio:audio_log",
    "//chromecast/media/audio:interleaved_channel_mixer",
    "//chromecast/media/audio:libcast_external_audio_pipeline_1.0",
    "//chromecast/media/audio:playback_rate_shifter",
    "//chromecast/media/audio:processing",
    "//chromecast/media/audio:rate_adjuster",
    "//chromecast/media/audio/mixer_service:common",
    "//chromecast/media/audio/mixer_service:proto",
    "//chromecast/media/audio/mixer_service:redirected_audio_connection",
    "//chromecast/media/audio/mixer_service/receiver",
    "//chromecast/media/audio/net:common",
    "//chromecast/media/audio/net:proto",
    "//chromecast/media/base",
    "//chromecast/media/base:slew_volume",
    "//chromecast/media/cma/backend:cast_audio_json",
    "//chromecast/media/cma/backend:volume_map",
    "//chromecast/media/cma/backend/mixer/post_processors:post_processor_wrapper",
    "//chromecast/media/cma/base",
    "//chromecast/net:io_buffer_pool",
    "//chromecast/public",
    "//chromecast/public/media",
    "//media",
    "//media:shared_memory_support",
  ]

  if (use_alsa) {
    deps += [ "//chromecast/media/cma/backend/alsa:mixer_output" ]
  } else {
    # If enable_video_with_mixed_audio && !use_alsa, the platform needs to
    # provide its own mixer output.
    if (!enable_video_with_mixed_audio) {
      deps += [ ":mixer_output_stream_dummy" ]
    } else {
      assert("$mixer_output" != "")
      deps += [ "$mixer_output" ]
    }
  }
}

cast_source_set("mixer_output_stream_dummy") {
  sources = [
    "mixer_output_stream_dummy.cc",
    "mixer_output_stream_dummy.h",
  ]
  deps = [
    "//base",
    "//chromecast/public/media",
  ]
}

cast_source_set("loopback_test_support") {
  testonly = true
  sources = [
    "loopback_test_support.cc",
    "loopback_test_support.h",
  ]

  deps = [
    ":loopback",
    "//base",
    "//chromecast/media/audio/mixer_service:common",
    "//chromecast/net:test_support",
  ]
}

cast_source_set("unittests") {
  testonly = true
  sources = [
    "filter_group_unittest.cc",
    "mock_mixer_source.cc",
    "mock_mixer_source.h",
    "mock_post_processor_factory.cc",
    "mock_post_processor_factory.h",
    "mock_redirected_audio_output.cc",
    "mock_redirected_audio_output.h",
    "stream_mixer_external_audio_pipeline_unittest.cc",
    "stream_mixer_unittest.cc",
  ]

  deps = [
    ":loopback",
    ":loopback_test_support",
    ":mixer",
    "//base",
    "//base/test:test_support",
    "//chromecast/media/audio:fake_external_audio_pipeline",
    "//chromecast/media/audio/mixer_service:common",
    "//chromecast/media/audio/mixer_service:loopback_connection",
    "//chromecast/media/audio/mixer_service:redirected_audio_connection",
    "//chromecast/media/cma/backend/mixer/post_processors:unittests",
    "//chromecast/public",
    "//chromecast/public/media",
    "//media",
    "//media:shared_memory_support",
    "//net",
    "//testing/gmock",
    "//testing/gtest",
  ]
}