core: add method to load spa_handle

Add a method that loads a spa handle based on the currently configured
libraries in the core. Remove duplicate code.
This commit is contained in:
Wim Taymans 2019-06-07 10:12:44 +02:00
parent 504d78cd18
commit c6c9e6a8b3
10 changed files with 87 additions and 138 deletions

View file

@ -249,26 +249,13 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
struct pw_node *this;
struct impl *impl;
struct spa_node *spa_node;
const char *lib = NULL;
int res;
struct spa_handle *handle;
void *iface;
const struct spa_support *support;
uint32_t n_support;
if (lib == NULL && properties)
lib = pw_properties_get(properties, SPA_KEY_LIBRARY_NAME);
if (lib == NULL)
lib = pw_core_find_spa_lib(core, factory_name);
if (lib == NULL)
goto exit;
support = pw_core_get_support(core, &n_support);
handle = pw_load_spa_handle(lib,
handle = pw_core_load_spa_handle(core,
factory_name,
properties ? &properties->dict : NULL,
n_support, support);
properties ? &properties->dict : NULL);
if (handle == NULL)
goto exit;