From 074b1120aeba363bb4aaec90dcd5a63a6c187b3e Mon Sep 17 00:00:00 2001 From: ZZyVSmOzMz OZaAEBlUIZ <1080187-ZZyVSmOzMz@users.noreply.gitlab.freedesktop.org> Date: Sun, 22 Jun 2025 11:22:26 +0000 Subject: [PATCH 1/7] bluez5: use ldacBT for both decode and encode fixup check version --- spa/meson.build | 14 +++++++++----- spa/plugins/bluez5/a2dp-codec-ldac.c | 6 +++++- spa/plugins/bluez5/meson.build | 1 - 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index f8acaec6a..c17deaab9 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -78,19 +78,23 @@ if get_option('spa-plugins').allowed() ldac_abr_dep = dependency('ldacBT-abr', required : get_option('bluez5-codec-ldac')) summary({'LDAC ABR': ldac_abr_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') + ldac_dec_dep = dependency('', required: false) if get_option('bluez5-codec-ldac-dec').allowed() - ldac_dec_dep = dependency('ldacBT-dec', required : false) - if not ldac_dec_dep.found() - dep = cc.find_library('ldacBT_dec', required : false) + dep = dependency('ldacBT', required : false) + if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep) + ldac_dec_dep = dep + else + dep = cc.find_library('ldacBT', required : false) if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep) ldac_dec_dep = dep endif endif + if ldac_dec_dep.found() + ldac_dep = ldac_dec_dep # use ldacBT for both decode and encode + endif if not ldac_dec_dep.found() and get_option('bluez5-codec-ldac-dec').enabled() error('LDAC decoder library not found') endif - else - ldac_dec_dep = dependency('', required: false) endif summary({'LDAC DEC': ldac_dec_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') diff --git a/spa/plugins/bluez5/a2dp-codec-ldac.c b/spa/plugins/bluez5/a2dp-codec-ldac.c index c80733220..ceda1621c 100644 --- a/spa/plugins/bluez5/a2dp-codec-ldac.c +++ b/spa/plugins/bluez5/a2dp-codec-ldac.c @@ -471,7 +471,11 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags, #endif #ifdef ENABLE_LDAC_ABR - this->ldac_abr = ldac_ABR_get_handle(); +#ifdef ENABLE_LDAC_DEC + this->ldac_abr = ldac_ABR_get_handle(NULL); +#else + this->ldac_abr = ldac_ABR_get_handle(); +#endif if (this->ldac_abr == NULL) goto error_errno; #endif diff --git a/spa/plugins/bluez5/meson.build b/spa/plugins/bluez5/meson.build index 01c5f3ac1..e39afd030 100644 --- a/spa/plugins/bluez5/meson.build +++ b/spa/plugins/bluez5/meson.build @@ -141,7 +141,6 @@ if ldac_dep.found() endif if get_option('bluez5-codec-ldac-dec').allowed() and ldac_dec_dep.found() ldac_args += [ '-DENABLE_LDAC_DEC' ] - ldac_dep = [ldac_dep, ldac_dec_dep] endif bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac', [ 'a2dp-codec-ldac.c', 'media-codecs.c' ], From 7584c835464261e02d359626bd827837fa30c0a3 Mon Sep 17 00:00:00 2001 From: Elias Souza Date: Sun, 7 Jun 2026 16:21:52 -0300 Subject: [PATCH 2/7] spa: meson: Bring back ldacBT-dec --- spa/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/meson.build b/spa/meson.build index c17deaab9..7d7eeaafa 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -80,7 +80,9 @@ if get_option('spa-plugins').allowed() ldac_dec_dep = dependency('', required: false) if get_option('bluez5-codec-ldac-dec').allowed() - dep = dependency('ldacBT', required : false) + ldac_dec_dep = dependency('ldacBT-dec', required : false) + if not ldac_dec_dep.found() + dep = cc.find_library('ldacBT-dec', required : false) if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep) ldac_dec_dep = dep else @@ -96,6 +98,7 @@ if get_option('spa-plugins').allowed() error('LDAC decoder library not found') endif endif + endif summary({'LDAC DEC': ldac_dec_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') aptx_dep = dependency('libfreeaptx', required : get_option('bluez5-codec-aptx')) From 86cc2f3f490ce57a08364f6cbe01972d7057a970 Mon Sep 17 00:00:00 2001 From: Elias Souza Date: Sun, 7 Jun 2026 16:24:26 -0300 Subject: [PATCH 3/7] spa: meson: Remove ldacBT only as ldac_dep --- spa/meson.build | 3 --- 1 file changed, 3 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index 7d7eeaafa..f8fdaa6ee 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -91,9 +91,6 @@ if get_option('spa-plugins').allowed() ldac_dec_dep = dep endif endif - if ldac_dec_dep.found() - ldac_dep = ldac_dec_dep # use ldacBT for both decode and encode - endif if not ldac_dec_dep.found() and get_option('bluez5-codec-ldac-dec').enabled() error('LDAC decoder library not found') endif From 7ae53f94e8f0b7a3e9d247d7da8008c2f0140d00 Mon Sep 17 00:00:00 2001 From: Elias Souza Date: Sun, 7 Jun 2026 16:27:48 -0300 Subject: [PATCH 4/7] fix: spa: meson: Bring back ldacBT-dec --- spa/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/meson.build b/spa/meson.build index f8fdaa6ee..b73de72c4 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -82,7 +82,7 @@ if get_option('spa-plugins').allowed() if get_option('bluez5-codec-ldac-dec').allowed() ldac_dec_dep = dependency('ldacBT-dec', required : false) if not ldac_dec_dep.found() - dep = cc.find_library('ldacBT-dec', required : false) + dep = cc.find_library('ldacBT_dec', required : false) if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep) ldac_dec_dep = dep else From dfbc59949c40231da00729cdb5a58feeebe0158e Mon Sep 17 00:00:00 2001 From: Elias Souza Date: Sun, 7 Jun 2026 16:30:04 -0300 Subject: [PATCH 5/7] spa: meson: Support use ldacBT as encoder library --- spa/meson.build | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spa/meson.build b/spa/meson.build index b73de72c4..1cbcfed30 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -73,6 +73,23 @@ if get_option('spa-plugins').allowed() endforeach summary({'Bluetooth audio': bluez_deps_found}, bool_yn: true, section: 'Backend') if bluez_deps_found + ldac_enc_dep = dependency('', required: false) + if get_option('bluez5-codec-ldac').allowed() + ldac_enc_dep = dependency('ldacBT-enc', required : false) + if not ldac_enc_dep.found() + dep = cc.find_library('ldacBT', required : false) + dep = dependency('ldacBT', required : false) + if dep.found() and cc.has_function('ldacBT_encode', dependencies : dep) + ldac_enc_dep = dep + dep = cc.find_library('ldacBT', required : false) + else + dep = cc.find_library('ldacBT', required : false) + if not ldac_enc_dep.found() and get_option('bluez5-codec-ldac').enabled() + error('LDAC encoder library not found') + endif + endif + endif + endif ldac_dep = dependency('ldacBT-enc', required : get_option('bluez5-codec-ldac')) summary({'LDAC': ldac_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') ldac_abr_dep = dependency('ldacBT-abr', required : get_option('bluez5-codec-ldac')) From 687c942eb7ffec1d1c10eacdcafe6eded6567613 Mon Sep 17 00:00:00 2001 From: Elias Souza Date: Sun, 7 Jun 2026 16:45:29 -0300 Subject: [PATCH 6/7] bluez5: Use LDAC_ABR_HANDLE_NULL on ldacBT >= 2.1.0.0 --- spa/plugins/bluez5/a2dp-codec-ldac.c | 6 +++--- spa/plugins/bluez5/meson.build | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spa/plugins/bluez5/a2dp-codec-ldac.c b/spa/plugins/bluez5/a2dp-codec-ldac.c index ceda1621c..98898c5f1 100644 --- a/spa/plugins/bluez5/a2dp-codec-ldac.c +++ b/spa/plugins/bluez5/a2dp-codec-ldac.c @@ -471,11 +471,11 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags, #endif #ifdef ENABLE_LDAC_ABR -#ifdef ENABLE_LDAC_DEC + #ifdef LDAC_ABR_HANDLE_NULL this->ldac_abr = ldac_ABR_get_handle(NULL); -#else + #else this->ldac_abr = ldac_ABR_get_handle(); -#endif + #endif if (this->ldac_abr == NULL) goto error_errno; #endif diff --git a/spa/plugins/bluez5/meson.build b/spa/plugins/bluez5/meson.build index e39afd030..2aeab5b9d 100644 --- a/spa/plugins/bluez5/meson.build +++ b/spa/plugins/bluez5/meson.build @@ -138,6 +138,9 @@ if ldac_dep.found() ldac_args = codec_args if ldac_abr_dep.found() ldac_args += [ '-DENABLE_LDAC_ABR' ] + if ldac_abr_dep.version().version_compare('>=2.1.0.0') + ldac_args += [ '-DLDAC_ABR_HANDLE_NULL' ] + endif endif if get_option('bluez5-codec-ldac-dec').allowed() and ldac_dec_dep.found() ldac_args += [ '-DENABLE_LDAC_DEC' ] From c775ef319bb6480db98f6ca2976c0a1f3c65673f Mon Sep 17 00:00:00 2001 From: EliasofWaffle Date: Thu, 18 Jun 2026 18:54:40 -0300 Subject: [PATCH 7/7] spa: meson: Fix ldac_enc dependency search --- spa/meson.build | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index 1cbcfed30..8bf98c309 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -73,24 +73,24 @@ if get_option('spa-plugins').allowed() endforeach summary({'Bluetooth audio': bluez_deps_found}, bool_yn: true, section: 'Backend') if bluez_deps_found - ldac_enc_dep = dependency('', required: false) + ldac_dep = dependency('', required: false) if get_option('bluez5-codec-ldac').allowed() - ldac_enc_dep = dependency('ldacBT-enc', required : false) - if not ldac_enc_dep.found() - dep = cc.find_library('ldacBT', required : false) - dep = dependency('ldacBT', required : false) + ldac_dep = dependency('ldacBT-enc', required : false) + if not ldac_dep.found() + dep = cc.find_library('ldacBT_enc', required : false) if dep.found() and cc.has_function('ldacBT_encode', dependencies : dep) - ldac_enc_dep = dep - dep = cc.find_library('ldacBT', required : false) + ldac_dep = dep else dep = cc.find_library('ldacBT', required : false) - if not ldac_enc_dep.found() and get_option('bluez5-codec-ldac').enabled() + if dep.found() and cc.has_function('ldacBT_encode', dependencies : dep) + ldac_dep = dep + endif + endif + if not ldac_dep.found() and get_option('bluez5-codec-ldac').enabled() error('LDAC encoder library not found') endif endif endif - endif - ldac_dep = dependency('ldacBT-enc', required : get_option('bluez5-codec-ldac')) summary({'LDAC': ldac_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') ldac_abr_dep = dependency('ldacBT-abr', required : get_option('bluez5-codec-ldac')) summary({'LDAC ABR': ldac_abr_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')