cc: Remove tile and scale specific code from raster source
[chromium-blink-merge.git] / media / base / BUILD.gn
blob9eedf1fb5ca479b75cb55b5a887bdecb0ef7b52a
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_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_support_uma.cc",
105     "key_systems_support_uma.h",
106     "key_systems.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_switches.cc",
117     "media_switches.h",
118     "multi_channel_resampler.cc",
119     "multi_channel_resampler.h",
120     "pipeline.cc",
121     "pipeline.h",
122     "pipeline_status.h",
123     "player_tracker.cc",
124     "player_tracker.h",
125     "ranges.cc",
126     "ranges.h",
127     "renderer.cc",
128     "renderer.h",
129     "renderer_factory.cc",
130     "renderer_factory.h",
131     "sample_format.cc",
132     "sample_format.h",
133     "scoped_histogram_timer.h",
134     "seekable_buffer.cc",
135     "seekable_buffer.h",
136     "serial_runner.cc",
137     "serial_runner.h",
138     "simd/convert_rgb_to_yuv.h",
139     "simd/convert_rgb_to_yuv_c.cc",
140     "simd/convert_yuv_to_rgb.h",
141     "simd/convert_yuv_to_rgb_c.cc",
142     "simd/filter_yuv.h",
143     "simd/filter_yuv_c.cc",
144     "sinc_resampler.cc",
145     "sinc_resampler.h",
146     "stream_parser.cc",
147     "stream_parser.h",
148     "stream_parser_buffer.cc",
149     "stream_parser_buffer.h",
150     "text_cue.cc",
151     "text_cue.h",
152     "text_ranges.cc",
153     "text_ranges.h",
154     "text_renderer.cc",
155     "text_renderer.h",
156     "text_track.h",
157     "text_track_config.cc",
158     "text_track_config.h",
159     "time_delta_interpolator.cc",
160     "time_delta_interpolator.h",
161     "time_source.h",
162     "user_input_monitor.cc",
163     "user_input_monitor.h",
164     "video_decoder.cc",
165     "video_decoder.h",
166     "video_decoder_config.cc",
167     "video_decoder_config.h",
168     "video_frame.cc",
169     "video_frame.h",
170     "video_frame_pool.cc",
171     "video_frame_pool.h",
172     "video_renderer.cc",
173     "video_renderer.h",
174     "video_rotation.h",
175     "video_util.cc",
176     "video_util.h",
177     "wall_clock_time_source.cc",
178     "wall_clock_time_source.h",
179     "yuv_convert.cc",
180     "yuv_convert.h",
181   ]
182   defines = []
183   deps = [
184     "//skia",
185   ]
186   libs = []
187   configs += [ "//media:media_config" ]
189   if (media_use_ffmpeg) {
190     sources += [
191       "audio_video_metadata_extractor.cc",
192       "audio_video_metadata_extractor.h",
193       "container_names.cc",
194       "container_names.h",
195       "media_file_checker.cc",
196       "media_file_checker.h",
197     ]
198     deps += [ "//third_party/ffmpeg" ]
199   }
201   if (enable_browser_cdms) {
202     sources += [
203       "browser_cdm.cc",
204       "browser_cdm.h",
205       "browser_cdm_factory.cc",
206       "browser_cdm_factory.h",
207     ]
208   }
210   if (is_android) {
211     sources += [ "media_stub.cc" ]
212   } else if (is_win) {
213     sources += [ "media_win.cc" ]
214   } else if (is_posix) {
215     sources += [ "media_posix.cc" ]
216   }
218   if (is_linux && use_x11) {
219     configs += [
220       "//build/config/linux:x11",
221       "//build/config/linux:xext",
223       # TODO(ajwong): Why does xent get a separate thing in //build/config/linux:BUILD.gn
224       #         "//build/config/linux:xdamage",
225       #         "//build/config/linux:xfixes",
226       #         "//build/config/linux:xtst",
227     ]
228     sources += [ "user_input_monitor_linux.cc" ]
229     deps += [
230       "//ui/events:events_base",
231       "//ui/gfx/x",
232     ]
233   } else if (is_mac) {
234     sources += [ "user_input_monitor_mac.cc" ]
235   } else if (is_win) {
236     sources += [ "user_input_monitor_win.cc" ]
237   } else {
238     defines += [ "DISABLE_USER_INPUT_MONITOR" ]
239   }
241   if (cpu_arch == "x86" || cpu_arch == "x64") {
242     sources += [ "simd/convert_yuv_to_rgb_x86.cc" ]
243     deps += [
244       ":media_yasm",
245       ":media_sse2",
246     ]
247   }
249   if (is_linux || is_win) {
250     sources += [
251       "keyboard_event_counter.cc",
252       "keyboard_event_counter.h",
253     ]
254   }
257 # Minimal media component for media/cast on iOS.
258 config("base_for_cast_ios_dependent_config") {
259   defines = [ "MEDIA_FOR_CAST_IOS" ]
262 source_set("base_for_cast_ios") {
263   sources = [
264     "video_frame.cc",
265     "video_frame.h",
266   ]
267   configs += [ "//media:media_config" ]
268   all_dependent_configs = [ ":base_for_cast_ios_dependent_config" ]
271 source_set("test_support") {
272   testonly = true
273   sources = [
274     "fake_audio_render_callback.cc",
275     "fake_audio_render_callback.h",
276     "fake_audio_renderer_sink.cc",
277     "fake_audio_renderer_sink.h",
278     "fake_text_track_stream.cc",
279     "fake_text_track_stream.h",
280     "gmock_callback_support.h",
281     "mock_audio_renderer_sink.cc",
282     "mock_audio_renderer_sink.h",
283     "mock_demuxer_host.cc",
284     "mock_demuxer_host.h",
285     "mock_filters.cc",
286     "mock_filters.h",
287     "test_data_util.cc",
288     "test_data_util.h",
289     "test_helpers.cc",
290     "test_helpers.h",
291   ]
292   configs += [ "//media:media_config" ]
293   deps = [
294     "//testing/gmock",
295   ]
298 source_set("unittests") {
299   testonly = true
300   sources = [
301     "audio_block_fifo_unittest.cc",
302     "audio_buffer_converter_unittest.cc",
303     "audio_buffer_unittest.cc",
304     "audio_buffer_queue_unittest.cc",
305     "audio_bus_unittest.cc",
306     "audio_converter_unittest.cc",
307     "audio_discard_helper_unittest.cc",
308     "audio_fifo_unittest.cc",
309     "audio_hardware_config_unittest.cc",
310     "audio_hash_unittest.cc",
311     "audio_pull_fifo_unittest.cc",
312     "audio_renderer_mixer_input_unittest.cc",
313     "audio_renderer_mixer_unittest.cc",
314     "audio_shifter_unittest.cc",
315     "audio_splicer_unittest.cc",
316     "audio_timestamp_helper_unittest.cc",
317     "bind_to_current_loop_unittest.cc",
318     "bit_reader_unittest.cc",
319     "callback_holder.h",
320     "callback_holder_unittest.cc",
321     "channel_mixer_unittest.cc",
322     "channel_mixing_matrix_unittest.cc",
323     "data_buffer_unittest.cc",
324     "decoder_buffer_queue_unittest.cc",
325     "decoder_buffer_unittest.cc",
326     "djb2_unittest.cc",
327     "gmock_callback_support_unittest.cc",
328     "key_systems_unittest.cc",
329     "multi_channel_resampler_unittest.cc",
330     "pipeline_unittest.cc",
331     "ranges_unittest.cc",
332     "run_all_unittests.cc",
333     "scoped_histogram_timer_unittest.cc",
334     "serial_runner_unittest.cc",
335     "seekable_buffer_unittest.cc",
336     "sinc_resampler_unittest.cc",
337     "stream_parser_unittest.cc",
338     "text_ranges_unittest.cc",
339     "text_renderer_unittest.cc",
340     "user_input_monitor_unittest.cc",
341     "vector_math_testing.h",
342     "vector_math_unittest.cc",
343     "video_frame_unittest.cc",
344     "video_frame_pool_unittest.cc",
345     "video_util_unittest.cc",
346     "wall_clock_time_source_unittest.cc",
347     "yuv_convert_unittest.cc",
348   ]
349   configs += [ "//media:media_config" ]
350   deps = [
351     ":base",
352     ":test_support",
353     "//skia",
354     "//testing/gmock",
355     "//testing/gtest",
356   ]
358   if (media_use_ffmpeg) {
359     sources += [
360       "audio_video_metadata_extractor_unittest.cc",
361       "media_file_checker_unittest.cc",
362     ]
363   }
365   if (!is_android) {
366     sources += [ "container_names_unittest.cc" ]
367   } else {
368     deps += [ "//ui/gl" ]
369   }
371   if (cpu_arch == "x86" || cpu_arch == "x64") {
372     sources += [ "simd/convert_rgb_to_yuv_unittest.cc" ]
373   }
376 source_set("perftests") {
377   testonly = true
378   sources = [
379     "audio_bus_perftest.cc",
380     "audio_converter_perftest.cc",
381     "run_all_perftests.cc",
382     "sinc_resampler_perftest.cc",
383     "vector_math_perftest.cc",
384     "yuv_convert_perftest.cc",
385   ]
386   configs += [ "//media:media_config" ]
387   deps = [
388     ":base",
389     ":test_support",
390     "//testing/gmock",
391     "//testing/gtest",
392   ]
394   if (media_use_ffmpeg) {
395     sources += [ "demuxer_perftest.cc" ]
396   }
398   if (is_android) {
399     deps += [ "//ui/gl" ]
400   }
403 if (cpu_arch == "x86" || cpu_arch == "x64") {
404   source_set("media_sse2") {
405     sources = [
406       "simd/convert_rgb_to_yuv_sse2.cc",
407       "simd/convert_rgb_to_yuv_ssse3.cc",
408       "simd/filter_yuv_sse2.cc",
409     ]
410     configs += [ "//media:media_config" ]
411     if (!is_win) {
412       cflags = [ "-msse2" ]
413     }
414   }
416   import("//third_party/yasm/yasm_assemble.gni")
417   yasm_assemble("media_yasm") {
418     sources = [
419       "simd/convert_rgb_to_yuv_ssse3.asm",
420       "simd/convert_yuv_to_rgb_sse.asm",
421       "simd/convert_yuva_to_argb_mmx.asm",
422       "simd/empty_register_state_mmx.asm",
423       "simd/linear_scale_yuv_to_rgb_mmx.asm",
424       "simd/linear_scale_yuv_to_rgb_sse.asm",
425       "simd/scale_yuv_to_rgb_mmx.asm",
426       "simd/scale_yuv_to_rgb_sse.asm",
427     ]
429     # TODO(ajwong): Only export if shared_library build...
430     yasm_flags = [
431       "-DCHROMIUM",
432       "-DEXPORT_SYMBOLS",
434       # In addition to the same path as source asm, let yasm %include
435       # search path be relative to src/ per Chromium policy.
436       "-I",
437       rebase_path("..", root_build_dir),
438     ]
440     inputs = [
441       "//third_party/x86inc/x86inc.asm",
442       "simd/convert_rgb_to_yuv_ssse3.inc",
443       "simd/convert_yuv_to_rgb_mmx.inc",
444       "simd/convert_yuva_to_argb_mmx.inc",
445       "simd/linear_scale_yuv_to_rgb_mmx.inc",
446       "simd/media_export.asm",
447       "simd/scale_yuv_to_rgb_mmx.inc",
448     ]
450     if (cpu_arch == "x86") {
451       yasm_flags += [ "-DARCH_X86_32" ]
452     } else if (cpu_arch == "x64") {
453       yasm_flags += [ "-DARCH_X86_64" ]
454       sources += [
455         "simd/linear_scale_yuv_to_rgb_mmx_x64.asm",
456         "simd/scale_yuv_to_rgb_sse2_x64.asm",
457       ]
458     }
460     if (is_mac || is_ios) {
461       yasm_flags += [
462         "-DPREFIX",
463         "-DMACHO",
464       ]
465     } else {
466       if (is_posix) {
467         yasm_flags += [ "-DELF" ]
468         if (cpu_arch == "x64") {
469           # TODO(ajwong): Why isn't this true in mac?
470           yasm_flags += [ "-DPIC" ]
471         }
472       }
473     }
474   }