mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
pipewire: add helper to load spa plugin
This commit is contained in:
parent
0b4cef586f
commit
aada47252d
2 changed files with 26 additions and 10 deletions
|
|
@ -170,27 +170,40 @@ const struct spa_support *pw_get_support(uint32_t *n_support)
|
||||||
return support_info.support;
|
return support_info.support;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pw_get_spa_dbus(struct pw_loop *loop)
|
void *pw_load_spa_interface(const char *lib, const char *factory_name, const char *type,
|
||||||
|
struct spa_support *support, uint32_t n_support)
|
||||||
{
|
{
|
||||||
struct support_info dbus_support_info;
|
struct support_info extra_support_info;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
int i;
|
||||||
|
|
||||||
dbus_support_info.n_support = support_info.n_support;
|
extra_support_info.n_support = support_info.n_support;
|
||||||
memcpy(dbus_support_info.support, support_info.support,
|
memcpy(extra_support_info.support, support_info.support,
|
||||||
sizeof(struct spa_support) * dbus_support_info.n_support);
|
sizeof(struct spa_support) * extra_support_info.n_support);
|
||||||
|
|
||||||
dbus_support_info.support[dbus_support_info.n_support++] =
|
|
||||||
SPA_SUPPORT_INIT(SPA_TYPE__LoopUtils, loop->utils);
|
|
||||||
|
|
||||||
|
for (i = 0; i < n_support; i++) {
|
||||||
|
extra_support_info.support[extra_support_info.n_support++] =
|
||||||
|
SPA_SUPPORT_INIT(support[i].type, support[i].data);
|
||||||
|
}
|
||||||
if ((str = getenv("SPA_PLUGIN_DIR")) == NULL)
|
if ((str = getenv("SPA_PLUGIN_DIR")) == NULL)
|
||||||
str = PLUGINDIR;
|
str = PLUGINDIR;
|
||||||
|
|
||||||
if (open_support(str, "support/libspa-dbus", &dbus_support_info))
|
pw_log_debug("load \"%s\", \"%s\"", lib, factory_name);
|
||||||
return load_interface(&dbus_support_info, "dbus", SPA_TYPE__DBus);
|
|
||||||
|
if (open_support(str, lib, &extra_support_info))
|
||||||
|
return load_interface(&extra_support_info, factory_name, type);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *pw_get_spa_dbus(struct pw_loop *loop)
|
||||||
|
{
|
||||||
|
struct spa_support support = SPA_SUPPORT_INIT(SPA_TYPE__LoopUtils, loop->utils);
|
||||||
|
|
||||||
|
return pw_load_spa_interface("support/libspa-dbus", "dbus", SPA_TYPE__DBus,
|
||||||
|
&support, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/** Initialize PipeWire
|
/** Initialize PipeWire
|
||||||
*
|
*
|
||||||
* \param argc pointer to argc
|
* \param argc pointer to argc
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,9 @@ pw_direction_reverse(enum pw_direction direction);
|
||||||
void *
|
void *
|
||||||
pw_get_support_interface(const char *type);
|
pw_get_support_interface(const char *type);
|
||||||
|
|
||||||
|
void *pw_load_spa_interface(const char *lib, const char *factory_name, const char *type,
|
||||||
|
struct spa_support *support, uint32_t n_support);
|
||||||
|
|
||||||
void *pw_get_spa_dbus(struct pw_loop *loop);
|
void *pw_get_spa_dbus(struct pw_loop *loop);
|
||||||
|
|
||||||
const struct spa_handle_factory *
|
const struct spa_handle_factory *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue