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/ui.gni")
8 import("//build/config/linux/pkg_config.gni")
9 import("//media/media_options.gni")
11 # Common configuration for targets in the media directory.
13 config("media_config") {
14 defines = [ "MEDIA_IMPLEMENTATION" ]
15 if (cpu_arch == "arm" && arm_use_neon) {
16 defines += [ "USE_NEON" ]
19 defines += [ "USE_PULSEAUDIO" ]
20 if (!linux_link_pulseaudio) {
21 defines += [ "DLOPEN_PULSEAUDIO" ]
25 defines += [ "USE_CRAS" ]
29 config("media_dependent_config") {
30 if (!media_use_libvpx) {
31 defines = [ "MEDIA_DISABLE_LIBVPX" ]
36 "/DELAYLOAD:mfplat.dll",
37 "/DELAYLOAD:mfreadwrite.dll",
43 action("generate_ozone_constructor_list") {
44 # Ozone platform objects are auto-generated using similar
45 # patterns for naming and classes constructors. Here we build the
46 # object MediaOzonePlatform.
47 script = "../ui/ozone/generate_constructor_list.py"
49 platform_list_txt_file = "$target_gen_dir/ui/ozone/platform_list.txt"
50 constructor_list_cc_file = "$target_gen_dir/media/ozone/constructor_list.cc"
52 sources = [ platform_list_txt_file ]
53 outputs = [ constructor_list_cc_file ]
55 "--platform_list=$platform_list_txt_file",
56 "--output_cc=$constructor_list_cc_file",
58 "--typename=MediaOzonePlatform",
59 "--include=\"media/ozone/media_ozone_platform.h\""
66 "cdm/aes_decryptor.cc",
67 "cdm/aes_decryptor.h",
68 "cdm/json_web_key.cc",
70 "cdm/key_system_names.cc",
71 "cdm/key_system_names.h",
72 "cdm/player_tracker_impl.cc",
73 "cdm/player_tracker_impl.h",
74 "ffmpeg/ffmpeg_deleters.h",
75 "filters/audio_clock.cc",
76 "filters/audio_clock.h",
77 "filters/audio_renderer_algorithm.cc",
78 "filters/audio_renderer_algorithm.h",
79 "filters/audio_renderer_impl.cc",
80 "filters/audio_renderer_impl.h",
81 "filters/chunk_demuxer.cc",
82 "filters/chunk_demuxer.h",
83 "filters/decoder_selector.cc",
84 "filters/decoder_selector.h",
85 "filters/decoder_stream.cc",
86 "filters/decoder_stream.h",
87 "filters/decoder_stream_traits.cc",
88 "filters/decoder_stream_traits.h",
89 "filters/decrypting_audio_decoder.cc",
90 "filters/decrypting_audio_decoder.h",
91 "filters/decrypting_demuxer_stream.cc",
92 "filters/decrypting_demuxer_stream.h",
93 "filters/decrypting_video_decoder.cc",
94 "filters/decrypting_video_decoder.h",
95 "filters/file_data_source.cc",
96 "filters/file_data_source.h",
97 "filters/frame_processor.cc",
98 "filters/frame_processor.h",
99 "filters/gpu_video_accelerator_factories.cc",
100 "filters/gpu_video_accelerator_factories.h",
101 "filters/gpu_video_decoder.cc",
102 "filters/gpu_video_decoder.h",
103 "filters/h264_bit_reader.cc",
104 "filters/h264_bit_reader.h",
105 "filters/h264_parser.cc",
106 "filters/h264_parser.h",
107 "filters/renderer_impl.cc",
108 "filters/renderer_impl.h",
109 "filters/skcanvas_video_renderer.cc",
110 "filters/skcanvas_video_renderer.h",
111 "filters/source_buffer_platform.cc",
112 "filters/source_buffer_platform.h",
113 "filters/source_buffer_stream.cc",
114 "filters/source_buffer_stream.h",
115 "filters/stream_parser_factory.cc",
116 "filters/stream_parser_factory.h",
117 "filters/video_frame_scheduler.h",
118 "filters/video_frame_scheduler_impl.cc",
119 "filters/video_frame_scheduler_impl.h",
120 "filters/video_frame_scheduler_proxy.cc",
121 "filters/video_frame_scheduler_proxy.h",
122 "filters/video_renderer_impl.cc",
123 "filters/video_renderer_impl.h",
124 "filters/webvtt_util.h",
125 "filters/wsola_internals.cc",
126 "filters/wsola_internals.h",
127 "midi/midi_manager.cc",
128 "midi/midi_manager.h",
129 "midi/midi_manager_mac.cc",
130 "midi/midi_manager_mac.h",
131 "midi/midi_manager_usb.cc",
132 "midi/midi_manager_usb.h",
133 "midi/midi_manager_win.cc",
134 "midi/midi_manager_win.h",
135 "midi/midi_message_queue.cc",
136 "midi/midi_message_queue.h",
137 "midi/midi_message_util.cc",
138 "midi/midi_message_util.h",
139 "midi/midi_port_info.cc",
140 "midi/midi_port_info.h",
141 "midi/usb_midi_descriptor_parser.cc",
142 "midi/usb_midi_descriptor_parser.h",
143 "midi/usb_midi_device.h",
144 "midi/usb_midi_input_stream.cc",
145 "midi/usb_midi_input_stream.h",
146 "midi/usb_midi_jack.h",
147 "midi/usb_midi_output_stream.cc",
148 "midi/usb_midi_output_stream.h",
149 "video/capture/fake_video_capture_device.cc",
150 "video/capture/fake_video_capture_device.h",
151 "video/capture/fake_video_capture_device_factory.h",
152 "video/capture/fake_video_capture_device_factory.cc",
153 "video/capture/file_video_capture_device.cc",
154 "video/capture/file_video_capture_device.h",
155 "video/capture/file_video_capture_device_factory.h",
156 "video/capture/file_video_capture_device_factory.cc",
157 "video/capture/linux/video_capture_device_factory_linux.cc",
158 "video/capture/linux/video_capture_device_factory_linux.h",
159 "video/capture/linux/video_capture_device_linux.cc",
160 "video/capture/linux/video_capture_device_linux.h",
161 "video/capture/linux/video_capture_device_chromeos.cc",
162 "video/capture/linux/video_capture_device_chromeos.h",
163 "video/capture/mac/platform_video_capturing_mac.h",
164 "video/capture/mac/video_capture_device_avfoundation_mac.h",
165 "video/capture/mac/video_capture_device_avfoundation_mac.mm",
166 "video/capture/mac/video_capture_device_factory_mac.h",
167 "video/capture/mac/video_capture_device_factory_mac.mm",
168 "video/capture/mac/video_capture_device_mac.h",
169 "video/capture/mac/video_capture_device_mac.mm",
170 "video/capture/mac/video_capture_device_qtkit_mac.h",
171 "video/capture/mac/video_capture_device_qtkit_mac.mm",
172 "video/capture/video_capture_device.cc",
173 "video/capture/video_capture_device.h",
174 "video/capture/video_capture_device_factory.cc",
175 "video/capture/video_capture_device_factory.h",
176 "video/capture/video_capture_types.cc",
177 "video/capture/video_capture_types.h",
178 "video/capture/win/capability_list_win.cc",
179 "video/capture/win/capability_list_win.h",
180 "video/capture/win/filter_base_win.cc",
181 "video/capture/win/filter_base_win.h",
182 "video/capture/win/pin_base_win.cc",
183 "video/capture/win/pin_base_win.h",
184 "video/capture/win/sink_filter_observer_win.h",
185 "video/capture/win/sink_filter_win.cc",
186 "video/capture/win/sink_filter_win.h",
187 "video/capture/win/sink_input_pin_win.cc",
188 "video/capture/win/sink_input_pin_win.h",
189 "video/capture/win/video_capture_device_factory_win.cc",
190 "video/capture/win/video_capture_device_factory_win.h",
191 "video/capture/win/video_capture_device_mf_win.cc",
192 "video/capture/win/video_capture_device_mf_win.h",
193 "video/capture/win/video_capture_device_win.cc",
194 "video/capture/win/video_capture_device_win.h",
197 "video/video_decode_accelerator.cc",
198 "video/video_decode_accelerator.h",
199 "video/video_encode_accelerator.cc",
200 "video/video_encode_accelerator.h",
201 "formats/common/offset_byte_queue.cc",
202 "formats/common/offset_byte_queue.h",
203 "formats/webm/webm_audio_client.cc",
204 "formats/webm/webm_audio_client.h",
205 "formats/webm/webm_cluster_parser.cc",
206 "formats/webm/webm_cluster_parser.h",
207 "formats/webm/webm_constants.cc",
208 "formats/webm/webm_constants.h",
209 "formats/webm/webm_content_encodings.cc",
210 "formats/webm/webm_content_encodings.h",
211 "formats/webm/webm_content_encodings_client.cc",
212 "formats/webm/webm_content_encodings_client.h",
213 "formats/webm/webm_crypto_helpers.cc",
214 "formats/webm/webm_crypto_helpers.h",
215 "formats/webm/webm_info_parser.cc",
216 "formats/webm/webm_info_parser.h",
217 "formats/webm/webm_parser.cc",
218 "formats/webm/webm_parser.h",
219 "formats/webm/webm_stream_parser.cc",
220 "formats/webm/webm_stream_parser.h",
221 "formats/webm/webm_tracks_parser.cc",
222 "formats/webm/webm_tracks_parser.h",
223 "formats/webm/webm_video_client.cc",
224 "formats/webm/webm_video_client.h",
225 "formats/webm/webm_webvtt_parser.cc",
226 "formats/webm/webm_webvtt_parser.h",
229 configs += [ ":media_config", ]
230 all_dependent_configs = [ ":media_dependent_config" ]
237 include_dirs = [ "." ]
238 if (media_use_ffmpeg) {
239 deps += [ "//third_party/ffmpeg" ]
241 "ffmpeg/ffmpeg_common.cc",
242 "ffmpeg/ffmpeg_common.h",
243 "filters/audio_file_reader.cc",
244 "filters/audio_file_reader.h",
245 "filters/blocking_url_protocol.cc",
246 "filters/blocking_url_protocol.h",
247 "filters/ffmpeg_audio_decoder.cc",
248 "filters/ffmpeg_audio_decoder.h",
249 "filters/ffmpeg_demuxer.cc",
250 "filters/ffmpeg_demuxer.h",
251 "filters/ffmpeg_glue.cc",
252 "filters/ffmpeg_glue.h",
253 "filters/ffmpeg_video_decoder.cc",
254 "filters/ffmpeg_video_decoder.h",
255 "filters/in_memory_url_protocol.cc",
256 "filters/in_memory_url_protocol.h",
258 if (proprietary_codecs) {
260 "filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc",
261 "filters/ffmpeg_h264_to_annex_b_bitstream_converter.h",
266 if (cpu_arch == "arm" && arm_use_neon) {
267 defines += [ "USE_NEON" ]
270 if (media_use_libvpx) {
272 "filters/vpx_video_decoder.cc",
273 "filters/vpx_video_decoder.h",
275 deps += [ "//third_party/libvpx" ]
280 "filters/opus_audio_decoder.cc",
281 "filters/opus_audio_decoder.h",
285 "midi/midi_manager_android.cc",
286 "midi/usb_midi_device_android.cc",
287 "midi/usb_midi_device_android.h",
288 "midi/usb_midi_device_factory_android.cc",
289 "midi/usb_midi_device_factory_android.h",
290 "video/capture/android/video_capture_device_android.cc",
291 "video/capture/android/video_capture_device_android.h",
292 "video/capture/android/video_capture_device_factory_android.cc",
293 "video/capture/android/video_capture_device_factory_android.h",
296 "//media/base/android",
297 "//media/base/android:media_jni_headers",
298 "//media/base/android:video_capture_jni_headers",
300 if (!is_android_webview_build) {
301 deps += [ "//media/base/android:media_java" ]
307 defines += [ "USE_ALSA" ]
309 "midi/midi_manager_alsa.cc",
310 "midi/midi_manager_alsa.h",
314 # A simple WebM encoder for animated avatars on ChromeOS.
317 # Used for the generated listing header (ui/ozone/platform_list.h)
318 include_dirs += [ target_gen_dir ]
321 "ozone/media_ozone_platform.cc",
322 "ozone/media_ozone_platform.h",
323 ] + get_target_outputs(":generate_ozone_constructor_list")
326 ":generate_ozone_constructor_list",
336 "CoreMIDI.framework",
337 "CoreVideo.framework",
357 "/wd4267" # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
358 # http://crbug.com/171009
362 if (proprietary_codecs) {
364 "formats/mp2t/es_adapter_video.cc",
365 "formats/mp2t/es_adapter_video.h",
366 "formats/mp2t/es_parser.cc",
367 "formats/mp2t/es_parser.h",
368 "formats/mp2t/es_parser_adts.cc",
369 "formats/mp2t/es_parser_adts.h",
370 "formats/mp2t/es_parser_h264.cc",
371 "formats/mp2t/es_parser_h264.h",
372 "formats/mp2t/mp2t_common.h",
373 "formats/mp2t/mp2t_stream_parser.cc",
374 "formats/mp2t/mp2t_stream_parser.h",
375 "formats/mp2t/ts_packet.cc",
376 "formats/mp2t/ts_packet.h",
377 "formats/mp2t/ts_section.h",
378 "formats/mp2t/ts_section_pat.cc",
379 "formats/mp2t/ts_section_pat.h",
380 "formats/mp2t/ts_section_pes.cc",
381 "formats/mp2t/ts_section_pes.h",
382 "formats/mp2t/ts_section_pmt.cc",
383 "formats/mp2t/ts_section_pmt.h",
384 "formats/mp2t/ts_section_psi.cc",
385 "formats/mp2t/ts_section_psi.h",
386 "formats/mp4/aac.cc",
388 "formats/mp4/avc.cc",
390 "formats/mp4/box_definitions.cc",
391 "formats/mp4/box_definitions.h",
392 "formats/mp4/box_reader.cc",
393 "formats/mp4/box_reader.h",
394 "formats/mp4/cenc.cc",
395 "formats/mp4/cenc.h",
396 "formats/mp4/es_descriptor.cc",
397 "formats/mp4/es_descriptor.h",
398 "formats/mp4/mp4_stream_parser.cc",
399 "formats/mp4/mp4_stream_parser.h",
400 "formats/mp4/sample_to_group_iterator.cc",
401 "formats/mp4/sample_to_group_iterator.h",
402 "formats/mp4/track_run_iterator.cc",
403 "formats/mp4/track_run_iterator.h",
404 "formats/mpeg/adts_constants.cc",
405 "formats/mpeg/adts_constants.h",
406 "formats/mpeg/adts_stream_parser.cc",
407 "formats/mpeg/adts_stream_parser.h",
408 "formats/mpeg/mp3_stream_parser.cc",
409 "formats/mpeg/mp3_stream_parser.h",
410 "formats/mpeg/mpeg_audio_stream_parser_base.cc",
411 "formats/mpeg/mpeg_audio_stream_parser_base.h",
416 ":shared_memory_support",
419 "//base/third_party/dynamic_annotations",
421 "//crypto:platform", # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings
422 "//gpu/command_buffer/common",
426 "//third_party/libyuv",
427 "//third_party/opus",
428 "//ui/events:events_base",
435 test("media_unittests") {
437 "cdm/aes_decryptor_unittest.cc",
438 "cdm/json_web_key_unittest.cc",
439 "filters/audio_clock_unittest.cc",
440 "filters/audio_decoder_selector_unittest.cc",
441 "filters/audio_renderer_algorithm_unittest.cc",
442 "filters/audio_renderer_impl_unittest.cc",
443 "filters/chunk_demuxer_unittest.cc",
444 "filters/decrypting_audio_decoder_unittest.cc",
445 "filters/decrypting_demuxer_stream_unittest.cc",
446 "filters/decrypting_video_decoder_unittest.cc",
447 "filters/fake_demuxer_stream.cc",
448 "filters/fake_demuxer_stream.h",
449 "filters/fake_demuxer_stream_unittest.cc",
450 "filters/fake_video_decoder.cc",
451 "filters/fake_video_decoder.h",
452 "filters/fake_video_decoder_unittest.cc",
453 "filters/file_data_source_unittest.cc",
454 "filters/frame_processor_unittest.cc",
455 "filters/h264_bit_reader_unittest.cc",
456 "filters/h264_parser_unittest.cc",
457 "filters/renderer_impl_unittest.cc",
458 "filters/skcanvas_video_renderer_unittest.cc",
459 "filters/source_buffer_stream_unittest.cc",
460 "filters/video_decoder_selector_unittest.cc",
461 "filters/video_frame_scheduler_impl_unittest.cc",
462 "filters/video_frame_scheduler_unittest.cc",
463 "filters/video_frame_stream_unittest.cc",
464 "filters/video_renderer_impl_unittest.cc",
465 "midi/midi_manager_unittest.cc",
466 "midi/midi_manager_usb_unittest.cc",
467 "midi/midi_message_queue_unittest.cc",
468 "midi/midi_message_util_unittest.cc",
469 "midi/usb_midi_descriptor_parser_unittest.cc",
470 "midi/usb_midi_input_stream_unittest.cc",
471 "midi/usb_midi_output_stream_unittest.cc",
472 "video/capture/fake_video_capture_device_unittest.cc",
473 "video/capture/video_capture_device_unittest.cc",
474 "formats/common/offset_byte_queue_unittest.cc",
475 "formats/webm/cluster_builder.cc",
476 "formats/webm/cluster_builder.h",
477 "formats/webm/tracks_builder.cc",
478 "formats/webm/tracks_builder.h",
479 "formats/webm/webm_cluster_parser_unittest.cc",
480 "formats/webm/webm_content_encodings_client_unittest.cc",
481 "formats/webm/webm_parser_unittest.cc",
482 "formats/webm/webm_tracks_parser_unittest.cc",
483 "formats/webm/webm_webvtt_parser_unittest.cc",
490 "//base/test:test_support",
491 "//media/audio:unittests",
492 "//media/audio:test_support",
493 "//media/base:unittests",
494 "//media/base:test_support",
495 "//skia", # Direct dependency required to inherit config.
498 "//third_party/widevine/cdm:version_h",
499 "//ui/gfx:test_support",
505 "//media/base/android",
507 #"//testing/android:native_test_native_code"
511 "ffmpeg/ffmpeg_common_unittest.cc",
512 "filters/audio_decoder_unittest.cc",
513 "filters/audio_file_reader_unittest.cc",
514 "filters/blocking_url_protocol_unittest.cc",
515 "filters/ffmpeg_demuxer_unittest.cc",
516 "filters/ffmpeg_glue_unittest.cc",
517 "filters/ffmpeg_video_decoder_unittest.cc",
518 "filters/in_memory_url_protocol_unittest.cc",
519 "filters/pipeline_integration_test.cc",
520 "filters/pipeline_integration_test_base.cc",
524 if (cpu_arch != "arm" && is_chromeos && use_x11) {
525 sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
528 if (proprietary_codecs) {
530 "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
531 "filters/h264_to_annex_b_bitstream_converter_unittest.cc",
532 "formats/common/stream_parser_test_base.cc",
533 "formats/common/stream_parser_test_base.h",
534 "formats/mp2t/es_adapter_video_unittest.cc",
535 "formats/mp2t/es_parser_adts_unittest.cc",
536 "formats/mp2t/es_parser_h264_unittest.cc",
537 "formats/mp2t/es_parser_test_base.cc",
538 "formats/mp2t/es_parser_test_base.h",
539 "formats/mp2t/mp2t_stream_parser_unittest.cc",
540 "formats/mp4/aac_unittest.cc",
541 "formats/mp4/avc_unittest.cc",
542 "formats/mp4/box_reader_unittest.cc",
543 "formats/mp4/es_descriptor_unittest.cc",
544 "formats/mp4/mp4_stream_parser_unittest.cc",
545 "formats/mp4/sample_to_group_iterator_unittest.cc",
546 "formats/mp4/track_run_iterator_unittest.cc",
547 "formats/mpeg/adts_stream_parser_unittest.cc",
548 "formats/mpeg/mp3_stream_parser_unittest.cc",
552 if (is_win && cpu_arch == "x64") {
554 "/wd4267" # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
555 # http://crbug.com/171009
561 "video/capture/mac/video_capture_device_factory_mac_unittest.mm"
566 # # Needed by media_drm_bridge.cc.
570 configs += [ ":media_config" ]
572 if (media_use_ffmpeg) {
574 "//third_party/ffmpeg", # Direct dependency required to inherit config.
579 test("media_perftests") {
581 if (media_use_ffmpeg) {
583 "filters/pipeline_integration_perftest.cc",
584 "filters/pipeline_integration_test_base.cc",
587 configs += [ ":media_config" ]
590 ":shared_memory_support",
592 "//base/test:test_support",
593 "//media/audio:test_support",
594 "//media/base:perftests",
595 "//media/base:test_support",
599 "//third_party/widevine/cdm:version_h",
600 "//ui/gfx:test_support",
603 deps += [ "//ui/gl" ]
605 if (media_use_ffmpeg) {
607 "//third_party/ffmpeg", # Direct dependency required to inherit config.
612 source_set("test_support") {
615 "filters/clockless_video_frame_scheduler.cc",
616 "filters/clockless_video_frame_scheduler.h",
617 "filters/mock_gpu_video_accelerator_factories.cc",
618 "filters/mock_gpu_video_accelerator_factories.h",
619 "filters/test_video_frame_scheduler.cc",
620 "filters/test_video_frame_scheduler.h",
621 "video/mock_video_decode_accelerator.cc",
622 "video/mock_video_decode_accelerator.h",
626 ":shared_memory_support",
634 # TODO(dalecurtis): How to split this across audio/base directories??
635 component("shared_memory_support") {
637 "audio/audio_parameters.cc",
638 "audio/audio_parameters.h",
641 "base/channel_layout.cc",
642 "base/channel_layout.h",
644 "base/media_export.h",
645 "base/vector_math.cc",
646 "base/vector_math.h",
648 configs += [ ":media_config" ]
652 if (media_use_ffmpeg) {
653 test("ffmpeg_unittests") {
654 sources = [ "ffmpeg/ffmpeg_unittest.cc" ]
661 "//base/test:test_support",
663 "//third_party/ffmpeg",
664 "//ui/gfx:test_support",
668 test("ffmpeg_regression_tests") {
670 "base/run_all_unittests.cc",
671 "ffmpeg/ffmpeg_regression_tests.cc",
672 "filters/pipeline_integration_test_base.cc",
674 configs += [ ":media_config" ]
678 "//base/test:test_support",
679 "//media/audio:test_support",
680 "//media/base:test_support",
683 "//third_party/ffmpeg",
685 "//ui/gfx:test_support",
687 # TODO(ajwong): This was in the original gyp, but it seems silly.
688 # ['os_posix==1 and OS!="mac"', {
690 # ['use_allocator!="none"', {
692 # '../base/allocator/allocator.gyp:allocator',
701 executable("player_x11") {
703 "tools/player_x11/data_source_logger.cc",
704 "tools/player_x11/data_source_logger.h",
705 "tools/player_x11/gl_video_renderer.cc",
706 "tools/player_x11/gl_video_renderer.h",
707 "tools/player_x11/player_x11.cc",
708 "tools/player_x11/x11_video_renderer.cc",
709 "tools/player_x11/x11_video_renderer.h",
713 "//build/config/linux:x11",
714 "//build/config/linux:xext",
715 # TODO(ajwong): Why does xext get a separate thing in //build/config/linux:BUILD.gn
716 # "//build/config/linux:xrender",
720 ":shared_memory_support",