# 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("//build/config/android/config.gni") import("//build/config/arm.gni") import("//build/config/ui.gni") import("//build/config/linux/pkg_config.gni") # These variables need to be args. # Override to dynamically link the cras (ChromeOS audio) library. use_cras = false # 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. # # TODO(ajwong): Why is this prefixed "linux_"? linux_link_pulseaudio = false # TODO(ajwong): Enable libvpx once that's converted. media_use_ffmpeg = true media_use_libvpx = false if (is_android) { # Android doesn't use ffmpeg or libvpx. media_use_ffmpeg = false media_use_libvpx = false } # TODO(ajwong): how to disable embedded? # Original conditional: (OS=="linux" or OS=="freebsd" or OS=="solaris") and embedded!=1 use_alsa = false use_pulseaudio = false if (is_posix && !is_android) { use_alsa = true if (!use_cras) { use_pulseaudio = true } } # TODO(ajwong): is_openbsd should be a platform define. is_openbsd = false # TODO(ajwong): This should be branding controlled? proprietary_codecs = false # TODO(ajwong): Where are these coming from?jk enable_mpeg2ts_stream_parser = false enable_browser_cdms = is_android # Common configuration for targets in the media directory. # NOT for exporting. config("media_config") { defines = [ "MEDIA_IMPLEMENTATION" ] if (cpu_arch == "arm" && arm_use_neon) { defines += [ "USE_NEON" ] } if (!media_use_libvpx) { defines += [ "MEDIA_DISABLE_LIBVPX" ] } if (use_pulseaudio) { defines += [ "USE_PULSEAUDIO" ] if (linux_link_pulseaudio) { defines += [ "DLOPEN_PULSEAUDIO" ] } } if (use_cras) { defines = [ "USE_CRAS" ] } if (enable_mpeg2ts_stream_parser) { defines += [ "ENABLE_MPEG2TS_STREAM_PARSER" ] } } if (is_win) { config("media_dependent_config") { ldflags += [ "/DELAYLOAD:mf.dll", "/DELAYLOAD:mfplat.dll", "/DELAYLOAD:mfreadwrite.dll", ] } } if (!linux_link_pulseaudio) { # When libpulse is not directly linked, use stubs to allow for dlopening of # the binary. action("pulse_generate_stubs") { extra_header = "audio/pulse/pulse_stub_header.fragment" script = "../tools/generate_stubs/generate_stubs.py" sources = [ "audio/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/audio/pulse/$stubs_filename_root.cc", "$target_gen_dir/audio/pulse/$stubs_filename_root.h", ] args = [ "-i", rebase_path("$target_gen_dir/audio/pulse", root_build_dir), "-o", rebase_path("$target_gen_dir/audio/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) } } component("media") { sources = [ "audio/agc_audio_stream.h", "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_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_power_monitor.cc", "audio/audio_power_monitor.h", "audio/audio_source_diverter.h", "audio/clockless_audio_sink.cc", "audio/clockless_audio_sink.h", "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_log_factory.h", "audio/fake_audio_log_factory.cc", "audio/fake_audio_manager.cc", "audio/fake_audio_manager.h", "audio/fake_audio_output_stream.cc", "audio/fake_audio_output_stream.h", "audio/linux/audio_manager_linux.cc", "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_manager_mac.cc", "audio/mac/audio_manager_mac.h", "audio/null_audio_sink.cc", "audio/null_audio_sink.h", "audio/sample_rates.cc", "audio/sample_rates.h", "audio/scoped_task_runner_observer.cc", "audio/scoped_task_runner_observer.h", "audio/simple_sources.cc", "audio/simple_sources.h", "audio/sounds/audio_stream_handler.cc", "audio/sounds/audio_stream_handler.h", "audio/sounds/sounds_manager.cc", "audio/sounds/sounds_manager.h", "audio/sounds/wav_audio_handler.cc", "audio/sounds/wav_audio_handler.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/avrt_wrapper_win.cc", "audio/win/avrt_wrapper_win.h", "audio/win/core_audio_util_win.cc", "audio/win/core_audio_util_win.h", "audio/win/device_enumeration_win.cc", "audio/win/device_enumeration_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/audio_buffer.cc", "base/audio_buffer.h", "base/audio_buffer_queue.cc", "base/audio_buffer_queue.h", "base/audio_capturer_source.h", "base/audio_buffer_converter.cc", "base/audio_buffer_converter.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_discard_helper.cc", "base/audio_discard_helper.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_mixer.cc", "base/audio_renderer_mixer.h", "base/audio_renderer_mixer_input.cc", "base/audio_renderer_mixer_input.h", "base/audio_renderer_sink.h", "base/audio_splicer.cc", "base/audio_splicer.h", "base/audio_timestamp_helper.cc", "base/audio_timestamp_helper.h", "base/bind_to_current_loop.h", "base/bit_reader.cc", "base/bit_reader.h", "base/bit_reader_core.cc", "base/bit_reader_core.h", "base/bitstream_buffer.h", "base/buffering_state.h", "base/buffers.h", "base/byte_queue.cc", "base/byte_queue.h", "base/cdm_promise.cc", "base/cdm_promise.h", "base/channel_mixer.cc", "base/channel_mixer.h", "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/decrypt_config.cc", "base/decrypt_config.h", "base/decryptor.cc", "base/decryptor.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_keys.cc", "base/media_keys.h", "base/media_log.cc", "base/media_log.h", "base/media_log_event.h", "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.h", "base/player_tracker.cc", "base/player_tracker.h", "base/ranges.cc", "base/ranges.h", "base/sample_format.cc", "base/sample_format.h", "base/scoped_histogram_timer.h", "base/seekable_buffer.cc", "base/seekable_buffer.h", "base/serial_runner.cc", "base/serial_runner.h", "base/simd/convert_rgb_to_yuv.h", "base/simd/convert_rgb_to_yuv_c.cc", "base/simd/convert_yuv_to_rgb.h", "base/simd/convert_yuv_to_rgb_c.cc", "base/simd/filter_yuv.h", "base/simd/filter_yuv_c.cc", "base/simd/yuv_to_rgb_table.cc", "base/simd/yuv_to_rgb_table.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/text_cue.cc", "base/text_cue.h", "base/text_ranges.cc", "base/text_ranges.h", "base/text_renderer.cc", "base/text_renderer.h", "base/text_track.h", "base/text_track_config.cc", "base/text_track_config.h", "base/time_delta_interpolator.cc", "base/time_delta_interpolator.h", "base/user_input_monitor.cc", "base/user_input_monitor.h", "base/user_input_monitor_mac.cc", "base/user_input_monitor_win.cc", "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_frame_pool.cc", "base/video_frame_pool.h", "base/video_renderer.cc", "base/video_renderer.h", "base/video_rotation.h", "base/video_util.cc", "base/video_util.h", "base/yuv_convert.cc", "base/yuv_convert.h", "cdm/aes_decryptor.cc", "cdm/aes_decryptor.h", "cdm/json_web_key.cc", "cdm/json_web_key.h", "cdm/key_system_names.cc", "cdm/key_system_names.h", "cdm/player_tracker_impl.cc", "cdm/player_tracker_impl.h", "ffmpeg/ffmpeg_deleters.h", "filters/audio_clock.cc", "filters/audio_clock.h", "filters/audio_renderer_algorithm.cc", "filters/audio_renderer_algorithm.h", "filters/audio_renderer_impl.cc", "filters/audio_renderer_impl.h", "filters/chunk_demuxer.cc", "filters/chunk_demuxer.h", "filters/decoder_selector.cc", "filters/decoder_selector.h", "filters/decoder_stream.cc", "filters/decoder_stream.h", "filters/decoder_stream_traits.cc", "filters/decoder_stream_traits.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/file_data_source.cc", "filters/file_data_source.h", "filters/frame_processor.cc", "filters/frame_processor.h", "filters/gpu_video_accelerator_factories.cc", "filters/gpu_video_accelerator_factories.h", "filters/gpu_video_decoder.cc", "filters/gpu_video_decoder.h", "filters/h264_bit_reader.cc", "filters/h264_bit_reader.h", "filters/h264_parser.cc", "filters/h264_parser.h", "filters/skcanvas_video_renderer.cc", "filters/skcanvas_video_renderer.h", "filters/source_buffer_platform.cc", "filters/source_buffer_platform.h", "filters/source_buffer_stream.cc", "filters/source_buffer_stream.h", "filters/stream_parser_factory.cc", "filters/stream_parser_factory.h", "filters/video_frame_scheduler.h", "filters/video_frame_scheduler_impl.cc", "filters/video_frame_scheduler_impl.h", "filters/video_frame_scheduler_proxy.cc", "filters/video_frame_scheduler_proxy.h", "filters/video_renderer_impl.cc", "filters/video_renderer_impl.h", "filters/webvtt_util.h", "filters/wsola_internals.cc", "filters/wsola_internals.h", "midi/midi_manager.cc", "midi/midi_manager.h", "midi/midi_manager_mac.cc", "midi/midi_manager_mac.h", "midi/midi_manager_usb.cc", "midi/midi_manager_usb.h", "midi/midi_manager_win.cc", "midi/midi_manager_win.h", "midi/midi_message_queue.cc", "midi/midi_message_queue.h", "midi/midi_message_util.cc", "midi/midi_message_util.h", "midi/midi_port_info.cc", "midi/midi_port_info.h", "midi/usb_midi_descriptor_parser.cc", "midi/usb_midi_descriptor_parser.h", "midi/usb_midi_device.h", "midi/usb_midi_input_stream.cc", "midi/usb_midi_input_stream.h", "midi/usb_midi_jack.h", "midi/usb_midi_output_stream.cc", "midi/usb_midi_output_stream.h", "video/capture/fake_video_capture_device.cc", "video/capture/fake_video_capture_device.h", "video/capture/fake_video_capture_device_factory.h", "video/capture/fake_video_capture_device_factory.cc", "video/capture/file_video_capture_device.cc", "video/capture/file_video_capture_device.h", "video/capture/file_video_capture_device_factory.h", "video/capture/file_video_capture_device_factory.cc", "video/capture/linux/video_capture_device_factory_linux.cc", "video/capture/linux/video_capture_device_factory_linux.h", "video/capture/linux/video_capture_device_linux.cc", "video/capture/linux/video_capture_device_linux.h", "video/capture/linux/video_capture_device_chromeos.cc", "video/capture/linux/video_capture_device_chromeos.h", "video/capture/mac/avfoundation_glue.h", "video/capture/mac/avfoundation_glue.mm", "video/capture/mac/coremedia_glue.h", "video/capture/mac/coremedia_glue.mm", "video/capture/mac/platform_video_capturing_mac.h", "video/capture/mac/video_capture_device_avfoundation_mac.h", "video/capture/mac/video_capture_device_avfoundation_mac.mm", "video/capture/mac/video_capture_device_factory_mac.h", "video/capture/mac/video_capture_device_factory_mac.mm", "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/video_capture_device.cc", "video/capture/video_capture_device.h", "video/capture/video_capture_device_factory.cc", "video/capture/video_capture_device_factory.h", "video/capture/video_capture_types.cc", "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_factory_win.cc", "video/capture/win/video_capture_device_factory_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", "video/video_encode_accelerator.cc", "video/video_encode_accelerator.h", "formats/common/offset_byte_queue.cc", "formats/common/offset_byte_queue.h", "formats/webm/webm_audio_client.cc", "formats/webm/webm_audio_client.h", "formats/webm/webm_cluster_parser.cc", "formats/webm/webm_cluster_parser.h", "formats/webm/webm_constants.cc", "formats/webm/webm_constants.h", "formats/webm/webm_content_encodings.cc", "formats/webm/webm_content_encodings.h", "formats/webm/webm_content_encodings_client.cc", "formats/webm/webm_content_encodings_client.h", "formats/webm/webm_crypto_helpers.cc", "formats/webm/webm_crypto_helpers.h", "formats/webm/webm_info_parser.cc", "formats/webm/webm_info_parser.h", "formats/webm/webm_parser.cc", "formats/webm/webm_parser.h", "formats/webm/webm_stream_parser.cc", "formats/webm/webm_stream_parser.h", "formats/webm/webm_tracks_parser.cc", "formats/webm/webm_tracks_parser.h", "formats/webm/webm_video_client.cc", "formats/webm/webm_video_client.h", "formats/webm/webm_webvtt_parser.cc", "formats/webm/webm_webvtt_parser.h", ] configs += [ ":media_config", ] libs = [] defines = [] deps = [] include_dirs = [ "." ] if (media_use_ffmpeg) { deps += [ "//third_party/ffmpeg" ] sources += [ "base/audio_video_metadata_extractor.cc", "base/audio_video_metadata_extractor.h", "base/container_names.cc", "base/container_names.h", "base/media_file_checker.cc", "base/media_file_checker.h", "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_video_decoder.cc", "filters/ffmpeg_video_decoder.h", "filters/in_memory_url_protocol.cc", "filters/in_memory_url_protocol.h", ] if (proprietary_codecs) { sources += [ "filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc", "filters/ffmpeg_h264_to_annex_b_bitstream_converter.h", ] } } if (cpu_arch == "arm" && arm_use_neon) { defines += [ "USE_NEON" ] } if (media_use_libvpx) { sources += [ "filters/vpx_video_decoder.cc", "filters/vpx_video_decoder.h", ] deps += [ "//third_party/libvpx" ] } if (enable_browser_cdms) { sources += [ "base/browser_cdm.cc", "base/browser_cdm.h", "base/browser_cdm_factory.h", ] } if (!is_android) { sources += [ "filters/opus_audio_decoder.cc", "filters/opus_audio_decoder.h", ] } else { sources += [ "audio/android/audio_manager_android.cc", "audio/android/audio_manager_android.h", "audio/android/audio_record_input.cc", "audio/android/audio_record_input.h", "audio/android/opensles_input.cc", "audio/android/opensles_input.h", "audio/android/opensles_output.cc", "audio/android/opensles_output.h", "audio/android/opensles_wrapper.cc", "base/android/demuxer_android.h", "base/android/demuxer_stream_player_params.cc", "base/android/demuxer_stream_player_params.h", "base/android/media_player_manager.h", "base/android/media_resource_getter.cc", "base/android/media_resource_getter.h", "base/media_stub.cc", "midi/midi_manager_android.cc", "midi/usb_midi_device_android.cc", "midi/usb_midi_device_android.h", "midi/usb_midi_device_factory_android.cc", "midi/usb_midi_device_factory_android.h", "video/capture/android/video_capture_device_android.cc", "video/capture/android/video_capture_device_android.h", "video/capture/android/video_capture_device_factory_android.cc", "video/capture/android/video_capture_device_factory_android.h", ] defines += [ "DISABLE_USER_INPUT_MONITOR" ] deps += [ ":media_android_jni_headers", ":player_android", ":video_capture_android_jni_headers", ] if (!is_android_webview_build) { deps += [ ":media_java" ] } } if (is_chromeos) { # A simple WebM encoder for animated avatars on ChromeOS. sources += [ "formats/webm/chromeos/ebml_writer.cc", "formats/webm/chromeos/ebml_writer.h", "formats/webm/chromeos/webm_encoder.cc", "formats/webm/chromeos/webm_encoder.h", ] deps += [ "//third_party/libvpx", "//third_party/libyuv" ] # For VaapiVideoEncodeAccelerator. if (cpu_arch != "arm" && use_x11) { sources += [ "filters/h264_bitstream_buffer.cc", "filters/h264_bitstream_buffer.h", ] } } if (!is_ios) { deps += [ "//third_party/libyuv" ] } if (use_alsa) { libs += [ "asound" ] defines += [ "USE_ALSA" ] sources += [ "audio/alsa/alsa_input.cc", "audio/alsa/alsa_input.h", "audio/alsa/alsa_output.cc", "audio/alsa/alsa_output.h", "audio/alsa/alsa_util.cc", "audio/alsa/alsa_util.h", "audio/alsa/alsa_wrapper.cc", "audio/alsa/alsa_wrapper.h", "audio/alsa/audio_manager_alsa.cc", "audio/alsa/audio_manager_alsa.h", "midi/midi_manager_alsa.cc", "midi/midi_manager_alsa.h", ] } if (is_openbsd) { sources += [ "audio/openbsd/audio_manager_openbsd.cc", "audio/openbsd/audio_manager_openbsd.h", ] } # A simple WebM encoder for animated avatars on ChromeOS. if (is_linux) { if (use_x11) { configs += [ "//build/config/linux:x11", "//build/config/linux:xext", # TODO(ajwong): Why does xent get a separate thing in //build/config/linux:BUILD.gn # "//build/config/linux:xdamage", # "//build/config/linux:xfixes", # "//build/config/linux:xtst", ] sources += [ "base/user_input_monitor_linux.cc" ] } else { defines += [ "DISABLE_USER_INPUT_MONITOR" ] } if (use_cras) { pkg_config("libcras") { packages = [ "libcras" ] } configs += [ "libcras" ] sources += [ "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", ] } } if (use_ozone) { platform_list_txt_file = "$target_gen_dir/ui/ozone/platform_list.txt" constructor_list_cc_file = "$target_gen_dir/media/ozone/constructor_list.cc" # Used for the generated listing header (ui/ozone/platform_list.h) include_dirs += [ target_gen_dir ] sources += [ constructor_list_cc_file, "ozone/media_ozone_platform.cc", "ozone/media_ozone_platform.h", ] deps += [ "//ui/ozone/ozone" ] action("generate_constructor_list") { # Ozone platform objects are auto-generated using similar # patterns for naming and classes constructors. Here we build the # object MediaOzonePlatform. script = "../ui/ozone/generate_constructor_list.py" sources = [ platform_list_txt_file ] outputs = [ constructor_list_cc_file ] args += [ "--platform_list=$platform_list_txt_file", "--output_cc=$constructor_list_cc_file", "--namespace=media", "--typename=MediaOzonePlatform", "--include=\"media/ozone/media_ozone_platform.h\"" ] } } if (use_pulseaudio) { 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") } sources += [ "audio/pulse/audio_manager_pulse.cc", "audio/pulse/audio_manager_pulse.h", "audio/pulse/pulse_input.cc", "audio/pulse/pulse_input.h", "audio/pulse/pulse_output.cc", "audio/pulse/pulse_output.h", "audio/pulse/pulse_util.cc", "audio/pulse/pulse_util.h", ] } if (is_mac) { libs += [ "AudioToolbox.framework", "AudioUnit.framework", "CoreAudio.framework", "CoreMIDI.framework", "CoreVideo.framework", "OpenGL.framework", "QTKit.framework", ] } if (is_win) { libs += [ "mf.lib", "mfplat.lib", "mfreadwrite.lib", "mfuuid.lib", ] cflags += [ "/wd4267" # TODO(wolenetz): Fix size_t to int trunctaion in win64. See # http://crbug.com/171009 ] configs += [ ":media_dependent_config" ] all_dependent_configs = [ ":media_dependent_config" ] } if (proprietary_codecs) { sources += [ "formats/mp2t/es_adapter_video.cc", "formats/mp2t/es_adapter_video.h", "formats/mp2t/es_parser.h", "formats/mp2t/es_parser_adts.cc", "formats/mp2t/es_parser_adts.h", "formats/mp2t/es_parser_h264.cc", "formats/mp2t/es_parser_h264.h", "formats/mp2t/mp2t_common.h", "formats/mp2t/mp2t_stream_parser.cc", "formats/mp2t/mp2t_stream_parser.h", "formats/mp2t/ts_packet.cc", "formats/mp2t/ts_packet.h", "formats/mp2t/ts_section.h", "formats/mp2t/ts_section_pat.cc", "formats/mp2t/ts_section_pat.h", "formats/mp2t/ts_section_pes.cc", "formats/mp2t/ts_section_pes.h", "formats/mp2t/ts_section_pmt.cc", "formats/mp2t/ts_section_pmt.h", "formats/mp2t/ts_section_psi.cc", "formats/mp2t/ts_section_psi.h", "formats/mp4/aac.cc", "formats/mp4/aac.h", "formats/mp4/avc.cc", "formats/mp4/avc.h", "formats/mp4/box_definitions.cc", "formats/mp4/box_definitions.h", "formats/mp4/box_reader.cc", "formats/mp4/box_reader.h", "formats/mp4/cenc.cc", "formats/mp4/cenc.h", "formats/mp4/es_descriptor.cc", "formats/mp4/es_descriptor.h", "formats/mp4/mp4_stream_parser.cc", "formats/mp4/mp4_stream_parser.h", "formats/mp4/sample_to_group_iterator.cc", "formats/mp4/sample_to_group_iterator.h", "formats/mp4/track_run_iterator.cc", "formats/mp4/track_run_iterator.h", "formats/mpeg/adts_constants.cc", "formats/mpeg/adts_constants.h", "formats/mpeg/adts_stream_parser.cc", "formats/mpeg/adts_stream_parser.h", "formats/mpeg/mp3_stream_parser.cc", "formats/mpeg/mp3_stream_parser.h", "formats/mpeg/mpeg_audio_stream_parser_base.cc", "formats/mpeg/mpeg_audio_stream_parser_base.h", ] } if (cpu_arch == "x86" || cpu_arch == "x64") { sources += [ "base/simd/convert_yuv_to_rgb_x86.cc" ] deps += [ ":media_yasm", ":media_mmx", ":media_sse2", ] } if (is_linux || is_win) { sources += [ "base/keyboard_event_counter.cc", "base/keyboard_event_counter.h", ] } deps += [ ":shared_memory_support", "//base", "//base:i18n", "//base/third_party/dynamic_annotations", "//crypto", "//crypto:platform", # TODO(ajwong): This used to be provided by crypto.gyp via export_dependent_settings "//gpu/command_buffer/common", "//skia", "//third_party/opus", "//ui/events:events_base", "//ui/gfx", "//ui/gfx/geometry", "//url", ] } test("media_unittests") { sources = [ "audio/android/audio_android_unittest.cc", "audio/audio_input_controller_unittest.cc", "audio/audio_input_unittest.cc", "audio/audio_manager_unittest.cc", "audio/audio_output_controller_unittest.cc", "audio/audio_output_device_unittest.cc", "audio/audio_output_proxy_unittest.cc", "audio/audio_parameters_unittest.cc", "audio/audio_power_monitor_unittest.cc", "audio/fake_audio_consumer_unittest.cc", "audio/mac/audio_auhal_mac_unittest.cc", "audio/mac/audio_device_listener_mac_unittest.cc", "audio/mac/audio_low_latency_input_mac_unittest.cc", "audio/simple_sources_unittest.cc", "audio/sounds/audio_stream_handler_unittest.cc", "audio/sounds/sounds_manager_unittest.cc", "audio/sounds/test_data.cc", "audio/sounds/test_data.h", "audio/sounds/wav_audio_handler_unittest.cc", "audio/virtual_audio_input_stream_unittest.cc", "audio/virtual_audio_output_stream_unittest.cc", "audio/win/audio_device_listener_win_unittest.cc", "audio/win/audio_low_latency_input_win_unittest.cc", "audio/win/audio_low_latency_output_win_unittest.cc", "audio/win/audio_output_win_unittest.cc", "audio/win/core_audio_util_win_unittest.cc", "base/android/media_codec_bridge_unittest.cc", "base/android/media_drm_bridge_unittest.cc", "base/android/media_source_player_unittest.cc", "base/audio_buffer_converter_unittest.cc", "base/audio_buffer_unittest.cc", "base/audio_buffer_queue_unittest.cc", "base/audio_bus_unittest.cc", "base/audio_converter_unittest.cc", "base/audio_discard_helper_unittest.cc", "base/audio_fifo_unittest.cc", "base/audio_hardware_config_unittest.cc", "base/audio_hash_unittest.cc", "base/audio_pull_fifo_unittest.cc", "base/audio_renderer_mixer_input_unittest.cc", "base/audio_renderer_mixer_unittest.cc", "base/audio_splicer_unittest.cc", "base/audio_timestamp_helper_unittest.cc", "base/bind_to_current_loop_unittest.cc", "base/bit_reader_unittest.cc", "base/callback_holder.h", "base/callback_holder_unittest.cc", "base/channel_mixer_unittest.cc", "base/data_buffer_unittest.cc", "base/decoder_buffer_queue_unittest.cc", "base/decoder_buffer_unittest.cc", "base/djb2_unittest.cc", "base/gmock_callback_support_unittest.cc", "base/multi_channel_resampler_unittest.cc", "base/pipeline_unittest.cc", "base/ranges_unittest.cc", "base/run_all_unittests.cc", "base/scoped_histogram_timer_unittest.cc", "base/serial_runner_unittest.cc", "base/seekable_buffer_unittest.cc", "base/sinc_resampler_unittest.cc", "base/stream_parser_unittest.cc", "base/text_ranges_unittest.cc", "base/text_renderer_unittest.cc", "base/user_input_monitor_unittest.cc", "base/vector_math_testing.h", "base/vector_math_unittest.cc", "base/video_frame_unittest.cc", "base/video_frame_pool_unittest.cc", "base/video_util_unittest.cc", "base/yuv_convert_unittest.cc", "cdm/aes_decryptor_unittest.cc", "cdm/json_web_key_unittest.cc", "filters/audio_clock_unittest.cc", "filters/audio_decoder_selector_unittest.cc", "filters/audio_renderer_algorithm_unittest.cc", "filters/audio_renderer_impl_unittest.cc", "filters/chunk_demuxer_unittest.cc", "filters/decrypting_audio_decoder_unittest.cc", "filters/decrypting_demuxer_stream_unittest.cc", "filters/decrypting_video_decoder_unittest.cc", "filters/fake_demuxer_stream.cc", "filters/fake_demuxer_stream.h", "filters/fake_demuxer_stream_unittest.cc", "filters/fake_video_decoder.cc", "filters/fake_video_decoder.h", "filters/fake_video_decoder_unittest.cc", "filters/file_data_source_unittest.cc", "filters/frame_processor_unittest.cc", "filters/h264_bit_reader_unittest.cc", "filters/h264_parser_unittest.cc", "filters/skcanvas_video_renderer_unittest.cc", "filters/source_buffer_stream_unittest.cc", "filters/video_decoder_selector_unittest.cc", "filters/video_frame_scheduler_impl_unittest.cc", "filters/video_frame_scheduler_unittest.cc", "filters/video_frame_stream_unittest.cc", "filters/video_renderer_impl_unittest.cc", "midi/midi_manager_unittest.cc", "midi/midi_manager_usb_unittest.cc", "midi/midi_message_queue_unittest.cc", "midi/midi_message_util_unittest.cc", "midi/usb_midi_descriptor_parser_unittest.cc", "midi/usb_midi_input_stream_unittest.cc", "midi/usb_midi_output_stream_unittest.cc", "video/capture/fake_video_capture_device_unittest.cc", "video/capture/video_capture_device_unittest.cc", "formats/common/offset_byte_queue_unittest.cc", "formats/webm/cluster_builder.cc", "formats/webm/cluster_builder.h", "formats/webm/tracks_builder.cc", "formats/webm/tracks_builder.h", "formats/webm/webm_cluster_parser_unittest.cc", "formats/webm/webm_content_encodings_client_unittest.cc", "formats/webm/webm_parser_unittest.cc", "formats/webm/webm_tracks_parser_unittest.cc", "formats/webm/webm_webvtt_parser_unittest.cc", ] if (media_use_ffmpeg) { sources += [ "base/audio_video_metadata_extractor_unittest.cc", "base/media_file_checker_unittest.cc", ] } if (!is_android) { sources += [ "audio/audio_input_volume_unittest.cc", "base/container_names_unittest.cc", "ffmpeg/ffmpeg_common_unittest.cc", "filters/audio_decoder_unittest.cc", "filters/audio_file_reader_unittest.cc", "filters/blocking_url_protocol_unittest.cc", "filters/ffmpeg_demuxer_unittest.cc", "filters/ffmpeg_glue_unittest.cc", "filters/ffmpeg_video_decoder_unittest.cc", "filters/in_memory_url_protocol_unittest.cc", "filters/pipeline_integration_test.cc", "filters/pipeline_integration_test_base.cc", ] } else { # TODO(ajwong): Blocked on android. # deps += [ # ":player_android", # "//testing/android:native_test_native_code" # ] } if (is_linux && use_cras) { sources += [ "audio/cras/cras_input_unittest.cc", "audio/cras/cras_unified_unittest.cc", ] } if (cpu_arch != "arm" && is_chromeos && use_x11) { sources += [ "filters/h264_bitstream_buffer_unittest.cc" ] } if (use_alsa) { sources += [ "audio/alsa/alsa_output_unittest.cc", "audio/audio_low_latency_input_output_unittest.cc", ] } if (cpu_arch == "x86" || cpu_arch == "x64") { sources += [ "base/simd/convert_rgb_to_yuv_unittest.cc" ] } if (proprietary_codecs) { sources += [ "filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc", "filters/h264_to_annex_b_bitstream_converter_unittest.cc", "formats/common/stream_parser_test_base.cc", "formats/common/stream_parser_test_base.h", "formats/mp2t/es_adapter_video_unittest.cc", "formats/mp2t/es_parser_h264_unittest.cc", "formats/mp2t/mp2t_stream_parser_unittest.cc", "formats/mp4/aac_unittest.cc", "formats/mp4/avc_unittest.cc", "formats/mp4/box_reader_unittest.cc", "formats/mp4/es_descriptor_unittest.cc", "formats/mp4/mp4_stream_parser_unittest.cc", "formats/mp4/sample_to_group_iterator_unittest.cc", "formats/mp4/track_run_iterator_unittest.cc", "formats/mpeg/adts_stream_parser_unittest.cc", "formats/mpeg/mp3_stream_parser_unittest.cc", ] } if (is_win && cpu_arch == "x64") { cflags += [ "/wd4267" # TODO(wolenetz): Fix size_t to int trunctaion in win64. See # http://crbug.com/171009 ] } if (is_mac) { sources += [ "video/capture/mac/video_capture_device_factory_mac_unittest.mm" ] } # include_dirs += [ # # Needed by media_drm_bridge.cc. # target_gen_dir, # ], configs += [ ":media_config" ] # TODO(ajwong): This was in the original gyp, but it seems silly. # ['os_posix==1 and OS!="mac"', { # 'conditions': [ # ['use_allocator!="none"', { # 'dependencies': [ # '../base/allocator/allocator.gyp:allocator', # ], # }], # ], # }], deps = [ ":media", ":media_test_support", "//base/test:test_support", "//skia", # Direct dependency required to inherit config. "//testing/gmock", "//testing/gtest", # TODO(dalecurtis): Port the rest of Widevine stuff. "//third_party/widevine/cdm:version_h", "//ui/base", "//ui/gfx:gfx_test_support", ] if (media_use_ffmpeg) { deps += [ "//third_party/ffmpeg", # Direct dependency required to inherit config. ] } } test("media_perftests") { sources = [ "base/audio_bus_perftest.cc", "base/audio_converter_perftest.cc", "base/run_all_perftests.cc", "base/sinc_resampler_perftest.cc", "base/vector_math_perftest.cc", "base/yuv_convert_perftest.cc", ] if (media_use_ffmpeg) { sources += [ "base/demuxer_perftest.cc", "filters/pipeline_integration_perftest.cc", "filters/pipeline_integration_test_base.cc", ] } configs += [ ":media_config" ] deps = [ ":media", ":media_test_support", ":shared_memory_support", "//base/test:test_support", "//testing/gmock", "//testing/gtest", "//testing/perf", "//third_party/widevine/cdm:version_h", "//ui/gl", "//ui/gfx:gfx_test_support", ] if (media_use_ffmpeg) { deps += [ "//third_party/ffmpeg", # Direct dependency required to inherit config. ] } } if (cpu_arch == "x86" || cpu_arch == "x64") { source_set("media_mmx") { sources = [ "base/simd/filter_yuv_mmx.cc" ] configs += [ ":media_config" ] cflags = [ "-mmmx" ] } source_set("media_sse2") { sources = [ "base/simd/convert_rgb_to_yuv_sse2.cc", "base/simd/convert_rgb_to_yuv_ssse3.cc", "base/simd/filter_yuv_sse2.cc", ] configs += [ ":media_config" ] cflags = [ "-msse2" ] } import("//third_party/yasm/yasm_assemble.gni") yasm_assemble("media_yasm") { sources = [ "base/simd/convert_rgb_to_yuv_ssse3.asm", "base/simd/convert_yuv_to_rgb_mmx.asm", "base/simd/convert_yuv_to_rgb_sse.asm", "base/simd/convert_yuva_to_argb_mmx.asm", "base/simd/empty_register_state_mmx.asm", "base/simd/linear_scale_yuv_to_rgb_mmx.asm", "base/simd/linear_scale_yuv_to_rgb_sse.asm", "base/simd/scale_yuv_to_rgb_mmx.asm", "base/simd/scale_yuv_to_rgb_sse.asm", ] # TODO(ajwong): Only export if shared_library build... yasm_flags = [ "-DCHROMIUM", "-DEXPORT_SYMBOLS", # In addition to the same path as source asm, let yasm %include # search path be relative to src/ per Chromium policy. "-I", rebase_path("..", root_build_dir), ] inputs = [ "//third_party/x86inc/x86inc.asm", "base/simd/convert_rgb_to_yuv_ssse3.inc", "base/simd/convert_yuv_to_rgb_mmx.inc", "base/simd/convert_yuva_to_argb_mmx.inc", "base/simd/linear_scale_yuv_to_rgb_mmx.inc", "base/simd/media_export.asm", "base/simd/scale_yuv_to_rgb_mmx.inc", ] if (cpu_arch == "x86") { yasm_flags += [ "-DARCH_X86_32" ] } else if (cpu_arch == "x64") { yasm_flags += [ "-DARCH_X86_64" ] sources += [ "base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm", "base/simd/scale_yuv_to_rgb_sse2_x64.asm", ] } if (is_mac) { yasm_flags += [ "-DPREFIX", "-DMACHO", ] } else { if (is_posix) { yasm_flags += [ "-DELF" ] if (cpu_arch == "x64") { # TODO(ajwong): Why isn't this true in mac? yasm_flags += [ "-DPIC" ] } } } } } source_set("media_test_support") { sources = [ "audio/mock_audio_manager.cc", "audio/mock_audio_manager.h", "audio/mock_audio_source_callback.cc", "audio/mock_audio_source_callback.h", "audio/test_audio_input_controller_factory.cc", "audio/test_audio_input_controller_factory.h", "base/fake_audio_render_callback.cc", "base/fake_audio_render_callback.h", "base/fake_audio_renderer_sink.cc", "base/fake_audio_renderer_sink.h", "base/fake_text_track_stream.cc", "base/fake_text_track_stream.h", "base/gmock_callback_support.h", "base/mock_audio_renderer_sink.cc", "base/mock_audio_renderer_sink.h", "base/mock_demuxer_host.cc", "base/mock_demuxer_host.h", "base/mock_filters.cc", "base/mock_filters.h", "base/test_data_util.cc", "base/test_data_util.h", "base/test_helpers.cc", "base/test_helpers.h", "filters/clockless_video_frame_scheduler.cc", "filters/clockless_video_frame_scheduler.h", "filters/mock_gpu_video_accelerator_factories.cc", "filters/mock_gpu_video_accelerator_factories.h", "filters/test_video_frame_scheduler.cc", "filters/test_video_frame_scheduler.h", "video/mock_video_decode_accelerator.cc", "video/mock_video_decode_accelerator.h", ] deps = [ ":media", ":shared_memory_support", "//base", "//skia", "//testing/gmock", "//testing/gtest", ] } component("shared_memory_support") { sources = [ "audio/audio_parameters.cc", "audio/audio_parameters.h", "base/audio_bus.cc", "base/audio_bus.h", "base/channel_layout.cc", "base/channel_layout.h", "base/limits.h", "base/media_export.h", "base/vector_math.cc", "base/vector_math.h", ] configs += [ ":media_config" ] deps = [ "//base" ] } if (media_use_ffmpeg) { test("ffmpeg_unittests") { sources = [ "ffmpeg/ffmpeg_unittest.cc" ] deps = [ ":media", ":media_test_support", "//base", "//base:i18n", "//base/test:test_support", "//testing/gtest", "//third_party/ffmpeg", "//ui/gfx:gfx_test_support", ] } test("ffmpeg_regression_tests") { sources = [ "base/run_all_unittests.cc", "ffmpeg/ffmpeg_regression_tests.cc", "filters/pipeline_integration_test_base.cc", ] configs += [ ":media_config" ] deps = [ ":media", ":media_test_support", "//base/test:test_support", "//testing/gmock", "//testing/gtest", "//third_party/ffmpeg", "//ui/gfx/geometry", "//ui/gfx:gfx_test_support", ] # TODO(ajwong): This was in the original gyp, but it seems silly. # ['os_posix==1 and OS!="mac"', { # 'conditions': [ # ['use_allocator!="none"', { # 'dependencies': [ # '../base/allocator/allocator.gyp:allocator', # ], # }], # ], # }], } } if (use_x11) { executable("player_x11") { sources = [ "tools/player_x11/data_source_logger.cc", "tools/player_x11/data_source_logger.h", "tools/player_x11/gl_video_renderer.cc", "tools/player_x11/gl_video_renderer.h", "tools/player_x11/player_x11.cc", "tools/player_x11/x11_video_renderer.cc", "tools/player_x11/x11_video_renderer.h", ] configs += [ ":media_config", "//build/config/linux:x11", "//build/config/linux:xext", # TODO(ajwong): Why does xext get a separate thing in //build/config/linux:BUILD.gn # "//build/config/linux:xrender", ] deps = [ ":media", ":shared_memory_support", "//base", "//ui/gl", "//ui/gfx", "//ui/gfx/geometry", ] } } if (is_android) { import("//build/config/android/rules.gni") source_set("player_android") { configs += [ ":media_config" ] sources = [ "base/android/audio_decoder_job.cc", "base/android/audio_decoder_job.h", "base/android/browser_cdm_factory_android.cc", "base/android/media_codec_bridge.cc", "base/android/media_codec_bridge.h", "base/android/media_decoder_job.cc", "base/android/media_decoder_job.h", "base/android/media_drm_bridge.cc", "base/android/media_drm_bridge.h", "base/android/media_jni_registrar.cc", "base/android/media_jni_registrar.h", "base/android/media_player_android.cc", "base/android/media_player_android.h", "base/android/media_player_bridge.cc", "base/android/media_player_bridge.h", "base/android/media_player_listener.cc", "base/android/media_player_listener.h", "base/android/media_source_player.cc", "base/android/media_source_player.h", "base/android/video_decoder_job.cc", "base/android/video_decoder_job.h", "base/android/webaudio_media_codec_bridge.cc", "base/android/webaudio_media_codec_bridge.h", "base/android/webaudio_media_codec_info.h", ] deps = [ ":media_android_jni_headers", "//base", "//third_party/widevine/cdm:version_h", "//ui/gl", "//url" ] } generate_jni("media_android_jni_headers") { sources = [ "base/android/java/src/org/chromium/media/AudioManagerAndroid.java", "base/android/java/src/org/chromium/media/AudioRecordInput.java", "base/android/java/src/org/chromium/media/MediaCodecBridge.java", "base/android/java/src/org/chromium/media/MediaDrmBridge.java", "base/android/java/src/org/chromium/media/MediaPlayerBridge.java", "base/android/java/src/org/chromium/media/MediaPlayerListener.java", "base/android/java/src/org/chromium/media/UsbMidiDeviceAndroid.java", "base/android/java/src/org/chromium/media/UsbMidiDeviceFactoryAndroid.java", "base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java", ] jni_package = "media" } generate_jni("video_capture_android_jni_headers") { sources = [ "base/android/java/src/org/chromium/media/VideoCapture.java", "base/android/java/src/org/chromium/media/VideoCaptureFactory.java", ] jni_package = "media" } android_library("media_java") { srcjar_deps = [ ":media_android_imageformat_list", ] java_files = [] } java_cpp_template("media_android_imageformat_list") { sources = [ "base/android/java/src/org/chromium/media/ImageFormat.template", ] inputs = [ "video/capture/android/imageformat_list.h" ] package_name = "org/chromium/media" } # TODO(dalecurtis): Finish media_unittests_apk and media_perftests_apk. }