This sets up API to release OutputSurface from LTHClient.
[chromium-blink-merge.git] / media / mojo / services / BUILD.gn
blob0df256abb61e18ab6a13b2c10d022c150830c793
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//media/media_options.gni")
6 import("//testing/test.gni")
7 import("//mojo/public/mojo_application.gni")
9 # Target naming conventions:
10 # - converters: C++/Mojo type converters.
11 # - proxy: C++ implementations supported by mojo services.
12 # - service: Mojo interface implementations.
13 # - unittests: Unit tests for a particular class/file.
14 # - test: Tests for a particular app, e.g. media.
16 config("enable_mojo_media_config") {
17   assert(enable_mojo_media == "none" || enable_mojo_media == "browser" ||
18          enable_mojo_media == "utility")
20   if (enable_mojo_media != "none") {
21     defines = [ "ENABLE_MOJO_MEDIA" ]
22   }
24   if (enable_mojo_media == "browser") {
25     defines += [ "ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS" ]
26   } else if (enable_mojo_media == "utility") {
27     defines += [ "ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS" ]
28   }
31 source_set("converters") {
32   sources = [
33     "media_type_converters.cc",
34     "media_type_converters.h",
35   ]
37   deps = [
38     "//base",
39     "//media",
40     "//media/mojo/interfaces",
41     "//mojo/common",
42     "//mojo/converters/geometry",
43     "//mojo/environment:chromium",
44     "//third_party/mojo/src/mojo/public/c/system:for_component",
45     "//ui/mojo/geometry:interfaces",
46   ]
49 # Implementations of media C++ interfaces using corresponding mojo services.
50 source_set("proxy") {
51   sources = [
52     "mojo_cdm.cc",
53     "mojo_cdm.h",
54     "mojo_cdm_factory.cc",
55     "mojo_cdm_factory.h",
56     "mojo_demuxer_stream_impl.cc",
57     "mojo_demuxer_stream_impl.h",
58     "mojo_renderer_factory.cc",
59     "mojo_renderer_factory.h",
60     "mojo_renderer_impl.cc",
61     "mojo_renderer_impl.h",
62     "mojo_type_trait.h",
63   ]
65   public_configs = [ ":enable_mojo_media_config" ]
67   deps = [
68     ":converters",
69     "//base",
70     "//media",
71     "//media/mojo/interfaces",
72     "//mojo/application/public/interfaces",
73     "//mojo/common",
74     "//mojo/environment:chromium",
75     "//third_party/mojo/src/mojo/public/c/system:for_component",
76   ]
79 source_set("cdm_service") {
80   deps = [
81     ":converters",
82     "//base",
83     "//media",
84     "//media/mojo/interfaces",
85     "//mojo/application/public/interfaces",
86     "//mojo/common",
87     "//mojo/environment:chromium",
88     "//third_party/mojo/src/mojo/public/c/system:for_component",
89   ]
91   sources = [
92     "mojo_cdm_promise.cc",
93     "mojo_cdm_promise.h",
94     "mojo_cdm_service.cc",
95     "mojo_cdm_service.h",
96     "mojo_cdm_service_context.cc",
97     "mojo_cdm_service_context.h",
98     "mojo_type_trait.h",
99   ]
101   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
104 # Renderer service; without a specific config.
105 source_set("renderer_service_generic") {
106   sources = [
107     "demuxer_stream_provider_shim.cc",
108     "demuxer_stream_provider_shim.h",
109     "mojo_demuxer_stream_adapter.cc",
110     "mojo_demuxer_stream_adapter.h",
111     "mojo_media_client.cc",
112     "mojo_media_client.h",
113     "mojo_renderer_service.cc",
114     "mojo_renderer_service.h",
115   ]
117   deps = [
118     ":converters",
119     "//base",
120     "//media",
121     "//media/mojo/interfaces",
122     "//media:shared_memory_support",
123     "//mojo/common",
124   ]
127 # Renderer service with a default config.
128 source_set("renderer_service") {
129   sources = [
130     "default_mojo_media_client.cc",
131   ]
133   public_configs = [ ":enable_mojo_media_config" ]
135   deps = [
136     ":renderer_service_generic",
137     "//base",
138     "//media",
139     "//media:shared_memory_support",
140   ]
143 source_set("application") {
144   sources = [
145     "mojo_media_application.cc",
146     "mojo_media_application.h",
147     "service_factory_impl.cc",
148     "service_factory_impl.h",
149   ]
151   public_configs = [ ":enable_mojo_media_config" ]
153   deps = [
154     ":cdm_service",
155     ":renderer_service",
156     "//base",
157     "//mojo/application/public/cpp",
158     "//third_party/mojo/src/mojo/public/c/system:for_component",
159   ]
162 test("media_mojo_unittests") {
163   sources = [
164     "media_type_converters_unittest.cc",
165   ]
167   deps = [
168     ":converters",
169     "//base",
170     "//base/test:test_support",
171     "//media",
172     "//media/mojo/interfaces",
173     "//mojo/environment:chromium",
174     "//testing/gtest",
175     "//third_party/mojo/src/mojo/edk/system",
176     "//third_party/mojo/src/mojo/edk/test:run_all_unittests",
177   ]
180 if (!is_component_build) {
181   mojo_native_application("media") {
182     sources = [
183       "main.cc",
184     ]
186     deps = [
187       ":application",
188       "//third_party/mojo/src/mojo/public/c/system:for_shared_library",
189     ]
190   }
192   # Note, the following tests must be loaded via mojo_runner as an app, e.g.
193   #
194   #   out/Debug/mojo_runner mojo:media_apptests
195   #   out/Debug/mojo_runner mojo:media_pipeline_integration_apptests
196   #
197   mojo_native_application("media_apptests") {
198     testonly = true
200     sources = [
201       "media_apptest.cc",
202     ]
204     deps = [
205       ":proxy",
206       "//media/base:test_support",
207       "//mojo/application/public/cpp:test_support",
208       "//testing/gmock",
209       "//testing/gtest",
210     ]
212     data_deps = [ ":media" ]
213   }
215   mojo_native_application("media_pipeline_integration_apptests") {
216     testonly = true
218     deps = [
219       "//media/test:mojo_pipeline_integration_tests",
220     ]
222     data_deps = [ ":media" ]
223   }
226 group("services") {
227   deps = [
228     ":proxy",
229   ]
231   if (!is_component_build) {
232     deps += [ ":media" ]
233   }
236 group("tests") {
237   testonly = true
238   deps = [
239     ":media_mojo_unittests",
240   ]
242   if (!is_component_build) {
243     deps += [
244       ":media_apptests",
245       ":media_pipeline_integration_apptests",
246     ]
247   }