chromium/chromecast/media/BUILD.gn

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

import("//chromecast/chromecast.gni")
import("//media/media_options.gni")
import("//testing/test.gni")

declare_args() {
  if (enable_starboard_media) {
    cast_static_media_lib_target =
        "//chromecast/starboard/media/media:starboard"
  } else if (is_cast_desktop_build) {
    # Non-starboard desktop builds should set cast_static_media_lib_target
    # explicitly if desired.
    cast_static_media_lib_target = ""
  } else if (is_cast_audio_only) {
    cast_static_media_lib_target =
        "//chromecast/media/cma/backend/alsa:libcast_media_1.0_audio"
  } else if (enable_video_with_mixed_audio) {
    cast_static_media_lib_target =
        "//chromecast/media/cma/backend/video:libcast_media_1.0_avsync"
  } else {
    cast_static_media_lib_target = ""
  }
}

group("media") {
  public_deps = [
    "//chromecast/media/audio",
    "//chromecast/media/base",
    "//chromecast/media/cdm",
    "//chromecast/media/cma",
    "//chromecast/media/common:media_resource_tracker",
  ]
}

# Any component calling CastMediaShlib:: static functions should depend on this.
# Handles the various differences between (ATV, Things, desktop, device builds).
group("libcast_media") {
  if (is_android) {
    deps = [ "//chromecast/media/cma/backend/android:cast_media_android" ]
  } else if (cast_static_media_lib_target != "") {
    deps = [ "$cast_static_media_lib_target" ]
  } else if (is_cast_desktop_build) {
    deps = [ "//chromecast/media/cma/backend/desktop" ]
  } else {
    deps = [ "//chromecast/media/cma/backend:libcast_media_1.0" ]
  }

  if (enable_chromium_runtime_cast_renderer) {
    deps += [ "//chromecast/media/cma/backend/proxy" ]
  }

  if (cast_volume_control_in_avsettings) {
    deps += [ "//chromecast/media/avsettings:libcast_avsettings_1.0" ]
  }
}

test("cast_media_unittests") {
  sources = [
    "audio/cast_audio_manager_unittest.cc",
    "audio/cast_audio_mixer_unittest.cc",
    "audio/cast_audio_output_stream_unittest.cc",
    "base/slew_volume_unittests.cc",
    "base/supported_codec_profile_levels_memo_unittest.cc",
    "common/audio_decoder_software_wrapper_unittest.cc",
    "common/media_resource_tracker_unittest.cc",
    "test/run_all_unittests.cc",
  ]

  if (use_alsa && !is_cast_desktop_build) {
    sources += [ "audio/cast_audio_manager_alsa_unittest.cc" ]
  }

  deps = [
    ":libcast_media",
    ":media",
    "//base",
    "//base/test:test_support",
    "//chromecast:chromecast_buildflags",
    "//chromecast/base",
    "//chromecast/base/metrics:test_support",
    "//chromecast/common/mojom",
    "//chromecast/external_mojo/external_service_support:external_service",
    "//chromecast/external_mojo/external_service_support:test_support",
    "//chromecast/media/api:test_support",
    "//chromecast/media/audio:test_support",
    "//chromecast/media/audio:unittests",
    "//chromecast/media/audio/capture_service:unittests",
    "//chromecast/media/audio/mixer_service:unittests",
    "//chromecast/media/base:monotonic_clock",
    "//chromecast/media/base:slew_volume",
    "//chromecast/media/cma:test_support",
    "//chromecast/media/cma:unittests",
    "//chromecast/media/common:media_pipeline_backend_manager",
    "//chromecast/media/common:test_media_resource_tracker",
    "//chromecast/public",
    "//content/test:test_support",
    "//media:test_support",
    "//media/mojo:test_support",
    "//mojo/core/embedder",
    "//services/service_manager/public/cpp",
    "//testing/gmock",
    "//testing/gtest",
  ]

  if (use_unix_sockets) {
    deps += [
      "//chromecast/media/audio/audio_output_service:unittests",
      "//chromecast/media/audio/net:audio_socket_service_unittests",
    ]
  }

  if (is_android) {
    deps += [
      "//chromecast/media/cma/backend/android:audio_track_java",
      "//media/base/android:media_java",
    ]
    shard_timeout = 300
  }
}