Roll leveldb 3f7758:803d69 (v1.17 -> v1.18)
[chromium-blink-merge.git] / media / BUILD.gn
blob2496984f14131516d5252566ac01a2516147adfe
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     "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_bitstream_converter.h",
258       "filters/ffmpeg_demuxer.cc",
259       "filters/ffmpeg_demuxer.h",
260       "filters/ffmpeg_glue.cc",
261       "filters/ffmpeg_glue.h",
262       "filters/ffmpeg_video_decoder.cc",
263       "filters/ffmpeg_video_decoder.h",
264       "filters/in_memory_url_protocol.cc",
265       "filters/in_memory_url_protocol.h",
266     ]
267     if (proprietary_codecs) {
268       sources += [
269         "filters/ffmpeg_aac_bitstream_converter.cc",
270         "filters/ffmpeg_aac_bitstream_converter.h",
271         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc",
272         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.h",
273       ]
274     }
275   }
277   if (cpu_arch == "arm" && arm_use_neon) {
278     defines += [ "USE_NEON" ]
279   }
281   if (media_use_libvpx) {
282      sources += [
283        "filters/vpx_video_decoder.cc",
284        "filters/vpx_video_decoder.h",
285      ]
286      deps += [ "//third_party/libvpx" ]
287   }
289   if (!is_android) {
290     sources += [
291       "filters/opus_audio_decoder.cc",
292       "filters/opus_audio_decoder.h",
293     ]
294   } else {
295     sources += [
296       "midi/midi_manager_android.cc",
297       "midi/usb_midi_device_android.cc",
298       "midi/usb_midi_device_android.h",
299       "midi/usb_midi_device_factory_android.cc",
300       "midi/usb_midi_device_factory_android.h",
301       "video/capture/android/video_capture_device_android.cc",
302       "video/capture/android/video_capture_device_android.h",
303       "video/capture/android/video_capture_device_factory_android.cc",
304       "video/capture/android/video_capture_device_factory_android.h",
305     ]
306     deps += [
307       "//media/base/android",
308       "//media/base/android:media_jni_headers",
309       "//media/base/android:video_capture_jni_headers",
310     ]
311     if (!is_android_webview_build) {
312       deps += [ "//media/base/android:media_java" ]
313     }
314   }
316   if (cpu_arch != "arm" && is_chromeos && use_x11) {
317     sources += [
318       "filters/h264_bitstream_buffer.cc",
319       "filters/h264_bitstream_buffer.h",
320     ]
321   }
323   if (use_alsa) {
324     libs += [ "asound" ]
325     defines += [ "USE_ALSA" ]
326     sources += [
327       "midi/midi_manager_alsa.cc",
328       "midi/midi_manager_alsa.h",
329     ]
330   }
332   # A simple WebM encoder for animated avatars on ChromeOS.
334   if (use_ozone) {
335     # Used for the generated listing header (ui/ozone/platform_list.h)
336     include_dirs += [ target_gen_dir ]
338     sources += [
339       "ozone/media_ozone_platform.cc",
340       "ozone/media_ozone_platform.h",
341     ] + get_target_outputs(":generate_ozone_constructor_list")
343     deps += [
344       ":generate_ozone_constructor_list",
345       "//ui/ozone",
346     ]
347   }
349   if (is_mac) {
350     deps += [
351       "//media/base/mac",
352       "//third_party/decklink",
353     ]
354     libs += [
355       "CoreMIDI.framework",
356       "CoreVideo.framework",
357       "OpenGL.framework",
358       "QTKit.framework",
359     ]
360   }
362   if (is_ios) {
363     deps += [
364       "//media/base/mac",
365     ]
366   }
368   if (is_win) {
369     libs += [
370       "mf.lib",
371       "mfplat.lib",
372       "mfreadwrite.lib",
373       "mfuuid.lib",
374     ]
375     cflags += [
376       "/wd4267"  # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
377                  # http://crbug.com/171009
378     ]
379   }
381   if (proprietary_codecs) {
382     sources += [
383       "filters/h264_to_annex_b_bitstream_converter.cc",
384       "filters/h264_to_annex_b_bitstream_converter.h",
385       "formats/mp2t/es_adapter_video.cc",
386       "formats/mp2t/es_adapter_video.h",
387       "formats/mp2t/es_parser.cc",
388       "formats/mp2t/es_parser.h",
389       "formats/mp2t/es_parser_adts.cc",
390       "formats/mp2t/es_parser_adts.h",
391       "formats/mp2t/es_parser_h264.cc",
392       "formats/mp2t/es_parser_h264.h",
393       "formats/mp2t/es_parser_mpeg1audio.cc",
394       "formats/mp2t/es_parser_mpeg1audio.h",
395       "formats/mp2t/mp2t_common.h",
396       "formats/mp2t/mp2t_stream_parser.cc",
397       "formats/mp2t/mp2t_stream_parser.h",
398       "formats/mp2t/timestamp_unroller.cc",
399       "formats/mp2t/timestamp_unroller.h",
400       "formats/mp2t/ts_packet.cc",
401       "formats/mp2t/ts_packet.h",
402       "formats/mp2t/ts_section.h",
403       "formats/mp2t/ts_section_pat.cc",
404       "formats/mp2t/ts_section_pat.h",
405       "formats/mp2t/ts_section_pes.cc",
406       "formats/mp2t/ts_section_pes.h",
407       "formats/mp2t/ts_section_pmt.cc",
408       "formats/mp2t/ts_section_pmt.h",
409       "formats/mp2t/ts_section_psi.cc",
410       "formats/mp2t/ts_section_psi.h",
411       "formats/mp4/aac.cc",
412       "formats/mp4/aac.h",
413       "formats/mp4/avc.cc",
414       "formats/mp4/avc.h",
415       "formats/mp4/box_definitions.cc",
416       "formats/mp4/box_definitions.h",
417       "formats/mp4/box_reader.cc",
418       "formats/mp4/box_reader.h",
419       "formats/mp4/cenc.cc",
420       "formats/mp4/cenc.h",
421       "formats/mp4/es_descriptor.cc",
422       "formats/mp4/es_descriptor.h",
423       "formats/mp4/mp4_stream_parser.cc",
424       "formats/mp4/mp4_stream_parser.h",
425       "formats/mp4/sample_to_group_iterator.cc",
426       "formats/mp4/sample_to_group_iterator.h",
427       "formats/mp4/track_run_iterator.cc",
428       "formats/mp4/track_run_iterator.h",
429       "formats/mpeg/adts_constants.cc",
430       "formats/mpeg/adts_constants.h",
431       "formats/mpeg/adts_stream_parser.cc",
432       "formats/mpeg/adts_stream_parser.h",
433       "formats/mpeg/mpeg_audio_stream_parser_base.cc",
434       "formats/mpeg/mpeg_audio_stream_parser_base.h",
435       "formats/mpeg/mpeg1_audio_stream_parser.cc",
436       "formats/mpeg/mpeg1_audio_stream_parser.h",
437     ]
438   }
440   public_deps = [
441     "//media/base",
442     "//media/audio",
443   ]
445   deps += [
446     ":shared_memory_support",
447     "//base",
448     "//base:i18n",
449     "//base/third_party/dynamic_annotations",
450     "//crypto",
451     "//crypto:platform",  # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings
452     "//gpu/command_buffer/common",
453     "//skia",
454     "//third_party/libyuv",
455     "//third_party/opus",
456     "//ui/events:events_base",
457     "//ui/gfx",
458     "//ui/gfx/geometry",
459     "//url",
460   ]
463 # Minimal media component for media/cast on iOS.
464 if (is_ios) {
465   component("media_for_cast_ios") {
466     configs += [ ":media_config" ]
467     all_dependent_configs = [ ":media_dependent_config" ]
468     include_dirs = [ "." ]
469     libs = [ "CoreVideo.framework" ]
471     deps = [
472       ":shared_memory_support",
473       "//base",
474       "//media/base:base_for_cast_ios",
475       "//media/base/mac",
476       "//ui/gfx/geometry",
477     ]
478   }
481 test("media_unittests") {
482   sources = [
483     "cdm/aes_decryptor_unittest.cc",
484     "cdm/json_web_key_unittest.cc",
485     "filters/audio_clock_unittest.cc",
486     "filters/audio_decoder_selector_unittest.cc",
487     "filters/audio_renderer_algorithm_unittest.cc",
488     "filters/audio_renderer_impl_unittest.cc",
489     "filters/chunk_demuxer_unittest.cc",
490     "filters/decrypting_audio_decoder_unittest.cc",
491     "filters/decrypting_demuxer_stream_unittest.cc",
492     "filters/decrypting_video_decoder_unittest.cc",
493     "filters/fake_demuxer_stream.cc",
494     "filters/fake_demuxer_stream.h",
495     "filters/fake_demuxer_stream_unittest.cc",
496     "filters/fake_video_decoder.cc",
497     "filters/fake_video_decoder.h",
498     "filters/fake_video_decoder_unittest.cc",
499     "filters/file_data_source_unittest.cc",
500     "filters/frame_processor_unittest.cc",
501     "filters/h264_bit_reader_unittest.cc",
502     "filters/h264_parser_unittest.cc",
503     "filters/renderer_impl_unittest.cc",
504     "filters/skcanvas_video_renderer_unittest.cc",
505     "filters/source_buffer_stream_unittest.cc",
506     "filters/video_decoder_selector_unittest.cc",
507     "filters/video_frame_scheduler_impl_unittest.cc",
508     "filters/video_frame_scheduler_unittest.cc",
509     "filters/video_frame_stream_unittest.cc",
510     "filters/video_renderer_impl_unittest.cc",
511     "midi/midi_manager_unittest.cc",
512     "midi/midi_manager_usb_unittest.cc",
513     "midi/midi_message_queue_unittest.cc",
514     "midi/midi_message_util_unittest.cc",
515     "midi/usb_midi_descriptor_parser_unittest.cc",
516     "midi/usb_midi_input_stream_unittest.cc",
517     "midi/usb_midi_output_stream_unittest.cc",
518     "video/capture/fake_video_capture_device_unittest.cc",
519     "video/capture/video_capture_device_unittest.cc",
520     "formats/common/offset_byte_queue_unittest.cc",
521     "formats/webm/cluster_builder.cc",
522     "formats/webm/cluster_builder.h",
523     "formats/webm/tracks_builder.cc",
524     "formats/webm/tracks_builder.h",
525     "formats/webm/webm_cluster_parser_unittest.cc",
526     "formats/webm/webm_content_encodings_client_unittest.cc",
527     "formats/webm/webm_parser_unittest.cc",
528     "formats/webm/webm_tracks_parser_unittest.cc",
529     "formats/webm/webm_webvtt_parser_unittest.cc",
530   ]
532   deps = [
533     ":media",
534     ":test_support",
535     "//base/allocator",
536     "//base/test:test_support",
537     "//media/audio:unittests",
538     "//media/audio:test_support",
539     "//media/base:unittests",
540     "//media/base:test_support",
541     "//skia",  # Direct dependency required to inherit config.
542     "//testing/gmock",
543     "//testing/gtest",
544     "//third_party/widevine/cdm:version_h",
545     "//ui/gfx:test_support",
546     "//url",
547   ]
549   if (is_android) {
550     deps += [
551       "//media/base/android",
552       # TODO(GYP)
553       #"//testing/android:native_test_native_code"
554     ]
555   }
557   if (media_use_ffmpeg) {
558     sources += [
559       "ffmpeg/ffmpeg_common_unittest.cc",
560       "filters/audio_decoder_unittest.cc",
561       "filters/audio_file_reader_unittest.cc",
562       "filters/blocking_url_protocol_unittest.cc",
563       "filters/ffmpeg_demuxer_unittest.cc",
564       "filters/ffmpeg_glue_unittest.cc",
565       "filters/ffmpeg_video_decoder_unittest.cc",
566       "filters/in_memory_url_protocol_unittest.cc",
567       "filters/pipeline_integration_test.cc",
568       "filters/pipeline_integration_test_base.cc",
569     ]
570   }
572   if (cpu_arch != "arm" && is_chromeos && use_x11) {
573     sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
574   }
576   if (proprietary_codecs) {
577     sources += [
578       "filters/ffmpeg_aac_bitstream_converter_unittest.cc",
579       "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
580       "filters/h264_to_annex_b_bitstream_converter_unittest.cc",
581       "formats/common/stream_parser_test_base.cc",
582       "formats/common/stream_parser_test_base.h",
583       "formats/mp2t/es_adapter_video_unittest.cc",
584       "formats/mp2t/es_parser_adts_unittest.cc",
585       "formats/mp2t/es_parser_h264_unittest.cc",
586       "formats/mp2t/es_parser_mpeg1audio_unittest.cc",
587       "formats/mp2t/es_parser_test_base.cc",
588       "formats/mp2t/es_parser_test_base.h",
589       "formats/mp2t/mp2t_stream_parser_unittest.cc",
590       "formats/mp2t/timestamp_unroller_unittest.cc",
591       "formats/mp4/aac_unittest.cc",
592       "formats/mp4/avc_unittest.cc",
593       "formats/mp4/box_reader_unittest.cc",
594       "formats/mp4/es_descriptor_unittest.cc",
595       "formats/mp4/mp4_stream_parser_unittest.cc",
596       "formats/mp4/sample_to_group_iterator_unittest.cc",
597       "formats/mp4/track_run_iterator_unittest.cc",
598       "formats/mpeg/adts_stream_parser_unittest.cc",
599       "formats/mpeg/mpeg1_audio_stream_parser_unittest.cc",
600     ]
601   }
603   if (is_win && cpu_arch == "x64") {
604     cflags += [
605       "/wd4267"  # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
606                  # http://crbug.com/171009
607     ]
608   }
610   if (is_mac || is_ios) {
611     deps += [
612       "//media/base/mac",
613     ]
614   }
616   if (is_mac) {
617     sources += [
618       "video/capture/mac/video_capture_device_factory_mac_unittest.mm"
619     ]
620   }
622 #      include_dirs += [
623 #        # Needed by media_drm_bridge.cc.
624 #        target_gen_dir,
625 #      ],
627   configs += [ ":media_config" ]
629   if (media_use_ffmpeg) {
630     deps += [
631       "//third_party/ffmpeg",  # Direct dependency required to inherit config.
632     ]
633   }
636 test("media_perftests") {
637   sources = []
638   if (media_use_ffmpeg) {
639     sources += [
640       "filters/pipeline_integration_perftest.cc",
641       "filters/pipeline_integration_test_base.cc",
642     ]
643   }
644   configs += [ ":media_config" ]
645   deps = [
646     ":media",
647     ":shared_memory_support",
648     ":test_support",
649     "//base/test:test_support",
650     "//media/audio:test_support",
651     "//media/base:perftests",
652     "//media/base:test_support",
653     "//testing/gmock",
654     "//testing/gtest",
655     "//testing/perf",
656     "//third_party/widevine/cdm:version_h",
657     "//ui/gfx:test_support",
658   ]
659   if (is_android) {
660     deps += [ "//ui/gl" ]
661   }
662   if (media_use_ffmpeg) {
663     deps += [
664       "//third_party/ffmpeg",  # Direct dependency required to inherit config.
665     ]
666   }
669 source_set("test_support") {
670   testonly = true
671   sources = [
672     "filters/clockless_video_frame_scheduler.cc",
673     "filters/clockless_video_frame_scheduler.h",
674     "filters/mock_gpu_video_accelerator_factories.cc",
675     "filters/mock_gpu_video_accelerator_factories.h",
676     "filters/test_video_frame_scheduler.cc",
677     "filters/test_video_frame_scheduler.h",
678     "video/mock_video_decode_accelerator.cc",
679     "video/mock_video_decode_accelerator.h",
680   ]
681   deps = [
682     ":media",
683     ":shared_memory_support",
684     "//base",
685     "//skia",
686     "//testing/gmock",
687     "//testing/gtest",
688   ]
691 # TODO(dalecurtis): How to split this across audio/base directories??
692 component("shared_memory_support") {
693   sources = [
694     "audio/audio_parameters.cc",
695     "audio/audio_parameters.h",
696     "base/audio_bus.cc",
697     "base/audio_bus.h",
698     "base/channel_layout.cc",
699     "base/channel_layout.h",
700     "base/limits.h",
701     "base/media_export.h",
702     "base/vector_math.cc",
703     "base/vector_math.h",
704   ]
705   configs += [ ":media_config" ]
706   defines = [ "MEDIA_IMPLEMENTATION" ]
707   deps = [ "//base" ]
710 if (media_use_ffmpeg) {
711   test("ffmpeg_unittests") {
712     sources = [ "ffmpeg/ffmpeg_unittest.cc" ]
714     deps = [
715        ":media",
716        ":test_support",
717        "//base",
718        "//base:i18n",
719        "//base/test:test_support",
720        "//testing/gtest",
721        "//third_party/ffmpeg",
722        "//ui/gfx:test_support",
723     ]
724   }
726   test("ffmpeg_regression_tests") {
727     sources = [
728       "base/run_all_unittests.cc",
729       "ffmpeg/ffmpeg_regression_tests.cc",
730       "filters/pipeline_integration_test_base.cc",
731     ]
732     configs += [ ":media_config" ]
733     deps = [
734       ":media",
735       ":test_support",
736       "//base/test:test_support",
737       "//media/audio:test_support",
738       "//media/base:test_support",
739       "//testing/gmock",
740       "//testing/gtest",
741       "//third_party/ffmpeg",
742       "//ui/gfx/geometry",
743       "//ui/gfx:test_support",
744     ]
745   # TODO(ajwong): This was in the original gyp, but it seems silly.
746   #        ['os_posix==1 and OS!="mac"', {
747   #          'conditions': [
748   #            ['use_allocator!="none"', {
749   #              'dependencies': [
750   #                '../base/allocator/allocator.gyp:allocator',
751   #              ],
752   #            }],
753   #          ],
754   #        }],
755   }
758 if (use_x11) {
759   executable("player_x11") {
760     sources = [
761       "tools/player_x11/data_source_logger.cc",
762       "tools/player_x11/data_source_logger.h",
763       "tools/player_x11/gl_video_renderer.cc",
764       "tools/player_x11/gl_video_renderer.h",
765       "tools/player_x11/player_x11.cc",
766       "tools/player_x11/x11_video_renderer.cc",
767       "tools/player_x11/x11_video_renderer.h",
768     ]
769     configs += [
770       ":media_config",
771       "//build/config/linux:x11",
772       "//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   }