chromium/chromecast/media/base/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("//build/buildflag_header.gni")
import("//chromecast/chromecast.gni")
import("//testing/test.gni")
import("//third_party/widevine/cdm/widevine.gni")

buildflag_header("buildflags") {
  header = "buildflags.h"

  flags = [ "MEDIA_CLOCK_MONOTONIC_RAW=$media_clock_monotonic_raw" ]
}

cast_source_set("key_systems") {
  sources = [
    "key_systems_common.cc",
    "key_systems_common.h",
  ]

  deps = [
    "//base",
    "//chromecast:chromecast_buildflags",
    "//chromecast/public/media",
    "//third_party/widevine/cdm:buildflags",
  ]

  if (enable_widevine) {
    deps += [ "//third_party/widevine/cdm:headers" ]
  }

  assert_no_deps = [ "//media" ]
}

cast_source_set("base") {
  sources = [
    "aligned_buffer.h",
    "audio_device_ids.cc",
    "audio_device_ids.h",
    "cast_decoder_buffer_impl.cc",
    "cast_decoder_buffer_impl.h",
    "decrypt_context_impl.cc",
    "decrypt_context_impl.h",
    "supported_codec_profile_levels_memo.cc",
    "supported_codec_profile_levels_memo.h",
    "video_mode_switcher.cc",
    "video_mode_switcher.h",
  ]

  if (!is_android) {
    sources += [
      "video_resolution_policy.cc",
      "video_resolution_policy.h",
    ]
  }

  public_deps = [
    ":key_systems",
    "//chromecast/public/media",
  ]

  deps = [
    "//base",
    "//chromecast/base",
    "//chromecast/media/api",
    "//ui/gfx/geometry",
  ]

  assert_no_deps = [ "//media" ]
}

cast_source_set("media_codec_support") {
  sources = [
    "media_codec_support.cc",
    "media_codec_support.h",
  ]

  public_deps = [ "//chromecast/public/media" ]

  deps = [
    "//base",
    "//media",
  ]
}

cast_source_set("slew_volume") {
  sources = [
    "slew_volume.cc",
    "slew_volume.h",
  ]

  deps = [
    "//base",
    "//media",
  ]
}

cast_source_set("video_plane_controller") {
  sources = [
    "video_plane_controller.cc",
    "video_plane_controller.h",
  ]

  public_deps = [ "//chromecast/public" ]

  deps = [
    "//base",
    "//chromecast/media:libcast_media",
    "//media",
    "//ui/gfx",
    "//ui/gfx/geometry",
  ]
}

cast_source_set("monotonic_clock") {
  sources = [
    "default_monotonic_clock.cc",
    "default_monotonic_clock.h",
  ]
  deps = [
    ":buildflags",
    "//base",
    "//chromecast/media/api:api",
  ]
}

test("video_plane_controller_test") {
  # Note: we include the video plane controller header and cc files directly to
  # avoid pulling in a dependency that defines CastMediaShlib functions. The
  # relevant shlib functions need to be defined in the test code so that a mock
  # VideoPlane can be used.
  sources = [
    "video_plane_controller.cc",
    "video_plane_controller.h",
    "video_plane_controller_test.cc",
  ]
  deps = [
    "//base",
    "//base/test:run_all_unittests",
    "//base/test:test_support",
    "//chromecast/public",
    "//media",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/gfx",
    "//ui/gfx/geometry",
  ]
}