# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, # Override to dynamically link the cras (ChromeOS audio) library. 'use_cras%': 0, # Option e.g. for Linux distributions to link pulseaudio directly # (DT_NEEDED) instead of using dlopen. This helps with automated # detection of ABI mismatches and prevents silent errors. 'linux_link_pulseaudio%': 0, 'conditions': [ ['OS == "android" or OS == "ios"', { # Android and iOS don't use ffmpeg. 'media_use_ffmpeg%': 0, # Android and iOS don't use libvpx. 'media_use_libvpx%': 0, }, { # 'OS != "android" and OS != "ios"' 'media_use_ffmpeg%': 1, 'media_use_libvpx%': 1, }], # Screen capturer works only on Windows, OSX and Linux (with X11). ['OS=="win" or OS=="mac" or (OS=="linux" and use_x11==1)', { 'screen_capture_supported%': 1, }, { 'screen_capture_supported%': 0, }], # ALSA usage. ['OS=="linux" or OS=="freebsd" or OS=="solaris"', { 'use_alsa%': 1, }, { 'use_alsa%': 0, }], ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and chromeos != 1', { 'use_pulseaudio%': 1, }, { 'use_pulseaudio%': 0, }], ], }, 'targets': [ { 'target_name': 'media', 'type': '<(component)', 'dependencies': [ '../base/base.gyp:base', '../build/temp_gyp/googleurl.gyp:googleurl', '../crypto/crypto.gyp:crypto', '../skia/skia.gyp:skia', '../third_party/opus/opus.gyp:opus', '../ui/ui.gyp:ui', ], 'defines': [ 'MEDIA_IMPLEMENTATION', ], 'include_dirs': [ '..', ], 'sources': [ 'audio/android/audio_manager_android.cc', 'audio/android/audio_manager_android.h', 'audio/android/opensles_input.cc', 'audio/android/opensles_input.h', 'audio/android/opensles_output.cc', 'audio/android/opensles_output.h', 'audio/async_socket_io_handler.h', 'audio/async_socket_io_handler_posix.cc', 'audio/async_socket_io_handler_win.cc', 'audio/audio_buffers_state.cc', 'audio/audio_buffers_state.h', 'audio/audio_device_name.cc', 'audio/audio_device_name.h', 'audio/audio_device_thread.cc', 'audio/audio_device_thread.h', 'audio/audio_input_controller.cc', 'audio/audio_input_controller.h', 'audio/audio_input_device.cc', 'audio/audio_input_device.h', 'audio/audio_input_ipc.cc', 'audio/audio_input_ipc.h', 'audio/audio_input_stream_impl.cc', 'audio/audio_input_stream_impl.h', 'audio/audio_io.h', 'audio/audio_manager.cc', 'audio/audio_manager.h', 'audio/audio_manager_base.cc', 'audio/audio_manager_base.h', 'audio/audio_output_controller.cc', 'audio/audio_output_controller.h', 'audio/audio_output_device.cc', 'audio/audio_output_device.h', 'audio/audio_output_dispatcher.cc', 'audio/audio_output_dispatcher.h', 'audio/audio_output_dispatcher_impl.cc', 'audio/audio_output_dispatcher_impl.h', 'audio/audio_output_ipc.cc', 'audio/audio_output_ipc.h', 'audio/audio_output_proxy.cc', 'audio/audio_output_proxy.h', 'audio/audio_output_resampler.cc', 'audio/audio_output_resampler.h', 'audio/audio_silence_detector.cc', 'audio/audio_silence_detector.h', 'audio/audio_source_diverter.h', 'audio/audio_util.cc', 'audio/audio_util.h', 'audio/cras/audio_manager_cras.cc', 'audio/cras/audio_manager_cras.h', 'audio/cras/cras_input.cc', 'audio/cras/cras_input.h', 'audio/cras/cras_unified.cc', 'audio/cras/cras_unified.h', 'audio/cross_process_notification.cc', 'audio/cross_process_notification.h', 'audio/cross_process_notification_posix.cc', 'audio/cross_process_notification_win.cc', 'audio/fake_audio_consumer.cc', 'audio/fake_audio_consumer.h', 'audio/fake_audio_input_stream.cc', 'audio/fake_audio_input_stream.h', 'audio/fake_audio_output_stream.cc', 'audio/fake_audio_output_stream.h', 'audio/ios/audio_manager_ios.h', 'audio/ios/audio_manager_ios.mm', 'audio/ios/audio_session_util_ios.h', 'audio/ios/audio_session_util_ios.mm', 'audio/linux/alsa_input.cc', 'audio/linux/alsa_input.h', 'audio/linux/alsa_output.cc', 'audio/linux/alsa_output.h', 'audio/linux/alsa_util.cc', 'audio/linux/alsa_util.h', 'audio/linux/alsa_wrapper.cc', 'audio/linux/alsa_wrapper.h', 'audio/linux/audio_manager_linux.cc', 'audio/linux/audio_manager_linux.h', 'audio/mac/aggregate_device_manager.cc', 'audio/mac/aggregate_device_manager.h', 'audio/mac/audio_auhal_mac.cc', 'audio/mac/audio_auhal_mac.h', 'audio/mac/audio_device_listener_mac.cc', 'audio/mac/audio_device_listener_mac.h', 'audio/mac/audio_input_mac.cc', 'audio/mac/audio_input_mac.h', 'audio/mac/audio_low_latency_input_mac.cc', 'audio/mac/audio_low_latency_input_mac.h', 'audio/mac/audio_low_latency_output_mac.cc', 'audio/mac/audio_low_latency_output_mac.h', 'audio/mac/audio_manager_mac.cc', 'audio/mac/audio_manager_mac.h', 'audio/mac/audio_synchronized_mac.cc', 'audio/mac/audio_synchronized_mac.h', 'audio/mac/audio_unified_mac.cc', 'audio/mac/audio_unified_mac.h', 'audio/null_audio_sink.cc', 'audio/null_audio_sink.h', 'audio/openbsd/audio_manager_openbsd.cc', 'audio/openbsd/audio_manager_openbsd.h', 'audio/pulse/audio_manager_pulse.cc', 'audio/pulse/audio_manager_pulse.h', 'audio/pulse/pulse_output.cc', 'audio/pulse/pulse_output.h', 'audio/pulse/pulse_input.cc', 'audio/pulse/pulse_input.h', 'audio/pulse/pulse_unified.cc', 'audio/pulse/pulse_unified.h', 'audio/pulse/pulse_util.cc', 'audio/pulse/pulse_util.h', 'audio/sample_rates.cc', 'audio/sample_rates.h', 'audio/scoped_loop_observer.cc', 'audio/scoped_loop_observer.h', 'audio/simple_sources.cc', 'audio/simple_sources.h', 'audio/virtual_audio_input_stream.cc', 'audio/virtual_audio_input_stream.h', 'audio/virtual_audio_output_stream.cc', 'audio/virtual_audio_output_stream.h', 'audio/win/audio_device_listener_win.cc', 'audio/win/audio_device_listener_win.h', 'audio/win/audio_low_latency_input_win.cc', 'audio/win/audio_low_latency_input_win.h', 'audio/win/audio_low_latency_output_win.cc', 'audio/win/audio_low_latency_output_win.h', 'audio/win/audio_manager_win.cc', 'audio/win/audio_manager_win.h', 'audio/win/audio_unified_win.cc', 'audio/win/audio_unified_win.h', 'audio/win/avrt_wrapper_win.cc', 'audio/win/avrt_wrapper_win.h', 'audio/win/device_enumeration_win.cc', 'audio/win/device_enumeration_win.h', 'audio/win/core_audio_util_win.cc', 'audio/win/core_audio_util_win.h', 'audio/win/wavein_input_win.cc', 'audio/win/wavein_input_win.h', 'audio/win/waveout_output_win.cc', 'audio/win/waveout_output_win.h', 'base/android/media_player_manager.cc', 'base/android/media_player_manager.h', 'base/android/media_resource_getter.cc', 'base/android/media_resource_getter.h', 'base/audio_capturer_source.h', 'base/audio_converter.cc', 'base/audio_converter.h', 'base/audio_decoder.cc', 'base/audio_decoder.h', 'base/audio_decoder_config.cc', 'base/audio_decoder_config.h', 'base/audio_fifo.cc', 'base/audio_fifo.h', 'base/audio_hardware_config.cc', 'base/audio_hardware_config.h', 'base/audio_hash.cc', 'base/audio_hash.h', 'base/audio_pull_fifo.cc', 'base/audio_pull_fifo.h', 'base/audio_renderer.cc', 'base/audio_renderer.h', 'base/audio_renderer_sink.h', 'base/audio_renderer_mixer.cc', 'base/audio_renderer_mixer.h', 'base/audio_renderer_mixer_input.cc', 'base/audio_renderer_mixer_input.h', 'base/audio_splicer.cc', 'base/audio_splicer.h', 'base/audio_timestamp_helper.cc', 'base/audio_timestamp_helper.h', 'base/bind_to_loop.h', 'base/bitstream_buffer.h', 'base/bit_reader.cc', 'base/bit_reader.h', 'base/buffers.h', 'base/byte_queue.cc', 'base/byte_queue.h', 'base/channel_mixer.cc', 'base/channel_mixer.h', 'base/clock.cc', 'base/clock.h', 'base/data_buffer.cc', 'base/data_buffer.h', 'base/data_source.cc', 'base/data_source.h', 'base/decoder_buffer.cc', 'base/decoder_buffer.h', 'base/decoder_buffer_queue.cc', 'base/decoder_buffer_queue.h', 'base/decryptor.cc', 'base/decryptor.h', 'base/decrypt_config.cc', 'base/decrypt_config.h', 'base/demuxer.cc', 'base/demuxer.h', 'base/demuxer_stream.cc', 'base/demuxer_stream.h', 'base/djb2.cc', 'base/djb2.h', 'base/filter_collection.cc', 'base/filter_collection.h', 'base/media.cc', 'base/media.h', 'base/media_log.cc', 'base/media_log.h', 'base/media_log_event.h', 'base/media_posix.cc', 'base/media_switches.cc', 'base/media_switches.h', 'base/media_win.cc', 'base/multi_channel_resampler.cc', 'base/multi_channel_resampler.h', 'base/pipeline.cc', 'base/pipeline.h', 'base/pipeline_status.cc', 'base/pipeline_status.h', 'base/ranges.cc', 'base/ranges.h', 'base/seekable_buffer.cc', 'base/seekable_buffer.h', 'base/serial_runner.cc', 'base/serial_runner.h', 'base/sinc_resampler.cc', 'base/sinc_resampler.h', 'base/stream_parser.cc', 'base/stream_parser.h', 'base/stream_parser_buffer.cc', 'base/stream_parser_buffer.h', 'base/video_decoder.cc', 'base/video_decoder.h', 'base/video_decoder_config.cc', 'base/video_decoder_config.h', 'base/video_frame.cc', 'base/video_frame.h', 'base/video_renderer.cc', 'base/video_renderer.h', 'base/video_util.cc', 'base/video_util.h', 'crypto/aes_decryptor.cc', 'crypto/aes_decryptor.h', 'ffmpeg/ffmpeg_common.cc', 'ffmpeg/ffmpeg_common.h', 'filters/audio_decoder_selector.cc', 'filters/audio_decoder_selector.h', 'filters/audio_file_reader.cc', 'filters/audio_file_reader.h', 'filters/audio_renderer_algorithm.cc', 'filters/audio_renderer_algorithm.h', 'filters/audio_renderer_impl.cc', 'filters/audio_renderer_impl.h', 'filters/blocking_url_protocol.cc', 'filters/blocking_url_protocol.h', 'filters/chunk_demuxer.cc', 'filters/chunk_demuxer.h', 'filters/decrypting_audio_decoder.cc', 'filters/decrypting_audio_decoder.h', 'filters/decrypting_demuxer_stream.cc', 'filters/decrypting_demuxer_stream.h', 'filters/decrypting_video_decoder.cc', 'filters/decrypting_video_decoder.h', 'filters/ffmpeg_audio_decoder.cc', 'filters/ffmpeg_audio_decoder.h', 'filters/ffmpeg_demuxer.cc', 'filters/ffmpeg_demuxer.h', 'filters/ffmpeg_glue.cc', 'filters/ffmpeg_glue.h', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.h', 'filters/ffmpeg_video_decoder.cc', 'filters/ffmpeg_video_decoder.h', 'filters/file_data_source.cc', 'filters/file_data_source.h', 'filters/gpu_video_decoder.cc', 'filters/gpu_video_decoder.h', 'filters/h264_to_annex_b_bitstream_converter.cc', 'filters/h264_to_annex_b_bitstream_converter.h', 'filters/in_memory_url_protocol.cc', 'filters/in_memory_url_protocol.h', 'filters/opus_audio_decoder.cc', 'filters/opus_audio_decoder.h', 'filters/skcanvas_video_renderer.cc', 'filters/skcanvas_video_renderer.h', 'filters/source_buffer_stream.cc', 'filters/source_buffer_stream.h', 'filters/stream_parser_factory.cc', 'filters/stream_parser_factory.h', 'filters/video_decoder_selector.cc', 'filters/video_decoder_selector.h', 'filters/video_frame_stream.cc', 'filters/video_frame_stream.h', 'filters/video_renderer_base.cc', 'filters/video_renderer_base.h', 'filters/vpx_video_decoder.cc', 'filters/vpx_video_decoder.h', 'video/capture/android/video_capture_device_android.cc', 'video/capture/android/video_capture_device_android.h', 'video/capture/fake_video_capture_device.cc', 'video/capture/fake_video_capture_device.h', 'video/capture/linux/video_capture_device_linux.cc', 'video/capture/linux/video_capture_device_linux.h', 'video/capture/mac/video_capture_device_mac.h', 'video/capture/mac/video_capture_device_mac.mm', 'video/capture/mac/video_capture_device_qtkit_mac.h', 'video/capture/mac/video_capture_device_qtkit_mac.mm', 'video/capture/screen/differ.cc', 'video/capture/screen/differ.h', 'video/capture/screen/differ_block.cc', 'video/capture/screen/differ_block.h', 'video/capture/screen/x11/x_server_pixel_buffer.cc', 'video/capture/screen/x11/x_server_pixel_buffer.h', 'video/capture/screen/mac/desktop_configuration.mm', 'video/capture/screen/mac/desktop_configuration.h', 'video/capture/screen/mac/scoped_pixel_buffer_object.cc', 'video/capture/screen/mac/scoped_pixel_buffer_object.h', 'video/capture/screen/mouse_cursor_shape.cc', 'video/capture/screen/mouse_cursor_shape.h', 'video/capture/screen/screen_capture_data.cc', 'video/capture/screen/screen_capture_data.h', 'video/capture/screen/screen_capture_device.cc', 'video/capture/screen/screen_capture_device.h', 'video/capture/screen/screen_capture_frame.cc', 'video/capture/screen/screen_capture_frame.h', 'video/capture/screen/screen_capture_frame_queue.cc', 'video/capture/screen/screen_capture_frame_queue.h', 'video/capture/screen/screen_capturer.h', 'video/capture/screen/screen_capturer_fake.cc', 'video/capture/screen/screen_capturer_fake.h', 'video/capture/screen/screen_capturer_helper.cc', 'video/capture/screen/screen_capturer_helper.h', 'video/capture/screen/screen_capturer_x11.cc', 'video/capture/screen/screen_capturer_mac.mm', 'video/capture/screen/screen_capturer_null.cc', 'video/capture/screen/screen_capturer_win.cc', 'video/capture/screen/shared_buffer.cc', 'video/capture/screen/shared_buffer.h', 'video/capture/screen/win/desktop.cc', 'video/capture/screen/win/desktop.h', 'video/capture/screen/win/scoped_thread_desktop.cc', 'video/capture/screen/win/scoped_thread_desktop.h', 'video/capture/video_capture.h', 'video/capture/video_capture_device.h', 'video/capture/video_capture_device_dummy.cc', 'video/capture/video_capture_device_dummy.h', 'video/capture/video_capture_proxy.cc', 'video/capture/video_capture_proxy.h', 'video/capture/video_capture_types.h', 'video/capture/win/capability_list_win.cc', 'video/capture/win/capability_list_win.h', 'video/capture/win/filter_base_win.cc', 'video/capture/win/filter_base_win.h', 'video/capture/win/pin_base_win.cc', 'video/capture/win/pin_base_win.h', 'video/capture/win/sink_filter_observer_win.h', 'video/capture/win/sink_filter_win.cc', 'video/capture/win/sink_filter_win.h', 'video/capture/win/sink_input_pin_win.cc', 'video/capture/win/sink_input_pin_win.h', 'video/capture/win/video_capture_device_mf_win.cc', 'video/capture/win/video_capture_device_mf_win.h', 'video/capture/win/video_capture_device_win.cc', 'video/capture/win/video_capture_device_win.h', 'video/picture.cc', 'video/picture.h', 'video/video_decode_accelerator.cc', 'video/video_decode_accelerator.h', 'webm/webm_audio_client.cc', 'webm/webm_audio_client.h', 'webm/webm_cluster_parser.cc', 'webm/webm_cluster_parser.h', 'webm/webm_constants.h', 'webm/webm_content_encodings.cc', 'webm/webm_content_encodings.h', 'webm/webm_content_encodings_client.cc', 'webm/webm_content_encodings_client.h', 'webm/webm_crypto_helpers.cc', 'webm/webm_crypto_helpers.h', 'webm/webm_info_parser.cc', 'webm/webm_info_parser.h', 'webm/webm_parser.cc', 'webm/webm_parser.h', 'webm/webm_stream_parser.cc', 'webm/webm_stream_parser.h', 'webm/webm_tracks_parser.cc', 'webm/webm_tracks_parser.h', 'webm/webm_video_client.cc', 'webm/webm_video_client.h', ], 'direct_dependent_settings': { 'include_dirs': [ '..', ], }, 'conditions': [ ['arm_neon == 1', { 'defines': [ 'USE_NEON' ], }], ['OS != "linux" or use_x11 == 1', { 'sources!': [ 'video/capture/screen/screen_capturer_null.cc', ] }], ['OS != "ios"', { 'dependencies': [ '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 'shared_memory_support', 'yuv_convert', ], }], ['media_use_ffmpeg == 1', { 'dependencies': [ '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', ], }, { # media_use_ffmpeg == 0 # Exclude the sources that depend on ffmpeg. 'sources!': [ 'base/media_posix.cc', 'ffmpeg/ffmpeg_common.cc', 'ffmpeg/ffmpeg_common.h', 'filters/audio_file_reader.cc', 'filters/audio_file_reader.h', 'filters/blocking_url_protocol.cc', 'filters/blocking_url_protocol.h', 'filters/ffmpeg_audio_decoder.cc', 'filters/ffmpeg_audio_decoder.h', 'filters/ffmpeg_demuxer.cc', 'filters/ffmpeg_demuxer.h', 'filters/ffmpeg_glue.cc', 'filters/ffmpeg_glue.h', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.h', 'filters/ffmpeg_video_decoder.cc', 'filters/ffmpeg_video_decoder.h', ], }], ['media_use_libvpx == 1', { 'dependencies': [ '<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx', ], }, { # media_use_libvpx == 0 'direct_dependent_settings': { 'defines': [ 'MEDIA_DISABLE_LIBVPX', ], }, # Exclude the sources that depend on libvpx. 'sources!': [ 'filters/vpx_video_decoder.cc', 'filters/vpx_video_decoder.h', ], }], ['use_system_ffmpeg == 1', { 'cflags': [ '\n' 'int test() { return AV_CODEC_ID_OPUS; }" ' '--on-failure -DCHROMIUM_OMIT_AV_CODEC_ID_OPUS=1)', '\n' 'int test() { return AV_CODEC_ID_VP9; }" ' '--on-failure -DCHROMIUM_OMIT_AV_CODEC_ID_VP9=1)', '\n' 'int test() { struct AVFrame frame;\n' 'return av_frame_get_channels(&frame); }" ' '--on-failure -DCHROMIUM_NO_AVFRAME_CHANNELS=1)', ], }], ['OS == "ios"', { 'includes': [ # For shared_memory_support_sources variable. 'shared_memory_support.gypi', ], 'sources': [ 'base/media_stub.cc', # These sources are normally built via a dependency on the # shared_memory_support target, but that target is not built on iOS. # Instead, directly build only the files that are needed for iOS. '<@(shared_memory_support_sources)', ], 'sources/': [ # Exclude everything but iOS-specific files. ['exclude', '\\.(cc|mm)$'], ['include', '_ios\\.(cc|mm)$'], ['include', '(^|/)ios/'], # Re-include specific pieces. # iOS support is limited to audio input only. ['include', '^audio/audio_buffers_state\\.'], ['include', '^audio/audio_input_controller\\.'], ['include', '^audio/audio_manager\\.'], ['include', '^audio/audio_manager_base\\.'], ['include', '^audio/audio_parameters\\.'], ['include', '^audio/fake_audio_consumer\\.'], ['include', '^audio/fake_audio_input_stream\\.'], ['include', '^audio/fake_audio_output_stream\\.'], ['include', '^base/audio_bus\\.'], ['include', '^base/channel_layout\\.'], ['include', '^base/media\\.cc$'], ['include', '^base/media_stub\\.cc$'], ['include', '^base/media_switches\\.'], ['include', '^base/vector_math\\.'], ], 'link_settings': { 'libraries': [ '$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework', '$(SDKROOT)/System/Library/Frameworks/AVFoundation.framework', '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework', ], }, }], ['OS == "android"', { 'link_settings': { 'libraries': [ '-lOpenSLES', ], }, 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)/media', ], 'dependencies': [ 'media_android_jni_headers', 'player_android', 'video_capture_android_jni_headers', ], 'sources': [ 'base/media.cc', 'base/media.h', ], 'conditions': [ ['android_webview_build == 0', { 'dependencies': [ 'media_java', ], }], ['use_openmax_dl_fft==1', { # FFT library requires Neon support, so we enable # WebAudio only if Neon is detected at runtime. 'sources': [ 'base/media_android.cc', ], 'includes': [ '../build/android/cpufeatures.gypi', ], }, { 'sources': [ 'base/media_stub.cc', ], }], ], }], # A simple WebM encoder for animated avatars on ChromeOS. ['chromeos==1', { 'dependencies': [ '../third_party/libvpx/libvpx.gyp:libvpx', '../third_party/libyuv/libyuv.gyp:libyuv', ], 'sources': [ 'webm/chromeos/ebml_writer.cc', 'webm/chromeos/ebml_writer.h', 'webm/chromeos/webm_encoder.cc', 'webm/chromeos/webm_encoder.h', ], }], ['use_alsa==1', { 'link_settings': { 'libraries': [ '-lasound', ], }, }, { # use_alsa==0 'sources/': [ ['exclude', '/alsa_' ], ['exclude', '/audio_manager_linux' ] ], }], ['OS!="openbsd"', { 'sources!': [ 'audio/openbsd/audio_manager_openbsd.cc', 'audio/openbsd/audio_manager_openbsd.h', ], }], ['OS=="linux"', { 'variables': { 'conditions': [ ['sysroot!=""', { 'pkg-config': '../build/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)"', }, { 'pkg-config': 'pkg-config' }], ], }, 'conditions': [ ['use_x11 == 1', { 'link_settings': { 'libraries': [ '-lX11', '-lXdamage', '-lXext', '-lXfixes', ], }, }], ['use_cras == 1', { 'cflags': [ '