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