# Copyright (c) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("../../config.gni") import("../../ressche_part.gni") pulseaudio_dir = "//third_party/pulseaudio" pulseaudio_build_path = "//third_party/pulseaudio/ohosbuild" group("audio_service_packages") { deps = [ ":audio_common", ":audio_service", ":audio_service_init", ] } ohos_shared_library("audio_common") { sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "../../cfi_blocklist.txt" } install_enable = true include_dirs = [ "common/include", "../../interfaces/inner_api/native/audiocommon/include", ] sources = [ "common/src/audio_process_config.cpp", "common/src/linear_pos_time_model.cpp", "common/src/oh_audio_buffer.cpp", ] cflags = [ "-Wall", "-Werror", ] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "../../frameworks/native/audioutils:audio_utils" ] external_deps = [ "c_utils:utils", "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_single", ] subsystem_name = "multimedia" innerapi_tags = [ "platformsdk_indirect" ] part_name = "audio_framework" } config("audio_client_public_config") { include_dirs = [ "client/include", "common/include", "../audio_policy/client/include", "../audio_policy/common/include", "../../frameworks/native/audiopolicy/include", "../../frameworks/native/audiostream/include", "../../frameworks/native/audioutils/include", "../../interfaces/inner_api/native/audiocapturer/include", "../../interfaces/inner_api/native/audiocommon/include", "../../interfaces/inner_api/native/audiomanager/include", "../../interfaces/inner_api/native/audiorenderer/include", ] cflags = [ "-Wall", "-Werror", ] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } } ohos_shared_library("audio_client") { sanitize = { cfi = true cfi_cross_dso = true integer_overflow = true debug = false blocklist = "../../cfi_blocklist.txt" } install_enable = true sources = [ "client/src/audio_device_descriptor.cpp", "client/src/audio_group_manager.cpp", "client/src/audio_manager_listener_stub.cpp", "client/src/audio_manager_proxy.cpp", "client/src/audio_process_in_client.cpp", "client/src/audio_process_proxy.cpp", "client/src/audio_routing_manager.cpp", "client/src/audio_service_client.cpp", "client/src/audio_stream.cpp", "client/src/audio_stream_manager.cpp", "client/src/audio_stream_tracker.cpp", "client/src/audio_system_manager.cpp", "client/src/fast_audio_stream.cpp", "client/src/i_audio_stream.cpp", "client/src/policy_provider_stub.cpp", ] public_configs = [ ":audio_client_public_config" ] deps = [ ":audio_common", "$pulseaudio_build_path/src/pulse:pulse", "../../frameworks/native/audioutils:audio_utils", "../audio_policy:audio_policy_client", ] include_dirs = [ "server/include", "$pulseaudio_dir/src", "$pulseaudio_dir/confgure/src", "$pulseaudio_dir/include", "$pulseaudio_build_path/include", "../../../../foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "../../../../utils/system/safwk/native/include", "../../../../commonlibrary/c_utils/base/include", "//third_party/bounds_checking_function/include", ] include_dirs += [ multimedia_audio_framework_pulse_audio ] external_deps = [ "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "eventhandler:libeventhandler", "hilog:libhilog", "hisysevent:libhisysevent", "ipc:ipc_single", "samgr:samgr_proxy", ] version_script = "../../audio_framework.versionscript" innerapi_tags = [ "platformsdk" ] subsystem_name = "multimedia" part_name = "audio_framework" } ohos_prebuilt_etc("audio_service_init") { source = "etc/pulseaudio.cfg" relative_install_dir = "init" part_name = "audio_framework" subsystem_name = "multimedia" } config("audio_service_config") { visibility = [ ":*" ] visibility += [ "../../test/fuzztest/*" ] include_dirs = [ "common/include", "client/include", "server/include", "../audio_policy/server/include/service/effect", "../../frameworks/native/audioeffect/include", "../../frameworks/native/audiopolicy/include", "../../frameworks/native/audioschedule/include", "../../frameworks/native/audioutils/include", "../../frameworks/native/playbackcapturer/include", "../../frameworks/native/hdiadapter/sink/bluetooth", "../../frameworks/native/hdiadapter/sink/common", "../../frameworks/native/hdiadapter/sink/file", "../../frameworks/native/hdiadapter/sink/fast", "../../frameworks/native/hdiadapter/sink/remote", "../../frameworks/native/hdiadapter/sink/remote_fast", "../../frameworks/native/hdiadapter/sink/primary", "../../frameworks/native/hdiadapter/source/common", "../../frameworks/native/hdiadapter/source/fast", "../../frameworks/native/hdiadapter/source/primary", "../../frameworks/native/hdiadapter/source/remote_fast", "../../interfaces/inner_api/native/audiocommon/include", "../../interfaces/inner_api/native/audiomanager/include", ] include_dirs += [ multimedia_audio_framework_drivers ] if (target_cpu == "arm") { cflags = [ "-DBINDER_IPC_32BIT" ] } } ohos_shared_library("audio_process_service") { sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "../../cfi_blocklist.txt" } install_enable = true sources = [ "server/src/audio_endpoint.cpp", "server/src/audio_process_in_server.cpp", "server/src/audio_process_stub.cpp", "server/src/audio_service.cpp", "server/src/policy_handler.cpp", "server/src/policy_provider_proxy.cpp", ] configs = [ ":audio_service_config" ] deps = [ ":audio_common", "../../frameworks/native/audioschedule:audio_schedule", "../../frameworks/native/audioutils:audio_utils", "../../frameworks/native/hdiadapter/sink:fast_audio_renderer_sink", "../../frameworks/native/hdiadapter/sink:remote_audio_renderer_sink", "../../frameworks/native/hdiadapter/sink:remote_fast_audio_renderer_sink", "../../frameworks/native/hdiadapter/source:fast_audio_capturer_source", "../../frameworks/native/hdiadapter/source:remote_fast_audio_capturer_source", ] public_deps = [ "//third_party/bounds_checking_function:libsec_static" ] external_deps = [ "c_utils:utils", "hicollie:libhicollie", "hilog:libhilog", "ipc:ipc_single", ] subsystem_name = "multimedia" part_name = "audio_framework" } ohos_shared_library("audio_service") { sanitize = { cfi = true cfi_cross_dso = true debug = false blocklist = "../../cfi_blocklist.txt" } install_enable = true sources = [ "server/src/audio_effect_server.cpp", "server/src/audio_manager_listener_proxy.cpp", "server/src/audio_manager_stub.cpp", "server/src/audio_server.cpp", ] configs = [ ":audio_service_config" ] deps = [ ":audio_common", ":audio_process_service", "$pulseaudio_build_path/src/daemon:pulseaudio", "../../frameworks/native/audioeffect:audio_effect", "../../frameworks/native/audioschedule:audio_schedule", "../../frameworks/native/audioutils:audio_utils", "../../frameworks/native/hdiadapter/sink:audio_renderer_sink", "../../frameworks/native/hdiadapter/sink:bluetooth_renderer_sink", "../../frameworks/native/hdiadapter/sink:remote_audio_renderer_sink", "../../frameworks/native/hdiadapter/sink:remote_fast_audio_renderer_sink", "../../frameworks/native/hdiadapter/sink:renderer_sink_adapter", "../../frameworks/native/hdiadapter/source:audio_capturer_source", "../../frameworks/native/hdiadapter/source:capturer_source_adapter", "../../frameworks/native/playbackcapturer:playback_capturer", ] external_deps = [ "access_token:libaccesstoken_sdk", "c_utils:utils", "hicollie:libhicollie", "hilog:libhilog", "ipc:ipc_single", "power_manager:powermgr_client", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (ressche_enable == true) { external_deps += [ "resource_schedule_service:ressched_client" ] } subsystem_name = "multimedia" part_name = "audio_framework" } group("audio_service_test_packages") { deps = [ ":audio_hdi_device_test", ":audio_multichannel_test", ":audio_process_client_test", ":audio_service_playback_test", ":audio_service_record_test", ] } ohos_executable("audio_process_client_test") { install_enable = false include_dirs = [ "../../frameworks/native/audioutils/include", "../../interfaces/inner_api/native/audiocommon/include", "client/include", ] sources = [ "test/example/audio_process_client_test.cpp" ] deps = [ ":audio_client", "./../../frameworks/native/audioutils:audio_utils", ] external_deps = [ "c_utils:utils", "hilog:libhilog", "init:libbegetutil", ] part_name = "audio_framework" subsystem_name = "multimedia" } ohos_executable("audio_hdi_device_test") { install_enable = false include_dirs = [ "../../frameworks/native/audioutils/include", "../../frameworks/native/hdiadapter/sink", "../../frameworks/native/hdiadapter/sink/common", "../../frameworks/native/hdiadapter/sink/fast", "../../interfaces/inner_api/native/audiocommon/include", ] include_dirs += [ multimedia_audio_framework_drivers ] cflags = [ "-DDEBUG_DIRECT_USE_HDI" ] sources = [ "../../frameworks/native/hdiadapter/sink/remote_fast/remote_fast_audio_renderer_sink.cpp", "test/example/audio_hdi_device_test.cpp", ] deps = [ "../../frameworks/native/audioutils:audio_utils", "../../frameworks/native/hdiadapter/sink:fast_audio_renderer_sink", "../../frameworks/native/hdiadapter/sink:remote_fast_audio_renderer_sink", ] external_deps = [ "c_utils:utils", "hilog:libhilog", "power_manager:powermgr_client", ] part_name = "audio_framework" subsystem_name = "multimedia" } ohos_executable("audio_service_playback_test") { install_enable = false sources = [ "test/example/playback_test.cpp" ] configs = [ ":audio_client_public_config" ] deps = [ ":audio_client" ] include_dirs = [ "$pulseaudio_build_path/include", "$pulseaudio_dir/confgure/src", "$pulseaudio_dir/include", "$pulseaudio_dir/src", "../../../../commonlibrary/c_utils/base/include", "../../../../foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "../../../../utils/system/safwk/native/include", "//third_party/bounds_checking_function/include", ] external_deps = [ "hilog:libhilog", "ipc:ipc_single", ] part_name = "audio_framework" subsystem_name = "multimedia" } ohos_executable("audio_faststream_playback_test") { install_enable = false sources = [ "test/example/fast_audio_stream_playback_test.cpp" ] configs = [ ":audio_client_public_config" ] deps = [ ":audio_client", "../../frameworks/native/audiocapturer:audio_capturer", "../../frameworks/native/audiorenderer:audio_renderer", ] include_dirs = [ "../../../../foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "../../../../utils/system/safwk/native/include", "../../../../commonlibrary/c_utils/base/include", "$pulseaudio_dir/src", "$pulseaudio_dir/confgure/src", "$pulseaudio_dir/include", "$pulseaudio_build_path/include", "//third_party/bounds_checking_function/include", ] external_deps = [ "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", ] part_name = "audio_framework" subsystem_name = "multimedia" } ohos_executable("audio_service_record_test") { install_enable = false sources = [ "test/example/record_test.cpp" ] configs = [ ":audio_client_public_config" ] include_dirs = [ "$pulseaudio_build_path/include", "$pulseaudio_dir/confgure/src", "$pulseaudio_dir/include", "$pulseaudio_dir/src", "../../../../commonlibrary/c_utils/base/include", "../../../../foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "../../../../utils/system/safwk/native/include", "//third_party/bounds_checking_function/include", ] deps = [ ":audio_client" ] external_deps = [ "hilog:libhilog", "ipc:ipc_single", ] part_name = "audio_framework" subsystem_name = "multimedia" } ohos_executable("audio_multichannel_test") { install_enable = false sources = [ "test/example/audio_multichannel_test.cpp" ] configs = [ ":audio_client_public_config" ] include_dirs = [ "$pulseaudio_build_path/include", "$pulseaudio_dir/confgure/src", "$pulseaudio_dir/include", "$pulseaudio_dir/src", "../../../../foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "../../../../utils/system/safwk/native/include", "../../../../commonlibrary/c_utils/base/include", "//third_party/bounds_checking_function/include", ] deps = [ ":audio_client" ] external_deps = [ "hilog:libhilog", "ipc:ipc_single", ] part_name = "audio_framework" subsystem_name = "multimedia" }