diff --git a/spa/meson.build b/spa/meson.build index f8acaec6a..1cbcfed30 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -73,15 +73,37 @@ 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')) 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) + 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 + dep = cc.find_library('ldacBT', required : false) if dep.found() and cc.has_function('ldacBT_decode', dependencies : dep) ldac_dec_dep = dep endif @@ -89,8 +111,7 @@ 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 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..98898c5f1 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 LDAC_ABR_HANDLE_NULL + 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..2aeab5b9d 100644 --- a/spa/plugins/bluez5/meson.build +++ b/spa/plugins/bluez5/meson.build @@ -138,10 +138,12 @@ 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' ] - ldac_dep = [ldac_dep, ldac_dec_dep] endif bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac', [ 'a2dp-codec-ldac.c', 'media-codecs.c' ],