From c727e8f8f9512796befb5d054aff0cfb65f7533f 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/3] bluez5: use ldacBT for both decode and encode --- spa/meson.build | 11 ++++++++--- spa/plugins/bluez5/a2dp-codec-ldac.c | 2 +- spa/plugins/bluez5/meson.build | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index 48a0000a1..e889db237 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -72,13 +72,18 @@ if get_option('spa-plugins').allowed() summary({'LDAC ABR': ldac_abr_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') 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 diff --git a/spa/plugins/bluez5/a2dp-codec-ldac.c b/spa/plugins/bluez5/a2dp-codec-ldac.c index 4ae86b571..a1bf1f678 100644 --- a/spa/plugins/bluez5/a2dp-codec-ldac.c +++ b/spa/plugins/bluez5/a2dp-codec-ldac.c @@ -470,7 +470,7 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags, #endif #ifdef ENABLE_LDAC_ABR - this->ldac_abr = ldac_ABR_get_handle(); + this->ldac_abr = ldac_ABR_get_handle(NULL); if (this->ldac_abr == NULL) goto error_errno; #endif diff --git a/spa/plugins/bluez5/meson.build b/spa/plugins/bluez5/meson.build index bf9c6374b..519b39bb1 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 ae1f79c514ba601b3f604c09d890491b463fa308 Mon Sep 17 00:00:00 2001 From: ZZyVSmOzMz OZaAEBlUIZ <1080187-ZZyVSmOzMz@users.noreply.gitlab.freedesktop.org> Date: Sun, 22 Jun 2025 12:00:40 +0000 Subject: [PATCH 2/3] fixup --- spa/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index e889db237..1cff83c00 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -71,6 +71,7 @@ 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() dep = dependency('ldacBT', required : false) if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep) @@ -87,8 +88,6 @@ if get_option('spa-plugins').allowed() 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') From 541b6fca270932f2979b6b4e3562e5034fa5c071 Mon Sep 17 00:00:00 2001 From: ZZyVSmOzMz OZaAEBlUIZ <1080187-ZZyVSmOzMz@users.noreply.gitlab.freedesktop.org> Date: Sun, 22 Jun 2025 12:30:53 +0000 Subject: [PATCH 3/3] check version --- spa/plugins/bluez5/a2dp-codec-ldac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/a2dp-codec-ldac.c b/spa/plugins/bluez5/a2dp-codec-ldac.c index a1bf1f678..63f87c202 100644 --- a/spa/plugins/bluez5/a2dp-codec-ldac.c +++ b/spa/plugins/bluez5/a2dp-codec-ldac.c @@ -470,7 +470,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(NULL); +#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