diff --git a/include/zephyr/libsbc/sbc.h b/include/zephyr/bluetooth/sbc.h similarity index 99% rename from include/zephyr/libsbc/sbc.h rename to include/zephyr/bluetooth/sbc.h index 399f2bb67557e..72559a0038146 100644 --- a/include/zephyr/libsbc/sbc.h +++ b/include/zephyr/bluetooth/sbc.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "sbc_encoder.h" #include "oi_codec_sbc.h" #include "oi_status.h" diff --git a/modules/libsbc/CMakeLists.txt b/modules/libsbc/CMakeLists.txt index db82cb49bd2b7..1b4cc6fd46efc 100644 --- a/modules/libsbc/CMakeLists.txt +++ b/modules/libsbc/CMakeLists.txt @@ -1,11 +1,10 @@ -if(CONFIG_LIBSBC_ENCODER OR CONFIG_LIBSBC_DECODER) +if(CONFIG_LIBSBC) zephyr_library_named(libsbc) -zephyr_library_compile_options(-O3 -std=c11 -ffast-math -Wno-array-bounds) +zephyr_library_compile_options(-O3 -std=c11 -ffast-math -Wno-stringop-overflow) zephyr_compile_definitions(SBC_FOR_EMBEDDED_LINUX) zephyr_compile_definitions(SBC_NO_PCM_CPY_OPTION) -zephyr_library_sources(sbc.c) zephyr_include_directories( ${ZEPHYR_LIBSBC_MODULE_DIR}/encoder/include @@ -16,7 +15,6 @@ zephyr_include_directories( ${ZEPHYR_LIBSBC_MODULE_DIR}/decoder/srce ) -if(CONFIG_LIBSBC_ENCODER) zephyr_library_sources( ${ZEPHYR_LIBSBC_MODULE_DIR}/encoder/srce/sbc_analysis.c ${ZEPHYR_LIBSBC_MODULE_DIR}/encoder/srce/sbc_dct.c @@ -27,9 +25,7 @@ zephyr_library_sources( ${ZEPHYR_LIBSBC_MODULE_DIR}/encoder/srce/sbc_encoder.c ${ZEPHYR_LIBSBC_MODULE_DIR}/encoder/srce/sbc_packing.c ) -endif() -if(CONFIG_LIBSBC_DECODER) zephyr_library_sources( ${ZEPHYR_LIBSBC_MODULE_DIR}/decoder/srce/alloc.c ${ZEPHYR_LIBSBC_MODULE_DIR}/decoder/srce/bitalloc.c @@ -48,4 +44,3 @@ zephyr_library_sources( ${ZEPHYR_LIBSBC_MODULE_DIR}/decoder/srce/synthesis-sbc.c ) endif() -endif() diff --git a/modules/libsbc/Kconfig b/modules/libsbc/Kconfig index af81496226793..7a511ddc4af93 100644 --- a/modules/libsbc/Kconfig +++ b/modules/libsbc/Kconfig @@ -4,12 +4,7 @@ config ZEPHYR_LIBSBC_MODULE bool -config LIBSBC_ENCODER - bool "libsbc encoder Support" +config LIBSBC + bool "libsbc Support" help - This option enables the Android SBC encoder library for Bluetooth A2DP - -config LIBSBC_DECODER - bool "libsbc decoder Support" - help - This option enables the Android SBC decoder library for Bluetooth A2DP + This option enables low Complexity Subband Coding (SBC) diff --git a/subsys/bluetooth/host/classic/Kconfig b/subsys/bluetooth/host/classic/Kconfig index 60252cbcecc84..2392f637050b2 100644 --- a/subsys/bluetooth/host/classic/Kconfig +++ b/subsys/bluetooth/host/classic/Kconfig @@ -444,6 +444,7 @@ config BT_AVDTP config BT_A2DP bool "Bluetooth A2DP Profile [EXPERIMENTAL]" select BT_AVDTP + imply LIBSBC select EXPERIMENTAL help This option enables the A2DP profile diff --git a/subsys/bluetooth/lib/CMakeLists.txt b/subsys/bluetooth/lib/CMakeLists.txt index 5798221535014..694830ae6cfdb 100644 --- a/subsys/bluetooth/lib/CMakeLists.txt +++ b/subsys/bluetooth/lib/CMakeLists.txt @@ -1,3 +1,4 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources_ifdef(CONFIG_BT_EAD ead.c) +zephyr_sources_ifdef(CONFIG_LIBSBC sbc.c) diff --git a/modules/libsbc/sbc.c b/subsys/bluetooth/lib/sbc.c similarity index 97% rename from modules/libsbc/sbc.c rename to subsys/bluetooth/lib/sbc.c index 9be90dd3cffac..6bcd8fc8b11b5 100644 --- a/modules/libsbc/sbc.c +++ b/subsys/bluetooth/lib/sbc.c @@ -5,9 +5,9 @@ */ #include -#include +#include -#if defined(CONFIG_LIBSBC_ENCODER) +#if defined(CONFIG_LIBSBC) int sbc_setup_encoder(struct sbc_encoder *encoder, struct sbc_encoder_init_param *param) { @@ -136,9 +136,7 @@ int sbc_frame_encoded_bytes(struct sbc_encoder *encoder) return size; } -#endif -#if defined(CONFIG_LIBSBC_DECODER) /** * Setup decoder */