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