Add "description" attribute to Value.
[chromium-blink-merge.git] / media / BUILD.gn
blobf2acd92058a1f9ded7d903cc87cef344cc060509
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 # Common configuration for targets in the media directory.
12 # NOT for exporting.
13 config("media_config") {
14   defines = [ "MEDIA_IMPLEMENTATION" ]
15   if (cpu_arch == "arm" && arm_use_neon) {
16     defines += [ "USE_NEON" ]
17   }
18   if (!media_use_libvpx) {
19     defines += [ "MEDIA_DISABLE_LIBVPX" ]
20   }
21   if (use_pulseaudio) {
22     defines += [ "USE_PULSEAUDIO" ]
23     if (linux_link_pulseaudio) {
24       defines += [ "DLOPEN_PULSEAUDIO" ]
25     }
26   }
27   if (use_cras) {
28     defines = [ "USE_CRAS" ]
29   }
30   if (enable_mpeg2ts_stream_parser) {
31     defines += [ "ENABLE_MPEG2TS_STREAM_PARSER" ]
32   }
35 config("media_dependent_config") {
36   if (is_win) {
37     ldflags = [
38       "/DELAYLOAD:mf.dll",
39       "/DELAYLOAD:mfplat.dll",
40       "/DELAYLOAD:mfreadwrite.dll",
41     ]
42   }
45 if (use_ozone) {
46   action("generate_ozone_constructor_list") {
47     # Ozone platform objects are auto-generated using similar
48     # patterns for naming and classes constructors. Here we build the
49     # object MediaOzonePlatform.
50     script = "../ui/ozone/generate_constructor_list.py"
52     platform_list_txt_file = "$target_gen_dir/ui/ozone/platform_list.txt"
53     constructor_list_cc_file = "$target_gen_dir/media/ozone/constructor_list.cc"
55     sources = [ platform_list_txt_file ]
56     outputs = [ constructor_list_cc_file ]
57     args = [
58       "--platform_list=$platform_list_txt_file",
59       "--output_cc=$constructor_list_cc_file",
60       "--namespace=media",
61       "--typename=MediaOzonePlatform",
62       "--include=\"media/ozone/media_ozone_platform.h\""
63     ]
64   }
67 component("media") {
68   sources = [
69     "base/audio_block_fifo.cc",
70     "base/audio_block_fifo.h",
71     "base/audio_buffer.cc",
72     "base/audio_buffer.h",
73     "base/audio_buffer_queue.cc",
74     "base/audio_buffer_queue.h",
75     "base/audio_capturer_source.h",
76     "base/audio_buffer_converter.cc",
77     "base/audio_buffer_converter.h",
78     "base/audio_converter.cc",
79     "base/audio_converter.h",
80     "base/audio_decoder.cc",
81     "base/audio_decoder.h",
82     "base/audio_decoder_config.cc",
83     "base/audio_decoder_config.h",
84     "base/audio_discard_helper.cc",
85     "base/audio_discard_helper.h",
86     "base/audio_fifo.cc",
87     "base/audio_fifo.h",
88     "base/audio_hardware_config.cc",
89     "base/audio_hardware_config.h",
90     "base/audio_hash.cc",
91     "base/audio_hash.h",
92     "base/audio_pull_fifo.cc",
93     "base/audio_pull_fifo.h",
94     "base/audio_renderer.cc",
95     "base/audio_renderer.h",
96     "base/audio_renderer_mixer.cc",
97     "base/audio_renderer_mixer.h",
98     "base/audio_renderer_mixer_input.cc",
99     "base/audio_renderer_mixer_input.h",
100     "base/audio_renderer_sink.h",
101     "base/audio_splicer.cc",
102     "base/audio_splicer.h",
103     "base/audio_timestamp_helper.cc",
104     "base/audio_timestamp_helper.h",
105     "base/bind_to_current_loop.h",
106     "base/bit_reader.cc",
107     "base/bit_reader.h",
108     "base/bit_reader_core.cc",
109     "base/bit_reader_core.h",
110     "base/bitstream_buffer.h",
111     "base/buffering_state.h",
112     "base/buffers.h",
113     "base/byte_queue.cc",
114     "base/byte_queue.h",
115     "base/cdm_promise.cc",
116     "base/cdm_promise.h",
117     "base/channel_mixer.cc",
118     "base/channel_mixer.h",
119     "base/clock.h",
120     "base/data_buffer.cc",
121     "base/data_buffer.h",
122     "base/data_source.cc",
123     "base/data_source.h",
124     "base/decoder_buffer.cc",
125     "base/decoder_buffer.h",
126     "base/decoder_buffer_queue.cc",
127     "base/decoder_buffer_queue.h",
128     "base/decrypt_config.cc",
129     "base/decrypt_config.h",
130     "base/decryptor.cc",
131     "base/decryptor.h",
132     "base/demuxer.cc",
133     "base/demuxer.h",
134     "base/demuxer_stream.cc",
135     "base/demuxer_stream.h",
136     "base/djb2.cc",
137     "base/djb2.h",
138     "base/filter_collection.cc",
139     "base/filter_collection.h",
140     "base/media.cc",
141     "base/media.h",
142     "base/media_keys.cc",
143     "base/media_keys.h",
144     "base/media_log.cc",
145     "base/media_log.h",
146     "base/media_log_event.h",
147     "base/media_switches.cc",
148     "base/media_switches.h",
149     "base/media_win.cc",
150     "base/multi_channel_resampler.cc",
151     "base/multi_channel_resampler.h",
152     "base/pipeline.cc",
153     "base/pipeline.h",
154     "base/pipeline_status.h",
155     "base/player_tracker.cc",
156     "base/player_tracker.h",
157     "base/ranges.cc",
158     "base/ranges.h",
159     "base/sample_format.cc",
160     "base/sample_format.h",
161     "base/scoped_histogram_timer.h",
162     "base/seekable_buffer.cc",
163     "base/seekable_buffer.h",
164     "base/serial_runner.cc",
165     "base/serial_runner.h",
166     "base/simd/convert_rgb_to_yuv.h",
167     "base/simd/convert_rgb_to_yuv_c.cc",
168     "base/simd/convert_yuv_to_rgb.h",
169     "base/simd/convert_yuv_to_rgb_c.cc",
170     "base/simd/filter_yuv.h",
171     "base/simd/filter_yuv_c.cc",
172     "base/simd/yuv_to_rgb_table.cc",
173     "base/simd/yuv_to_rgb_table.h",
174     "base/sinc_resampler.cc",
175     "base/sinc_resampler.h",
176     "base/stream_parser.cc",
177     "base/stream_parser.h",
178     "base/stream_parser_buffer.cc",
179     "base/stream_parser_buffer.h",
180     "base/text_cue.cc",
181     "base/text_cue.h",
182     "base/text_ranges.cc",
183     "base/text_ranges.h",
184     "base/text_renderer.cc",
185     "base/text_renderer.h",
186     "base/text_track.h",
187     "base/text_track_config.cc",
188     "base/text_track_config.h",
189     "base/time_delta_interpolator.cc",
190     "base/time_delta_interpolator.h",
191     "base/time_source.h",
192     "base/user_input_monitor.cc",
193     "base/user_input_monitor.h",
194     "base/user_input_monitor_mac.cc",
195     "base/user_input_monitor_win.cc",
196     "base/video_decoder.cc",
197     "base/video_decoder.h",
198     "base/video_decoder_config.cc",
199     "base/video_decoder_config.h",
200     "base/video_frame.cc",
201     "base/video_frame.h",
202     "base/video_frame_pool.cc",
203     "base/video_frame_pool.h",
204     "base/video_renderer.cc",
205     "base/video_renderer.h",
206     "base/video_rotation.h",
207     "base/video_util.cc",
208     "base/video_util.h",
209     "base/wall_clock_time_source.cc",
210     "base/wall_clock_time_source.h",
211     "base/yuv_convert.cc",
212     "base/yuv_convert.h",
213     "cdm/aes_decryptor.cc",
214     "cdm/aes_decryptor.h",
215     "cdm/json_web_key.cc",
216     "cdm/json_web_key.h",
217     "cdm/key_system_names.cc",
218     "cdm/key_system_names.h",
219     "cdm/player_tracker_impl.cc",
220     "cdm/player_tracker_impl.h",
221     "ffmpeg/ffmpeg_deleters.h",
222     "filters/audio_clock.cc",
223     "filters/audio_clock.h",
224     "filters/audio_renderer_algorithm.cc",
225     "filters/audio_renderer_algorithm.h",
226     "filters/audio_renderer_impl.cc",
227     "filters/audio_renderer_impl.h",
228     "filters/chunk_demuxer.cc",
229     "filters/chunk_demuxer.h",
230     "filters/decoder_selector.cc",
231     "filters/decoder_selector.h",
232     "filters/decoder_stream.cc",
233     "filters/decoder_stream.h",
234     "filters/decoder_stream_traits.cc",
235     "filters/decoder_stream_traits.h",
236     "filters/decrypting_audio_decoder.cc",
237     "filters/decrypting_audio_decoder.h",
238     "filters/decrypting_demuxer_stream.cc",
239     "filters/decrypting_demuxer_stream.h",
240     "filters/decrypting_video_decoder.cc",
241     "filters/decrypting_video_decoder.h",
242     "filters/file_data_source.cc",
243     "filters/file_data_source.h",
244     "filters/frame_processor.cc",
245     "filters/frame_processor.h",
246     "filters/gpu_video_accelerator_factories.cc",
247     "filters/gpu_video_accelerator_factories.h",
248     "filters/gpu_video_decoder.cc",
249     "filters/gpu_video_decoder.h",
250     "filters/h264_bit_reader.cc",
251     "filters/h264_bit_reader.h",
252     "filters/h264_parser.cc",
253     "filters/h264_parser.h",
254     "filters/skcanvas_video_renderer.cc",
255     "filters/skcanvas_video_renderer.h",
256     "filters/source_buffer_platform.cc",
257     "filters/source_buffer_platform.h",
258     "filters/source_buffer_stream.cc",
259     "filters/source_buffer_stream.h",
260     "filters/stream_parser_factory.cc",
261     "filters/stream_parser_factory.h",
262     "filters/video_frame_scheduler.h",
263     "filters/video_frame_scheduler_impl.cc",
264     "filters/video_frame_scheduler_impl.h",
265     "filters/video_frame_scheduler_proxy.cc",
266     "filters/video_frame_scheduler_proxy.h",
267     "filters/video_renderer_impl.cc",
268     "filters/video_renderer_impl.h",
269     "filters/webvtt_util.h",
270     "filters/wsola_internals.cc",
271     "filters/wsola_internals.h",
272     "midi/midi_manager.cc",
273     "midi/midi_manager.h",
274     "midi/midi_manager_mac.cc",
275     "midi/midi_manager_mac.h",
276     "midi/midi_manager_usb.cc",
277     "midi/midi_manager_usb.h",
278     "midi/midi_manager_win.cc",
279     "midi/midi_manager_win.h",
280     "midi/midi_message_queue.cc",
281     "midi/midi_message_queue.h",
282     "midi/midi_message_util.cc",
283     "midi/midi_message_util.h",
284     "midi/midi_port_info.cc",
285     "midi/midi_port_info.h",
286     "midi/usb_midi_descriptor_parser.cc",
287     "midi/usb_midi_descriptor_parser.h",
288     "midi/usb_midi_device.h",
289     "midi/usb_midi_input_stream.cc",
290     "midi/usb_midi_input_stream.h",
291     "midi/usb_midi_jack.h",
292     "midi/usb_midi_output_stream.cc",
293     "midi/usb_midi_output_stream.h",
294     "video/capture/fake_video_capture_device.cc",
295     "video/capture/fake_video_capture_device.h",
296     "video/capture/fake_video_capture_device_factory.h",
297     "video/capture/fake_video_capture_device_factory.cc",
298     "video/capture/file_video_capture_device.cc",
299     "video/capture/file_video_capture_device.h",
300     "video/capture/file_video_capture_device_factory.h",
301     "video/capture/file_video_capture_device_factory.cc",
302     "video/capture/linux/video_capture_device_factory_linux.cc",
303     "video/capture/linux/video_capture_device_factory_linux.h",
304     "video/capture/linux/video_capture_device_linux.cc",
305     "video/capture/linux/video_capture_device_linux.h",
306     "video/capture/linux/video_capture_device_chromeos.cc",
307     "video/capture/linux/video_capture_device_chromeos.h",
308     "video/capture/mac/avfoundation_glue.h",
309     "video/capture/mac/avfoundation_glue.mm",
310     "video/capture/mac/coremedia_glue.h",
311     "video/capture/mac/coremedia_glue.mm",
312     "video/capture/mac/platform_video_capturing_mac.h",
313     "video/capture/mac/video_capture_device_avfoundation_mac.h",
314     "video/capture/mac/video_capture_device_avfoundation_mac.mm",
315     "video/capture/mac/video_capture_device_factory_mac.h",
316     "video/capture/mac/video_capture_device_factory_mac.mm",
317     "video/capture/mac/video_capture_device_mac.h",
318     "video/capture/mac/video_capture_device_mac.mm",
319     "video/capture/mac/video_capture_device_qtkit_mac.h",
320     "video/capture/mac/video_capture_device_qtkit_mac.mm",
321     "video/capture/video_capture_device.cc",
322     "video/capture/video_capture_device.h",
323     "video/capture/video_capture_device_factory.cc",
324     "video/capture/video_capture_device_factory.h",
325     "video/capture/video_capture_types.cc",
326     "video/capture/video_capture_types.h",
327     "video/capture/win/capability_list_win.cc",
328     "video/capture/win/capability_list_win.h",
329     "video/capture/win/filter_base_win.cc",
330     "video/capture/win/filter_base_win.h",
331     "video/capture/win/pin_base_win.cc",
332     "video/capture/win/pin_base_win.h",
333     "video/capture/win/sink_filter_observer_win.h",
334     "video/capture/win/sink_filter_win.cc",
335     "video/capture/win/sink_filter_win.h",
336     "video/capture/win/sink_input_pin_win.cc",
337     "video/capture/win/sink_input_pin_win.h",
338     "video/capture/win/video_capture_device_factory_win.cc",
339     "video/capture/win/video_capture_device_factory_win.h",
340     "video/capture/win/video_capture_device_mf_win.cc",
341     "video/capture/win/video_capture_device_mf_win.h",
342     "video/capture/win/video_capture_device_win.cc",
343     "video/capture/win/video_capture_device_win.h",
344     "video/picture.cc",
345     "video/picture.h",
346     "video/video_decode_accelerator.cc",
347     "video/video_decode_accelerator.h",
348     "video/video_encode_accelerator.cc",
349     "video/video_encode_accelerator.h",
350     "formats/common/offset_byte_queue.cc",
351     "formats/common/offset_byte_queue.h",
352     "formats/webm/webm_audio_client.cc",
353     "formats/webm/webm_audio_client.h",
354     "formats/webm/webm_cluster_parser.cc",
355     "formats/webm/webm_cluster_parser.h",
356     "formats/webm/webm_constants.cc",
357     "formats/webm/webm_constants.h",
358     "formats/webm/webm_content_encodings.cc",
359     "formats/webm/webm_content_encodings.h",
360     "formats/webm/webm_content_encodings_client.cc",
361     "formats/webm/webm_content_encodings_client.h",
362     "formats/webm/webm_crypto_helpers.cc",
363     "formats/webm/webm_crypto_helpers.h",
364     "formats/webm/webm_info_parser.cc",
365     "formats/webm/webm_info_parser.h",
366     "formats/webm/webm_parser.cc",
367     "formats/webm/webm_parser.h",
368     "formats/webm/webm_stream_parser.cc",
369     "formats/webm/webm_stream_parser.h",
370     "formats/webm/webm_tracks_parser.cc",
371     "formats/webm/webm_tracks_parser.h",
372     "formats/webm/webm_video_client.cc",
373     "formats/webm/webm_video_client.h",
374     "formats/webm/webm_webvtt_parser.cc",
375     "formats/webm/webm_webvtt_parser.h",
376   ]
378   configs += [ ":media_config", ]
379   all_dependent_configs = [ ":media_dependent_config" ]
381   cflags = []
382   libs = []
383   defines = []
384   deps = []
386   include_dirs = [ "." ]
387   if (media_use_ffmpeg) {
388     deps += [ "//third_party/ffmpeg" ]
389     sources += [
390       "base/audio_video_metadata_extractor.cc",
391       "base/audio_video_metadata_extractor.h",
392       "base/container_names.cc",
393       "base/container_names.h",
394       "base/media_file_checker.cc",
395       "base/media_file_checker.h",
396       "base/media_posix.cc",
397       "ffmpeg/ffmpeg_common.cc",
398       "ffmpeg/ffmpeg_common.h",
399       "filters/audio_file_reader.cc",
400       "filters/audio_file_reader.h",
401       "filters/blocking_url_protocol.cc",
402       "filters/blocking_url_protocol.h",
403       "filters/ffmpeg_audio_decoder.cc",
404       "filters/ffmpeg_audio_decoder.h",
405       "filters/ffmpeg_demuxer.cc",
406       "filters/ffmpeg_demuxer.h",
407       "filters/ffmpeg_glue.cc",
408       "filters/ffmpeg_glue.h",
409       "filters/ffmpeg_video_decoder.cc",
410       "filters/ffmpeg_video_decoder.h",
411       "filters/in_memory_url_protocol.cc",
412       "filters/in_memory_url_protocol.h",
413     ]
414     if (proprietary_codecs) {
415       sources += [
416         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc",
417         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.h",
418       ]
419     }
420   }
422   if (cpu_arch == "arm" && arm_use_neon) {
423     defines += [ "USE_NEON" ]
424   }
426   if (media_use_libvpx) {
427      sources += [
428        "filters/vpx_video_decoder.cc",
429        "filters/vpx_video_decoder.h",
430      ]
431      deps += [ "//third_party/libvpx" ]
432   }
434   if (enable_browser_cdms) {
435     sources += [
436       "base/browser_cdm.cc",
437       "base/browser_cdm.h",
438       "base/browser_cdm_factory.h",
439     ]
440   }
442   if (!is_android) {
443     sources += [
444       "filters/opus_audio_decoder.cc",
445       "filters/opus_audio_decoder.h",
446     ]
447   } else {
448     sources += [
449       "base/android/demuxer_android.h",
450       "base/android/demuxer_stream_player_params.cc",
451       "base/android/demuxer_stream_player_params.h",
452       "base/android/media_player_manager.h",
453       "base/android/media_resource_getter.cc",
454       "base/android/media_resource_getter.h",
455       "base/media_stub.cc",
456       "midi/midi_manager_android.cc",
457       "midi/usb_midi_device_android.cc",
458       "midi/usb_midi_device_android.h",
459       "midi/usb_midi_device_factory_android.cc",
460       "midi/usb_midi_device_factory_android.h",
461       "video/capture/android/video_capture_device_android.cc",
462       "video/capture/android/video_capture_device_android.h",
463       "video/capture/android/video_capture_device_factory_android.cc",
464       "video/capture/android/video_capture_device_factory_android.h",
465     ]
466     defines += [ "DISABLE_USER_INPUT_MONITOR" ]
467     deps += [
468       ":media_android_jni_headers",
469       ":player_android",
470       ":video_capture_android_jni_headers",
471     ]
472     if (!is_android_webview_build) {
473       deps += [ ":media_java" ]
474     }
475   }
477   if (is_chromeos) {
478     # A simple WebM encoder for animated avatars on ChromeOS.
479     sources += [
480       "formats/webm/chromeos/ebml_writer.cc",
481       "formats/webm/chromeos/ebml_writer.h",
482       "formats/webm/chromeos/webm_encoder.cc",
483       "formats/webm/chromeos/webm_encoder.h",
484     ]
485     deps += [
486       "//third_party/libvpx",
487       "//third_party/libyuv"
488     ]
489     # For VaapiVideoEncodeAccelerator.
490     if (cpu_arch != "arm" && use_x11) {
491       sources += [
492         "filters/h264_bitstream_buffer.cc",
493         "filters/h264_bitstream_buffer.h",
494       ]
495     }
496   }
498   if (!is_ios) {
499     deps += [ "//third_party/libyuv" ]
500   }
502   if (use_alsa) {
503     libs += [ "asound" ]
504     defines += [ "USE_ALSA" ]
505     sources += [
506       "midi/midi_manager_alsa.cc",
507       "midi/midi_manager_alsa.h",
508     ]
509   }
511   # A simple WebM encoder for animated avatars on ChromeOS.
512   if (is_linux) {
513     if (use_x11) {
514       configs += [
515         "//build/config/linux:x11",
516         "//build/config/linux:xext",
517 # TODO(ajwong): Why does xent get a separate thing in //build/config/linux:BUILD.gn
518 #         "//build/config/linux:xdamage",
519 #         "//build/config/linux:xfixes",
520 #         "//build/config/linux:xtst",
521       ]
522       sources += [
523         "base/user_input_monitor_linux.cc"
524       ]
525     } else {
526       defines += [ "DISABLE_USER_INPUT_MONITOR" ]
527     }
528   }
530   if (use_ozone) {
531     # Used for the generated listing header (ui/ozone/platform_list.h)
532     include_dirs += [ target_gen_dir ]
534     sources += [
535       "ozone/media_ozone_platform.cc",
536       "ozone/media_ozone_platform.h",
537     ] + get_target_outputs(":generate_ozone_constructor_list")
539     deps += [
540       ":generate_ozone_constructor_list",
541       "//ui/ozone",
542     ]
543   }
545   if (is_mac) {
546     libs += [
547       "CoreMIDI.framework",
548       "CoreVideo.framework",
549       "OpenGL.framework",
550       "QTKit.framework",
551     ]
552   }
554   if (is_win) {
555     libs += [
556       "mf.lib",
557       "mfplat.lib",
558       "mfreadwrite.lib",
559       "mfuuid.lib",
560     ]
561     cflags += [
562       "/wd4267"  # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
563                  # http://crbug.com/171009
564     ]
565   }
567   if (proprietary_codecs) {
568     sources += [
569       "formats/mp2t/es_adapter_video.cc",
570       "formats/mp2t/es_adapter_video.h",
571       "formats/mp2t/es_parser.h",
572       "formats/mp2t/es_parser_adts.cc",
573       "formats/mp2t/es_parser_adts.h",
574       "formats/mp2t/es_parser_h264.cc",
575       "formats/mp2t/es_parser_h264.h",
576       "formats/mp2t/mp2t_common.h",
577       "formats/mp2t/mp2t_stream_parser.cc",
578       "formats/mp2t/mp2t_stream_parser.h",
579       "formats/mp2t/ts_packet.cc",
580       "formats/mp2t/ts_packet.h",
581       "formats/mp2t/ts_section.h",
582       "formats/mp2t/ts_section_pat.cc",
583       "formats/mp2t/ts_section_pat.h",
584       "formats/mp2t/ts_section_pes.cc",
585       "formats/mp2t/ts_section_pes.h",
586       "formats/mp2t/ts_section_pmt.cc",
587       "formats/mp2t/ts_section_pmt.h",
588       "formats/mp2t/ts_section_psi.cc",
589       "formats/mp2t/ts_section_psi.h",
590       "formats/mp4/aac.cc",
591       "formats/mp4/aac.h",
592       "formats/mp4/avc.cc",
593       "formats/mp4/avc.h",
594       "formats/mp4/box_definitions.cc",
595       "formats/mp4/box_definitions.h",
596       "formats/mp4/box_reader.cc",
597       "formats/mp4/box_reader.h",
598       "formats/mp4/cenc.cc",
599       "formats/mp4/cenc.h",
600       "formats/mp4/es_descriptor.cc",
601       "formats/mp4/es_descriptor.h",
602       "formats/mp4/mp4_stream_parser.cc",
603       "formats/mp4/mp4_stream_parser.h",
604       "formats/mp4/sample_to_group_iterator.cc",
605       "formats/mp4/sample_to_group_iterator.h",
606       "formats/mp4/track_run_iterator.cc",
607       "formats/mp4/track_run_iterator.h",
608       "formats/mpeg/adts_constants.cc",
609       "formats/mpeg/adts_constants.h",
610       "formats/mpeg/adts_stream_parser.cc",
611       "formats/mpeg/adts_stream_parser.h",
612       "formats/mpeg/mp3_stream_parser.cc",
613       "formats/mpeg/mp3_stream_parser.h",
614       "formats/mpeg/mpeg_audio_stream_parser_base.cc",
615       "formats/mpeg/mpeg_audio_stream_parser_base.h",
616     ]
617   }
619   if (cpu_arch == "x86" || cpu_arch == "x64") {
620     sources += [ "base/simd/convert_yuv_to_rgb_x86.cc" ]
621     deps += [
622       ":media_yasm",
623       ":media_mmx",
624       ":media_sse2",
625     ]
626   }
628   if (is_linux || is_win) {
629     sources += [
630       "base/keyboard_event_counter.cc",
631       "base/keyboard_event_counter.h",
632     ]
633   }
635   deps += [
636     ":shared_memory_support",
637     "//base",
638     "//base:i18n",
639     "//base/third_party/dynamic_annotations",
640     "//crypto",
641     "//crypto:platform",  # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings
642     "//gpu/command_buffer/common",
643     "//media/audio",
644     "//skia",
645     "//third_party/opus",
646     "//ui/events:events_base",
647     "//ui/gfx",
648     "//ui/gfx/geometry",
649     "//url",
650   ]
653 test("media_unittests") {
654   sources = [
655     "base/android/media_codec_bridge_unittest.cc",
656     "base/android/media_drm_bridge_unittest.cc",
657     "base/android/media_source_player_unittest.cc",
658     "base/audio_block_fifo_unittest.cc",
659     "base/audio_buffer_converter_unittest.cc",
660     "base/audio_buffer_unittest.cc",
661     "base/audio_buffer_queue_unittest.cc",
662     "base/audio_bus_unittest.cc",
663     "base/audio_converter_unittest.cc",
664     "base/audio_discard_helper_unittest.cc",
665     "base/audio_fifo_unittest.cc",
666     "base/audio_hardware_config_unittest.cc",
667     "base/audio_hash_unittest.cc",
668     "base/audio_pull_fifo_unittest.cc",
669     "base/audio_renderer_mixer_input_unittest.cc",
670     "base/audio_renderer_mixer_unittest.cc",
671     "base/audio_splicer_unittest.cc",
672     "base/audio_timestamp_helper_unittest.cc",
673     "base/bind_to_current_loop_unittest.cc",
674     "base/bit_reader_unittest.cc",
675     "base/callback_holder.h",
676     "base/callback_holder_unittest.cc",
677     "base/channel_mixer_unittest.cc",
678     "base/data_buffer_unittest.cc",
679     "base/decoder_buffer_queue_unittest.cc",
680     "base/decoder_buffer_unittest.cc",
681     "base/djb2_unittest.cc",
682     "base/gmock_callback_support_unittest.cc",
683     "base/multi_channel_resampler_unittest.cc",
684     "base/pipeline_unittest.cc",
685     "base/ranges_unittest.cc",
686     "base/run_all_unittests.cc",
687     "base/scoped_histogram_timer_unittest.cc",
688     "base/serial_runner_unittest.cc",
689     "base/seekable_buffer_unittest.cc",
690     "base/sinc_resampler_unittest.cc",
691     "base/stream_parser_unittest.cc",
692     "base/text_ranges_unittest.cc",
693     "base/text_renderer_unittest.cc",
694     "base/user_input_monitor_unittest.cc",
695     "base/vector_math_testing.h",
696     "base/vector_math_unittest.cc",
697     "base/video_frame_unittest.cc",
698     "base/video_frame_pool_unittest.cc",
699     "base/video_util_unittest.cc",
700     "base/wall_clock_time_source_unittest.cc",
701     "base/yuv_convert_unittest.cc",
702     "cdm/aes_decryptor_unittest.cc",
703     "cdm/json_web_key_unittest.cc",
704     "filters/audio_clock_unittest.cc",
705     "filters/audio_decoder_selector_unittest.cc",
706     "filters/audio_renderer_algorithm_unittest.cc",
707     "filters/audio_renderer_impl_unittest.cc",
708     "filters/chunk_demuxer_unittest.cc",
709     "filters/decrypting_audio_decoder_unittest.cc",
710     "filters/decrypting_demuxer_stream_unittest.cc",
711     "filters/decrypting_video_decoder_unittest.cc",
712     "filters/fake_demuxer_stream.cc",
713     "filters/fake_demuxer_stream.h",
714     "filters/fake_demuxer_stream_unittest.cc",
715     "filters/fake_video_decoder.cc",
716     "filters/fake_video_decoder.h",
717     "filters/fake_video_decoder_unittest.cc",
718     "filters/file_data_source_unittest.cc",
719     "filters/frame_processor_unittest.cc",
720     "filters/h264_bit_reader_unittest.cc",
721     "filters/h264_parser_unittest.cc",
722     "filters/skcanvas_video_renderer_unittest.cc",
723     "filters/source_buffer_stream_unittest.cc",
724     "filters/video_decoder_selector_unittest.cc",
725     "filters/video_frame_scheduler_impl_unittest.cc",
726     "filters/video_frame_scheduler_unittest.cc",
727     "filters/video_frame_stream_unittest.cc",
728     "filters/video_renderer_impl_unittest.cc",
729     "midi/midi_manager_unittest.cc",
730     "midi/midi_manager_usb_unittest.cc",
731     "midi/midi_message_queue_unittest.cc",
732     "midi/midi_message_util_unittest.cc",
733     "midi/usb_midi_descriptor_parser_unittest.cc",
734     "midi/usb_midi_input_stream_unittest.cc",
735     "midi/usb_midi_output_stream_unittest.cc",
736     "video/capture/fake_video_capture_device_unittest.cc",
737     "video/capture/video_capture_device_unittest.cc",
738     "formats/common/offset_byte_queue_unittest.cc",
739     "formats/webm/cluster_builder.cc",
740     "formats/webm/cluster_builder.h",
741     "formats/webm/tracks_builder.cc",
742     "formats/webm/tracks_builder.h",
743     "formats/webm/webm_cluster_parser_unittest.cc",
744     "formats/webm/webm_content_encodings_client_unittest.cc",
745     "formats/webm/webm_parser_unittest.cc",
746     "formats/webm/webm_tracks_parser_unittest.cc",
747     "formats/webm/webm_webvtt_parser_unittest.cc",
748   ]
750   if (media_use_ffmpeg) {
751     sources += [
752       "base/audio_video_metadata_extractor_unittest.cc",
753       "base/media_file_checker_unittest.cc",
754     ]
755   }
757   if (!is_android) {
758     sources += [
760       "base/container_names_unittest.cc",
761       "ffmpeg/ffmpeg_common_unittest.cc",
762       "filters/audio_decoder_unittest.cc",
763       "filters/audio_file_reader_unittest.cc",
764       "filters/blocking_url_protocol_unittest.cc",
765       "filters/ffmpeg_demuxer_unittest.cc",
766       "filters/ffmpeg_glue_unittest.cc",
767       "filters/ffmpeg_video_decoder_unittest.cc",
768       "filters/in_memory_url_protocol_unittest.cc",
769       "filters/pipeline_integration_test.cc",
770       "filters/pipeline_integration_test_base.cc",
771     ]
772   } else {
773 # TODO(ajwong): Blocked on android.
774 #    deps += [
775 #      ":player_android",
776 #      "//testing/android:native_test_native_code"
777 #    ]
778   }
780   if (cpu_arch != "arm" && is_chromeos && use_x11) {
781     sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
782   }
784   if (cpu_arch == "x86" || cpu_arch == "x64") {
785     sources += [ "base/simd/convert_rgb_to_yuv_unittest.cc" ]
786   }
788   if (proprietary_codecs) {
789     sources += [
790       "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
791       "filters/h264_to_annex_b_bitstream_converter_unittest.cc",
792       "formats/common/stream_parser_test_base.cc",
793       "formats/common/stream_parser_test_base.h",
794       "formats/mp2t/es_adapter_video_unittest.cc",
795       "formats/mp2t/es_parser_h264_unittest.cc",
796       "formats/mp2t/mp2t_stream_parser_unittest.cc",
797       "formats/mp4/aac_unittest.cc",
798       "formats/mp4/avc_unittest.cc",
799       "formats/mp4/box_reader_unittest.cc",
800       "formats/mp4/es_descriptor_unittest.cc",
801       "formats/mp4/mp4_stream_parser_unittest.cc",
802       "formats/mp4/sample_to_group_iterator_unittest.cc",
803       "formats/mp4/track_run_iterator_unittest.cc",
804       "formats/mpeg/adts_stream_parser_unittest.cc",
805       "formats/mpeg/mp3_stream_parser_unittest.cc",
806     ]
807   }
809   if (is_win && cpu_arch == "x64") {
810     cflags += [
811       "/wd4267"  # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
812                  # http://crbug.com/171009
813     ]
814   }
816   if (is_mac) {
817     sources += [
818       "video/capture/mac/video_capture_device_factory_mac_unittest.mm"
819     ]
820   }
822 #      include_dirs += [
823 #        # Needed by media_drm_bridge.cc.
824 #        target_gen_dir,
825 #      ],
827   configs += [ ":media_config" ]
829 # TODO(ajwong): This was in the original gyp, but it seems silly.
830 #        ['os_posix==1 and OS!="mac"', {
831 #          'conditions': [
832 #            ['use_allocator!="none"', {
833 #              'dependencies': [
834 #                '../base/allocator/allocator.gyp:allocator',
835 #              ],
836 #            }],
837 #          ],
838 #        }],
839   deps = [
840     ":media",
841     ":test_support",
842     "//base/test:test_support",
843     "//media/audio:unittests",
844     "//media/audio:test_support",
845     "//skia",  # Direct dependency required to inherit config.
846     "//testing/gmock",
847     "//testing/gtest",
848     # TODO(dalecurtis): Port the rest of Widevine stuff.
849     "//third_party/widevine/cdm:version_h",
850     "//ui/base",
851     "//ui/gfx:test_support",
852   ]
853   if (media_use_ffmpeg) {
854     deps += [
855       "//third_party/ffmpeg",  # Direct dependency required to inherit config.
856     ]
857   }
860 test("media_perftests") {
861   sources = [
862     "base/audio_bus_perftest.cc",
863     "base/audio_converter_perftest.cc",
864     "base/run_all_perftests.cc",
865     "base/sinc_resampler_perftest.cc",
866     "base/vector_math_perftest.cc",
867     "base/yuv_convert_perftest.cc",
868   ]
869   if (media_use_ffmpeg) {
870     sources += [
871       "base/demuxer_perftest.cc",
872       "filters/pipeline_integration_perftest.cc",
873       "filters/pipeline_integration_test_base.cc",
874     ]
875   }
876   configs += [ ":media_config" ]
877   deps = [
878     ":media",
879     ":shared_memory_support",
880     ":test_support",
881     "//base/test:test_support",
882     "//media/audio:test_support",
883     "//testing/gmock",
884     "//testing/gtest",
885     "//testing/perf",
886     "//third_party/widevine/cdm:version_h",
887     "//ui/gl",
888     "//ui/gfx:test_support",
889   ]
890   if (media_use_ffmpeg) {
891     deps += [
892       "//third_party/ffmpeg",  # Direct dependency required to inherit config.
893     ]
894   }
897 if (cpu_arch == "x86" || cpu_arch == "x64") {
898   source_set("media_mmx") {
899     sources = [ "base/simd/filter_yuv_mmx.cc" ]
900     configs += [ ":media_config" ]
901     cflags = [ "-mmmx" ]
902   }
904   source_set("media_sse2") {
905     sources = [
906       "base/simd/convert_rgb_to_yuv_sse2.cc",
907       "base/simd/convert_rgb_to_yuv_ssse3.cc",
908       "base/simd/filter_yuv_sse2.cc",
909     ]
910     configs += [ ":media_config" ]
911     cflags = [ "-msse2" ]
912   }
914   import("//third_party/yasm/yasm_assemble.gni")
915   yasm_assemble("media_yasm") {
916     sources = [
917       "base/simd/convert_rgb_to_yuv_ssse3.asm",
918       "base/simd/convert_yuv_to_rgb_mmx.asm",
919       "base/simd/convert_yuv_to_rgb_sse.asm",
920       "base/simd/convert_yuva_to_argb_mmx.asm",
921       "base/simd/empty_register_state_mmx.asm",
922       "base/simd/linear_scale_yuv_to_rgb_mmx.asm",
923       "base/simd/linear_scale_yuv_to_rgb_sse.asm",
924       "base/simd/scale_yuv_to_rgb_mmx.asm",
925       "base/simd/scale_yuv_to_rgb_sse.asm",
926     ]
928     # TODO(ajwong): Only export if shared_library build...
929     yasm_flags = [
930       "-DCHROMIUM",
931       "-DEXPORT_SYMBOLS",
932       # In addition to the same path as source asm, let yasm %include
933       # search path be relative to src/ per Chromium policy.
934       "-I", rebase_path("..", root_build_dir),
935     ]
937     inputs = [
938       "//third_party/x86inc/x86inc.asm",
939       "base/simd/convert_rgb_to_yuv_ssse3.inc",
940       "base/simd/convert_yuv_to_rgb_mmx.inc",
941       "base/simd/convert_yuva_to_argb_mmx.inc",
942       "base/simd/linear_scale_yuv_to_rgb_mmx.inc",
943       "base/simd/media_export.asm",
944       "base/simd/scale_yuv_to_rgb_mmx.inc",
945     ]
947     if (cpu_arch == "x86") {
948       yasm_flags += [ "-DARCH_X86_32" ]
949     } else if (cpu_arch == "x64") {
950       yasm_flags += [ "-DARCH_X86_64" ]
951       sources += [
952         "base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm",
953         "base/simd/scale_yuv_to_rgb_sse2_x64.asm",
954       ]
955     }
957     if (is_mac) {
958       yasm_flags += [
959         "-DPREFIX",
960         "-DMACHO",
961       ]
962     } else {
963       if (is_posix) {
964         yasm_flags += [ "-DELF" ]
965         if (cpu_arch == "x64") {
966         # TODO(ajwong): Why isn't this true in mac?
967           yasm_flags += [ "-DPIC" ]
968         }
969       }
970     }
971   }
974 source_set("test_support") {
975   sources = [
976     "base/fake_audio_render_callback.cc",
977     "base/fake_audio_render_callback.h",
978     "base/fake_audio_renderer_sink.cc",
979     "base/fake_audio_renderer_sink.h",
980     "base/fake_text_track_stream.cc",
981     "base/fake_text_track_stream.h",
982     "base/gmock_callback_support.h",
983     "base/mock_audio_renderer_sink.cc",
984     "base/mock_audio_renderer_sink.h",
985     "base/mock_demuxer_host.cc",
986     "base/mock_demuxer_host.h",
987     "base/mock_filters.cc",
988     "base/mock_filters.h",
989     "base/test_data_util.cc",
990     "base/test_data_util.h",
991     "base/test_helpers.cc",
992     "base/test_helpers.h",
993     "filters/clockless_video_frame_scheduler.cc",
994     "filters/clockless_video_frame_scheduler.h",
995     "filters/mock_gpu_video_accelerator_factories.cc",
996     "filters/mock_gpu_video_accelerator_factories.h",
997     "filters/test_video_frame_scheduler.cc",
998     "filters/test_video_frame_scheduler.h",
999     "video/mock_video_decode_accelerator.cc",
1000     "video/mock_video_decode_accelerator.h",
1001   ]
1002   deps = [
1003     ":media",
1004     ":shared_memory_support",
1005     "//base",
1006     "//net:test_support",
1007     "//skia",
1008     "//testing/gmock",
1009     "//testing/gtest",
1010   ]
1013 # TODO(dalecurtis): How to split this across audio/base directories??
1014 component("shared_memory_support") {
1015   sources = [
1016     "audio/audio_parameters.cc",
1017     "audio/audio_parameters.h",
1018     "base/audio_bus.cc",
1019     "base/audio_bus.h",
1020     "base/channel_layout.cc",
1021     "base/channel_layout.h",
1022     "base/limits.h",
1023     "base/media_export.h",
1024     "base/vector_math.cc",
1025     "base/vector_math.h",
1026   ]
1027   configs += [ ":media_config" ]
1028   deps = [ "//base" ]
1031 if (media_use_ffmpeg) {
1032   test("ffmpeg_unittests") {
1033     sources = [ "ffmpeg/ffmpeg_unittest.cc" ]
1035     deps = [
1036        ":media",
1037        ":test_support",
1038        "//base",
1039        "//base:i18n",
1040        "//base/test:test_support",
1041        "//testing/gtest",
1042        "//third_party/ffmpeg",
1043        "//ui/gfx:test_support",
1044     ]
1045   }
1047   test("ffmpeg_regression_tests") {
1048     sources = [
1049       "base/run_all_unittests.cc",
1050       "ffmpeg/ffmpeg_regression_tests.cc",
1051       "filters/pipeline_integration_test_base.cc",
1052     ]
1053     configs += [ ":media_config" ]
1054     deps = [
1055       ":media",
1056       ":test_support",
1057       "//base/test:test_support",
1058       "//media/audio:test_support",
1059       "//testing/gmock",
1060       "//testing/gtest",
1061       "//third_party/ffmpeg",
1062       "//ui/gfx/geometry",
1063       "//ui/gfx:test_support",
1064     ]
1065   # TODO(ajwong): This was in the original gyp, but it seems silly.
1066   #        ['os_posix==1 and OS!="mac"', {
1067   #          'conditions': [
1068   #            ['use_allocator!="none"', {
1069   #              'dependencies': [
1070   #                '../base/allocator/allocator.gyp:allocator',
1071   #              ],
1072   #            }],
1073   #          ],
1074   #        }],
1075   }
1078 if (use_x11) {
1079   executable("player_x11") {
1080     sources = [
1081       "tools/player_x11/data_source_logger.cc",
1082       "tools/player_x11/data_source_logger.h",
1083       "tools/player_x11/gl_video_renderer.cc",
1084       "tools/player_x11/gl_video_renderer.h",
1085       "tools/player_x11/player_x11.cc",
1086       "tools/player_x11/x11_video_renderer.cc",
1087       "tools/player_x11/x11_video_renderer.h",
1088     ]
1089     configs += [
1090       ":media_config",
1091       "//build/config/linux:x11",
1092       "//build/config/linux:xext",
1093 # TODO(ajwong): Why does xext get a separate thing in //build/config/linux:BUILD.gn
1094     #  "//build/config/linux:xrender",
1095     ]
1096     deps = [
1097       ":media",
1098       ":shared_memory_support",
1099       "//base",
1100       "//ui/gl",
1101       "//ui/gfx",
1102       "//ui/gfx/geometry",
1103     ]
1104   }
1107 if (is_android) {
1108   import("//build/config/android/rules.gni")
1109   source_set("player_android") {
1110     configs += [ ":media_config" ]
1111     sources = [
1112       "base/android/audio_decoder_job.cc",
1113       "base/android/audio_decoder_job.h",
1114       "base/android/browser_cdm_factory_android.cc",
1115       "base/android/media_codec_bridge.cc",
1116       "base/android/media_codec_bridge.h",
1117       "base/android/media_decoder_job.cc",
1118       "base/android/media_decoder_job.h",
1119       "base/android/media_drm_bridge.cc",
1120       "base/android/media_drm_bridge.h",
1121       "base/android/media_jni_registrar.cc",
1122       "base/android/media_jni_registrar.h",
1123       "base/android/media_player_android.cc",
1124       "base/android/media_player_android.h",
1125       "base/android/media_player_bridge.cc",
1126       "base/android/media_player_bridge.h",
1127       "base/android/media_player_listener.cc",
1128       "base/android/media_player_listener.h",
1129       "base/android/media_source_player.cc",
1130       "base/android/media_source_player.h",
1131       "base/android/video_decoder_job.cc",
1132       "base/android/video_decoder_job.h",
1133       "base/android/webaudio_media_codec_bridge.cc",
1134       "base/android/webaudio_media_codec_bridge.h",
1135       "base/android/webaudio_media_codec_info.h",
1136     ]
1138     deps = [
1139       ":media_android_jni_headers",
1140       "//base",
1141       "//third_party/widevine/cdm:version_h",
1142       "//ui/gl",
1143       "//url"
1144     ]
1145   }
1147   generate_jni("media_android_jni_headers") {
1148     sources = [
1149       "base/android/java/src/org/chromium/media/AudioManagerAndroid.java",
1150       "base/android/java/src/org/chromium/media/AudioRecordInput.java",
1151       "base/android/java/src/org/chromium/media/MediaCodecBridge.java",
1152       "base/android/java/src/org/chromium/media/MediaDrmBridge.java",
1153       "base/android/java/src/org/chromium/media/MediaPlayerBridge.java",
1154       "base/android/java/src/org/chromium/media/MediaPlayerListener.java",
1155       "base/android/java/src/org/chromium/media/UsbMidiDeviceAndroid.java",
1156       "base/android/java/src/org/chromium/media/UsbMidiDeviceFactoryAndroid.java",
1157       "base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java",
1158     ]
1159     jni_package = "media"
1160   }
1162   generate_jni("video_capture_android_jni_headers") {
1163     sources = [
1164       "base/android/java/src/org/chromium/media/VideoCapture.java",
1165       "base/android/java/src/org/chromium/media/VideoCaptureFactory.java",
1166     ]
1167     jni_package = "media"
1168   }
1170   android_library("media_java") {
1171     srcjar_deps = [
1172       ":media_android_imageformat_list",
1173     ]
1174     java_files = []
1175   }
1177   java_cpp_template("media_android_imageformat_list") {
1178     sources = [
1179       "base/android/java/src/org/chromium/media/ImageFormat.template",
1180     ]
1181     inputs = [
1182       "video/capture/android/imageformat_list.h"
1183     ]
1184     package_name = "org/chromium/media"
1185   }
1187   # TODO(dalecurtis): Finish media_unittests_apk and media_perftests_apk.