Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / media / base / BUILD.gn
blob508833937dce57399f6cec572700c34b6bf66538
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     "pipeline.cc",
133     "pipeline.h",
134     "pipeline_status.h",
135     "player_tracker.cc",
136     "player_tracker.h",
137     "ranges.cc",
138     "ranges.h",
139     "renderer.cc",
140     "renderer.h",
141     "renderer_factory.cc",
142     "renderer_factory.h",
143     "sample_format.cc",
144     "sample_format.h",
145     "seekable_buffer.cc",
146     "seekable_buffer.h",
147     "serial_runner.cc",
148     "serial_runner.h",
149     "simd/convert_rgb_to_yuv.h",
150     "simd/convert_rgb_to_yuv_c.cc",
151     "simd/convert_yuv_to_rgb.h",
152     "simd/convert_yuv_to_rgb_c.cc",
153     "simd/filter_yuv.h",
154     "simd/filter_yuv_c.cc",
155     "sinc_resampler.cc",
156     "sinc_resampler.h",
157     "stream_parser.cc",
158     "stream_parser.h",
159     "stream_parser_buffer.cc",
160     "stream_parser_buffer.h",
161     "text_cue.cc",
162     "text_cue.h",
163     "text_ranges.cc",
164     "text_ranges.h",
165     "text_renderer.cc",
166     "text_renderer.h",
167     "text_track.h",
168     "text_track_config.cc",
169     "text_track_config.h",
170     "time_delta_interpolator.cc",
171     "time_delta_interpolator.h",
172     "time_source.h",
173     "user_input_monitor.cc",
174     "user_input_monitor.h",
175     "video_capture_types.cc",
176     "video_capture_types.h",
177     "video_capturer_source.cc",
178     "video_capturer_source.h",
179     "video_decoder.cc",
180     "video_decoder.h",
181     "video_decoder_config.cc",
182     "video_decoder_config.h",
183     "video_frame.cc",
184     "video_frame.h",
185     "video_frame_metadata.cc",
186     "video_frame_metadata.h",
187     "video_frame_pool.cc",
188     "video_frame_pool.h",
189     "video_renderer.cc",
190     "video_renderer.h",
191     "video_rotation.h",
192     "video_types.cc",
193     "video_types.h",
194     "video_util.cc",
195     "video_util.h",
196     "wall_clock_time_source.cc",
197     "wall_clock_time_source.h",
198     "yuv_convert.cc",
199     "yuv_convert.h",
200   ]
202   allow_circular_includes_from = []
203   defines = []
204   public_deps = []
205   deps = [
206     "//ui/events:events_base",
207     "//skia",
208   ]
209   libs = []
210   configs += [
211     # This target uses the ALLOCATOR_SHIM define.
212     "//base/allocator:allocator_shim_define",
213     "//media:media_config",
214     "//media:media_implementation",
215   ]
217   if (media_use_ffmpeg) {
218     sources += [
219       "audio_video_metadata_extractor.cc",
220       "audio_video_metadata_extractor.h",
221       "container_names.cc",
222       "container_names.h",
223       "media_file_checker.cc",
224       "media_file_checker.h",
225     ]
227     deps += [ "//third_party/ffmpeg" ]
228   }
230   if (enable_browser_cdms) {
231     sources += [
232       "browser_cdm.cc",
233       "browser_cdm.h",
234       "browser_cdm_factory.cc",
235       "browser_cdm_factory.h",
236     ]
237   }
239   if (is_android) {
240     public_deps = [
241       "//media/base/android",
242       "//media/base/android:media_java",
243       "//media/base/android:media_jni_headers",
244       "//media/base/android:video_capture_jni_headers",
245     ]
246     allow_circular_includes_from += [ "//media/base/android" ]
247   }
249   if (is_linux && use_x11) {
250     configs += [
251       "//build/config/linux:x11",
252       "//build/config/linux:xext",
254       # TODO(ajwong): Why does xent get a separate thing in //build/config/linux:BUILD.gn
255       #         "//build/config/linux:xdamage",
256       #         "//build/config/linux:xfixes",
257       #         "//build/config/linux:xtst",
258     ]
259     sources += [ "user_input_monitor_linux.cc" ]
260     deps += [
261       "//ui/events:events_base",
262       "//ui/gfx/x",
263     ]
264   } else if (is_mac) {
265     sources += [ "user_input_monitor_mac.cc" ]
267     # Required by video_frame.cc.
268     libs = [ "CoreVideo.framework" ]
269   } else if (is_win) {
270     sources += [ "user_input_monitor_win.cc" ]
271   } else {
272     defines += [ "DISABLE_USER_INPUT_MONITOR" ]
273   }
275   if (current_cpu == "x86" || current_cpu == "x64") {
276     sources += [
277       "simd/convert_rgb_to_yuv_sse2.cc",
278       "simd/convert_rgb_to_yuv_ssse3.cc",
279       "simd/convert_yuv_to_rgb_x86.cc",
280       "simd/filter_yuv_sse2.cc",
281     ]
282     deps += [ ":media_yasm" ]
283   }
285   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
287   if (is_linux || is_win) {
288     sources += [
289       "keyboard_event_counter.cc",
290       "keyboard_event_counter.h",
291     ]
292   }
295 # Minimal media component for media/cast on iOS.
296 config("base_for_cast_ios_dependent_config") {
297   defines = [ "MEDIA_FOR_CAST_IOS" ]
300 if (is_ios) {
301   source_set("base_for_cast_ios") {
302     sources = [
303       "simd/convert_rgb_to_yuv.h",
304       "simd/convert_rgb_to_yuv_c.cc",
305       "simd/convert_yuv_to_rgb.h",
306       "simd/convert_yuv_to_rgb_c.cc",
307       "simd/filter_yuv.h",
308       "simd/filter_yuv_c.cc",
309       "video_frame.cc",
310       "video_frame.h",
311       "video_frame_metadata.cc",
312       "video_frame_metadata.h",
313       "video_types.cc",
314       "video_types.h",
315       "video_util.cc",
316       "video_util.h",
317       "yuv_convert.cc",
318       "yuv_convert.h",
319     ]
320     configs += [
321       "//build/config/compiler:no_size_t_to_int_warning",
322       "//media:media_config",
323     ]
324     all_dependent_configs = [ ":base_for_cast_ios_dependent_config" ]
325   }
328 source_set("test_support") {
329   testonly = true
330   sources = [
331     "fake_audio_render_callback.cc",
332     "fake_audio_render_callback.h",
333     "fake_audio_renderer_sink.cc",
334     "fake_audio_renderer_sink.h",
335     "fake_demuxer_stream.cc",
336     "fake_demuxer_stream.h",
337     "fake_text_track_stream.cc",
338     "fake_text_track_stream.h",
339     "gmock_callback_support.h",
340     "mock_audio_renderer_sink.cc",
341     "mock_audio_renderer_sink.h",
342     "mock_demuxer_host.cc",
343     "mock_demuxer_host.h",
344     "mock_filters.cc",
345     "mock_filters.h",
346     "test_data_util.cc",
347     "test_data_util.h",
348     "test_helpers.cc",
349     "test_helpers.h",
350   ]
351   configs += [ "//media:media_config" ]
352   deps = [
353     "//testing/gmock",
354   ]
357 source_set("unittests") {
358   testonly = true
359   sources = [
360     "audio_block_fifo_unittest.cc",
361     "audio_buffer_converter_unittest.cc",
362     "audio_buffer_queue_unittest.cc",
363     "audio_buffer_unittest.cc",
364     "audio_bus_unittest.cc",
365     "audio_converter_unittest.cc",
366     "audio_discard_helper_unittest.cc",
367     "audio_fifo_unittest.cc",
368     "audio_hardware_config_unittest.cc",
369     "audio_hash_unittest.cc",
370     "audio_pull_fifo_unittest.cc",
371     "audio_renderer_mixer_input_unittest.cc",
372     "audio_renderer_mixer_unittest.cc",
373     "audio_shifter_unittest.cc",
374     "audio_splicer_unittest.cc",
375     "audio_timestamp_helper_unittest.cc",
376     "bind_to_current_loop_unittest.cc",
377     "bit_reader_unittest.cc",
378     "callback_holder.h",
379     "callback_holder_unittest.cc",
380     "channel_mixer_unittest.cc",
381     "channel_mixing_matrix_unittest.cc",
382     "data_buffer_unittest.cc",
383     "decoder_buffer_queue_unittest.cc",
384     "decoder_buffer_unittest.cc",
385     "djb2_unittest.cc",
386     "fake_demuxer_stream_unittest.cc",
387     "gmock_callback_support_unittest.cc",
388     "key_systems_unittest.cc",
389     "mime_util_unittest.cc",
390     "moving_average_unittest.cc",
391     "multi_channel_resampler_unittest.cc",
392     "null_video_sink_unittest.cc",
393     "pipeline_unittest.cc",
394     "ranges_unittest.cc",
395     "run_all_unittests.cc",
396     "seekable_buffer_unittest.cc",
397     "serial_runner_unittest.cc",
398     "sinc_resampler_unittest.cc",
399     "stream_parser_unittest.cc",
400     "text_ranges_unittest.cc",
401     "text_renderer_unittest.cc",
402     "user_input_monitor_unittest.cc",
403     "vector_math_testing.h",
404     "vector_math_unittest.cc",
405     "video_frame_pool_unittest.cc",
406     "video_frame_unittest.cc",
407     "video_util_unittest.cc",
408     "wall_clock_time_source_unittest.cc",
409     "yuv_convert_unittest.cc",
410   ]
411   configs += [
412     "//build/config/compiler:no_size_t_to_int_warning",
413     "//media:media_config",
414   ]
415   deps = [
416     ":test_support",
417     "//gpu/command_buffer/common",
418     "//media",
419     "//skia",
420     "//testing/gmock",
421     "//testing/gtest",
422   ]
424   if (media_use_ffmpeg) {
425     sources += [
426       "audio_video_metadata_extractor_unittest.cc",
427       "media_file_checker_unittest.cc",
428     ]
429   }
431   if (!is_android) {
432     sources += [ "container_names_unittest.cc" ]
433   } else {
434     deps += [ "//ui/gl" ]
435   }
437   if (current_cpu == "x86" || current_cpu == "x64") {
438     sources += [ "simd/convert_rgb_to_yuv_unittest.cc" ]
439   }
442 source_set("perftests") {
443   testonly = true
444   sources = [
445     "audio_bus_perftest.cc",
446     "audio_converter_perftest.cc",
447     "run_all_perftests.cc",
448     "sinc_resampler_perftest.cc",
449     "vector_math_perftest.cc",
450     "yuv_convert_perftest.cc",
451   ]
452   configs += [ "//media:media_config" ]
453   deps = [
454     ":test_support",
455     "//media",
456     "//testing/gmock",
457     "//testing/gtest",
458   ]
460   if (media_use_ffmpeg) {
461     sources += [ "demuxer_perftest.cc" ]
462   }
464   if (is_android) {
465     deps += [ "//ui/gl" ]
466   }
469 if (current_cpu == "x86" || current_cpu == "x64") {
470   import("//third_party/yasm/yasm_assemble.gni")
471   yasm_assemble("media_yasm") {
472     sources = [
473       "simd/convert_rgb_to_yuv_ssse3.asm",
474       "simd/convert_yuv_to_rgb_sse.asm",
475       "simd/convert_yuva_to_argb_mmx.asm",
476       "simd/empty_register_state_mmx.asm",
477       "simd/linear_scale_yuv_to_rgb_mmx.asm",
478       "simd/linear_scale_yuv_to_rgb_sse.asm",
479       "simd/scale_yuv_to_rgb_mmx.asm",
480       "simd/scale_yuv_to_rgb_sse.asm",
481     ]
483     # TODO(ajwong): Only export if shared_library build...
484     yasm_flags = [
485       "-DCHROMIUM",
486       "-DEXPORT_SYMBOLS",
488       # In addition to the same path as source asm, let yasm %include
489       # search path be relative to src/ per Chromium policy.
490       "-I",
491       rebase_path("..", root_build_dir),
492     ]
494     inputs = [
495       "//third_party/x86inc/x86inc.asm",
496       "simd/convert_rgb_to_yuv_ssse3.inc",
497       "simd/convert_yuv_to_rgb_mmx.inc",
498       "simd/convert_yuva_to_argb_mmx.inc",
499       "simd/linear_scale_yuv_to_rgb_mmx.inc",
500       "simd/media_export.asm",
501       "simd/scale_yuv_to_rgb_mmx.inc",
502     ]
504     if (current_cpu == "x86") {
505       yasm_flags += [ "-DARCH_X86_32" ]
506     } else if (current_cpu == "x64") {
507       yasm_flags += [ "-DARCH_X86_64" ]
508       sources += [
509         "simd/linear_scale_yuv_to_rgb_mmx_x64.asm",
510         "simd/scale_yuv_to_rgb_sse2_x64.asm",
511       ]
512     }
514     if (is_mac || is_ios) {
515       yasm_flags += [
516         "-DPREFIX",
517         "-DMACHO",
518       ]
519     } else {
520       if (is_posix) {
521         yasm_flags += [ "-DELF" ]
522         if (current_cpu == "x64") {
523           # TODO(ajwong): Why isn't this true in mac?
524           yasm_flags += [ "-DPIC" ]
525         }
526       }
527     }
528   }