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