bluez5: split A2DP codecs to separate SPA plugins

Make easier to package A2DP codecs separately, by splitting each to a
separate SPA plugin.  Adjust the code to not use a global variable for
the codec list.

The A2DP SPA interface API is in the bluez5 private headers, and not
exposed in installed SPA headers, as it's too close to the
implementation.
This commit is contained in:
Pauli Virtanen 2021-09-01 00:33:43 +03:00
parent 3115775c02
commit 59d572de09
15 changed files with 911 additions and 469 deletions

View file

@ -21,9 +21,8 @@ if not get_option('bluez5-backend-hsphfpd').disabled()
endif
bluez5_sources = ['plugin.c',
'codec-loader.c',
'a2dp-codecs.c',
'a2dp-codec-sbc.c',
'a2dp-codec-faststream.c',
'a2dp-sink.c',
'a2dp-source.c',
'sco-sink.c',
@ -33,28 +32,6 @@ bluez5_sources = ['plugin.c',
'bluez5-device.c',
'bluez5-dbus.c']
bluez5_args = [ ]
if ldac_dep.found()
bluez5_sources += [ 'a2dp-codec-ldac.c' ]
bluez5_args += [ '-DENABLE_LDAC' ]
bluez5_deps += ldac_dep
if ldac_abr_dep.found()
bluez5_args += [ '-DENABLE_LDAC_ABR' ]
bluez5_deps += ldac_abr_dep
endif
endif
if aptx_dep.found()
bluez5_sources += [ 'a2dp-codec-aptx.c' ]
bluez5_args += [ '-DENABLE_APTX' ]
bluez5_deps += aptx_dep
endif
if fdk_aac_dep.found()
bluez5_sources += [ 'a2dp-codec-aac.c' ]
bluez5_args += [ '-DENABLE_AAC' ]
bluez5_deps += fdk_aac_dep
endif
if not get_option('bluez5-backend-hsp-native').disabled() or not get_option('bluez5-backend-hfp-native').disabled()
if libusb_dep.found()
bluez5_deps += libusb_dep
@ -73,7 +50,60 @@ endif
bluez5lib = shared_library('spa-bluez5',
bluez5_sources,
include_directories : [ spa_inc, configinc ],
c_args : bluez5_args,
dependencies : bluez5_deps,
install : true,
install_dir : spa_plugindir / 'bluez5')
codec_args = [ '-DCODEC_PLUGIN' ]
bluez_codec_sbc = shared_library('spa-bluez5-codec-sbc',
[ 'a2dp-codec-sbc.c', 'a2dp-codecs.c' ],
include_directories : [ spa_inc, configinc ],
c_args : codec_args,
dependencies : sbc_dep,
install : true,
install_dir : spa_plugindir / 'bluez5')
bluez_codec_faststream = shared_library('spa-bluez5-codec-faststream',
[ 'a2dp-codec-faststream.c', 'a2dp-codecs.c' ],
include_directories : [ spa_inc, configinc ],
c_args : codec_args,
dependencies : sbc_dep,
install : true,
install_dir : spa_plugindir / 'bluez5')
if fdk_aac_dep.found()
bluez_codec_aac = shared_library('spa-bluez5-codec-aac',
[ 'a2dp-codec-aac.c', 'a2dp-codecs.c' ],
include_directories : [ spa_inc, configinc ],
c_args : codec_args,
dependencies : fdk_aac_dep,
install : true,
install_dir : spa_plugindir / 'bluez5')
endif
if aptx_dep.found()
bluez_codec_aac = shared_library('spa-bluez5-codec-aptx',
[ 'a2dp-codec-aptx.c', 'a2dp-codecs.c' ],
include_directories : [ spa_inc, configinc ],
c_args : codec_args,
dependencies : [ aptx_dep, sbc_dep ],
install : true,
install_dir : spa_plugindir / 'bluez5')
endif
if ldac_dep.found()
ldac_args = codec_args
ldac_dep = [ ldac_dep ]
if ldac_abr_dep.found()
ldac_args += [ '-DENABLE_LDAC_ABR' ]
ldac_dep += ldac_abr_dep
endif
bluez_codec_ldac = shared_library('spa-bluez5-codec-ldac',
[ 'a2dp-codec-ldac.c', 'a2dp-codecs.c' ],
include_directories : [ spa_inc, configinc ],
c_args : ldac_args,
dependencies : ldac_dep,
install : true,
install_dir : spa_plugindir / 'bluez5')
endif