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.
This commit is contained in:
Wim Taymans 2019-06-21 13:31:34 +02:00
parent 4494f9c7c9
commit 6720ded529
40 changed files with 188 additions and 55 deletions

View file

@ -42,6 +42,7 @@
#include <spa/param/props.h>
#include <spa/param/audio/format-utils.h>
#include <spa/control/control.h>
#include <spa/utils/names.h>
#define M_PI_M2 ( M_PI + M_PI )
@ -283,7 +284,8 @@ static int make_nodes(struct data *data, const char *device)
//uint32_t idx;
if ((res = make_node(data, &data->sink,
"build/spa/plugins/alsa/libspa-alsa.so", "api.alsa.pcm.sink")) < 0) {
"build/spa/plugins/alsa/libspa-alsa.so",
SPA_NAME_API_ALSA_PCM_SINK)) < 0) {
printf("can't create alsa-sink: %d\n", res);
return res;
}

View file

@ -34,6 +34,7 @@
#include <SDL2/SDL.h>
#include <spa/utils/names.h>
#include <spa/support/log-impl.h>
#include <spa/support/loop.h>
#include <spa/node/node.h>
@ -255,7 +256,9 @@ static int make_nodes(struct data *data, const char *device)
uint32_t index;
if ((res =
make_node(data, &data->source, PATH "v4l2/libspa-v4l2.so", "api.v4l2.source")) < 0) {
make_node(data, &data->source,
PATH "v4l2/libspa-v4l2.so",
SPA_NAME_API_V4L2_SOURCE)) < 0) {
printf("can't create v4l2-source: %d\n", res);
return res;
}
@ -469,7 +472,9 @@ int main(int argc, char *argv[])
struct spa_handle *handle = NULL;
void *iface;
if ((res = load_handle(&data, &handle, PATH "support/libspa-support.so", "loop")) < 0)
if ((res = load_handle(&data, &handle,
PATH "support/libspa-support.so",
SPA_NAME_SUPPORT_LOOP)) < 0)
return res;
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Loop, &iface)) < 0) {