mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
bluez5: make codec loading compatible with old conf files
Change codec factory names to api.codec.bluez5.*, so that they won't conflict with old config file lib name rules for api.bluez5.* Specify the fallback library name when loading the codecs, so that it works without the rules in config files.
This commit is contained in:
parent
435de99428
commit
b5ad37c7ac
5 changed files with 29 additions and 23 deletions
|
|
@ -50,7 +50,7 @@ struct spa_bluez5_codec_a2dp {
|
|||
const struct a2dp_codec * const *codecs; /**< NULL terminated array */
|
||||
};
|
||||
|
||||
#define A2DP_CODEC_FACTORY_NAME(basename) (SPA_NAME_API_BLUEZ5_CODEC_A2DP "." basename)
|
||||
#define A2DP_CODEC_FACTORY_NAME(basename) (SPA_NAME_API_CODEC_BLUEZ5_A2DP "." basename)
|
||||
|
||||
#ifdef CODEC_PLUGIN
|
||||
#define A2DP_CODEC_EXPORT_DEF(basename,...) \
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include "defs.h"
|
||||
#include "codec-loader.h"
|
||||
|
||||
#define A2DP_CODEC_LIB_BASE "bluez5/libspa-codec-bluez5-"
|
||||
|
||||
/* AVDTP allows 0x3E endpoints, can't have more codecs than that */
|
||||
#define MAX_CODECS 0x3E
|
||||
#define MAX_HANDLES MAX_CODECS
|
||||
|
|
@ -77,7 +79,7 @@ static int codec_order_cmp(const void *a, const void *b)
|
|||
return (ia == ib) ? (*ca < *cb ? -1 : 1) : ia - ib;
|
||||
}
|
||||
|
||||
static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name)
|
||||
static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name, const char *libname)
|
||||
{
|
||||
struct spa_handle *handle = NULL;
|
||||
void *iface;
|
||||
|
|
@ -85,8 +87,12 @@ static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name)
|
|||
int n_codecs = 0;
|
||||
int res;
|
||||
size_t i;
|
||||
struct spa_dict_item info_items[] = {
|
||||
{ SPA_KEY_LIBRARY_NAME, libname },
|
||||
};
|
||||
struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
|
||||
|
||||
handle = spa_plugin_loader_load(impl->loader, factory_name, NULL);
|
||||
handle = spa_plugin_loader_load(impl->loader, factory_name, &info);
|
||||
if (handle == NULL) {
|
||||
spa_log_info(impl->log, NAME ": Bluetooth codec plugin %s not available", factory_name);
|
||||
return -ENOENT;
|
||||
|
|
@ -152,15 +158,18 @@ fail:
|
|||
const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *loader, struct spa_log *log)
|
||||
{
|
||||
struct impl *impl;
|
||||
const char *codec_plugins[] = {
|
||||
A2DP_CODEC_FACTORY_NAME("aac"),
|
||||
A2DP_CODEC_FACTORY_NAME("aptx"),
|
||||
A2DP_CODEC_FACTORY_NAME("faststream"),
|
||||
A2DP_CODEC_FACTORY_NAME("ldac"),
|
||||
A2DP_CODEC_FACTORY_NAME("sbc")
|
||||
};
|
||||
bool has_sbc;
|
||||
size_t i;
|
||||
const struct { const char *factory; const char *lib; } plugins[] = {
|
||||
#define A2DP_CODEC_FACTORY_LIB(basename) \
|
||||
{ A2DP_CODEC_FACTORY_NAME(basename), A2DP_CODEC_LIB_BASE basename }
|
||||
A2DP_CODEC_FACTORY_LIB("aac"),
|
||||
A2DP_CODEC_FACTORY_LIB("aptx"),
|
||||
A2DP_CODEC_FACTORY_LIB("faststream"),
|
||||
A2DP_CODEC_FACTORY_LIB("ldac"),
|
||||
A2DP_CODEC_FACTORY_LIB("sbc")
|
||||
#undef A2DP_CODEC_FACTORY_LIB
|
||||
};
|
||||
|
||||
impl = calloc(sizeof(struct impl), 1);
|
||||
if (impl == NULL)
|
||||
|
|
@ -169,8 +178,8 @@ const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *load
|
|||
impl->loader = loader;
|
||||
impl->log = log;
|
||||
|
||||
for (i = 0; i < SPA_N_ELEMENTS(codec_plugins); ++i)
|
||||
load_a2dp_codecs_from(impl, codec_plugins[i]);
|
||||
for (i = 0; i < SPA_N_ELEMENTS(plugins); ++i)
|
||||
load_a2dp_codecs_from(impl, plugins[i].factory, plugins[i].lib);
|
||||
|
||||
has_sbc = false;
|
||||
for (i = 0; i < impl->n_codecs; ++i)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ bluez5lib = shared_library('spa-bluez5',
|
|||
|
||||
codec_args = [ '-DCODEC_PLUGIN' ]
|
||||
|
||||
bluez_codec_sbc = shared_library('spa-bluez5-codec-sbc',
|
||||
bluez_codec_sbc = shared_library('spa-codec-bluez5-sbc',
|
||||
[ 'a2dp-codec-sbc.c', 'a2dp-codecs.c' ],
|
||||
include_directories : [ spa_inc, configinc ],
|
||||
c_args : codec_args,
|
||||
|
|
@ -64,7 +64,7 @@ bluez_codec_sbc = shared_library('spa-bluez5-codec-sbc',
|
|||
install : true,
|
||||
install_dir : spa_plugindir / 'bluez5')
|
||||
|
||||
bluez_codec_faststream = shared_library('spa-bluez5-codec-faststream',
|
||||
bluez_codec_faststream = shared_library('spa-codec-bluez5-faststream',
|
||||
[ 'a2dp-codec-faststream.c', 'a2dp-codecs.c' ],
|
||||
include_directories : [ spa_inc, configinc ],
|
||||
c_args : codec_args,
|
||||
|
|
@ -73,7 +73,7 @@ bluez_codec_faststream = shared_library('spa-bluez5-codec-faststream',
|
|||
install_dir : spa_plugindir / 'bluez5')
|
||||
|
||||
if fdk_aac_dep.found()
|
||||
bluez_codec_aac = shared_library('spa-bluez5-codec-aac',
|
||||
bluez_codec_aac = shared_library('spa-codec-bluez5-aac',
|
||||
[ 'a2dp-codec-aac.c', 'a2dp-codecs.c' ],
|
||||
include_directories : [ spa_inc, configinc ],
|
||||
c_args : codec_args,
|
||||
|
|
@ -83,7 +83,7 @@ if fdk_aac_dep.found()
|
|||
endif
|
||||
|
||||
if aptx_dep.found()
|
||||
bluez_codec_aac = shared_library('spa-bluez5-codec-aptx',
|
||||
bluez_codec_aac = shared_library('spa-codec-bluez5-aptx',
|
||||
[ 'a2dp-codec-aptx.c', 'a2dp-codecs.c' ],
|
||||
include_directories : [ spa_inc, configinc ],
|
||||
c_args : codec_args,
|
||||
|
|
@ -99,7 +99,7 @@ if ldac_dep.found()
|
|||
ldac_args += [ '-DENABLE_LDAC_ABR' ]
|
||||
ldac_dep += ldac_abr_dep
|
||||
endif
|
||||
bluez_codec_ldac = shared_library('spa-bluez5-codec-ldac',
|
||||
bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac',
|
||||
[ 'a2dp-codec-ldac.c', 'a2dp-codecs.c' ],
|
||||
include_directories : [ spa_inc, configinc ],
|
||||
c_args : ldac_args,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue