| # Copyright 2014 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. |
| |
| import("//media/media_options.gni") |
| |
| # When libpulse is not directly linked, use stubs to allow for dlopening of the |
| # binary. |
| if (!linux_link_pulseaudio) { |
| action("pulse_generate_stubs") { |
| extra_header = "pulse/pulse_stub_header.fragment" |
| |
| script = "../../tools/generate_stubs/generate_stubs.py" |
| sources = [ "pulse/pulse.sigs" ] |
| source_prereqs = [ extra_header ] |
| stubs_filename_root = "pulse_stubs" |
| |
| # TODO(ajwong): these need to be included in the pulse build. |
| outputs = [ |
| "$target_gen_dir/pulse/$stubs_filename_root.cc", |
| "$target_gen_dir/pulse/$stubs_filename_root.h", |
| ] |
| args = [ |
| "-i", rebase_path("$target_gen_dir/pulse", root_build_dir), |
| "-o", rebase_path("$target_gen_dir/pulse", root_build_dir), |
| "-t", "posix_stubs", |
| "-e", rebase_path(extra_header, root_build_dir), |
| "-s", stubs_filename_root, |
| "-p", "media/audio/pulse", |
| ] |
| |
| args += rebase_path(sources, root_build_dir) |
| } |
| } |
| |
| source_set("audio") { |
| sources = [ |
| "agc_audio_stream.h", |
| "audio_buffers_state.cc", |
| "audio_buffers_state.h", |
| "audio_device_name.cc", |
| "audio_device_name.h", |
| "audio_device_thread.cc", |
| "audio_device_thread.h", |
| "audio_input_controller.cc", |
| "audio_input_controller.h", |
| "audio_input_device.cc", |
| "audio_input_device.h", |
| "audio_input_ipc.cc", |
| "audio_input_ipc.h", |
| "audio_io.h", |
| "audio_manager.cc", |
| "audio_manager.h", |
| "audio_manager_base.cc", |
| "audio_manager_base.h", |
| "audio_output_controller.cc", |
| "audio_output_controller.h", |
| "audio_output_device.cc", |
| "audio_output_device.h", |
| "audio_output_dispatcher.cc", |
| "audio_output_dispatcher.h", |
| "audio_output_dispatcher_impl.cc", |
| "audio_output_dispatcher_impl.h", |
| "audio_output_ipc.cc", |
| "audio_output_ipc.h", |
| "audio_output_proxy.cc", |
| "audio_output_proxy.h", |
| "audio_output_resampler.cc", |
| "audio_output_resampler.h", |
| "audio_power_monitor.cc", |
| "audio_power_monitor.h", |
| "audio_source_diverter.h", |
| "fake_audio_consumer.cc", |
| "fake_audio_consumer.h", |
| "fake_audio_input_stream.cc", |
| "fake_audio_input_stream.h", |
| "fake_audio_log_factory.h", |
| "fake_audio_log_factory.cc", |
| "fake_audio_manager.cc", |
| "fake_audio_manager.h", |
| "fake_audio_output_stream.cc", |
| "fake_audio_output_stream.h", |
| "null_audio_sink.cc", |
| "null_audio_sink.h", |
| "sample_rates.cc", |
| "sample_rates.h", |
| "scoped_task_runner_observer.cc", |
| "scoped_task_runner_observer.h", |
| "simple_sources.cc", |
| "simple_sources.h", |
| "virtual_audio_input_stream.cc", |
| "virtual_audio_input_stream.h", |
| "virtual_audio_output_stream.cc", |
| "virtual_audio_output_stream.h", |
| ] |
| deps = [] |
| libs = [] |
| configs += [ "//media:media_config" ] |
| |
| if (is_chromeos) { |
| sources += [ |
| "sounds/audio_stream_handler.cc", |
| "sounds/audio_stream_handler.h", |
| "sounds/sounds_manager.cc", |
| "sounds/sounds_manager.h", |
| "sounds/wav_audio_handler.cc", |
| "sounds/wav_audio_handler.h", |
| ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "mac/audio_auhal_mac.cc", |
| "mac/audio_auhal_mac.h", |
| "mac/audio_device_listener_mac.cc", |
| "mac/audio_device_listener_mac.h", |
| "mac/audio_input_mac.cc", |
| "mac/audio_input_mac.h", |
| "mac/audio_low_latency_input_mac.cc", |
| "mac/audio_low_latency_input_mac.h", |
| "mac/audio_manager_mac.cc", |
| "mac/audio_manager_mac.h", |
| ] |
| libs += [ |
| "AudioToolbox.framework", |
| "AudioUnit.framework", |
| "CoreAudio.framework", |
| ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "win/audio_device_listener_win.cc", |
| "win/audio_device_listener_win.h", |
| "win/audio_low_latency_input_win.cc", |
| "win/audio_low_latency_input_win.h", |
| "win/audio_low_latency_output_win.cc", |
| "win/audio_low_latency_output_win.h", |
| "win/audio_manager_win.cc", |
| "win/audio_manager_win.h", |
| "win/avrt_wrapper_win.cc", |
| "win/avrt_wrapper_win.h", |
| "win/core_audio_util_win.cc", |
| "win/core_audio_util_win.h", |
| "win/device_enumeration_win.cc", |
| "win/device_enumeration_win.h", |
| "win/wavein_input_win.cc", |
| "win/wavein_input_win.h", |
| "win/waveout_output_win.cc", |
| "win/waveout_output_win.h", |
| ] |
| } |
| |
| if (is_android) { |
| sources += [ |
| "android/audio_manager_android.cc", |
| "android/audio_manager_android.h", |
| "android/audio_record_input.cc", |
| "android/audio_record_input.h", |
| "android/opensles_input.cc", |
| "android/opensles_input.h", |
| "android/opensles_output.cc", |
| "android/opensles_output.h", |
| "android/opensles_wrapper.cc", |
| ] |
| deps += [ |
| "//media:media_android_jni_headers", |
| ] |
| } |
| |
| if (is_openbsd) { |
| sources += [ |
| "openbsd/audio_manager_openbsd.cc", |
| "openbsd/audio_manager_openbsd.h", |
| ] |
| } |
| |
| if (is_linux) { |
| sources += [ |
| "linux/audio_manager_linux.cc", |
| ] |
| } |
| |
| if (use_alsa) { |
| libs = [ "asound" ] |
| defines = [ "USE_ALSA" ] |
| sources += [ |
| "alsa/alsa_input.cc", |
| "alsa/alsa_input.h", |
| "alsa/alsa_output.cc", |
| "alsa/alsa_output.h", |
| "alsa/alsa_util.cc", |
| "alsa/alsa_util.h", |
| "alsa/alsa_wrapper.cc", |
| "alsa/alsa_wrapper.h", |
| "alsa/audio_manager_alsa.cc", |
| "alsa/audio_manager_alsa.h", |
| ] |
| } |
| |
| if (use_cras) { |
| sources += [ |
| "cras/audio_manager_cras.cc", |
| "cras/audio_manager_cras.h", |
| "cras/cras_input.cc", |
| "cras/cras_input.h", |
| "cras/cras_unified.cc", |
| "cras/cras_unified.h", |
| ] |
| |
| pkg_config("libcras") { |
| packages = [ "libcras" ] |
| } |
| configs += [ "libcras" ] |
| } |
| |
| if (use_pulseaudio) { |
| sources += [ |
| "pulse/audio_manager_pulse.cc", |
| "pulse/audio_manager_pulse.h", |
| "pulse/pulse_input.cc", |
| "pulse/pulse_input.h", |
| "pulse/pulse_output.cc", |
| "pulse/pulse_output.h", |
| "pulse/pulse_util.cc", |
| "pulse/pulse_util.h", |
| ] |
| |
| if (linux_link_pulseaudio) { |
| pkg_config("libpulse") { |
| packages = [ "libpulse" ] |
| } |
| configs += [ ":libpulse" ] |
| } else { |
| # TODO(ajwong): Technically, this dl should go in the action. |
| libs += [ "dl" ] |
| deps += [ ":pulse_generate_stubs" ] |
| sources += get_target_outputs(":pulse_generate_stubs") |
| } |
| } |
| } |
| |
| source_set("test_support") { |
| sources = [ |
| "clockless_audio_sink.cc", |
| "clockless_audio_sink.h", |
| "mock_audio_manager.cc", |
| "mock_audio_manager.h", |
| "mock_audio_source_callback.cc", |
| "mock_audio_source_callback.h", |
| "test_audio_input_controller_factory.cc", |
| "test_audio_input_controller_factory.h", |
| ] |
| deps = [ "//testing/gmock" ] |
| configs += [ "//media:media_config" ] |
| } |
| |
| source_set("unittests") { |
| sources = [ |
| "audio_input_controller_unittest.cc", |
| "audio_input_unittest.cc", |
| "audio_low_latency_input_output_unittest.cc", |
| "audio_manager_unittest.cc", |
| "audio_output_controller_unittest.cc", |
| "audio_output_device_unittest.cc", |
| "audio_output_proxy_unittest.cc", |
| "audio_parameters_unittest.cc", |
| "audio_power_monitor_unittest.cc", |
| "fake_audio_consumer_unittest.cc", |
| "simple_sources_unittest.cc", |
| "virtual_audio_input_stream_unittest.cc", |
| "virtual_audio_output_stream_unittest.cc", |
| ] |
| deps = [ |
| ":test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| configs += [ "//media:media_config" ] |
| |
| if (is_android) { |
| sources += [ |
| "android/audio_android_unittest.cc", |
| ] |
| } else { |
| sources += [ |
| "audio_input_volume_unittest.cc", |
| ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "mac/audio_auhal_mac_unittest.cc", |
| "mac/audio_device_listener_mac_unittest.cc", |
| "mac/audio_low_latency_input_mac_unittest.cc", |
| ] |
| } |
| |
| if (is_chromeos) { |
| sources += [ |
| "sounds/audio_stream_handler_unittest.cc", |
| "sounds/sounds_manager_unittest.cc", |
| "sounds/test_data.cc", |
| "sounds/test_data.h", |
| "sounds/wav_audio_handler_unittest.cc", |
| ] |
| |
| if (use_cras) { |
| sources += [ |
| "cras/cras_input_unittest.cc", |
| "cras/cras_unified_unittest.cc", |
| ] |
| } |
| } |
| |
| if (is_win) { |
| sources += [ |
| "win/audio_device_listener_win_unittest.cc", |
| "win/audio_low_latency_input_win_unittest.cc", |
| "win/audio_low_latency_output_win_unittest.cc", |
| "win/audio_output_win_unittest.cc", |
| "win/core_audio_util_win_unittest.cc", |
| ] |
| } |
| |
| if (use_alsa) { |
| sources += [ |
| "alsa/alsa_output_unittest.cc", |
| ] |
| } |
| } |