blob: c73f88e74f023ea149c727764160e6cb3f2ccb51 [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# 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")
import("//testing/test.gni")
import("//mojo/public/mojo_application.gni")
import("//mojo/public/mojo_application_manifest.gni")
# Target naming conventions:
# - converters: C++/Mojo type converters.
# - proxy: C++ implementations supported by mojo services.
# - service: Mojo interface implementations.
# - unittests: Unit tests for a particular class/file.
# - test: Tests for a particular app, e.g. media.
config("mojo_media_config") {
if (!enable_mojo_media) {
assert(mojo_media_services == [], "Mojo media is not enabled")
assert(mojo_media_host == "none", "Mojo media is not enabled")
} else {
defines = [ "ENABLE_MOJO_MEDIA" ]
assert(mojo_media_services != [], "No mojo media service specified")
foreach(service, mojo_media_services) {
if (service == "renderer") {
defines += [ "ENABLE_MOJO_RENDERER" ]
} else if (service == "cdm") {
defines += [ "ENABLE_MOJO_CDM" ]
} else if (service == "audio_decoder") {
defines += [ "ENABLE_MOJO_AUDIO_DECODER" ]
} else {
assert(false, "Invalid mojo media service: $service")
}
}
if (mojo_media_host == "browser") {
defines += [ "ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS" ]
} else if (mojo_media_host == "gpu") {
defines += [ "ENABLE_MOJO_MEDIA_IN_GPU_PROCESS" ]
} else if (mojo_media_host == "utility") {
defines += [ "ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS" ]
} else {
assert(false, "Invalid mojo media host: $mojo_media_host")
}
}
}
source_set("converters") {
sources = [
"media_type_converters.cc",
"media_type_converters.h",
]
deps = [
"//base",
"//media",
"//media/mojo/interfaces",
"//mojo/common",
"//mojo/converters/geometry",
"//mojo/environment:chromium",
"//mojo/public/c/system:for_component",
"//ui/mojo/geometry:interfaces",
]
}
# Implementations of media C++ interfaces using corresponding mojo services.
source_set("proxy") {
sources = [
"mojo_audio_decoder.cc",
"mojo_audio_decoder.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_renderer_factory.cc",
"mojo_renderer_factory.h",
"mojo_renderer_impl.cc",
"mojo_renderer_impl.h",
"mojo_type_trait.h",
]
public_configs = [ ":mojo_media_config" ]
deps = [
":converters",
"//base",
"//media",
"//media/mojo/interfaces",
"//mojo/common",
"//mojo/environment:chromium",
"//mojo/public/c/system:for_component",
"//mojo/shell/public/interfaces",
]
}
source_set("cdm_service") {
deps = [
":converters",
"//base",
"//media",
"//media/mojo/interfaces",
"//mojo/common",
"//mojo/environment:chromium",
"//mojo/public/c/system:for_component",
"//mojo/shell/public/interfaces",
]
sources = [
"mojo_cdm_promise.cc",
"mojo_cdm_promise.h",
"mojo_cdm_service.cc",
"mojo_cdm_service.h",
"mojo_cdm_service_context.cc",
"mojo_cdm_service_context.h",
"mojo_decryptor_service.cc",
"mojo_decryptor_service.h",
"mojo_type_trait.h",
]
if (is_android) {
sources += [
"mojo_provision_fetcher.cc",
"mojo_provision_fetcher.h",
]
}
# TODO(xhwang): Needed because targets can depend on cdm_service directly,
# which is a bit hacky since we need to access CdmService directly
# from C++ code (AVDA). In the future we'll make those decoders part of
# MojoMediaApplication, then we won't need this.
public_configs = [ ":mojo_media_config" ]
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
}
source_set("renderer_service") {
sources = [
"demuxer_stream_provider_shim.cc",
"demuxer_stream_provider_shim.h",
"mojo_demuxer_stream_adapter.cc",
"mojo_demuxer_stream_adapter.h",
"mojo_renderer_service.cc",
"mojo_renderer_service.h",
]
deps = [
":converters",
"//base",
"//media",
"//media:shared_memory_support",
"//media/mojo/interfaces",
"//mojo/common",
]
}
source_set("application") {
sources = [
"mojo_media_application.cc",
"mojo_media_application.h",
"mojo_media_client.cc",
"mojo_media_client.h",
"service_factory_impl.cc",
"service_factory_impl.h",
]
public_configs = [ ":mojo_media_config" ]
deps = [
":cdm_service",
":renderer_service",
"//base",
"//media",
"//mojo/shell/public/cpp",
]
}
source_set("application_factory") {
sources = [
"mojo_media_application_factory.cc",
"mojo_media_application_factory.h",
]
public_configs = [ ":mojo_media_config" ]
deps = [
":application",
"//base",
"//media",
]
if (enable_test_mojo_media_client) {
defines = [ "ENABLE_TEST_MOJO_MEDIA_CLIENT" ]
sources += [
"test_mojo_media_client.cc",
"test_mojo_media_client.h",
]
} else if (is_android) {
sources += [
"android_mojo_media_client.cc",
"android_mojo_media_client.h",
]
} else {
sources += [
"default_mojo_media_client.cc",
"default_mojo_media_client.h",
]
}
}
test("media_mojo_unittests") {
sources = [
"media_type_converters_unittest.cc",
]
deps = [
":converters",
"//base",
"//base/test:test_support",
"//media",
"//media/base:test_support",
"//media/mojo/interfaces",
"//mojo/edk/system",
"//mojo/edk/test:run_all_unittests",
"//mojo/environment:chromium",
"//testing/gmock",
"//testing/gtest",
]
}
mojo_native_application("media") {
testonly = true
sources = [
"main.cc",
"test_mojo_media_client.cc",
"test_mojo_media_client.h",
]
deps = [
":application",
"//mojo/logging",
"//mojo/public/c/system:for_shared_library",
]
}
# Note, the following tests must be loaded via mojo_runner as an app, e.g.
#
# mojo/tools/apptest_runner.py
# --apptest-filter mojo:media_apptests out/Debug
#
# mojo/tools/apptest_runner.py
# --apptest-filter mojo:media_pipeline_integration_apptests out/Debug
#
mojo_native_application("media_apptests") {
testonly = true
sources = [
"media_apptest.cc",
]
deps = [
":apptest_manifest",
":proxy",
"//media/base:test_support",
"//mojo/shell/public/cpp:test_support",
"//testing/gmock",
"//testing/gtest",
]
data_deps = [
":media",
]
}
mojo_application_manifest("apptest_manifest") {
application_name = "media_apptests"
source = "apptest_manifest.json"
}
mojo_native_application("media_pipeline_integration_apptests") {
testonly = true
deps = [
":pipeline_apptest_manifest",
"//media/test:mojo_pipeline_integration_tests",
]
data_deps = [
":media",
]
}
mojo_application_manifest("pipeline_apptest_manifest") {
application_name = "media_pipeline_integration_apptests"
source = "pipeline_apptest_manifest.json"
}
group("tests") {
testonly = true
deps = [
":media_apptests",
":media_mojo_unittests",
":media_pipeline_integration_apptests",
]
}