Split out mojo_converters into its own target.
[chromium-blink-merge.git] / media / BUILD.gn
blob280dc3d84dce0bc8e59d813bcedc52aa0886442d
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/linux/pkg_config.gni")
9 import("//build/config/ui.gni")
10 import("//media/media_options.gni")
12 # Common configuration for targets in the media directory.
13 # NOT for exporting.
14 config("media_config") {
15   defines = [ "MEDIA_IMPLEMENTATION" ]
16   if (cpu_arch == "arm" && arm_use_neon) {
17     defines += [ "USE_NEON" ]
18   }
19   if (use_pulseaudio) {
20     defines += [ "USE_PULSEAUDIO" ]
21     if (!link_pulseaudio) {
22       defines += [ "DLOPEN_PULSEAUDIO" ]
23     }
24   }
25   if (use_cras) {
26     defines += [ "USE_CRAS" ]
27   }
30 config("media_dependent_config") {
31   defines = []
32   if (!media_use_libvpx) {
33     defines += [ "MEDIA_DISABLE_LIBVPX" ]
34   }
35   if (is_win) {
36     ldflags = [
37       "/DELAYLOAD:mf.dll",
38       "/DELAYLOAD:mfplat.dll",
39       "/DELAYLOAD:mfreadwrite.dll",
40     ]
41   }
44 if (use_ozone) {
45   action("generate_ozone_constructor_list") {
46     # Ozone platform objects are auto-generated using similar
47     # patterns for naming and classes constructors. Here we build the
48     # object MediaOzonePlatform.
49     script = "../ui/ozone/generate_constructor_list.py"
51     platform_list_txt_file = "$target_gen_dir/ui/ozone/platform_list.txt"
52     constructor_list_cc_file = "$target_gen_dir/media/ozone/constructor_list.cc"
54     sources = [ platform_list_txt_file ]
55     outputs = [ constructor_list_cc_file ]
56     args = [
57       "--platform_list=$platform_list_txt_file",
58       "--output_cc=$constructor_list_cc_file",
59       "--namespace=media",
60       "--typename=MediaOzonePlatform",
61       "--include=\"media/ozone/media_ozone_platform.h\""
62     ]
63   }
66 component("media") {
67   sources = [
68     "cdm/aes_decryptor.cc",
69     "cdm/aes_decryptor.h",
70     "cdm/json_web_key.cc",
71     "cdm/json_web_key.h",
72     "cdm/key_system_names.cc",
73     "cdm/key_system_names.h",
74     "cdm/player_tracker_impl.cc",
75     "cdm/player_tracker_impl.h",
76     "ffmpeg/ffmpeg_deleters.h",
77     "filters/audio_clock.cc",
78     "filters/audio_clock.h",
79     "filters/audio_renderer_algorithm.cc",
80     "filters/audio_renderer_algorithm.h",
81     "filters/audio_renderer_impl.cc",
82     "filters/audio_renderer_impl.h",
83     "filters/chunk_demuxer.cc",
84     "filters/chunk_demuxer.h",
85     "filters/decoder_selector.cc",
86     "filters/decoder_selector.h",
87     "filters/decoder_stream.cc",
88     "filters/decoder_stream.h",
89     "filters/decoder_stream_traits.cc",
90     "filters/decoder_stream_traits.h",
91     "filters/decrypting_audio_decoder.cc",
92     "filters/decrypting_audio_decoder.h",
93     "filters/decrypting_demuxer_stream.cc",
94     "filters/decrypting_demuxer_stream.h",
95     "filters/decrypting_video_decoder.cc",
96     "filters/decrypting_video_decoder.h",
97     "filters/file_data_source.cc",
98     "filters/file_data_source.h",
99     "filters/frame_processor.cc",
100     "filters/frame_processor.h",
101     "filters/gpu_video_accelerator_factories.cc",
102     "filters/gpu_video_accelerator_factories.h",
103     "filters/gpu_video_decoder.cc",
104     "filters/gpu_video_decoder.h",
105     "filters/h264_bit_reader.cc",
106     "filters/h264_bit_reader.h",
107     "filters/h264_parser.cc",
108     "filters/h264_parser.h",
109     "filters/renderer_impl.cc",
110     "filters/renderer_impl.h",
111     "filters/skcanvas_video_renderer.cc",
112     "filters/skcanvas_video_renderer.h",
113     "filters/source_buffer_platform.cc",
114     "filters/source_buffer_platform.h",
115     "filters/source_buffer_range.cc",
116     "filters/source_buffer_range.h",
117     "filters/source_buffer_stream.cc",
118     "filters/source_buffer_stream.h",
119     "filters/stream_parser_factory.cc",
120     "filters/stream_parser_factory.h",
121     "filters/video_frame_scheduler.h",
122     "filters/video_frame_scheduler_impl.cc",
123     "filters/video_frame_scheduler_impl.h",
124     "filters/video_frame_scheduler_proxy.cc",
125     "filters/video_frame_scheduler_proxy.h",
126     "filters/video_renderer_impl.cc",
127     "filters/video_renderer_impl.h",
128     "filters/webvtt_util.h",
129     "filters/wsola_internals.cc",
130     "filters/wsola_internals.h",
131     "midi/midi_manager.cc",
132     "midi/midi_manager.h",
133     "midi/midi_manager_mac.cc",
134     "midi/midi_manager_mac.h",
135     "midi/midi_manager_usb.cc",
136     "midi/midi_manager_usb.h",
137     "midi/midi_manager_win.cc",
138     "midi/midi_manager_win.h",
139     "midi/midi_message_queue.cc",
140     "midi/midi_message_queue.h",
141     "midi/midi_message_util.cc",
142     "midi/midi_message_util.h",
143     "midi/midi_port_info.cc",
144     "midi/midi_port_info.h",
145     "midi/usb_midi_descriptor_parser.cc",
146     "midi/usb_midi_descriptor_parser.h",
147     "midi/usb_midi_device.h",
148     "midi/usb_midi_input_stream.cc",
149     "midi/usb_midi_input_stream.h",
150     "midi/usb_midi_jack.h",
151     "midi/usb_midi_output_stream.cc",
152     "midi/usb_midi_output_stream.h",
153     "video/capture/fake_video_capture_device.cc",
154     "video/capture/fake_video_capture_device.h",
155     "video/capture/fake_video_capture_device_factory.h",
156     "video/capture/fake_video_capture_device_factory.cc",
157     "video/capture/file_video_capture_device.cc",
158     "video/capture/file_video_capture_device.h",
159     "video/capture/file_video_capture_device_factory.h",
160     "video/capture/file_video_capture_device_factory.cc",
161     "video/capture/linux/video_capture_device_factory_linux.cc",
162     "video/capture/linux/video_capture_device_factory_linux.h",
163     "video/capture/linux/video_capture_device_linux.cc",
164     "video/capture/linux/video_capture_device_linux.h",
165     "video/capture/linux/video_capture_device_chromeos.cc",
166     "video/capture/linux/video_capture_device_chromeos.h",
167     "video/capture/mac/platform_video_capturing_mac.h",
168     "video/capture/mac/video_capture_device_avfoundation_mac.h",
169     "video/capture/mac/video_capture_device_avfoundation_mac.mm",
170     "video/capture/mac/video_capture_device_decklink_mac.h",
171     "video/capture/mac/video_capture_device_decklink_mac.mm",
172     "video/capture/mac/video_capture_device_factory_mac.h",
173     "video/capture/mac/video_capture_device_factory_mac.mm",
174     "video/capture/mac/video_capture_device_mac.h",
175     "video/capture/mac/video_capture_device_mac.mm",
176     "video/capture/mac/video_capture_device_qtkit_mac.h",
177     "video/capture/mac/video_capture_device_qtkit_mac.mm",
178     "video/capture/video_capture_device.cc",
179     "video/capture/video_capture_device.h",
180     "video/capture/video_capture_device_factory.cc",
181     "video/capture/video_capture_device_factory.h",
182     "video/capture/video_capture_device_info.cc",
183     "video/capture/video_capture_device_info.h",
184     "video/capture/video_capture_types.cc",
185     "video/capture/video_capture_types.h",
186     "video/capture/win/capability_list_win.cc",
187     "video/capture/win/capability_list_win.h",
188     "video/capture/win/filter_base_win.cc",
189     "video/capture/win/filter_base_win.h",
190     "video/capture/win/pin_base_win.cc",
191     "video/capture/win/pin_base_win.h",
192     "video/capture/win/sink_filter_observer_win.h",
193     "video/capture/win/sink_filter_win.cc",
194     "video/capture/win/sink_filter_win.h",
195     "video/capture/win/sink_input_pin_win.cc",
196     "video/capture/win/sink_input_pin_win.h",
197     "video/capture/win/video_capture_device_factory_win.cc",
198     "video/capture/win/video_capture_device_factory_win.h",
199     "video/capture/win/video_capture_device_mf_win.cc",
200     "video/capture/win/video_capture_device_mf_win.h",
201     "video/capture/win/video_capture_device_win.cc",
202     "video/capture/win/video_capture_device_win.h",
203     "video/picture.cc",
204     "video/picture.h",
205     "video/video_decode_accelerator.cc",
206     "video/video_decode_accelerator.h",
207     "video/video_encode_accelerator.cc",
208     "video/video_encode_accelerator.h",
209     "formats/common/offset_byte_queue.cc",
210     "formats/common/offset_byte_queue.h",
211     "formats/webm/webm_audio_client.cc",
212     "formats/webm/webm_audio_client.h",
213     "formats/webm/webm_cluster_parser.cc",
214     "formats/webm/webm_cluster_parser.h",
215     "formats/webm/webm_constants.cc",
216     "formats/webm/webm_constants.h",
217     "formats/webm/webm_content_encodings.cc",
218     "formats/webm/webm_content_encodings.h",
219     "formats/webm/webm_content_encodings_client.cc",
220     "formats/webm/webm_content_encodings_client.h",
221     "formats/webm/webm_crypto_helpers.cc",
222     "formats/webm/webm_crypto_helpers.h",
223     "formats/webm/webm_info_parser.cc",
224     "formats/webm/webm_info_parser.h",
225     "formats/webm/webm_parser.cc",
226     "formats/webm/webm_parser.h",
227     "formats/webm/webm_stream_parser.cc",
228     "formats/webm/webm_stream_parser.h",
229     "formats/webm/webm_tracks_parser.cc",
230     "formats/webm/webm_tracks_parser.h",
231     "formats/webm/webm_video_client.cc",
232     "formats/webm/webm_video_client.h",
233     "formats/webm/webm_webvtt_parser.cc",
234     "formats/webm/webm_webvtt_parser.h",
235   ]
237   configs += [ ":media_config", ]
238   all_dependent_configs = [ ":media_dependent_config" ]
240   cflags = []
241   libs = []
242   defines = []
243   deps = []
245   include_dirs = [ "." ]
246   if (media_use_ffmpeg) {
247     deps += [ "//third_party/ffmpeg" ]
248     sources += [
249       "ffmpeg/ffmpeg_common.cc",
250       "ffmpeg/ffmpeg_common.h",
251       "filters/audio_file_reader.cc",
252       "filters/audio_file_reader.h",
253       "filters/blocking_url_protocol.cc",
254       "filters/blocking_url_protocol.h",
255       "filters/ffmpeg_audio_decoder.cc",
256       "filters/ffmpeg_audio_decoder.h",
257       "filters/ffmpeg_demuxer.cc",
258       "filters/ffmpeg_demuxer.h",
259       "filters/ffmpeg_glue.cc",
260       "filters/ffmpeg_glue.h",
261       "filters/ffmpeg_video_decoder.cc",
262       "filters/ffmpeg_video_decoder.h",
263       "filters/in_memory_url_protocol.cc",
264       "filters/in_memory_url_protocol.h",
265     ]
266     if (proprietary_codecs) {
267       sources += [
268         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc",
269         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.h",
270       ]
271     }
272   }
274   if (cpu_arch == "arm" && arm_use_neon) {
275     defines += [ "USE_NEON" ]
276   }
278   if (media_use_libvpx) {
279      sources += [
280        "filters/vpx_video_decoder.cc",
281        "filters/vpx_video_decoder.h",
282      ]
283      deps += [ "//third_party/libvpx" ]
284   }
286   if (!is_android) {
287     sources += [
288       "filters/opus_audio_decoder.cc",
289       "filters/opus_audio_decoder.h",
290     ]
291   } else {
292     sources += [
293       "midi/midi_manager_android.cc",
294       "midi/usb_midi_device_android.cc",
295       "midi/usb_midi_device_android.h",
296       "midi/usb_midi_device_factory_android.cc",
297       "midi/usb_midi_device_factory_android.h",
298       "video/capture/android/video_capture_device_android.cc",
299       "video/capture/android/video_capture_device_android.h",
300       "video/capture/android/video_capture_device_factory_android.cc",
301       "video/capture/android/video_capture_device_factory_android.h",
302     ]
303     deps += [
304       "//media/base/android",
305       "//media/base/android:media_jni_headers",
306       "//media/base/android:video_capture_jni_headers",
307     ]
308     if (!is_android_webview_build) {
309       deps += [ "//media/base/android:media_java" ]
310     }
311   }
313   if (cpu_arch != "arm" && is_chromeos && use_x11) {
314     sources += [
315       "filters/h264_bitstream_buffer.cc",
316       "filters/h264_bitstream_buffer.h",
317     ]
318   }
320   if (use_alsa) {
321     libs += [ "asound" ]
322     defines += [ "USE_ALSA" ]
323     sources += [
324       "midi/midi_manager_alsa.cc",
325       "midi/midi_manager_alsa.h",
326     ]
327   }
329   # A simple WebM encoder for animated avatars on ChromeOS.
331   if (use_ozone) {
332     # Used for the generated listing header (ui/ozone/platform_list.h)
333     include_dirs += [ target_gen_dir ]
335     sources += [
336       "ozone/media_ozone_platform.cc",
337       "ozone/media_ozone_platform.h",
338     ] + get_target_outputs(":generate_ozone_constructor_list")
340     deps += [
341       ":generate_ozone_constructor_list",
342       "//ui/ozone",
343     ]
344   }
346   if (is_mac) {
347     deps += [
348       "//media/base/mac",
349       "//third_party/decklink",
350     ]
351     libs += [
352       "CoreMIDI.framework",
353       "CoreVideo.framework",
354       "OpenGL.framework",
355       "QTKit.framework",
356     ]
357   }
359   if (is_ios) {
360     deps += [
361       "//media/base/mac",
362     ]
363   }
365   if (is_win) {
366     libs += [
367       "mf.lib",
368       "mfplat.lib",
369       "mfreadwrite.lib",
370       "mfuuid.lib",
371     ]
372     cflags += [
373       "/wd4267"  # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
374                  # http://crbug.com/171009
375     ]
376   }
378   if (proprietary_codecs) {
379     sources += [
380       "filters/h264_to_annex_b_bitstream_converter.cc",
381       "filters/h264_to_annex_b_bitstream_converter.h",
382       "formats/mp2t/es_adapter_video.cc",
383       "formats/mp2t/es_adapter_video.h",
384       "formats/mp2t/es_parser.cc",
385       "formats/mp2t/es_parser.h",
386       "formats/mp2t/es_parser_adts.cc",
387       "formats/mp2t/es_parser_adts.h",
388       "formats/mp2t/es_parser_h264.cc",
389       "formats/mp2t/es_parser_h264.h",
390       "formats/mp2t/es_parser_mpeg1audio.cc",
391       "formats/mp2t/es_parser_mpeg1audio.h",
392       "formats/mp2t/mp2t_common.h",
393       "formats/mp2t/mp2t_stream_parser.cc",
394       "formats/mp2t/mp2t_stream_parser.h",
395       "formats/mp2t/timestamp_unroller.cc",
396       "formats/mp2t/timestamp_unroller.h",
397       "formats/mp2t/ts_packet.cc",
398       "formats/mp2t/ts_packet.h",
399       "formats/mp2t/ts_section.h",
400       "formats/mp2t/ts_section_pat.cc",
401       "formats/mp2t/ts_section_pat.h",
402       "formats/mp2t/ts_section_pes.cc",
403       "formats/mp2t/ts_section_pes.h",
404       "formats/mp2t/ts_section_pmt.cc",
405       "formats/mp2t/ts_section_pmt.h",
406       "formats/mp2t/ts_section_psi.cc",
407       "formats/mp2t/ts_section_psi.h",
408       "formats/mp4/aac.cc",
409       "formats/mp4/aac.h",
410       "formats/mp4/avc.cc",
411       "formats/mp4/avc.h",
412       "formats/mp4/box_definitions.cc",
413       "formats/mp4/box_definitions.h",
414       "formats/mp4/box_reader.cc",
415       "formats/mp4/box_reader.h",
416       "formats/mp4/cenc.cc",
417       "formats/mp4/cenc.h",
418       "formats/mp4/es_descriptor.cc",
419       "formats/mp4/es_descriptor.h",
420       "formats/mp4/mp4_stream_parser.cc",
421       "formats/mp4/mp4_stream_parser.h",
422       "formats/mp4/sample_to_group_iterator.cc",
423       "formats/mp4/sample_to_group_iterator.h",
424       "formats/mp4/track_run_iterator.cc",
425       "formats/mp4/track_run_iterator.h",
426       "formats/mpeg/adts_constants.cc",
427       "formats/mpeg/adts_constants.h",
428       "formats/mpeg/adts_stream_parser.cc",
429       "formats/mpeg/adts_stream_parser.h",
430       "formats/mpeg/mpeg_audio_stream_parser_base.cc",
431       "formats/mpeg/mpeg_audio_stream_parser_base.h",
432       "formats/mpeg/mpeg1_audio_stream_parser.cc",
433       "formats/mpeg/mpeg1_audio_stream_parser.h",
434     ]
435   }
437   public_deps = [
438     "//media/base",
439     "//media/audio",
440   ]
442   deps += [
443     ":shared_memory_support",
444     "//base",
445     "//base:i18n",
446     "//base/third_party/dynamic_annotations",
447     "//crypto",
448     "//crypto:platform",  # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings
449     "//gpu/command_buffer/common",
450     "//skia",
451     "//third_party/libyuv",
452     "//third_party/opus",
453     "//ui/events:events_base",
454     "//ui/gfx",
455     "//ui/gfx/geometry",
456     "//url",
457   ]
460 # Minimal media component for media/cast on iOS.
461 if (is_ios) {
462   component("media_for_cast_ios") {
463     configs += [ ":media_config" ]
464     all_dependent_configs = [ ":media_dependent_config" ]
465     include_dirs = [ "." ]
466     libs = [ "CoreVideo.framework" ]
468     deps = [
469       ":shared_memory_support",
470       "//base",
471       "//media/base:base_for_cast_ios",
472       "//media/base/mac",
473       "//ui/gfx/geometry",
474     ]
475   }
478 test("media_unittests") {
479   sources = [
480     "cdm/aes_decryptor_unittest.cc",
481     "cdm/json_web_key_unittest.cc",
482     "filters/audio_clock_unittest.cc",
483     "filters/audio_decoder_selector_unittest.cc",
484     "filters/audio_renderer_algorithm_unittest.cc",
485     "filters/audio_renderer_impl_unittest.cc",
486     "filters/chunk_demuxer_unittest.cc",
487     "filters/decrypting_audio_decoder_unittest.cc",
488     "filters/decrypting_demuxer_stream_unittest.cc",
489     "filters/decrypting_video_decoder_unittest.cc",
490     "filters/fake_demuxer_stream.cc",
491     "filters/fake_demuxer_stream.h",
492     "filters/fake_demuxer_stream_unittest.cc",
493     "filters/fake_video_decoder.cc",
494     "filters/fake_video_decoder.h",
495     "filters/fake_video_decoder_unittest.cc",
496     "filters/file_data_source_unittest.cc",
497     "filters/frame_processor_unittest.cc",
498     "filters/h264_bit_reader_unittest.cc",
499     "filters/h264_parser_unittest.cc",
500     "filters/renderer_impl_unittest.cc",
501     "filters/skcanvas_video_renderer_unittest.cc",
502     "filters/source_buffer_stream_unittest.cc",
503     "filters/video_decoder_selector_unittest.cc",
504     "filters/video_frame_scheduler_impl_unittest.cc",
505     "filters/video_frame_scheduler_unittest.cc",
506     "filters/video_frame_stream_unittest.cc",
507     "filters/video_renderer_impl_unittest.cc",
508     "midi/midi_manager_unittest.cc",
509     "midi/midi_manager_usb_unittest.cc",
510     "midi/midi_message_queue_unittest.cc",
511     "midi/midi_message_util_unittest.cc",
512     "midi/usb_midi_descriptor_parser_unittest.cc",
513     "midi/usb_midi_input_stream_unittest.cc",
514     "midi/usb_midi_output_stream_unittest.cc",
515     "video/capture/fake_video_capture_device_unittest.cc",
516     "video/capture/video_capture_device_unittest.cc",
517     "formats/common/offset_byte_queue_unittest.cc",
518     "formats/webm/cluster_builder.cc",
519     "formats/webm/cluster_builder.h",
520     "formats/webm/tracks_builder.cc",
521     "formats/webm/tracks_builder.h",
522     "formats/webm/webm_cluster_parser_unittest.cc",
523     "formats/webm/webm_content_encodings_client_unittest.cc",
524     "formats/webm/webm_parser_unittest.cc",
525     "formats/webm/webm_tracks_parser_unittest.cc",
526     "formats/webm/webm_webvtt_parser_unittest.cc",
527   ]
529   deps = [
530     ":media",
531     ":test_support",
532     "//base/allocator",
533     "//base/test:test_support",
534     "//media/audio:unittests",
535     "//media/audio:test_support",
536     "//media/base:unittests",
537     "//media/base:test_support",
538     "//skia",  # Direct dependency required to inherit config.
539     "//testing/gmock",
540     "//testing/gtest",
541     "//third_party/widevine/cdm:version_h",
542     "//ui/gfx:test_support",
543     "//url",
544   ]
546   if (is_android) {
547     deps += [
548       "//media/base/android",
549       # TODO(GYP)
550       #"//testing/android:native_test_native_code"
551     ]
552   }
554   if (media_use_ffmpeg) {
555     sources += [
556       "ffmpeg/ffmpeg_common_unittest.cc",
557       "filters/audio_decoder_unittest.cc",
558       "filters/audio_file_reader_unittest.cc",
559       "filters/blocking_url_protocol_unittest.cc",
560       "filters/ffmpeg_demuxer_unittest.cc",
561       "filters/ffmpeg_glue_unittest.cc",
562       "filters/ffmpeg_video_decoder_unittest.cc",
563       "filters/in_memory_url_protocol_unittest.cc",
564       "filters/pipeline_integration_test.cc",
565       "filters/pipeline_integration_test_base.cc",
566     ]
567   }
569   if (cpu_arch != "arm" && is_chromeos && use_x11) {
570     sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
571   }
573   if (proprietary_codecs) {
574     sources += [
575       "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
576       "filters/h264_to_annex_b_bitstream_converter_unittest.cc",
577       "formats/common/stream_parser_test_base.cc",
578       "formats/common/stream_parser_test_base.h",
579       "formats/mp2t/es_adapter_video_unittest.cc",
580       "formats/mp2t/es_parser_adts_unittest.cc",
581       "formats/mp2t/es_parser_h264_unittest.cc",
582       "formats/mp2t/es_parser_mpeg1audio_unittest.cc",
583       "formats/mp2t/es_parser_test_base.cc",
584       "formats/mp2t/es_parser_test_base.h",
585       "formats/mp2t/mp2t_stream_parser_unittest.cc",
586       "formats/mp2t/timestamp_unroller_unittest.cc",
587       "formats/mp4/aac_unittest.cc",
588       "formats/mp4/avc_unittest.cc",
589       "formats/mp4/box_reader_unittest.cc",
590       "formats/mp4/es_descriptor_unittest.cc",
591       "formats/mp4/mp4_stream_parser_unittest.cc",
592       "formats/mp4/sample_to_group_iterator_unittest.cc",
593       "formats/mp4/track_run_iterator_unittest.cc",
594       "formats/mpeg/adts_stream_parser_unittest.cc",
595       "formats/mpeg/mpeg1_audio_stream_parser_unittest.cc",
596     ]
597   }
599   if (is_win && cpu_arch == "x64") {
600     cflags += [
601       "/wd4267"  # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
602                  # http://crbug.com/171009
603     ]
604   }
606   if (is_mac) {
607     sources += [
608       "video/capture/mac/video_capture_device_factory_mac_unittest.mm"
609     ]
610   }
612 #      include_dirs += [
613 #        # Needed by media_drm_bridge.cc.
614 #        target_gen_dir,
615 #      ],
617   configs += [ ":media_config" ]
619   if (media_use_ffmpeg) {
620     deps += [
621       "//third_party/ffmpeg",  # Direct dependency required to inherit config.
622     ]
623   }
626 test("media_perftests") {
627   sources = []
628   if (media_use_ffmpeg) {
629     sources += [
630       "filters/pipeline_integration_perftest.cc",
631       "filters/pipeline_integration_test_base.cc",
632     ]
633   }
634   configs += [ ":media_config" ]
635   deps = [
636     ":media",
637     ":shared_memory_support",
638     ":test_support",
639     "//base/test:test_support",
640     "//media/audio:test_support",
641     "//media/base:perftests",
642     "//media/base:test_support",
643     "//testing/gmock",
644     "//testing/gtest",
645     "//testing/perf",
646     "//third_party/widevine/cdm:version_h",
647     "//ui/gfx:test_support",
648   ]
649   if (is_android) {
650     deps += [ "//ui/gl" ]
651   }
652   if (media_use_ffmpeg) {
653     deps += [
654       "//third_party/ffmpeg",  # Direct dependency required to inherit config.
655     ]
656   }
659 source_set("test_support") {
660   testonly = true
661   sources = [
662     "filters/clockless_video_frame_scheduler.cc",
663     "filters/clockless_video_frame_scheduler.h",
664     "filters/mock_gpu_video_accelerator_factories.cc",
665     "filters/mock_gpu_video_accelerator_factories.h",
666     "filters/test_video_frame_scheduler.cc",
667     "filters/test_video_frame_scheduler.h",
668     "video/mock_video_decode_accelerator.cc",
669     "video/mock_video_decode_accelerator.h",
670   ]
671   deps = [
672     ":media",
673     ":shared_memory_support",
674     "//base",
675     "//skia",
676     "//testing/gmock",
677     "//testing/gtest",
678   ]
681 # TODO(dalecurtis): How to split this across audio/base directories??
682 component("shared_memory_support") {
683   sources = [
684     "audio/audio_parameters.cc",
685     "audio/audio_parameters.h",
686     "base/audio_bus.cc",
687     "base/audio_bus.h",
688     "base/channel_layout.cc",
689     "base/channel_layout.h",
690     "base/limits.h",
691     "base/media_export.h",
692     "base/vector_math.cc",
693     "base/vector_math.h",
694   ]
695   configs += [ ":media_config" ]
696   defines = [ "MEDIA_IMPLEMENTATION" ]
697   deps = [ "//base" ]
700 if (media_use_ffmpeg) {
701   test("ffmpeg_unittests") {
702     sources = [ "ffmpeg/ffmpeg_unittest.cc" ]
704     deps = [
705        ":media",
706        ":test_support",
707        "//base",
708        "//base:i18n",
709        "//base/test:test_support",
710        "//testing/gtest",
711        "//third_party/ffmpeg",
712        "//ui/gfx:test_support",
713     ]
714   }
716   test("ffmpeg_regression_tests") {
717     sources = [
718       "base/run_all_unittests.cc",
719       "ffmpeg/ffmpeg_regression_tests.cc",
720       "filters/pipeline_integration_test_base.cc",
721     ]
722     configs += [ ":media_config" ]
723     deps = [
724       ":media",
725       ":test_support",
726       "//base/test:test_support",
727       "//media/audio:test_support",
728       "//media/base:test_support",
729       "//testing/gmock",
730       "//testing/gtest",
731       "//third_party/ffmpeg",
732       "//ui/gfx/geometry",
733       "//ui/gfx:test_support",
734     ]
735   # TODO(ajwong): This was in the original gyp, but it seems silly.
736   #        ['os_posix==1 and OS!="mac"', {
737   #          'conditions': [
738   #            ['use_allocator!="none"', {
739   #              'dependencies': [
740   #                '../base/allocator/allocator.gyp:allocator',
741   #              ],
742   #            }],
743   #          ],
744   #        }],
745   }
748 if (use_x11) {
749   executable("player_x11") {
750     sources = [
751       "tools/player_x11/data_source_logger.cc",
752       "tools/player_x11/data_source_logger.h",
753       "tools/player_x11/gl_video_renderer.cc",
754       "tools/player_x11/gl_video_renderer.h",
755       "tools/player_x11/player_x11.cc",
756       "tools/player_x11/x11_video_renderer.cc",
757       "tools/player_x11/x11_video_renderer.h",
758     ]
759     configs += [
760       ":media_config",
761       "//build/config/linux:x11",
762       "//build/config/linux:xext",
763 # TODO(ajwong): Why does xext get a separate thing in //build/config/linux:BUILD.gn
764     #  "//build/config/linux:xrender",
765     ]
766     deps = [
767       ":media",
768       ":shared_memory_support",
769       "//base",
770       "//ui/gl",
771       "//ui/gfx",
772       "//ui/gfx/geometry",
773     ]
774   }