# 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("monotonic_clock") {
  sources = [
    "default_monotonic_clock.cc",
    "default_monotonic_clock.h",
  ]
  deps = [
    ":buildflags",
    "//base",
    "//chromecast/media/api",
  ]
}
