Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.8) |
| 2 | |
| 3 | project(aml_audio_hal |
| 4 | VERSION 1.0) |
| 5 | |
| 6 | include(GNUInstallDirs) |
| 7 | |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 8 | add_subdirectory("libms12_v24") |
yayun.shi | f83e1a2 | 2021-07-22 01:33:58 -0400 | [diff] [blame] | 9 | add_subdirectory("audio_codec/libfaad") |
| 10 | add_subdirectory("audio_codec/libmad") |
wei.wang1 | 697eab6 | 2021-08-09 00:36:53 -0400 | [diff] [blame] | 11 | add_subdirectory("audio_codec/libvorbis") |
yayun.shi | 62e6794 | 2021-08-23 10:18:13 +0800 | [diff] [blame^] | 12 | add_subdirectory("audio_codec/libdts") |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 13 | add_subdirectory("audio_hal/libaudioprocessing") |
| 14 | |
| 15 | add_library(spdifenc STATIC |
| 16 | utils/SPDIFEncoderAD.cpp |
| 17 | utils/spdifenc_wrap.cpp |
| 18 | ) |
| 19 | |
| 20 | target_include_directories(spdifenc PRIVATE |
| 21 | ./audio_hal |
| 22 | ./include |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 23 | ./include/utils |
| 24 | ./utils/tinyalsa/include |
| 25 | ./utils/include) |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 26 | |
Tim Yao | e419f81 | 2021-01-20 21:15:05 -0800 | [diff] [blame] | 27 | target_compile_options(spdifenc PRIVATE -Wno-deprecated-declarations -fPIC) |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 28 | |
cheng tong | 12e5d13 | 2020-09-25 18:57:09 +0800 | [diff] [blame] | 29 | option(USE_DTV "Compile with DTV option" OFF) |
Tim Yao | 2c66a76 | 2021-01-06 18:08:33 -0800 | [diff] [blame] | 30 | option(USE_CAP "Support audio capture" ON) |
Zhizhong Zhang | 1630230 | 2021-01-20 22:29:14 +0800 | [diff] [blame] | 31 | option(USE_SC2 "Current platform is sc2" OFF) |
Tim Yao | b5e9839 | 2021-03-03 11:51:26 -0800 | [diff] [blame] | 32 | option(USE_CAP_MUTE_HDMI "Support audio capture mute for HDMI INPUT" ON) |
Tim Yao | 97c694d | 2021-02-25 12:12:53 -0800 | [diff] [blame] | 33 | option(USE_APP_MIXING "Support appsound mixing" ON) |
Tim Yao | b9e78d8 | 2021-03-22 23:46:23 -0700 | [diff] [blame] | 34 | option(USE_DIAG_LOG "Support diagnostic logging for RDK" OFF) |
Tim Yao | 92407a0 | 2021-03-31 20:43:29 -0700 | [diff] [blame] | 35 | option(USE_MSYNC "Support avsync with aml-avsync" OFF) |
Pradeep Sriram | d18aa61 | 2020-05-14 13:05:34 -0700 | [diff] [blame] | 36 | |
| 37 | if(USE_DTV) |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 38 | list(APPEND DTV_FILES dtv_audio_utils/audio_data_read/audio_dtv_ad.c) |
Pradeep Sriram | d18aa61 | 2020-05-14 13:05:34 -0700 | [diff] [blame] | 39 | list(APPEND DTV_FILES audio_hal/audio_hw_dtv.c) |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 40 | list(APPEND DTV_FILES audio_hal/audio_dtv_utils.c) |
Shoufu Zhao | 30412dc | 2021-06-02 14:50:47 +0800 | [diff] [blame] | 41 | list(APPEND DTV_INC $ENV{AML_AUDIO_HAL_STAGING_DIR}/usr/include/aml_dvb/am_adp) |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 42 | #list(APPEND DTV_LIBS -L$ENV{AML_AUDIO_HAL_STAGING_DIR}/usr/lib/aml_libs_nf -lamadec_hal -lam_adp -lasound) |
| 43 | list(APPEND DTV_LIBS -L./amadec -laudamadec) |
| 44 | list(APPEND DTV_LIBS -L$ENV{AML_AUDIO_HAL_STAGING_DIR}/usr/lib/aml_libs_nf -lam_adp -lasound) |
Zhizhong Zhang | 1630230 | 2021-01-20 22:29:14 +0800 | [diff] [blame] | 45 | list(APPEND DVB_AUDIO_INC ./dtv_audio_utils/sync) |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 46 | list(APPEND DVB_AUDIO_INC ./amadec/include) |
Zhizhong Zhang | 1630230 | 2021-01-20 22:29:14 +0800 | [diff] [blame] | 47 | list(APPEND DVB_AUDIO_LIBS -L./dtv_audio_utils -ldvbaudioutils) |
| 48 | |
cheng tong | 7177c1b | 2020-09-17 17:36:27 +0800 | [diff] [blame] | 49 | add_definitions(-DUSE_DTV) |
Pradeep Sriram | d18aa61 | 2020-05-14 13:05:34 -0700 | [diff] [blame] | 50 | endif() |
| 51 | |
Tim Yao | 97c694d | 2021-02-25 12:12:53 -0800 | [diff] [blame] | 52 | if(USE_APP_MIXING) |
| 53 | add_definitions(-DUSE_APP_MIXING) |
| 54 | endif() |
| 55 | |
Tim Yao | b9e78d8 | 2021-03-22 23:46:23 -0700 | [diff] [blame] | 56 | if(USE_DIAG_LOG) |
| 57 | add_definitions(-DDIAG_LOG) |
| 58 | endif() |
| 59 | |
Tim Yao | 35766e4 | 2021-02-22 17:35:58 -0800 | [diff] [blame] | 60 | if(USE_MSYNC) |
| 61 | add_definitions(-DUSE_MSYNC) |
| 62 | endif() |
| 63 | |
Song Zhao | c23fabe | 2020-09-18 13:28:40 -0700 | [diff] [blame] | 64 | option(USE_EQ_DRC "Compile with EQ/DRC" OFF) |
| 65 | |
cheng tong | 12e5d13 | 2020-09-25 18:57:09 +0800 | [diff] [blame] | 66 | if(USE_EQ_DRC) |
| 67 | list(APPEND EQ_DRC_FILES |
| 68 | amlogic_AQ_tools/audio_eq_drc_compensation.c |
| 69 | amlogic_AQ_tools/audio_eq_drc_parser.c |
| 70 | amlogic_AQ_tools/ini/dictionary.c |
| 71 | amlogic_AQ_tools/ini/iniparser.c) |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 72 | add_definitions(-DUSE_EQ_DRC) |
cheng tong | 12e5d13 | 2020-09-25 18:57:09 +0800 | [diff] [blame] | 73 | endif() |
| 74 | |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 75 | ############################################# |
| 76 | # libaudio_hal |
| 77 | ############################################# |
| 78 | add_library(audio_hal SHARED |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 79 | aml_adecs/aml_aac_dec_api.c |
| 80 | aml_adecs/aml_ddp_dec_api.c |
| 81 | aml_adecs/aml_dec_api.c |
| 82 | aml_adecs/aml_dts_dec_api.c |
| 83 | aml_adecs/aml_mpeg_dec_api.c |
| 84 | aml_adecs/aml_pcm_dec_api.c |
shu.zhang | cebe6d8 | 2021-07-21 05:49:06 -0400 | [diff] [blame] | 85 | aml_adecs/aml_flac_dec_api.c |
shu.zhang | b3d790c | 2021-08-08 21:30:30 -0400 | [diff] [blame] | 86 | aml_adecs/aml_vorbis_dec_api.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 87 | aml_parser/ac3_parser_utils.c |
| 88 | aml_parser/aml_ac3_parser.c |
| 89 | aml_parser/aml_audio_ac3parser.c |
| 90 | aml_parser/aml_audio_ac4parser.c |
| 91 | aml_parser/aml_audio_bitsparser.c |
| 92 | aml_parser/aml_audio_matparser.c |
| 93 | aml_resampler/aml_audio_resample_manager.c |
| 94 | aml_resampler/aml_audio_resampler.c |
| 95 | aml_resampler/aml_resample_wrap.cpp |
| 96 | aml_resampler/audio_android_resample_api.c |
| 97 | aml_resampler/audio_simple_resample_api.c |
| 98 | aml_speed/aml_audio_speed_manager.c |
| 99 | aml_speed/audio_sonic_speed_api.c |
| 100 | aml_speed/sonic_speed_wrapper.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 101 | audio_hal/alsa_config_parameters.c |
| 102 | audio_hal/alsa_manager.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 103 | audio_hal/audio_bt_sco.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 104 | audio_hal/aml_audio_delay.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 105 | #audio_hal/a2dp_hal.cpp |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 106 | audio_hal/aml_audio_ease.c |
| 107 | audio_hal/amlAudioMixer.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 108 | audio_hal/aml_audio_ms12_bypass.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 109 | audio_hal/aml_audio_stream.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 110 | audio_hal/aml_audio_spdifout.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 111 | audio_hal/aml_audio_timer.c |
| 112 | audio_hal/aml_avsync_tuning.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 113 | audio_hal/audio_format_parse.c |
| 114 | audio_hal/audio_hw.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 115 | audio_hal/audio_hw_ms12_common.c |
| 116 | #audio_hal/audio_hw_ms12.c by default, we compile V2,V1 is not used now. TBD |
| 117 | audio_hal/audio_hw_ms12_v2.c |
| 118 | audio_hal/aml_audio_ms12_sync.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 119 | audio_hal/audio_hw_profile.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 120 | audio_hal/audio_route.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 121 | audio_hal/audio_hwsync.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 122 | audio_hal/audio_hwsync_wrap.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 123 | audio_hal/audio_hw_utils.c |
| 124 | audio_hal/audio_port.c |
| 125 | audio_hal/audio_post_process.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 126 | audio_hal/audio_virtual_buf.c |
| 127 | audio_hal/dolby_lib_api.c |
| 128 | audio_hal/hw_avsync.c |
| 129 | audio_hal/hw_avsync_callbacks.c |
| 130 | audio_hal/spdif_encoder_api.c |
| 131 | audio_hal/sub_mixing_factory.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 132 | audio_hal/aml_audio_dev2mix_process.c |
| 133 | audio_hal/aml_audio_ms12_render.c |
| 134 | audio_hal/aml_audio_nonms12_render.c |
| 135 | audio_hal/aml_audio_spdifdec.c |
| 136 | audio_hal/aml_dtvsync.c |
| 137 | audio_hal/audio_mediasync_wrap.c |
| 138 | audio_hal/audio_hdmi_util.c |
| 139 | audio_hal/aml_audio_hal_avsync.c |
yayun.shi | 3a40dcb | 2021-07-20 05:14:48 -0400 | [diff] [blame] | 140 | audio_hal/tinyalsa_ext.c |
yayun.shi | d6eaaf4 | 2021-08-06 07:02:13 -0400 | [diff] [blame] | 141 | audio_hal/aml_config_parser.c |
| 142 | utils/cJSON/cJSON.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 143 | utils/aml_hw_mixer.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 144 | utils/alsa_device_parser.c |
| 145 | utils/aml_alsa_mixer.c |
| 146 | utils/aml_android_utils.c |
| 147 | utils/aml_audio_mixer.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 148 | utils/aml_buffer_provider.c |
| 149 | utils/aml_data_utils.c |
| 150 | utils/aml_dump_debug.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 151 | utils/aml_malloc_debug.c |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 152 | utils/aml_ringbuffer.c |
| 153 | utils/aml_volume_utils.c |
| 154 | utils/aml_configs/aml_conf_loader.c |
| 155 | utils/aml_configs/aml_conf_parser.c |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 156 | utils/audio_data_process.c |
| 157 | utils/tinyalsa/pcm.c |
| 158 | utils/tinyalsa/mixer.c |
| 159 | #rcaudio/audio_hal_thunks.cpp |
Pradeep Sriram | d18aa61 | 2020-05-14 13:05:34 -0700 | [diff] [blame] | 160 | ${DTV_FILES} |
cheng tong | 12e5d13 | 2020-09-25 18:57:09 +0800 | [diff] [blame] | 161 | ${EQ_DRC_FILES} |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 162 | ) |
| 163 | |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 164 | add_definitions(-DNDEBUG -DREPLACE_OUTPUT_BUFFER_WITH_CALLBACK -DDOLBY_MS12_ENABLE -DMS12_V24_ENABLE -DBUILD_LINUX) |
Tim Yao | 2c66a76 | 2021-01-06 18:08:33 -0800 | [diff] [blame] | 165 | if(USE_CAP) |
| 166 | add_definitions(-DAUDIO_CAP) |
Tim Yao | b5e9839 | 2021-03-03 11:51:26 -0800 | [diff] [blame] | 167 | |
| 168 | if(USE_CAP_MUTE_HDMI) |
| 169 | add_definitions(-DAUDIO_CAP_MUTE_HDMI) |
| 170 | endif() |
Tim Yao | 2c66a76 | 2021-01-06 18:08:33 -0800 | [diff] [blame] | 171 | endif() |
Tim Yao | 4bff678 | 2019-12-26 18:31:40 -0800 | [diff] [blame] | 172 | |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 173 | #if(USE_EQ_DRC) |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 174 | set(PREBUILD_STATIC_LIBS |
| 175 | ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/lib_aml_ng.a |
| 176 | ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/Amlogic_DRC_Param_Generator.a |
| 177 | ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/Amlogic_EQ_Param_Generator.a) |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 178 | #endif() |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 179 | |
| 180 | set_target_properties(audio_hal PROPERTIES |
| 181 | VERSION ${PROJECT_VERSION} |
| 182 | SOVERSION 1) |
| 183 | |
| 184 | target_include_directories(audio_hal PRIVATE |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 185 | ./include |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 186 | ../hal_audio_service/include |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 187 | ./include/utils |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 188 | ./aml_speed/include |
| 189 | ./aml_speed |
| 190 | ./aml_resampler/include |
| 191 | ./aml_resampler |
| 192 | ./aml_adecs/include |
| 193 | ./aml_adecs/ |
| 194 | ./aml_parser/include |
| 195 | ./aml_parser |
| 196 | ./utils/include |
| 197 | ./utils/tinyalsa/include |
yayun.shi | d6eaaf4 | 2021-08-06 07:02:13 -0400 | [diff] [blame] | 198 | ./utils/cJSON |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 199 | ./libms12_v24/include |
| 200 | ./amlogic_AQ_tools |
| 201 | ./dtv_audio_utils/audio_read_api |
| 202 | ./audio_hal) |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 203 | |
Tim Yao | e419f81 | 2021-01-20 21:15:05 -0800 | [diff] [blame] | 204 | target_compile_options(audio_hal PRIVATE -D_GNU_SOURCE -DTV_AUDIO_OUTPUT -Wno-deprecated-declarations -funwind-tables -fasynchronous-unwind-tables -fPIC) |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 205 | |
| 206 | target_link_libraries(audio_hal |
cheng tong | 5ae9269 | 2020-08-28 14:13:39 +0800 | [diff] [blame] | 207 | audioprocessing spdifenc ms12v2 ${PREBUILD_STATIC_LIBS} |
yayun.shi | 4a7148a | 2021-07-16 06:13:50 -0400 | [diff] [blame] | 208 | -lcutils -lamaudioutils -llog -lexpat -lpthread -ldl -lstdc++ -Wl,-z,defs) |
Song Zhao | c23fabe | 2020-09-18 13:28:40 -0700 | [diff] [blame] | 209 | |
| 210 | if(USE_EQ_DRC) |
| 211 | target_include_directories(audio_hal PRIVATE |
| 212 | ./include/amlogic_AQ_tools |
| 213 | ./amlogic_AQ_tools |
| 214 | ./amlogic_AQ_tools/ini) |
| 215 | target_compile_options(audio_hal PRIVATE -DAML_EQ_DRC) |
Song Zhao | c23fabe | 2020-09-18 13:28:40 -0700 | [diff] [blame] | 216 | endif() |
| 217 | |
| 218 | if(USE_DTV) |
Zhizhong Zhang | 1630230 | 2021-01-20 22:29:14 +0800 | [diff] [blame] | 219 | target_include_directories(audio_hal PRIVATE |
| 220 | ${DTV_INC} |
| 221 | ${DVB_AUDIO_INC}) |
| 222 | target_link_libraries(audio_hal |
| 223 | ${DTV_LIBS} |
| 224 | ${DVB_AUDIO_LIBS} -lamavutils) |
| 225 | endif() |
| 226 | |
Tim Yao | 35766e4 | 2021-02-22 17:35:58 -0800 | [diff] [blame] | 227 | if(USE_MSYNC) |
| 228 | target_link_libraries(audio_hal -lamlavsync) |
| 229 | endif() |
| 230 | |
Zhizhong Zhang | 1630230 | 2021-01-20 22:29:14 +0800 | [diff] [blame] | 231 | if(USE_SC2) |
| 232 | add_definitions(-DDVB_AUDIO_SC2) |
Song Zhao | c23fabe | 2020-09-18 13:28:40 -0700 | [diff] [blame] | 233 | endif() |
Tim Yao | e004da0 | 2019-12-03 11:59:05 -0800 | [diff] [blame] | 234 | |
| 235 | install(TARGETS audio_hal |
| 236 | LIBRARY DESTINATION "lib") |
| 237 | |
| 238 | install(FILES audio_hal/mixer_paths.xml |
| 239 | DESTINATION /etc) |
| 240 | |
cheng tong | 5ae9269 | 2020-08-28 14:13:39 +0800 | [diff] [blame] | 241 | install(PROGRAMS amlogic_AQ_tools/Amlogic_DRC_Param_Generator amlogic_AQ_tools/Amlogic_EQ_Param_Generator |
| 242 | DESTINATION /usr/bin) |
| 243 | |