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

@ -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),

View file

@ -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,

View file

@ -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;