# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//media/media_options.gni")
# Implementations of media C++ interfaces using corresponding mojo services.
source_set("clients") {
visibility = [
":test_support",
"//chromecast/*",
# Mirroring Service needs the video accelerated encoder mojom interfaces.
"//components/mirroring/service:mirroring_service",
"//content/renderer:*",
# TODO(xhwang): Only allow //media/mojo/services:unit_tests
"//chrome/browser:*",
"//chrome/browser/thumbnail/generator",
"//content/browser:*",
"//content/gpu:*",
"//media/mojo:test_support",
"//media/mojo/services:*",
"//media/test/*",
# TODO(liberato): can we avoid this?
"//content/test/*",
"//third_party/blink/renderer/modules/mediarecorder",
"//third_party/blink/renderer/modules/peerconnection:peerconnection",
"//third_party/blink/renderer/modules/webcodecs",
"//third_party/blink/renderer/platform:platform",
]
sources = [
"mojo_audio_decoder.cc",
"mojo_audio_decoder.h",
"mojo_audio_encoder.cc",
"mojo_audio_encoder.h",
"mojo_cdm.cc",
"mojo_cdm.h",
"mojo_cdm_factory.cc",
"mojo_cdm_factory.h",
"mojo_decoder_factory.cc",
"mojo_decoder_factory.h",
"mojo_decryptor.cc",
"mojo_decryptor.h",
"mojo_demuxer_stream_impl.cc",
"mojo_demuxer_stream_impl.h",
"mojo_media_log_service.cc",
"mojo_media_log_service.h",
"mojo_renderer.cc",
"mojo_renderer.h",
"mojo_renderer_factory.cc",
"mojo_renderer_factory.h",
"mojo_renderer_wrapper.cc",
"mojo_renderer_wrapper.h",
"mojo_video_decoder.cc",
"mojo_video_decoder.h",
"mojo_video_encode_accelerator.cc",
"mojo_video_encode_accelerator.h",
"mojo_video_encoder_metrics_provider.cc",
"mojo_video_encoder_metrics_provider.h",
]
if (allow_oop_video_decoder) {
sources += [
"mojo_stable_video_decoder.cc",
"mojo_stable_video_decoder.h",
]
}
if (is_android) {
sources += [
"mojo_android_overlay.cc",
"mojo_android_overlay.h",
]
}
public_deps = [
"//base",
"//media",
"//media/mojo:buildflags",
"//media/mojo/mojom",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//services/service_manager/public/mojom",
]
deps = [
"//build:chromeos_buildflags",
"//media/gpu",
"//media/mojo/common",
"//services/service_manager/public/cpp",
]
if (is_android) {
deps += [
"//gpu/ipc/common:common",
"//ui/gl:gl",
]
}
if (is_win) {
sources += [
"win/media_foundation_renderer_client.cc",
"win/media_foundation_renderer_client.h",
"win/media_foundation_renderer_client_factory.cc",
"win/media_foundation_renderer_client_factory.h",
]
}
if (is_fuchsia) {
sources += [
"mojo_fuchsia_cdm_provider.cc",
"mojo_fuchsia_cdm_provider.h",
]
deps += [ "//third_party/blink/public:blink_headers" ]
}
}
static_library("test_support") {
testonly = true
sources = [
"mock_mojo_video_encoder_metrics_provider_factory.cc",
"mock_mojo_video_encoder_metrics_provider_factory.h",
]
deps = [
":clients",
"//testing/gmock",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"mojo_audio_decoder_unittest.cc",
"mojo_audio_encoder_unittest.cc",
"mojo_cdm_unittest.cc",
"mojo_decryptor_unittest.cc",
"mojo_renderer_unittest.cc",
"mojo_video_encode_accelerator_unittest.cc",
"mojo_video_encoder_metrics_provider_unittest.cc",
]
if (allow_oop_video_decoder) {
sources += [ "mojo_stable_video_decoder_unittest.cc" ]
}
deps = [
"//base",
"//base/test:test_support",
"//media:test_support",
"//media/mojo:test_support",
"//testing/gmock",
"//testing/gtest",
]
if (is_android) {
sources += [ "mojo_android_overlay_unittest.cc" ]
deps += [
"//media/mojo/mojom:test_interfaces",
"//ui/gfx:test_support",
"//ui/gl",
]
}
if (is_win) {
sources += [ "win/media_foundation_renderer_client_unittest.cc" ]
deps += [
"//content/public/renderer",
"//content/renderer:renderer",
"//media",
]
}
}