Merge branch 'ldac' into 'master'

Draft: bluez5: use ldacBT for both decode and encode

See merge request pipewire/pipewire!2413
This commit is contained in:
ZZyVSmOzMz OZaAEBlUIZ 2026-03-28 06:56:30 +00:00
commit ee909d33a1
3 changed files with 14 additions and 7 deletions

View file

@ -78,19 +78,23 @@ if get_option('spa-plugins').allowed()
ldac_abr_dep = dependency('ldacBT-abr', required : get_option('bluez5-codec-ldac')) 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') 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() if get_option('bluez5-codec-ldac-dec').allowed()
ldac_dec_dep = dependency('ldacBT-dec', required : false) dep = dependency('ldacBT', required : false)
if not ldac_dec_dep.found() if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep)
dep = cc.find_library('ldacBT_dec', required : false) ldac_dec_dep = dep
else
dep = cc.find_library('ldacBT', required : false)
if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep) if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep)
ldac_dec_dep = dep ldac_dec_dep = dep
endif endif
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() if not ldac_dec_dep.found() and get_option('bluez5-codec-ldac-dec').enabled()
error('LDAC decoder library not found') error('LDAC decoder library not found')
endif endif
else
ldac_dec_dep = dependency('', required: false)
endif endif
summary({'LDAC DEC': ldac_dec_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') summary({'LDAC DEC': ldac_dec_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')

View file

@ -471,7 +471,11 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
#endif #endif
#ifdef ENABLE_LDAC_ABR #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) if (this->ldac_abr == NULL)
goto error_errno; goto error_errno;
#endif #endif

View file

@ -141,7 +141,6 @@ if ldac_dep.found()
endif endif
if get_option('bluez5-codec-ldac-dec').allowed() and ldac_dec_dep.found() if get_option('bluez5-codec-ldac-dec').allowed() and ldac_dec_dep.found()
ldac_args += [ '-DENABLE_LDAC_DEC' ] ldac_args += [ '-DENABLE_LDAC_DEC' ]
ldac_dep = [ldac_dep, ldac_dec_dep]
endif endif
bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac', bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac',
[ 'a2dp-codec-ldac.c', 'media-codecs.c' ], [ 'a2dp-codec-ldac.c', 'media-codecs.c' ],