Roll src/third_party/WebKit 787a07c:716df21 (svn 201034:201036)
[chromium-blink-merge.git] / media / BUILD.gn
blob02d8b049f8d2211a399bf88c3fa03f3b76900bdd
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 = []
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   }
37 config("media_implementation") {
38   defines = [ "MEDIA_IMPLEMENTATION" ]
41 config("media_dependent_config") {
42   defines = []
43   if (!media_use_libvpx) {
44     defines += [ "MEDIA_DISABLE_LIBVPX" ]
45   }
46   if (!media_use_ffmpeg) {
47     defines += [ "MEDIA_DISABLE_FFMPEG" ]
48   }
49   if (is_win) {
50     ldflags = [
51       "/DELAYLOAD:mf.dll",
52       "/DELAYLOAD:mfplat.dll",
53       "/DELAYLOAD:mfreadwrite.dll",
54     ]
55   }
58 if (use_ozone) {
59   action("generate_ozone_constructor_list") {
60     # Ozone platform objects are auto-generated using similar
61     # patterns for naming and classes constructors. Here we build the
62     # object MediaOzonePlatform.
63     script = "../ui/ozone/generate_constructor_list.py"
65     platform_list_txt_file = "$target_gen_dir/../ui/ozone/platform_list.txt"
66     constructor_list_cc_file = "$target_gen_dir/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     deps = [
82       "//ui/ozone:generate_ozone_platform_list",
83     ]
84   }
87 component("media") {
88   sources = [
89     "blink/skcanvas_video_renderer.cc",
90     "blink/skcanvas_video_renderer.h",
91     "capture/content/animated_content_sampler.cc",
92     "capture/content/animated_content_sampler.h",
93     "capture/content/capture_resolution_chooser.cc",
94     "capture/content/capture_resolution_chooser.h",
95     "capture/content/feedback_signal_accumulator.cc",
96     "capture/content/feedback_signal_accumulator.h",
97     "capture/content/screen_capture_device_core.cc",
98     "capture/content/screen_capture_device_core.h",
99     "capture/content/smooth_event_sampler.cc",
100     "capture/content/smooth_event_sampler.h",
101     "capture/content/thread_safe_capture_oracle.cc",
102     "capture/content/thread_safe_capture_oracle.h",
103     "capture/content/video_capture_oracle.cc",
104     "capture/content/video_capture_oracle.h",
105     "capture/video/fake_video_capture_device.cc",
106     "capture/video/fake_video_capture_device.h",
107     "capture/video/fake_video_capture_device_factory.cc",
108     "capture/video/fake_video_capture_device_factory.h",
109     "capture/video/file_video_capture_device.cc",
110     "capture/video/file_video_capture_device.h",
111     "capture/video/file_video_capture_device_factory.cc",
112     "capture/video/file_video_capture_device_factory.h",
113     "capture/video/linux/v4l2_capture_delegate.cc",
114     "capture/video/linux/v4l2_capture_delegate.h",
115     "capture/video/linux/v4l2_capture_delegate_multi_plane.cc",
116     "capture/video/linux/v4l2_capture_delegate_multi_plane.h",
117     "capture/video/linux/v4l2_capture_delegate_single_plane.cc",
118     "capture/video/linux/v4l2_capture_delegate_single_plane.h",
119     "capture/video/linux/video_capture_device_chromeos.cc",
120     "capture/video/linux/video_capture_device_chromeos.h",
121     "capture/video/linux/video_capture_device_factory_linux.cc",
122     "capture/video/linux/video_capture_device_factory_linux.h",
123     "capture/video/linux/video_capture_device_linux.cc",
124     "capture/video/linux/video_capture_device_linux.h",
125     "capture/video/mac/platform_video_capturing_mac.h",
126     "capture/video/mac/video_capture_device_avfoundation_mac.h",
127     "capture/video/mac/video_capture_device_avfoundation_mac.mm",
128     "capture/video/mac/video_capture_device_decklink_mac.h",
129     "capture/video/mac/video_capture_device_decklink_mac.mm",
130     "capture/video/mac/video_capture_device_factory_mac.h",
131     "capture/video/mac/video_capture_device_factory_mac.mm",
132     "capture/video/mac/video_capture_device_mac.h",
133     "capture/video/mac/video_capture_device_mac.mm",
134     "capture/video/mac/video_capture_device_qtkit_mac.h",
135     "capture/video/mac/video_capture_device_qtkit_mac.mm",
136     "capture/video/video_capture_device.cc",
137     "capture/video/video_capture_device.h",
138     "capture/video/video_capture_device_factory.cc",
139     "capture/video/video_capture_device_factory.h",
140     "capture/video/video_capture_device_info.cc",
141     "capture/video/video_capture_device_info.h",
142     "capture/video/win/capability_list_win.cc",
143     "capture/video/win/capability_list_win.h",
144     "capture/video/win/filter_base_win.cc",
145     "capture/video/win/filter_base_win.h",
146     "capture/video/win/pin_base_win.cc",
147     "capture/video/win/pin_base_win.h",
148     "capture/video/win/sink_filter_observer_win.h",
149     "capture/video/win/sink_filter_win.cc",
150     "capture/video/win/sink_filter_win.h",
151     "capture/video/win/sink_input_pin_win.cc",
152     "capture/video/win/sink_input_pin_win.h",
153     "capture/video/win/video_capture_device_factory_win.cc",
154     "capture/video/win/video_capture_device_factory_win.h",
155     "capture/video/win/video_capture_device_mf_win.cc",
156     "capture/video/win/video_capture_device_mf_win.h",
157     "capture/video/win/video_capture_device_win.cc",
158     "capture/video/win/video_capture_device_win.h",
159     "cdm/aes_decryptor.cc",
160     "cdm/aes_decryptor.h",
161     "cdm/default_cdm_factory.cc",
162     "cdm/default_cdm_factory.h",
163     "cdm/json_web_key.cc",
164     "cdm/json_web_key.h",
165     "cdm/key_system_names.cc",
166     "cdm/key_system_names.h",
167     "cdm/player_tracker_impl.cc",
168     "cdm/player_tracker_impl.h",
169     "cdm/proxy_decryptor.cc",
170     "cdm/proxy_decryptor.h",
171     "ffmpeg/ffmpeg_deleters.h",
172     "filters/audio_clock.cc",
173     "filters/audio_clock.h",
174     "filters/audio_renderer_algorithm.cc",
175     "filters/audio_renderer_algorithm.h",
176     "filters/chunk_demuxer.cc",
177     "filters/chunk_demuxer.h",
178     "filters/context_3d.h",
179     "filters/decoder_selector.cc",
180     "filters/decoder_selector.h",
181     "filters/decoder_stream.cc",
182     "filters/decoder_stream.h",
183     "filters/decoder_stream_traits.cc",
184     "filters/decoder_stream_traits.h",
185     "filters/decrypting_audio_decoder.cc",
186     "filters/decrypting_audio_decoder.h",
187     "filters/decrypting_demuxer_stream.cc",
188     "filters/decrypting_demuxer_stream.h",
189     "filters/decrypting_video_decoder.cc",
190     "filters/decrypting_video_decoder.h",
191     "filters/default_media_permission.cc",
192     "filters/default_media_permission.h",
193     "filters/file_data_source.cc",
194     "filters/file_data_source.h",
195     "filters/frame_processor.cc",
196     "filters/frame_processor.h",
197     "filters/gpu_video_decoder.cc",
198     "filters/gpu_video_decoder.h",
199     "filters/h264_bit_reader.cc",
200     "filters/h264_bit_reader.h",
201     "filters/h264_parser.cc",
202     "filters/h264_parser.h",
203     "filters/ivf_parser.cc",
204     "filters/ivf_parser.h",
205     "filters/jpeg_parser.cc",
206     "filters/jpeg_parser.h",
207     "filters/source_buffer_platform.cc",
208     "filters/source_buffer_platform.h",
209     "filters/source_buffer_range.cc",
210     "filters/source_buffer_range.h",
211     "filters/source_buffer_stream.cc",
212     "filters/source_buffer_stream.h",
213     "filters/stream_parser_factory.cc",
214     "filters/stream_parser_factory.h",
215     "filters/video_cadence_estimator.cc",
216     "filters/video_cadence_estimator.h",
217     "filters/video_renderer_algorithm.cc",
218     "filters/video_renderer_algorithm.h",
219     "filters/vp8_bool_decoder.cc",
220     "filters/vp8_bool_decoder.h",
221     "filters/vp8_parser.cc",
222     "filters/vp8_parser.h",
223     "filters/vp9_parser.cc",
224     "filters/vp9_parser.h",
225     "filters/vp9_raw_bits_reader.cc",
226     "filters/vp9_raw_bits_reader.h",
227     "filters/webvtt_util.h",
228     "filters/wsola_internals.cc",
229     "filters/wsola_internals.h",
230     "formats/common/offset_byte_queue.cc",
231     "formats/common/offset_byte_queue.h",
232     "formats/webm/webm_audio_client.cc",
233     "formats/webm/webm_audio_client.h",
234     "formats/webm/webm_cluster_parser.cc",
235     "formats/webm/webm_cluster_parser.h",
236     "formats/webm/webm_constants.cc",
237     "formats/webm/webm_constants.h",
238     "formats/webm/webm_content_encodings.cc",
239     "formats/webm/webm_content_encodings.h",
240     "formats/webm/webm_content_encodings_client.cc",
241     "formats/webm/webm_content_encodings_client.h",
242     "formats/webm/webm_crypto_helpers.cc",
243     "formats/webm/webm_crypto_helpers.h",
244     "formats/webm/webm_info_parser.cc",
245     "formats/webm/webm_info_parser.h",
246     "formats/webm/webm_parser.cc",
247     "formats/webm/webm_parser.h",
248     "formats/webm/webm_stream_parser.cc",
249     "formats/webm/webm_stream_parser.h",
250     "formats/webm/webm_tracks_parser.cc",
251     "formats/webm/webm_tracks_parser.h",
252     "formats/webm/webm_video_client.cc",
253     "formats/webm/webm_video_client.h",
254     "formats/webm/webm_webvtt_parser.cc",
255     "formats/webm/webm_webvtt_parser.h",
256     "renderers/audio_renderer_impl.cc",
257     "renderers/audio_renderer_impl.h",
258     "renderers/default_renderer_factory.cc",
259     "renderers/default_renderer_factory.h",
260     "renderers/gpu_video_accelerator_factories.h",
261     "renderers/renderer_impl.cc",
262     "renderers/renderer_impl.h",
263     "renderers/video_renderer_impl.cc",
264     "renderers/video_renderer_impl.h",
265     "video/fake_video_encode_accelerator.cc",
266     "video/fake_video_encode_accelerator.h",
267     "video/gpu_memory_buffer_video_frame_pool.cc",
268     "video/gpu_memory_buffer_video_frame_pool.h",
269     "video/h264_poc.cc",
270     "video/h264_poc.h",
271     "video/jpeg_decode_accelerator.cc",
272     "video/jpeg_decode_accelerator.h",
273     "video/picture.cc",
274     "video/picture.h",
275     "video/video_decode_accelerator.cc",
276     "video/video_decode_accelerator.h",
277     "video/video_encode_accelerator.cc",
278     "video/video_encode_accelerator.h",
279   ]
281   configs += [
282     ":media_config",
283     ":media_implementation",
284     "//build/config:precompiled_headers",
286     # TODO(wolenetz): Fix size_t to int trunctaion in win64.
287     # See http://crbug.com/171009
288     "//build/config/compiler:no_size_t_to_int_warning",
289   ]
290   all_dependent_configs = [ ":media_dependent_config" ]
292   allow_circular_includes_from = []
293   cflags = []
294   libs = []
295   defines = []
296   deps = []
298   include_dirs = [ "." ]
299   if (media_use_ffmpeg) {
300     deps += [ "//third_party/ffmpeg" ]
301     sources += [
302       "ffmpeg/ffmpeg_common.cc",
303       "ffmpeg/ffmpeg_common.h",
304       "filters/audio_file_reader.cc",
305       "filters/audio_file_reader.h",
306       "filters/blocking_url_protocol.cc",
307       "filters/blocking_url_protocol.h",
308       "filters/ffmpeg_audio_decoder.cc",
309       "filters/ffmpeg_audio_decoder.h",
310       "filters/ffmpeg_bitstream_converter.h",
311       "filters/ffmpeg_demuxer.cc",
312       "filters/ffmpeg_demuxer.h",
313       "filters/ffmpeg_glue.cc",
314       "filters/ffmpeg_glue.h",
315       "filters/ffmpeg_video_decoder.cc",
316       "filters/ffmpeg_video_decoder.h",
317       "filters/in_memory_url_protocol.cc",
318       "filters/in_memory_url_protocol.h",
319     ]
320     if (proprietary_codecs) {
321       sources += [
322         "filters/ffmpeg_aac_bitstream_converter.cc",
323         "filters/ffmpeg_aac_bitstream_converter.h",
324         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc",
325         "filters/ffmpeg_h264_to_annex_b_bitstream_converter.h",
326       ]
327     }
328   }
330   if (current_cpu == "arm" && arm_use_neon) {
331     defines += [ "USE_NEON" ]
332   }
334   if (media_use_libvpx) {
335     sources += [
336       "filters/vpx_video_decoder.cc",
337       "filters/vpx_video_decoder.h",
338     ]
339     deps += [ "//third_party/libvpx" ]
340   }
342   if (media_use_libwebm) {
343     sources += [
344       "capture/webm_muxer.cc",
345       "capture/webm_muxer.h",
346     ]
347     deps += [ "//third_party/libwebm" ]
348   }
350   if (is_android) {
351     sources += [
352       "capture/video/android/video_capture_device_android.cc",
353       "capture/video/android/video_capture_device_android.h",
354       "capture/video/android/video_capture_device_factory_android.cc",
355       "capture/video/android/video_capture_device_factory_android.h",
356     ]
357     deps += [
358       "//media/base/android",
359       "//media/base/android:media_jni_headers",
360       "//media/base/android:video_capture_jni_headers",
361     ]
362     allow_circular_includes_from = [ "//media/base/android" ]
363   } else {
364     sources += [
365       "filters/opus_audio_decoder.cc",
366       "filters/opus_audio_decoder.h",
367     ]
368   }
370   if (current_cpu != "arm" && is_chromeos) {
371     sources += [
372       "filters/h264_bitstream_buffer.cc",
373       "filters/h264_bitstream_buffer.h",
374     ]
375   }
377   # A simple WebM encoder for animated avatars on ChromeOS.
379   if (use_ozone) {
380     # Used for the generated listing header (ui/ozone/platform_list.h)
381     include_dirs += [ target_gen_dir ]
383     sources += [
384                  "ozone/media_ozone_platform.cc",
385                  "ozone/media_ozone_platform.h",
386                ] + get_target_outputs(":generate_ozone_constructor_list")
388     deps += [
389       ":generate_ozone_constructor_list",
390       "//ui/ozone",
391     ]
392   }
394   if (is_mac) {
395     deps += [
396       "//media/base/mac",
397       "//third_party/decklink",
398     ]
399     libs += [
400       "CoreVideo.framework",
401       "OpenGL.framework",
402       "QTKit.framework",
403     ]
404   }
406   if (is_openbsd) {
407     sources -= [
408       "capture/video/linux/v4l2_capture_delegate_multi_plane.cc",
409       "capture/video/linux/v4l2_capture_delegate_multi_plane.h",
410     ]
411   }
413   if (is_ios) {
414     deps += [ "//media/base/mac" ]
415   }
417   if (is_win) {
418     deps += [ "//media/base/win" ]
419     libs += [
420       "mf.lib",
421       "mfplat.lib",
422       "mfreadwrite.lib",
423       "mfuuid.lib",
424     ]
425   }
427   if (proprietary_codecs) {
428     sources += [
429       "cdm/cenc_utils.cc",
430       "cdm/cenc_utils.h",
431       "filters/h264_to_annex_b_bitstream_converter.cc",
432       "filters/h264_to_annex_b_bitstream_converter.h",
433       "formats/mp2t/es_adapter_video.cc",
434       "formats/mp2t/es_adapter_video.h",
435       "formats/mp2t/es_parser.cc",
436       "formats/mp2t/es_parser.h",
437       "formats/mp2t/es_parser_adts.cc",
438       "formats/mp2t/es_parser_adts.h",
439       "formats/mp2t/es_parser_h264.cc",
440       "formats/mp2t/es_parser_h264.h",
441       "formats/mp2t/es_parser_mpeg1audio.cc",
442       "formats/mp2t/es_parser_mpeg1audio.h",
443       "formats/mp2t/mp2t_common.h",
444       "formats/mp2t/mp2t_stream_parser.cc",
445       "formats/mp2t/mp2t_stream_parser.h",
446       "formats/mp2t/timestamp_unroller.cc",
447       "formats/mp2t/timestamp_unroller.h",
448       "formats/mp2t/ts_packet.cc",
449       "formats/mp2t/ts_packet.h",
450       "formats/mp2t/ts_section.h",
451       "formats/mp2t/ts_section_pat.cc",
452       "formats/mp2t/ts_section_pat.h",
453       "formats/mp2t/ts_section_pes.cc",
454       "formats/mp2t/ts_section_pes.h",
455       "formats/mp2t/ts_section_pmt.cc",
456       "formats/mp2t/ts_section_pmt.h",
457       "formats/mp2t/ts_section_psi.cc",
458       "formats/mp2t/ts_section_psi.h",
459       "formats/mp4/aac.cc",
460       "formats/mp4/aac.h",
461       "formats/mp4/avc.cc",
462       "formats/mp4/avc.h",
463       "formats/mp4/bitstream_converter.cc",
464       "formats/mp4/bitstream_converter.h",
465       "formats/mp4/box_definitions.cc",
466       "formats/mp4/box_definitions.h",
467       "formats/mp4/box_reader.cc",
468       "formats/mp4/box_reader.h",
469       "formats/mp4/cenc.cc",
470       "formats/mp4/cenc.h",
471       "formats/mp4/es_descriptor.cc",
472       "formats/mp4/es_descriptor.h",
473       "formats/mp4/mp4_stream_parser.cc",
474       "formats/mp4/mp4_stream_parser.h",
475       "formats/mp4/sample_to_group_iterator.cc",
476       "formats/mp4/sample_to_group_iterator.h",
477       "formats/mp4/track_run_iterator.cc",
478       "formats/mp4/track_run_iterator.h",
479       "formats/mpeg/adts_constants.cc",
480       "formats/mpeg/adts_constants.h",
481       "formats/mpeg/adts_stream_parser.cc",
482       "formats/mpeg/adts_stream_parser.h",
483       "formats/mpeg/mpeg1_audio_stream_parser.cc",
484       "formats/mpeg/mpeg1_audio_stream_parser.h",
485       "formats/mpeg/mpeg_audio_stream_parser_base.cc",
486       "formats/mpeg/mpeg_audio_stream_parser_base.h",
487     ]
488   }
490   public_deps = [
491     "//media/base",
492     "//media/audio",
493   ]
495   deps += [
496     ":shared_memory_support",
497     "//base",
498     "//base:i18n",
499     "//base/third_party/dynamic_annotations",
500     "//crypto",
501     "//crypto:platform",  # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings
502     "//gpu/command_buffer/common",
503     "//skia",
504     "//third_party/libyuv",
505     "//third_party/opus",
506     "//ui/events:events_base",
507     "//ui/gfx",
508     "//ui/gfx/geometry",
509     "//url",
510   ]
513 # Minimal media component for media/cast on iOS.
514 if (is_ios) {
515   component("media_for_cast_ios") {
516     configs += [
517       ":media_config",
518       ":media_implementation",
519     ]
520     all_dependent_configs = [ ":media_dependent_config" ]
521     include_dirs = [ "." ]
522     libs = [ "CoreVideo.framework" ]
524     deps = [
525       ":shared_memory_support",
526       "//base",
527       "//gpu/command_buffer/common",
528       "//media/base:base_for_cast_ios",
529       "//media/base/mac",
530       "//ui/gfx/geometry",
531     ]
532   }
535 # TODO(GYP): Delete this after we've converted everything to GN.
536 # The _run targets exist only for compatibility w/ GYP.
537 group("media_unittests_run") {
538   testonly = true
539   deps = [
540     ":media_unittests",
541   ]
544 test("media_unittests") {
545   sources = [
546     "blink/skcanvas_video_renderer_unittest.cc",
547     "capture/content/animated_content_sampler_unittest.cc",
548     "capture/content/capture_resolution_chooser_unittest.cc",
549     "capture/content/feedback_signal_accumulator_unittest.cc",
550     "capture/content/smooth_event_sampler_unittest.cc",
551     "capture/content/video_capture_oracle_unittest.cc",
552     "capture/video/fake_video_capture_device_unittest.cc",
553     "capture/video/video_capture_device_unittest.cc",
554     "cdm/aes_decryptor_unittest.cc",
555     "cdm/json_web_key_unittest.cc",
556     "filters/audio_clock_unittest.cc",
557     "filters/audio_decoder_selector_unittest.cc",
558     "filters/audio_renderer_algorithm_unittest.cc",
559     "filters/chunk_demuxer_unittest.cc",
560     "filters/decrypting_audio_decoder_unittest.cc",
561     "filters/decrypting_demuxer_stream_unittest.cc",
562     "filters/decrypting_video_decoder_unittest.cc",
563     "filters/fake_video_decoder.cc",
564     "filters/fake_video_decoder.h",
565     "filters/fake_video_decoder_unittest.cc",
566     "filters/file_data_source_unittest.cc",
567     "filters/frame_processor_unittest.cc",
568     "filters/h264_bit_reader_unittest.cc",
569     "filters/h264_parser_unittest.cc",
570     "filters/ivf_parser_unittest.cc",
571     "filters/jpeg_parser_unittest.cc",
572     "filters/source_buffer_stream_unittest.cc",
573     "filters/video_cadence_estimator_unittest.cc",
574     "filters/video_decoder_selector_unittest.cc",
575     "filters/video_frame_stream_unittest.cc",
576     "filters/video_renderer_algorithm_unittest.cc",
577     "filters/vp8_bool_decoder_unittest.cc",
578     "filters/vp8_parser_unittest.cc",
579     "filters/vp9_parser_unittest.cc",
580     "filters/vp9_raw_bits_reader_unittest.cc",
581     "formats/common/offset_byte_queue_unittest.cc",
582     "formats/webm/cluster_builder.cc",
583     "formats/webm/cluster_builder.h",
584     "formats/webm/opus_packet_builder.cc",
585     "formats/webm/opus_packet_builder.h",
586     "formats/webm/tracks_builder.cc",
587     "formats/webm/tracks_builder.h",
588     "formats/webm/webm_cluster_parser_unittest.cc",
589     "formats/webm/webm_content_encodings_client_unittest.cc",
590     "formats/webm/webm_parser_unittest.cc",
591     "formats/webm/webm_tracks_parser_unittest.cc",
592     "formats/webm/webm_webvtt_parser_unittest.cc",
593     "renderers/audio_renderer_impl_unittest.cc",
594     "renderers/renderer_impl_unittest.cc",
595     "renderers/video_renderer_impl_unittest.cc",
596     "video/h264_poc_unittest.cc",
597   ]
599   data = [
600     "test/data/",
601   ]
603   # TODO(wolenetz): Fix size_t to int trunctaion in win64.
604   # See http://crbug.com/171009
605   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
607   deps = [
608     ":media",
609     ":test_support",
610     "//base/allocator",
611     "//base/test:test_support",
612     "//media/audio:unittests",
613     "//media/audio:test_support",
614     "//media/base:unittests",
615     "//media/base:test_support",
616     "//media/test:pipeline_integration_tests",
617     "//skia",  # Direct dependency required to inherit config.
618     "//testing/gmock",
619     "//testing/gtest",
620     "//third_party/widevine/cdm:version_h",
621     "//ui/gfx:test_support",
622     "//url",
623   ]
625   if (is_android) {
626     isolate_file = "media_unittests.isolate"
627     deps += [
628       "//media/base/android",
629       # TODO(GYP)
630       #"//testing/android/native_test:native_test_native_code"
631     ]
632   }
634   if (media_use_ffmpeg) {
635     sources += [
636       "ffmpeg/ffmpeg_common_unittest.cc",
637       "filters/audio_decoder_unittest.cc",
638       "filters/audio_file_reader_unittest.cc",
639       "filters/blocking_url_protocol_unittest.cc",
640       "filters/ffmpeg_demuxer_unittest.cc",
641       "filters/ffmpeg_glue_unittest.cc",
642       "filters/ffmpeg_video_decoder_unittest.cc",
643       "filters/in_memory_url_protocol_unittest.cc",
644     ]
645   }
647   if (current_cpu != "arm" && is_chromeos) {
648     sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
649   }
651   if (proprietary_codecs) {
652     sources += [
653       "cdm/cenc_utils_unittest.cc",
654       "filters/h264_to_annex_b_bitstream_converter_unittest.cc",
655       "formats/common/stream_parser_test_base.cc",
656       "formats/common/stream_parser_test_base.h",
657       "formats/mp2t/es_adapter_video_unittest.cc",
658       "formats/mp2t/es_parser_adts_unittest.cc",
659       "formats/mp2t/es_parser_h264_unittest.cc",
660       "formats/mp2t/es_parser_mpeg1audio_unittest.cc",
661       "formats/mp2t/es_parser_test_base.cc",
662       "formats/mp2t/es_parser_test_base.h",
663       "formats/mp2t/mp2t_stream_parser_unittest.cc",
664       "formats/mp2t/timestamp_unroller_unittest.cc",
665       "formats/mp4/aac_unittest.cc",
666       "formats/mp4/avc_unittest.cc",
667       "formats/mp4/box_reader_unittest.cc",
668       "formats/mp4/es_descriptor_unittest.cc",
669       "formats/mp4/mp4_stream_parser_unittest.cc",
670       "formats/mp4/sample_to_group_iterator_unittest.cc",
671       "formats/mp4/track_run_iterator_unittest.cc",
672       "formats/mpeg/adts_stream_parser_unittest.cc",
673       "formats/mpeg/mpeg1_audio_stream_parser_unittest.cc",
674     ]
675     if (media_use_ffmpeg) {
676       sources += [
677         "filters/ffmpeg_aac_bitstream_converter_unittest.cc",
678         "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
679       ]
680     }
681   }
683   if (is_mac || is_ios) {
684     deps += [ "//media/base/mac" ]
685   }
687   if (is_mac) {
688     sources +=
689         [ "capture/video/mac/video_capture_device_factory_mac_unittest.mm" ]
690   }
692   #      include_dirs += [
693   #        # Needed by media_drm_bridge.cc.
694   #        target_gen_dir,
695   #      ],
697   configs += [ ":media_config" ]
699   if (media_use_ffmpeg) {
700     deps += [ "//third_party/ffmpeg" ]  # Direct dependency required to inherit config.
701   }
704 test("media_perftests") {
705   configs += [ ":media_config" ]
706   deps = [
707     ":media",
708     ":shared_memory_support",
709     ":test_support",
710     "//base/test:test_support",
711     "//media/audio:test_support",
712     "//media/base:perftests",
713     "//media/base:test_support",
714     "//media/test:pipeline_integration_perftests",
715     "//testing/gmock",
716     "//testing/gtest",
717     "//testing/perf",
718     "//third_party/widevine/cdm:version_h",
719     "//ui/gfx:test_support",
720   ]
721   if (is_android) {
722     deps += [ "//ui/gl" ]
723     isolate_file = "media_perftests.isolate"
724   }
725   if (media_use_ffmpeg) {
726     deps += [ "//third_party/ffmpeg" ]  # Direct dependency required to inherit config.
727   }
730 # For running the subset of media_unittests that might require audio hardware
731 # separately on GPU bots. media_unittests includes these too.
732 test("audio_unittests") {
733   sources = [
734     "base/run_all_unittests.cc",
735   ]
736   deps = [
737     ":test_support",
738     "//base/test:test_support",
739     "//media/audio:unittests",
740     "//ui/gfx:test_support",
741   ]
744 source_set("test_support") {
745   testonly = true
746   sources = [
747     "renderers/mock_gpu_video_accelerator_factories.cc",
748     "renderers/mock_gpu_video_accelerator_factories.h",
749     "video/mock_video_decode_accelerator.cc",
750     "video/mock_video_decode_accelerator.h",
751   ]
752   deps = [
753     ":media",
754     ":shared_memory_support",
755     "//base",
756     "//skia",
757     "//testing/gmock",
758     "//testing/gtest",
759   ]
762 # TODO(dalecurtis): How to split this across audio/base directories??
763 component("shared_memory_support") {
764   sources = [
765     "audio/audio_parameters.cc",
766     "audio/audio_parameters.h",
767     "base/audio_bus.cc",
768     "base/audio_bus.h",
769     "base/channel_layout.cc",
770     "base/channel_layout.h",
771     "base/limits.h",
772     "base/media_export.h",
773     "base/vector_math.cc",
774     "base/vector_math.h",
775   ]
776   configs += [
777     ":media_config",
778     ":media_implementation",
779   ]
780   deps = [
781     "//base",
782   ]
785 if (media_use_ffmpeg) {
786   test("ffmpeg_regression_tests") {
787     sources = [
788       "base/run_all_unittests.cc",
789       "ffmpeg/ffmpeg_regression_tests.cc",
790     ]
792     configs += [ "//media:media_config" ]
794     deps = [
795       "//base/test:test_support",
796       "//media",
797       "//media:test_support",
798       "//media/audio:test_support",
799       "//media/base:test_support",
800       "//media/test:pipeline_integration_tests",
801       "//testing/gmock",
802       "//testing/gtest",
803       "//third_party/ffmpeg",
804       "//ui/gfx/geometry",
805       "//ui/gfx:test_support",
806     ]
807   }