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