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