Add support for providers called when the omnibox is focused.
[chromium-blink-merge.git] / media / base / BUILD.gn
blob48b96ec91ed5763fdc5da269d997503dd5903e64
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/android/config.gni")
6 import("//build/config/arm.gni")
7 import("//build/config/ui.gni")
8 import("//build/config/linux/pkg_config.gni")
9 import("//media/media_options.gni")
11 source_set("base") {
12   visibility = [ "//media/*" ]
13   sources = [
14     "audio_block_fifo.cc",
15     "audio_block_fifo.h",
16     "audio_buffer.cc",
17     "audio_buffer.h",
18     "audio_buffer_queue.cc",
19     "audio_buffer_queue.h",
20     "audio_capturer_source.h",
21     "audio_buffer_converter.cc",
22     "audio_buffer_converter.h",
23     "audio_converter.cc",
24     "audio_converter.h",
25     "audio_decoder.cc",
26     "audio_decoder.h",
27     "audio_decoder_config.cc",
28     "audio_decoder_config.h",
29     "audio_discard_helper.cc",
30     "audio_discard_helper.h",
31     "audio_fifo.cc",
32     "audio_fifo.h",
33     "audio_hardware_config.cc",
34     "audio_hardware_config.h",
35     "audio_hash.cc",
36     "audio_hash.h",
37     "audio_pull_fifo.cc",
38     "audio_pull_fifo.h",
39     "audio_renderer.cc",
40     "audio_renderer.h",
41     "audio_renderer_mixer.cc",
42     "audio_renderer_mixer.h",
43     "audio_renderer_mixer_input.cc",
44     "audio_renderer_mixer_input.h",
45     "audio_renderer_sink.h",
46     "audio_splicer.cc",
47     "audio_splicer.h",
48     "audio_timestamp_helper.cc",
49     "audio_timestamp_helper.h",
50     "bind_to_current_loop.h",
51     "bit_reader.cc",
52     "bit_reader.h",
53     "bit_reader_core.cc",
54     "bit_reader_core.h",
55     "bitstream_buffer.h",
56     "buffering_state.h",
57     "buffers.h",
58     "byte_queue.cc",
59     "byte_queue.h",
60     "cdm_callback_promise.cc",
61     "cdm_callback_promise.h",
62     "cdm_context.cc",
63     "cdm_context.h",
64     "cdm_factory.cc",
65     "cdm_factory.h",
66     "cdm_promise.cc",
67     "cdm_promise.h",
68     "channel_mixer.cc",
69     "channel_mixer.h",
70     "channel_mixing_matrix.cc",
71     "channel_mixing_matrix.h",
72     "clock.h",
73     "data_buffer.cc",
74     "data_buffer.h",
75     "data_source.cc",
76     "data_source.h",
77     "decoder_buffer.cc",
78     "decoder_buffer.h",
79     "decoder_buffer_queue.cc",
80     "decoder_buffer_queue.h",
81     "decrypt_config.cc",
82     "decrypt_config.h",
83     "decryptor.cc",
84     "decryptor.h",
85     "demuxer.cc",
86     "demuxer.h",
87     "demuxer_stream.cc",
88     "demuxer_stream.h",
89     "demuxer_stream_provider.cc",
90     "demuxer_stream_provider.h",
91     "djb2.cc",
92     "djb2.h",
93     "eme_constants.h",
94     "key_system_info.cc",
95     "key_system_info.h",
96     "key_systems.cc",
97     "key_systems.h",
98     "key_systems_support_uma.cc",
99     "key_systems_support_uma.h",
100     "key_systems.h",
101     "media.cc",
102     "media.h",
103     "media_client.cc",
104     "media_client.h",
105     "media_keys.cc",
106     "media_keys.h",
107     "media_log.cc",
108     "media_log.h",
109     "media_log_event.h",
110     "media_switches.cc",
111     "media_switches.h",
112     "multi_channel_resampler.cc",
113     "multi_channel_resampler.h",
114     "pipeline.cc",
115     "pipeline.h",
116     "pipeline_status.h",
117     "player_tracker.cc",
118     "player_tracker.h",
119     "ranges.cc",
120     "ranges.h",
121     "renderer.cc",
122     "renderer.h",
123     "renderer_factory.cc",
124     "renderer_factory.h",
125     "sample_format.cc",
126     "sample_format.h",
127     "scoped_histogram_timer.h",
128     "seekable_buffer.cc",
129     "seekable_buffer.h",
130     "serial_runner.cc",
131     "serial_runner.h",
132     "simd/convert_rgb_to_yuv.h",
133     "simd/convert_rgb_to_yuv_c.cc",
134     "simd/convert_yuv_to_rgb.h",
135     "simd/convert_yuv_to_rgb_c.cc",
136     "simd/filter_yuv.h",
137     "simd/filter_yuv_c.cc",
138     "simd/yuv_to_rgb_table.cc",
139     "simd/yuv_to_rgb_table.h",
140     "sinc_resampler.cc",
141     "sinc_resampler.h",
142     "stream_parser.cc",
143     "stream_parser.h",
144     "stream_parser_buffer.cc",
145     "stream_parser_buffer.h",
146     "text_cue.cc",
147     "text_cue.h",
148     "text_ranges.cc",
149     "text_ranges.h",
150     "text_renderer.cc",
151     "text_renderer.h",
152     "text_track.h",
153     "text_track_config.cc",
154     "text_track_config.h",
155     "time_delta_interpolator.cc",
156     "time_delta_interpolator.h",
157     "time_source.h",
158     "user_input_monitor.cc",
159     "user_input_monitor.h",
160     "video_decoder.cc",
161     "video_decoder.h",
162     "video_decoder_config.cc",
163     "video_decoder_config.h",
164     "video_frame.cc",
165     "video_frame.h",
166     "video_frame_pool.cc",
167     "video_frame_pool.h",
168     "video_renderer.cc",
169     "video_renderer.h",
170     "video_rotation.h",
171     "video_util.cc",
172     "video_util.h",
173     "wall_clock_time_source.cc",
174     "wall_clock_time_source.h",
175     "yuv_convert.cc",
176     "yuv_convert.h",
177   ]
178   defines = []
179   deps = [
180     "//skia",
181   ]
182   libs = []
183   configs += [ "//media:media_config" ]
185   if (media_use_ffmpeg) {
186     sources += [
187       "audio_video_metadata_extractor.cc",
188       "audio_video_metadata_extractor.h",
189       "container_names.cc",
190       "container_names.h",
191       "media_file_checker.cc",
192       "media_file_checker.h",
193     ]
194     deps += [ "//third_party/ffmpeg" ]
195   }
197   if (enable_browser_cdms) {
198     sources += [
199       "browser_cdm.cc",
200       "browser_cdm.h",
201       "browser_cdm_factory.cc",
202       "browser_cdm_factory.h",
203     ]
204   }
206   if (is_android) {
207     sources += [ "media_stub.cc" ]
208   } else if (is_win) {
209     sources += [ "media_win.cc" ]
210   } else if (is_posix) {
211     sources += [ "media_posix.cc" ]
212   }
214   if (is_linux && use_x11) {
215     configs += [
216       "//build/config/linux:x11",
217       "//build/config/linux:xext",
219       # TODO(ajwong): Why does xent get a separate thing in //build/config/linux:BUILD.gn
220       #         "//build/config/linux:xdamage",
221       #         "//build/config/linux:xfixes",
222       #         "//build/config/linux:xtst",
223     ]
224     sources += [ "user_input_monitor_linux.cc" ]
225     deps += [
226       "//ui/events:events_base",
227       "//ui/gfx/x",
228     ]
229   } else if (is_mac) {
230     sources += [ "user_input_monitor_mac.cc" ]
231   } else if (is_win) {
232     sources += [ "user_input_monitor_win.cc" ]
233   } else {
234     defines += [ "DISABLE_USER_INPUT_MONITOR" ]
235   }
237   if (cpu_arch == "x86" || cpu_arch == "x64") {
238     sources += [ "simd/convert_yuv_to_rgb_x86.cc" ]
239     deps += [
240       ":media_yasm",
241       ":media_sse2",
242     ]
243   }
245   if (is_linux || is_win) {
246     sources += [
247       "keyboard_event_counter.cc",
248       "keyboard_event_counter.h",
249     ]
250   }
253 # Minimal media component for media/cast on iOS.
254 config("base_for_cast_ios_dependent_config") {
255   defines = [ "MEDIA_FOR_CAST_IOS" ]
258 source_set("base_for_cast_ios") {
259   sources = [
260     "video_frame.cc",
261     "video_frame.h",
262   ]
263   configs += [ "//media:media_config" ]
264   all_dependent_configs = [ ":base_for_cast_ios_dependent_config" ]
267 source_set("test_support") {
268   testonly = true
269   sources = [
270     "fake_audio_render_callback.cc",
271     "fake_audio_render_callback.h",
272     "fake_audio_renderer_sink.cc",
273     "fake_audio_renderer_sink.h",
274     "fake_text_track_stream.cc",
275     "fake_text_track_stream.h",
276     "gmock_callback_support.h",
277     "mock_audio_renderer_sink.cc",
278     "mock_audio_renderer_sink.h",
279     "mock_demuxer_host.cc",
280     "mock_demuxer_host.h",
281     "mock_filters.cc",
282     "mock_filters.h",
283     "test_data_util.cc",
284     "test_data_util.h",
285     "test_helpers.cc",
286     "test_helpers.h",
287   ]
288   configs += [ "//media:media_config" ]
289   deps = [
290     "//testing/gmock",
291   ]
294 source_set("unittests") {
295   testonly = true
296   sources = [
297     "audio_block_fifo_unittest.cc",
298     "audio_buffer_converter_unittest.cc",
299     "audio_buffer_unittest.cc",
300     "audio_buffer_queue_unittest.cc",
301     "audio_bus_unittest.cc",
302     "audio_converter_unittest.cc",
303     "audio_discard_helper_unittest.cc",
304     "audio_fifo_unittest.cc",
305     "audio_hardware_config_unittest.cc",
306     "audio_hash_unittest.cc",
307     "audio_pull_fifo_unittest.cc",
308     "audio_renderer_mixer_input_unittest.cc",
309     "audio_renderer_mixer_unittest.cc",
310     "audio_splicer_unittest.cc",
311     "audio_timestamp_helper_unittest.cc",
312     "bind_to_current_loop_unittest.cc",
313     "bit_reader_unittest.cc",
314     "callback_holder.h",
315     "callback_holder_unittest.cc",
316     "channel_mixer_unittest.cc",
317     "channel_mixing_matrix_unittest.cc",
318     "data_buffer_unittest.cc",
319     "decoder_buffer_queue_unittest.cc",
320     "decoder_buffer_unittest.cc",
321     "djb2_unittest.cc",
322     "gmock_callback_support_unittest.cc",
323     "key_systems_unittest.cc",
324     "multi_channel_resampler_unittest.cc",
325     "pipeline_unittest.cc",
326     "ranges_unittest.cc",
327     "run_all_unittests.cc",
328     "scoped_histogram_timer_unittest.cc",
329     "serial_runner_unittest.cc",
330     "seekable_buffer_unittest.cc",
331     "sinc_resampler_unittest.cc",
332     "stream_parser_unittest.cc",
333     "text_ranges_unittest.cc",
334     "text_renderer_unittest.cc",
335     "user_input_monitor_unittest.cc",
336     "vector_math_testing.h",
337     "vector_math_unittest.cc",
338     "video_frame_unittest.cc",
339     "video_frame_pool_unittest.cc",
340     "video_util_unittest.cc",
341     "wall_clock_time_source_unittest.cc",
342     "yuv_convert_unittest.cc",
343   ]
344   configs += [ "//media:media_config" ]
345   deps = [
346     ":base",
347     ":test_support",
348     "//skia",
349     "//testing/gmock",
350     "//testing/gtest",
351   ]
353   if (media_use_ffmpeg) {
354     sources += [
355       "audio_video_metadata_extractor_unittest.cc",
356       "media_file_checker_unittest.cc",
357     ]
358   }
360   if (!is_android) {
361     sources += [ "container_names_unittest.cc" ]
362   } else {
363     deps += [ "//ui/gl" ]
364   }
366   if (cpu_arch == "x86" || cpu_arch == "x64") {
367     sources += [ "simd/convert_rgb_to_yuv_unittest.cc" ]
368   }
371 source_set("perftests") {
372   testonly = true
373   sources = [
374     "audio_bus_perftest.cc",
375     "audio_converter_perftest.cc",
376     "run_all_perftests.cc",
377     "sinc_resampler_perftest.cc",
378     "vector_math_perftest.cc",
379     "yuv_convert_perftest.cc",
380   ]
381   configs += [ "//media:media_config" ]
382   deps = [
383     ":base",
384     ":test_support",
385     "//testing/gmock",
386     "//testing/gtest",
387   ]
389   if (media_use_ffmpeg) {
390     sources += [ "demuxer_perftest.cc" ]
391   }
393   if (is_android) {
394     deps += [ "//ui/gl" ]
395   }
398 if (cpu_arch == "x86" || cpu_arch == "x64") {
399   source_set("media_sse2") {
400     sources = [
401       "simd/convert_rgb_to_yuv_sse2.cc",
402       "simd/convert_rgb_to_yuv_ssse3.cc",
403       "simd/filter_yuv_sse2.cc",
404     ]
405     configs += [ "//media:media_config" ]
406     if (!is_win) {
407       cflags = [ "-msse2" ]
408     }
409   }
411   import("//third_party/yasm/yasm_assemble.gni")
412   yasm_assemble("media_yasm") {
413     sources = [
414       "simd/convert_rgb_to_yuv_ssse3.asm",
415       "simd/convert_yuv_to_rgb_sse.asm",
416       "simd/convert_yuva_to_argb_mmx.asm",
417       "simd/empty_register_state_mmx.asm",
418       "simd/linear_scale_yuv_to_rgb_mmx.asm",
419       "simd/linear_scale_yuv_to_rgb_sse.asm",
420       "simd/scale_yuv_to_rgb_mmx.asm",
421       "simd/scale_yuv_to_rgb_sse.asm",
422     ]
424     # TODO(ajwong): Only export if shared_library build...
425     yasm_flags = [
426       "-DCHROMIUM",
427       "-DEXPORT_SYMBOLS",
429       # In addition to the same path as source asm, let yasm %include
430       # search path be relative to src/ per Chromium policy.
431       "-I",
432       rebase_path("..", root_build_dir),
433     ]
435     inputs = [
436       "//third_party/x86inc/x86inc.asm",
437       "simd/convert_rgb_to_yuv_ssse3.inc",
438       "simd/convert_yuv_to_rgb_mmx.inc",
439       "simd/convert_yuva_to_argb_mmx.inc",
440       "simd/linear_scale_yuv_to_rgb_mmx.inc",
441       "simd/media_export.asm",
442       "simd/scale_yuv_to_rgb_mmx.inc",
443     ]
445     if (cpu_arch == "x86") {
446       yasm_flags += [ "-DARCH_X86_32" ]
447     } else if (cpu_arch == "x64") {
448       yasm_flags += [ "-DARCH_X86_64" ]
449       sources += [
450         "simd/linear_scale_yuv_to_rgb_mmx_x64.asm",
451         "simd/scale_yuv_to_rgb_sse2_x64.asm",
452       ]
453     }
455     if (is_mac || is_ios) {
456       yasm_flags += [
457         "-DPREFIX",
458         "-DMACHO",
459       ]
460     } else {
461       if (is_posix) {
462         yasm_flags += [ "-DELF" ]
463         if (cpu_arch == "x64") {
464           # TODO(ajwong): Why isn't this true in mac?
465           yasm_flags += [ "-DPIC" ]
466         }
467       }
468     }
469   }