Disable Enhanced Bookmark for ICS devices
[chromium-blink-merge.git] / media / base / BUILD.gn
blob235ef60538bdee9f5aef199e44f628cda3ed0d5e
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     "video_frame.cc",
276     "video_frame.h",
277     "video_frame_metadata.cc",
278     "video_frame_metadata.h",
279   ]
280   configs += [
281     "//build/config/compiler:no_size_t_to_int_warning",
282     "//media:media_config",
283   ]
284   all_dependent_configs = [ ":base_for_cast_ios_dependent_config" ]
287 source_set("test_support") {
288   testonly = true
289   sources = [
290     "fake_audio_render_callback.cc",
291     "fake_audio_render_callback.h",
292     "fake_audio_renderer_sink.cc",
293     "fake_audio_renderer_sink.h",
294     "fake_text_track_stream.cc",
295     "fake_text_track_stream.h",
296     "gmock_callback_support.h",
297     "mock_audio_renderer_sink.cc",
298     "mock_audio_renderer_sink.h",
299     "mock_demuxer_host.cc",
300     "mock_demuxer_host.h",
301     "mock_filters.cc",
302     "mock_filters.h",
303     "test_data_util.cc",
304     "test_data_util.h",
305     "test_helpers.cc",
306     "test_helpers.h",
307   ]
308   configs += [ "//media:media_config" ]
309   deps = [
310     "//testing/gmock",
311   ]
314 source_set("unittests") {
315   testonly = true
316   sources = [
317     "audio_block_fifo_unittest.cc",
318     "audio_buffer_converter_unittest.cc",
319     "audio_buffer_queue_unittest.cc",
320     "audio_buffer_unittest.cc",
321     "audio_bus_unittest.cc",
322     "audio_converter_unittest.cc",
323     "audio_discard_helper_unittest.cc",
324     "audio_fifo_unittest.cc",
325     "audio_hardware_config_unittest.cc",
326     "audio_hash_unittest.cc",
327     "audio_pull_fifo_unittest.cc",
328     "audio_renderer_mixer_input_unittest.cc",
329     "audio_renderer_mixer_unittest.cc",
330     "audio_shifter_unittest.cc",
331     "audio_splicer_unittest.cc",
332     "audio_timestamp_helper_unittest.cc",
333     "bind_to_current_loop_unittest.cc",
334     "bit_reader_unittest.cc",
335     "callback_holder.h",
336     "callback_holder_unittest.cc",
337     "channel_mixer_unittest.cc",
338     "channel_mixing_matrix_unittest.cc",
339     "data_buffer_unittest.cc",
340     "decoder_buffer_queue_unittest.cc",
341     "decoder_buffer_unittest.cc",
342     "djb2_unittest.cc",
343     "gmock_callback_support_unittest.cc",
344     "key_systems_unittest.cc",
345     "multi_channel_resampler_unittest.cc",
346     "pipeline_unittest.cc",
347     "ranges_unittest.cc",
348     "run_all_unittests.cc",
349     "seekable_buffer_unittest.cc",
350     "serial_runner_unittest.cc",
351     "sinc_resampler_unittest.cc",
352     "stream_parser_unittest.cc",
353     "text_ranges_unittest.cc",
354     "text_renderer_unittest.cc",
355     "user_input_monitor_unittest.cc",
356     "vector_math_testing.h",
357     "vector_math_unittest.cc",
358     "video_frame_pool_unittest.cc",
359     "video_frame_unittest.cc",
360     "video_util_unittest.cc",
361     "wall_clock_time_source_unittest.cc",
362     "yuv_convert_unittest.cc",
363   ]
364   configs += [
365     "//build/config/compiler:no_size_t_to_int_warning",
366     "//media:media_config",
367   ]
368   deps = [
369     ":base",
370     ":test_support",
371     "//skia",
372     "//testing/gmock",
373     "//testing/gtest",
374   ]
376   if (media_use_ffmpeg) {
377     sources += [
378       "audio_video_metadata_extractor_unittest.cc",
379       "media_file_checker_unittest.cc",
380     ]
381   }
383   if (!is_android) {
384     sources += [ "container_names_unittest.cc" ]
385   } else {
386     deps += [ "//ui/gl" ]
387   }
389   if (current_cpu == "x86" || current_cpu == "x64") {
390     sources += [ "simd/convert_rgb_to_yuv_unittest.cc" ]
391   }
394 source_set("perftests") {
395   testonly = true
396   sources = [
397     "audio_bus_perftest.cc",
398     "audio_converter_perftest.cc",
399     "run_all_perftests.cc",
400     "sinc_resampler_perftest.cc",
401     "vector_math_perftest.cc",
402     "yuv_convert_perftest.cc",
403   ]
404   configs += [ "//media:media_config" ]
405   deps = [
406     ":base",
407     ":test_support",
408     "//testing/gmock",
409     "//testing/gtest",
410   ]
412   if (media_use_ffmpeg) {
413     sources += [ "demuxer_perftest.cc" ]
414   }
416   if (is_android) {
417     deps += [ "//ui/gl" ]
418   }
421 if (current_cpu == "x86" || current_cpu == "x64") {
422   source_set("media_sse2") {
423     sources = [
424       "simd/convert_rgb_to_yuv_sse2.cc",
425       "simd/convert_rgb_to_yuv_ssse3.cc",
426       "simd/filter_yuv_sse2.cc",
427     ]
428     configs += [ "//media:media_config" ]
429     if (!is_win) {
430       cflags = [ "-msse2" ]
431     }
432   }
434   import("//third_party/yasm/yasm_assemble.gni")
435   yasm_assemble("media_yasm") {
436     sources = [
437       "simd/convert_rgb_to_yuv_ssse3.asm",
438       "simd/convert_yuv_to_rgb_sse.asm",
439       "simd/convert_yuva_to_argb_mmx.asm",
440       "simd/empty_register_state_mmx.asm",
441       "simd/linear_scale_yuv_to_rgb_mmx.asm",
442       "simd/linear_scale_yuv_to_rgb_sse.asm",
443       "simd/scale_yuv_to_rgb_mmx.asm",
444       "simd/scale_yuv_to_rgb_sse.asm",
445     ]
447     # TODO(ajwong): Only export if shared_library build...
448     yasm_flags = [
449       "-DCHROMIUM",
450       "-DEXPORT_SYMBOLS",
452       # In addition to the same path as source asm, let yasm %include
453       # search path be relative to src/ per Chromium policy.
454       "-I",
455       rebase_path("..", root_build_dir),
456     ]
458     inputs = [
459       "//third_party/x86inc/x86inc.asm",
460       "simd/convert_rgb_to_yuv_ssse3.inc",
461       "simd/convert_yuv_to_rgb_mmx.inc",
462       "simd/convert_yuva_to_argb_mmx.inc",
463       "simd/linear_scale_yuv_to_rgb_mmx.inc",
464       "simd/media_export.asm",
465       "simd/scale_yuv_to_rgb_mmx.inc",
466     ]
468     if (current_cpu == "x86") {
469       yasm_flags += [ "-DARCH_X86_32" ]
470     } else if (current_cpu == "x64") {
471       yasm_flags += [ "-DARCH_X86_64" ]
472       sources += [
473         "simd/linear_scale_yuv_to_rgb_mmx_x64.asm",
474         "simd/scale_yuv_to_rgb_sse2_x64.asm",
475       ]
476     }
478     if (is_mac || is_ios) {
479       yasm_flags += [
480         "-DPREFIX",
481         "-DMACHO",
482       ]
483     } else {
484       if (is_posix) {
485         yasm_flags += [ "-DELF" ]
486         if (current_cpu == "x64") {
487           # TODO(ajwong): Why isn't this true in mac?
488           yasm_flags += [ "-DPIC" ]
489         }
490       }
491     }
492   }