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