summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-06-21 13:31:34 +0200
committerWim Taymans <wtaymans@redhat.com>2019-06-21 13:31:34 +0200
commit6720ded5296fe1d689041b1b4c7eb9b8a7315e4d (patch)
tree6347a11337b70eb69b4736738647eaee2132c82d /src
parent4494f9c7c927d4d7b6f69bb172a352ed2eeb70de (diff)
names: add standard factory name definitions
Define a set of standard factory names and document what they contain. This makes it possible to change the implementation by mapping the factory-name to a different shared library.
Diffstat (limited to 'src')
-rw-r--r--src/daemon/pipewire.conf.in1
-rw-r--r--src/examples/bluez-session.c3
-rw-r--r--src/examples/local-v4l2.c3
-rw-r--r--src/modules/module-audio-dsp/audio-dsp.c13
-rw-r--r--src/modules/module-audio-dsp/floatmix.c3
-rw-r--r--src/modules/module-client-node/client-stream.c3
-rw-r--r--src/pipewire/core.c6
-rw-r--r--src/pipewire/loop.c9
-rw-r--r--src/pipewire/pipewire.c5
9 files changed, 29 insertions, 17 deletions
diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in
index 9c4ee75a..3aba3ae2 100644
--- a/src/daemon/pipewire.conf.in
+++ b/src/daemon/pipewire.conf.in
@@ -3,6 +3,7 @@
#set-prop library.name.system support/libspa-support
#set-prop core.data-loop.library.name.system support/libspa-support
+add-spa-lib audio.convert* audioconvert/libspa-audioconvert
add-spa-lib api.alsa.* alsa/libspa-alsa
add-spa-lib api.v4l2.* v4l2/libspa-v4l2
add-spa-lib api.bluez5.* bluez5/libspa-bluez5
diff --git a/src/examples/bluez-session.c b/src/examples/bluez-session.c
index 4e32694e..55d5906a 100644
--- a/src/examples/bluez-session.c
+++ b/src/examples/bluez-session.c
@@ -32,6 +32,7 @@
#include <spa/node/node.h>
#include <spa/utils/hook.h>
+#include <spa/utils/names.h>
#include <spa/param/audio/format-utils.h>
#include <spa/param/props.h>
#include <spa/debug/dict.h>
@@ -314,7 +315,7 @@ static int start_monitor(struct impl *impl)
int res;
void *iface;
- handle = pw_core_load_spa_handle(impl->core, "api.bluez5.monitor", NULL);
+ handle = pw_core_load_spa_handle(impl->core, SPA_NAME_API_BLUEZ5_MONITOR, NULL);
if (handle == NULL) {
res = -errno;
goto out;
diff --git a/src/examples/local-v4l2.c b/src/examples/local-v4l2.c
index 42dbb653..4d52d4ac 100644
--- a/src/examples/local-v4l2.c
+++ b/src/examples/local-v4l2.c
@@ -37,6 +37,7 @@
#include <spa/node/io.h>
#include <spa/node/utils.h>
#include <spa/debug/format.h>
+#include <spa/utils/names.h>
#include <pipewire/pipewire.h>
@@ -348,7 +349,7 @@ static int make_nodes(struct data *data)
factory = pw_core_find_factory(data->core, "spa-node-factory");
props = pw_properties_new(SPA_KEY_LIBRARY_NAME, "v4l2/libspa-v4l2",
- SPA_KEY_FACTORY_NAME, "api.v4l2.source", NULL);
+ SPA_KEY_FACTORY_NAME, SPA_NAME_API_V4L2_SOURCE, NULL);
data->v4l2 = pw_factory_create_object(factory,
NULL,
PW_TYPE_INTERFACE_Node,
diff --git a/src/modules/module-audio-dsp/audio-dsp.c b/src/modules/module-audio-dsp/audio-dsp.c
index 9bf79bbe..a5b6ff40 100644
--- a/src/modules/module-audio-dsp/audio-dsp.c
+++ b/src/modules/module-audio-dsp/audio-dsp.c
@@ -32,6 +32,7 @@
#include <spa/node/node.h>
#include <spa/utils/hook.h>
+#include <spa/utils/names.h>
#include <spa/param/audio/format-utils.h>
#include <spa/utils/type-info.h>
#include <spa/param/audio/type-info.h>
@@ -262,7 +263,7 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
{
struct pw_node *node;
struct node *n;
- const char *api, *alias, *str, *factory;
+ const char *api, *alias, *str, *mode;
char node_name[128];
enum pw_direction direction;
uint32_t max_buffer_size;
@@ -307,16 +308,16 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
if (direction == PW_DIRECTION_OUTPUT) {
pw_properties_set(props, "merger.monitor", "1");
- factory = "merge";
+ mode = "merge";
} else {
- factory = "split";
+ mode = "split";
}
- pw_properties_set(props, "factory.mode", factory);
- factory = "audioconvert";
+
+ pw_properties_set(props, "factory.mode", mode);
pw_properties_set(props, SPA_KEY_LIBRARY_NAME, "audioconvert/libspa-audioconvert");
node = pw_spa_node_load(core, NULL, NULL,
- factory,
+ SPA_NAME_AUDIO_CONVERT,
node_name,
PW_SPA_NODE_FLAG_ACTIVATE | PW_SPA_NODE_FLAG_NO_REGISTER,
pw_properties_copy(props),
diff --git a/src/modules/module-audio-dsp/floatmix.c b/src/modules/module-audio-dsp/floatmix.c
index fc6f23dd..5e665b9f 100644
--- a/src/modules/module-audio-dsp/floatmix.c
+++ b/src/modules/module-audio-dsp/floatmix.c
@@ -28,6 +28,7 @@
#include <spa/support/log.h>
#include <spa/utils/list.h>
+#include <spa/utils/names.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@@ -931,7 +932,7 @@ impl_enum_interface_info(const struct spa_handle_factory *factory,
const struct spa_handle_factory spa_floatmix_factory = {
SPA_VERSION_HANDLE_FACTORY,
- NAME,
+ SPA_NAME_AUDIO_MIXER,
NULL,
impl_get_size,
impl_init,
diff --git a/src/modules/module-client-node/client-stream.c b/src/modules/module-client-node/client-stream.c
index 08fdb06f..40a9c38d 100644
--- a/src/modules/module-client-node/client-stream.c
+++ b/src/modules/module-client-node/client-stream.c
@@ -35,6 +35,7 @@
#include <spa/node/node.h>
#include <spa/node/utils.h>
+#include <spa/utils/names.h>
#include <spa/buffer/alloc.h>
#include <spa/pod/parser.h>
#include <spa/pod/filter.h>
@@ -1059,7 +1060,7 @@ static void client_node_initialized(void *data)
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LIBRARY_NAME, "audioconvert/libspa-audioconvert");
if ((impl->handle = pw_core_load_spa_handle(impl->core,
- "audioconvert",
+ SPA_NAME_AUDIO_CONVERT,
&SPA_DICT_INIT(items, n_items))) == NULL)
return;
diff --git a/src/pipewire/core.c b/src/pipewire/core.c
index ebf29b59..5e03e6ee 100644
--- a/src/pipewire/core.c
+++ b/src/pipewire/core.c
@@ -31,6 +31,7 @@
#include <spa/support/dbus.h>
#include <spa/node/utils.h>
+#include <spa/utils/names.h>
#include <spa/debug/format.h>
#include <spa/debug/types.h>
@@ -516,7 +517,10 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop,
if (lib == NULL)
lib = "support/libspa-dbus";
- impl->dbus_handle = pw_load_spa_handle(lib, "dbus", NULL, n_support, this->support);
+ impl->dbus_handle = pw_load_spa_handle(lib,
+ SPA_NAME_SUPPORT_DBUS, NULL,
+ n_support, this->support);
+
if (impl->dbus_handle == NULL ||
(res = spa_handle_get_interface(impl->dbus_handle,
SPA_TYPE_INTERFACE_DBus, &dbus_iface)) < 0) {
diff --git a/src/pipewire/loop.c b/src/pipewire/loop.c
index 9a4a7c85..3fd939b6 100644
--- a/src/pipewire/loop.c
+++ b/src/pipewire/loop.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <spa/support/loop.h>
+#include <spa/utils/names.h>
#include <pipewire/pipewire.h>
#include <pipewire/loop.h>
@@ -76,12 +77,12 @@ struct pw_loop *pw_loop_new(struct pw_properties *properties)
lib = NULL;
impl->system_handle = pw_load_spa_handle(lib,
- "system",
+ SPA_NAME_SUPPORT_SYSTEM,
properties ? &properties->dict : NULL,
n_support, support);
if (impl->system_handle == NULL) {
res = -errno;
- pw_log_error("can't make system handle: %m");
+ pw_log_error("can't make "SPA_NAME_SUPPORT_SYSTEM" handle: %m");
goto error_free;
}
@@ -101,12 +102,12 @@ struct pw_loop *pw_loop_new(struct pw_properties *properties)
lib = NULL;
impl->loop_handle = pw_load_spa_handle(lib,
- "loop",
+ SPA_NAME_SUPPORT_LOOP,
properties ? &properties->dict : NULL,
n_support, support);
if (impl->loop_handle == NULL) {
res = -errno;
- pw_log_error("can't make loop handle: %m");
+ pw_log_error("can't make "SPA_NAME_SUPPORT_LOOP" handle: %m");
goto error_unload_system;
}
diff --git a/src/pipewire/pipewire.c b/src/pipewire/pipewire.c
index 1ff8ecdd..bbcc9137 100644
--- a/src/pipewire/pipewire.c
+++ b/src/pipewire/pipewire.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <dlfcn.h>
+#include <spa/utils/names.h>
#include <spa/support/cpu.h>
#include "pipewire.h"
@@ -376,7 +377,7 @@ void pw_init(int *argc, char **argv[])
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_LEVEL, level);
info = SPA_DICT_INIT(items, n_items);
- log = add_interface(support, "logger", SPA_TYPE_INTERFACE_Log, &info);
+ log = add_interface(support, SPA_NAME_SUPPORT_LOG, SPA_TYPE_INTERFACE_Log, &info);
if (log)
pw_log_set(log);
@@ -385,7 +386,7 @@ void pw_init(int *argc, char **argv[])
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_CPU_FORCE, str);
info = SPA_DICT_INIT(items, n_items);
- add_interface(support, "cpu", SPA_TYPE_INTERFACE_CPU, &info);
+ add_interface(support, SPA_NAME_SUPPORT_CPU, SPA_TYPE_INTERFACE_CPU, &info);
pw_log_info("version %s", pw_get_library_version());
}