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

# Copyright 2017 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/android/config.gni")
import("//build/config/android/rules.gni")
import("//chromecast/chromecast.gni")
import("//testing/test.gni")
import("//third_party/jni_zero/jni_zero.gni")

cast_source_set("cast_media_android") {
  sources = [
    "audio_decoder_android.cc",
    "audio_decoder_android.h",
    "audio_sink_android.cc",
    "audio_sink_android.h",
    "audio_sink_android_audiotrack_impl.cc",
    "audio_sink_android_audiotrack_impl.h",
    "audio_sink_manager.cc",
    "audio_sink_manager.h",
    "cast_media_android.cc",
    "media_codec_support_cast_audio.cc",
    "media_pipeline_backend_android.cc",
    "media_pipeline_backend_android.h",
    "volume_cache.cc",
    "volume_cache.h",
    "volume_control_android.cc",
    "volume_control_android.h",
  ]

  deps = [
    ":audio_track_java",
    ":audio_track_jni_headers",
    "//base",
    "//chromecast:chromecast_buildflags",
    "//chromecast/base",
    "//chromecast/media/api",
    "//chromecast/media/cma/backend:null_video",
    "//chromecast/media/cma/base",
    "//chromecast/media/cma/decoder",
    "//chromecast/public/media",
    "//media",
  ]
}

generate_jni("audio_track_jni_headers") {
  sources = [
    "java/src/org/chromium/chromecast/cma/backend/android/AudioSinkAudioTrackImpl.java",
    "java/src/org/chromium/chromecast/cma/backend/android/VolumeControl.java",
    "java/src/org/chromium/chromecast/cma/backend/android/VolumeMap.java",
  ]
}

android_library("audio_track_java") {
  srcjar_deps = [ ":audio_track_jni_headers" ]
  sources = [
    "java/src/org/chromium/chromecast/cma/backend/android/AudioSinkAudioTrackImpl.java",
    "java/src/org/chromium/chromecast/cma/backend/android/ThrottledLog.java",
    "java/src/org/chromium/chromecast/cma/backend/android/VolumeControl.java",
    "java/src/org/chromium/chromecast/cma/backend/android/VolumeMap.java",
  ]

  deps = [
    "//base:base_java",
    "//build/android:build_java",
    "//chromecast/base:base_java",
    "//chromecast/public:volume_control_enums_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
}

test("cast_android_cma_backend_unittests") {
  deps = [ ":unit_tests" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "volume_cache_test.cc" ]

  deps = [
    ":cast_media_android",
    "//base",
    "//base/test:run_all_unittests",
    "//testing/gtest",
  ]
}