From 6ccb93926714d7d8d29365c41be452248b361898 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Mon, 2 May 2022 23:03:48 +0300 Subject: [PATCH] bluez5: use lc3plus.h instead of lc3.h The file name "lc3.h" in the ETSI LC3plus package may conflict with the actual LC3 codec, so try to find a file "lc3plus.h" instead. Also try to find a pkg-config dependency for it first (in which case use lc3.h, assuming it's in different directory). This can be fine tuned, if something starts to package that library. --- spa/meson.build | 8 +++++++- spa/plugins/bluez5/a2dp-codec-lc3plus.c | 4 ++++ spa/plugins/bluez5/meson.build | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index 84e4486ea..82e274e9f 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -54,7 +54,13 @@ if get_option('spa-plugins').allowed() summary({'aptX': aptx_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') fdk_aac_dep = dependency('fdk-aac', required : get_option('bluez5-codec-aac')) summary({'AAC': fdk_aac_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') - lc3plus_dep = cc.find_library('LC3plus', has_headers: ['lc3.h'], required : get_option('bluez5-codec-lc3plus')) + lc3plus_dep = dependency('lc3plus', required : false) + if not lc3plus_dep.found() + lc3plus_lc3plus_h_dep = cc.find_library('LC3plus', has_headers: ['lc3plus.h'], required : get_option('bluez5-codec-lc3plus')) + if lc3plus_lc3plus_h_dep.found() + lc3plus_dep = declare_dependency(compile_args : '-DHAVE_LC3PLUS_H', dependencies : [ lc3plus_lc3plus_h_dep ]) + endif + endif summary({'LC3plus': lc3plus_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs') endif avcodec_dep = dependency('libavcodec', required: get_option('ffmpeg')) diff --git a/spa/plugins/bluez5/a2dp-codec-lc3plus.c b/spa/plugins/bluez5/a2dp-codec-lc3plus.c index bd798cfc1..b50c94746 100644 --- a/spa/plugins/bluez5/a2dp-codec-lc3plus.c +++ b/spa/plugins/bluez5/a2dp-codec-lc3plus.c @@ -34,7 +34,11 @@ #include #include +#ifdef HAVE_LC3PLUS_H +#include +#else #include +#endif #include "rtp.h" #include "a2dp-codecs.h" diff --git a/spa/plugins/bluez5/meson.build b/spa/plugins/bluez5/meson.build index 365c36f37..03f986b37 100644 --- a/spa/plugins/bluez5/meson.build +++ b/spa/plugins/bluez5/meson.build @@ -110,7 +110,7 @@ if ldac_dep.found() install_dir : spa_plugindir / 'bluez5') endif -if lc3plus_dep.found() +if get_option('bluez5-codec-lc3plus').allowed() and lc3plus_dep.found() lc3plus_args = codec_args lc3plus_dep = [ lc3plus_dep ] bluez_codec_lc3plus = shared_library('spa-codec-bluez5-lc3plus',