Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / media / audio / BUILD.gn
blob369d7d0a10813af7407b1ccf30b9ecbd8524f165
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("//build/config/linux/pkg_config.gni")
6 import("//media/media_options.gni")
8 # When libpulse is not directly linked, use stubs to allow for dlopening of the
9 # binary.
10 if (!link_pulseaudio) {
11   action("pulse_generate_stubs") {
12     extra_header = "pulse/pulse_stub_header.fragment"
14     script = "../../tools/generate_stubs/generate_stubs.py"
15     sources = [
16       "pulse/pulse.sigs",
17     ]
18     inputs = [
19       extra_header,
20     ]
21     stubs_filename_root = "pulse_stubs"
23     # TODO(ajwong): these need to be included in the pulse build.
24     outputs = [
25       "$target_gen_dir/pulse/$stubs_filename_root.cc",
26       "$target_gen_dir/pulse/$stubs_filename_root.h",
27     ]
28     args = [
29       "-i",
30       rebase_path("$target_gen_dir/pulse", root_build_dir),
31       "-o",
32       rebase_path("$target_gen_dir/pulse", root_build_dir),
33       "-t",
34       "posix_stubs",
35       "-e",
36       rebase_path(extra_header, root_build_dir),
37       "-s",
38       stubs_filename_root,
39       "-p",
40       "media/audio/pulse",
41     ]
43     args += rebase_path(sources, root_build_dir)
44   }
47 config("platform_config") {
48   if (use_alsa) {
49     defines = [ "USE_ALSA" ]
50   }
53 source_set("audio") {
54   visibility = [ "//media/*" ]
55   sources = [
56     "agc_audio_stream.h",
57     "audio_device_name.cc",
58     "audio_device_name.h",
59     "audio_device_thread.cc",
60     "audio_device_thread.h",
61     "audio_input_controller.cc",
62     "audio_input_controller.h",
63     "audio_input_device.cc",
64     "audio_input_device.h",
65     "audio_input_ipc.cc",
66     "audio_input_ipc.h",
67     "audio_io.h",
68     "audio_manager.cc",
69     "audio_manager.h",
70     "audio_manager_base.cc",
71     "audio_manager_base.h",
72     "audio_output_controller.cc",
73     "audio_output_controller.h",
74     "audio_output_device.cc",
75     "audio_output_device.h",
76     "audio_output_dispatcher.cc",
77     "audio_output_dispatcher.h",
78     "audio_output_dispatcher_impl.cc",
79     "audio_output_dispatcher_impl.h",
80     "audio_output_ipc.cc",
81     "audio_output_ipc.h",
82     "audio_output_proxy.cc",
83     "audio_output_proxy.h",
84     "audio_output_resampler.cc",
85     "audio_output_resampler.h",
86     "audio_output_stream_sink.cc",
87     "audio_output_stream_sink.h",
88     "audio_power_monitor.cc",
89     "audio_power_monitor.h",
90     "audio_source_diverter.h",
91     "clockless_audio_sink.cc",
92     "clockless_audio_sink.h",
93     "fake_audio_input_stream.cc",
94     "fake_audio_input_stream.h",
95     "fake_audio_log_factory.cc",
96     "fake_audio_log_factory.h",
97     "fake_audio_manager.cc",
98     "fake_audio_manager.h",
99     "fake_audio_output_stream.cc",
100     "fake_audio_output_stream.h",
101     "fake_audio_worker.cc",
102     "fake_audio_worker.h",
103     "null_audio_sink.cc",
104     "null_audio_sink.h",
105     "sample_rates.cc",
106     "sample_rates.h",
107     "scoped_task_runner_observer.cc",
108     "scoped_task_runner_observer.h",
109     "simple_sources.cc",
110     "simple_sources.h",
111     "sounds/audio_stream_handler.cc",
112     "sounds/audio_stream_handler.h",
113     "sounds/sounds_manager.cc",
114     "sounds/sounds_manager.h",
115     "sounds/wav_audio_handler.cc",
116     "sounds/wav_audio_handler.h",
117     "virtual_audio_input_stream.cc",
118     "virtual_audio_input_stream.h",
119     "virtual_audio_output_stream.cc",
120     "virtual_audio_output_stream.h",
121   ]
122   deps = []
123   libs = []
124   configs += [
125     ":platform_config",
126     "//media:media_config",
127     "//media:media_implementation",
128   ]
130   if (is_mac) {
131     sources += [
132       "mac/audio_auhal_mac.cc",
133       "mac/audio_auhal_mac.h",
134       "mac/audio_device_listener_mac.cc",
135       "mac/audio_device_listener_mac.h",
136       "mac/audio_input_mac.cc",
137       "mac/audio_input_mac.h",
138       "mac/audio_low_latency_input_mac.cc",
139       "mac/audio_low_latency_input_mac.h",
140       "mac/audio_manager_mac.cc",
141       "mac/audio_manager_mac.h",
142     ]
143     libs += [
144       "AudioToolbox.framework",
145       "AudioUnit.framework",
146       "CoreAudio.framework",
147     ]
148   }
150   if (is_win) {
151     sources += [
152       "win/audio_device_listener_win.cc",
153       "win/audio_device_listener_win.h",
154       "win/audio_low_latency_input_win.cc",
155       "win/audio_low_latency_input_win.h",
156       "win/audio_low_latency_output_win.cc",
157       "win/audio_low_latency_output_win.h",
158       "win/audio_manager_win.cc",
159       "win/audio_manager_win.h",
160       "win/avrt_wrapper_win.cc",
161       "win/avrt_wrapper_win.h",
162       "win/core_audio_util_win.cc",
163       "win/core_audio_util_win.h",
164       "win/device_enumeration_win.cc",
165       "win/device_enumeration_win.h",
166       "win/wavein_input_win.cc",
167       "win/wavein_input_win.h",
168       "win/waveout_output_win.cc",
169       "win/waveout_output_win.h",
170     ]
171   }
173   if (is_android) {
174     sources += [
175       "android/audio_manager_android.cc",
176       "android/audio_manager_android.h",
177       "android/audio_record_input.cc",
178       "android/audio_record_input.h",
179       "android/opensles_input.cc",
180       "android/opensles_input.h",
181       "android/opensles_output.cc",
182       "android/opensles_output.h",
183       "android/opensles_wrapper.cc",
184     ]
185     deps += [ "//media/base/android:media_jni_headers" ]
186   }
188   if (is_linux) {
189     sources += [ "linux/audio_manager_linux.cc" ]
190   }
192   if (use_alsa) {
193     libs += [ "asound" ]
194     sources += [
195       "alsa/alsa_input.cc",
196       "alsa/alsa_input.h",
197       "alsa/alsa_output.cc",
198       "alsa/alsa_output.h",
199       "alsa/alsa_util.cc",
200       "alsa/alsa_util.h",
201       "alsa/alsa_wrapper.cc",
202       "alsa/alsa_wrapper.h",
203       "alsa/audio_manager_alsa.cc",
204       "alsa/audio_manager_alsa.h",
205     ]
206   }
208   if (use_cras) {
209     sources += [
210       "cras/audio_manager_cras.cc",
211       "cras/audio_manager_cras.h",
212       "cras/cras_input.cc",
213       "cras/cras_input.h",
214       "cras/cras_unified.cc",
215       "cras/cras_unified.h",
216     ]
218     pkg_config("libcras") {
219       packages = [ "libcras" ]
220     }
221     configs += [ ":libcras" ]
222     deps += [ "//chromeos:chromeos" ]
223   }
225   if (use_pulseaudio) {
226     sources += [
227       "pulse/audio_manager_pulse.cc",
228       "pulse/audio_manager_pulse.h",
229       "pulse/pulse_input.cc",
230       "pulse/pulse_input.h",
231       "pulse/pulse_output.cc",
232       "pulse/pulse_output.h",
233       "pulse/pulse_util.cc",
234       "pulse/pulse_util.h",
235     ]
237     if (link_pulseaudio) {
238       pkg_config("libpulse") {
239         packages = [ "libpulse" ]
240       }
241       configs += [ ":libpulse" ]
242     } else {
243       # TODO(ajwong): Technically, this dl should go in the action.
244       libs += [ "dl" ]
245       deps += [ ":pulse_generate_stubs" ]
246       sources += get_target_outputs(":pulse_generate_stubs")
247     }
248   }
250   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
253 source_set("test_support") {
254   testonly = true
255   sources = [
256     "audio_unittest_util.cc",
257     "audio_unittest_util.h",
258     "mock_audio_manager.cc",
259     "mock_audio_manager.h",
260     "mock_audio_source_callback.cc",
261     "mock_audio_source_callback.h",
262     "test_audio_input_controller_factory.cc",
263     "test_audio_input_controller_factory.h",
264   ]
265   configs += [ ":platform_config" ]
266   deps = [
267     "//testing/gmock",
268   ]
269   configs += [ "//media:media_config" ]
272 source_set("unittests") {
273   testonly = true
274   sources = [
275     "audio_input_controller_unittest.cc",
276     "audio_input_unittest.cc",
277     "audio_manager_factory_unittest.cc",
278     "audio_manager_unittest.cc",
279     "audio_output_controller_unittest.cc",
280     "audio_output_device_unittest.cc",
281     "audio_output_proxy_unittest.cc",
282     "audio_parameters_unittest.cc",
283     "audio_power_monitor_unittest.cc",
284     "fake_audio_worker_unittest.cc",
285     "simple_sources_unittest.cc",
286     "virtual_audio_input_stream_unittest.cc",
287     "virtual_audio_output_stream_unittest.cc",
288   ]
289   deps = [
290     ":test_support",
291     "//media/base:test_support",
292     "//testing/gmock",
293     "//testing/gtest",
294     "//url",
295   ]
297   configs += [
298     ":platform_config",
299     "//build/config/compiler:no_size_t_to_int_warning",
300     "//media:media_config",
301   ]
303   if (is_android) {
304     sources += [ "android/audio_android_unittest.cc" ]
305     deps += [ "//ui/gl" ]
306   } else {
307     sources += [ "audio_input_volume_unittest.cc" ]
308   }
310   if (is_mac) {
311     sources += [
312       "mac/audio_auhal_mac_unittest.cc",
313       "mac/audio_device_listener_mac_unittest.cc",
314       "mac/audio_low_latency_input_mac_unittest.cc",
315     ]
316   }
318   if (is_chromeos) {
319     sources += [
320       "sounds/audio_stream_handler_unittest.cc",
321       "sounds/sounds_manager_unittest.cc",
322       "sounds/test_data.cc",
323       "sounds/test_data.h",
324       "sounds/wav_audio_handler_unittest.cc",
325     ]
327     if (use_cras) {
328       sources += [
329         "cras/cras_input_unittest.cc",
330         "cras/cras_unified_unittest.cc",
331       ]
332     }
333   }
335   if (is_win) {
336     sources += [
337       "win/audio_device_listener_win_unittest.cc",
338       "win/audio_low_latency_input_win_unittest.cc",
339       "win/audio_low_latency_output_win_unittest.cc",
340       "win/audio_output_win_unittest.cc",
341       "win/core_audio_util_win_unittest.cc",
342     ]
343   }
345   if (use_alsa) {
346     sources += [
347       "alsa/alsa_output_unittest.cc",
348       "audio_low_latency_input_output_unittest.cc",
349     ]
350   }