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/es_parser_mpeg1audio.cc",
373 "formats/mp2t/es_parser_mpeg1audio.h",
374 "formats/mp2t/mp2t_common.h",
375 "formats/mp2t/mp2t_stream_parser.cc",
376 "formats/mp2t/mp2t_stream_parser.h",
377 "formats/mp2t/timestamp_unroller.cc",
378 "formats/mp2t/timestamp_unroller.h",
379 "formats/mp2t/ts_packet.cc",
380 "formats/mp2t/ts_packet.h",
381 "formats/mp2t/ts_section.h",
382 "formats/mp2t/ts_section_pat.cc",
383 "formats/mp2t/ts_section_pat.h",
384 "formats/mp2t/ts_section_pes.cc",
385 "formats/mp2t/ts_section_pes.h",
386 "formats/mp2t/ts_section_pmt.cc",
387 "formats/mp2t/ts_section_pmt.h",
388 "formats/mp2t/ts_section_psi.cc",
389 "formats/mp2t/ts_section_psi.h",
390 "formats/mp4/aac.cc",
392 "formats/mp4/avc.cc",
394 "formats/mp4/box_definitions.cc",
395 "formats/mp4/box_definitions.h",
396 "formats/mp4/box_reader.cc",
397 "formats/mp4/box_reader.h",
398 "formats/mp4/cenc.cc",
399 "formats/mp4/cenc.h",
400 "formats/mp4/es_descriptor.cc",
401 "formats/mp4/es_descriptor.h",
402 "formats/mp4/mp4_stream_parser.cc",
403 "formats/mp4/mp4_stream_parser.h",
404 "formats/mp4/sample_to_group_iterator.cc",
405 "formats/mp4/sample_to_group_iterator.h",
406 "formats/mp4/track_run_iterator.cc",
407 "formats/mp4/track_run_iterator.h",
408 "formats/mpeg/adts_constants.cc",
409 "formats/mpeg/adts_constants.h",
410 "formats/mpeg/adts_stream_parser.cc",
411 "formats/mpeg/adts_stream_parser.h",
412 "formats/mpeg/mpeg_audio_stream_parser_base.cc",
413 "formats/mpeg/mpeg_audio_stream_parser_base.h",
414 "formats/mpeg/mpeg1_audio_stream_parser.cc",
415 "formats/mpeg/mpeg1_audio_stream_parser.h",
420 ":shared_memory_support",
423 "//base/third_party/dynamic_annotations",
425 "//crypto:platform", # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings
426 "//gpu/command_buffer/common",
430 "//third_party/libyuv",
431 "//third_party/opus",
432 "//ui/events:events_base",
439 test("media_unittests") {
441 "cdm/aes_decryptor_unittest.cc",
442 "cdm/json_web_key_unittest.cc",
443 "filters/audio_clock_unittest.cc",
444 "filters/audio_decoder_selector_unittest.cc",
445 "filters/audio_renderer_algorithm_unittest.cc",
446 "filters/audio_renderer_impl_unittest.cc",
447 "filters/chunk_demuxer_unittest.cc",
448 "filters/decrypting_audio_decoder_unittest.cc",
449 "filters/decrypting_demuxer_stream_unittest.cc",
450 "filters/decrypting_video_decoder_unittest.cc",
451 "filters/fake_demuxer_stream.cc",
452 "filters/fake_demuxer_stream.h",
453 "filters/fake_demuxer_stream_unittest.cc",
454 "filters/fake_video_decoder.cc",
455 "filters/fake_video_decoder.h",
456 "filters/fake_video_decoder_unittest.cc",
457 "filters/file_data_source_unittest.cc",
458 "filters/frame_processor_unittest.cc",
459 "filters/h264_bit_reader_unittest.cc",
460 "filters/h264_parser_unittest.cc",
461 "filters/renderer_impl_unittest.cc",
462 "filters/skcanvas_video_renderer_unittest.cc",
463 "filters/source_buffer_stream_unittest.cc",
464 "filters/video_decoder_selector_unittest.cc",
465 "filters/video_frame_scheduler_impl_unittest.cc",
466 "filters/video_frame_scheduler_unittest.cc",
467 "filters/video_frame_stream_unittest.cc",
468 "filters/video_renderer_impl_unittest.cc",
469 "midi/midi_manager_unittest.cc",
470 "midi/midi_manager_usb_unittest.cc",
471 "midi/midi_message_queue_unittest.cc",
472 "midi/midi_message_util_unittest.cc",
473 "midi/usb_midi_descriptor_parser_unittest.cc",
474 "midi/usb_midi_input_stream_unittest.cc",
475 "midi/usb_midi_output_stream_unittest.cc",
476 "video/capture/fake_video_capture_device_unittest.cc",
477 "video/capture/video_capture_device_unittest.cc",
478 "formats/common/offset_byte_queue_unittest.cc",
479 "formats/webm/cluster_builder.cc",
480 "formats/webm/cluster_builder.h",
481 "formats/webm/tracks_builder.cc",
482 "formats/webm/tracks_builder.h",
483 "formats/webm/webm_cluster_parser_unittest.cc",
484 "formats/webm/webm_content_encodings_client_unittest.cc",
485 "formats/webm/webm_parser_unittest.cc",
486 "formats/webm/webm_tracks_parser_unittest.cc",
487 "formats/webm/webm_webvtt_parser_unittest.cc",
494 "//base/test:test_support",
495 "//media/audio:unittests",
496 "//media/audio:test_support",
497 "//media/base:unittests",
498 "//media/base:test_support",
499 "//skia", # Direct dependency required to inherit config.
502 "//third_party/widevine/cdm:version_h",
503 "//ui/gfx:test_support",
509 "//media/base/android",
511 #"//testing/android:native_test_native_code"
515 if (media_use_ffmpeg) {
517 "ffmpeg/ffmpeg_common_unittest.cc",
518 "filters/audio_decoder_unittest.cc",
519 "filters/audio_file_reader_unittest.cc",
520 "filters/blocking_url_protocol_unittest.cc",
521 "filters/ffmpeg_demuxer_unittest.cc",
522 "filters/ffmpeg_glue_unittest.cc",
523 "filters/ffmpeg_video_decoder_unittest.cc",
524 "filters/in_memory_url_protocol_unittest.cc",
525 "filters/pipeline_integration_test.cc",
526 "filters/pipeline_integration_test_base.cc",
530 if (cpu_arch != "arm" && is_chromeos && use_x11) {
531 sources += [ "filters/h264_bitstream_buffer_unittest.cc" ]
534 if (proprietary_codecs) {
536 "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc",
537 "filters/h264_to_annex_b_bitstream_converter_unittest.cc",
538 "formats/common/stream_parser_test_base.cc",
539 "formats/common/stream_parser_test_base.h",
540 "formats/mp2t/es_adapter_video_unittest.cc",
541 "formats/mp2t/es_parser_adts_unittest.cc",
542 "formats/mp2t/es_parser_h264_unittest.cc",
543 "formats/mp2t/es_parser_mpeg1audio_unittest.cc",
544 "formats/mp2t/es_parser_test_base.cc",
545 "formats/mp2t/es_parser_test_base.h",
546 "formats/mp2t/mp2t_stream_parser_unittest.cc",
547 "formats/mp2t/timestamp_unroller_unittest.cc",
548 "formats/mp4/aac_unittest.cc",
549 "formats/mp4/avc_unittest.cc",
550 "formats/mp4/box_reader_unittest.cc",
551 "formats/mp4/es_descriptor_unittest.cc",
552 "formats/mp4/mp4_stream_parser_unittest.cc",
553 "formats/mp4/sample_to_group_iterator_unittest.cc",
554 "formats/mp4/track_run_iterator_unittest.cc",
555 "formats/mpeg/adts_stream_parser_unittest.cc",
556 "formats/mpeg/mpeg1_audio_stream_parser_unittest.cc",
560 if (is_win && cpu_arch == "x64") {
562 "/wd4267" # TODO(wolenetz): Fix size_t to int trunctaion in win64. See
563 # http://crbug.com/171009
569 "video/capture/mac/video_capture_device_factory_mac_unittest.mm"
574 # # Needed by media_drm_bridge.cc.
578 configs += [ ":media_config" ]
580 if (media_use_ffmpeg) {
582 "//third_party/ffmpeg", # Direct dependency required to inherit config.
587 test("media_perftests") {
589 if (media_use_ffmpeg) {
591 "filters/pipeline_integration_perftest.cc",
592 "filters/pipeline_integration_test_base.cc",
595 configs += [ ":media_config" ]
598 ":shared_memory_support",
600 "//base/test:test_support",
601 "//media/audio:test_support",
602 "//media/base:perftests",
603 "//media/base:test_support",
607 "//third_party/widevine/cdm:version_h",
608 "//ui/gfx:test_support",
611 deps += [ "//ui/gl" ]
613 if (media_use_ffmpeg) {
615 "//third_party/ffmpeg", # Direct dependency required to inherit config.
620 source_set("test_support") {
623 "filters/clockless_video_frame_scheduler.cc",
624 "filters/clockless_video_frame_scheduler.h",
625 "filters/mock_gpu_video_accelerator_factories.cc",
626 "filters/mock_gpu_video_accelerator_factories.h",
627 "filters/test_video_frame_scheduler.cc",
628 "filters/test_video_frame_scheduler.h",
629 "video/mock_video_decode_accelerator.cc",
630 "video/mock_video_decode_accelerator.h",
634 ":shared_memory_support",
642 # TODO(dalecurtis): How to split this across audio/base directories??
643 component("shared_memory_support") {
645 "audio/audio_parameters.cc",
646 "audio/audio_parameters.h",
649 "base/channel_layout.cc",
650 "base/channel_layout.h",
652 "base/media_export.h",
653 "base/vector_math.cc",
654 "base/vector_math.h",
656 configs += [ ":media_config" ]
657 defines = [ "MEDIA_IMPLEMENTATION" ]
661 if (media_use_ffmpeg) {
662 test("ffmpeg_unittests") {
663 sources = [ "ffmpeg/ffmpeg_unittest.cc" ]
670 "//base/test:test_support",
672 "//third_party/ffmpeg",
673 "//ui/gfx:test_support",
677 test("ffmpeg_regression_tests") {
679 "base/run_all_unittests.cc",
680 "ffmpeg/ffmpeg_regression_tests.cc",
681 "filters/pipeline_integration_test_base.cc",
683 configs += [ ":media_config" ]
687 "//base/test:test_support",
688 "//media/audio:test_support",
689 "//media/base:test_support",
692 "//third_party/ffmpeg",
694 "//ui/gfx:test_support",
696 # TODO(ajwong): This was in the original gyp, but it seems silly.
697 # ['os_posix==1 and OS!="mac"', {
699 # ['use_allocator!="none"', {
701 # '../base/allocator/allocator.gyp:allocator',
710 executable("player_x11") {
712 "tools/player_x11/data_source_logger.cc",
713 "tools/player_x11/data_source_logger.h",
714 "tools/player_x11/gl_video_renderer.cc",
715 "tools/player_x11/gl_video_renderer.h",
716 "tools/player_x11/player_x11.cc",
717 "tools/player_x11/x11_video_renderer.cc",
718 "tools/player_x11/x11_video_renderer.h",
722 "//build/config/linux:x11",
723 "//build/config/linux:xext",
724 # TODO(ajwong): Why does xext get a separate thing in //build/config/linux:BUILD.gn
725 # "//build/config/linux:xrender",
729 ":shared_memory_support",