alsa: implement monitor and device

This commit is contained in:
Wim Taymans 2018-11-23 17:41:39 +01:00
parent 0a88805743
commit e23c209a5f
11 changed files with 527 additions and 289 deletions

View file

@ -253,10 +253,14 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
struct pw_properties *pr;
int i;
if ((api = pw_properties_get(props, "device.api")) == NULL)
if ((api = pw_properties_get(props, "device.api")) == NULL) {
pw_log_error("missing device.api property");
goto error;
if ((alias = pw_properties_get(props, "device.name")) == NULL)
}
if ((alias = pw_properties_get(props, "device.name")) == NULL) {
pw_log_error("missing device.name property");
goto error;
}
snprintf(node_name, sizeof(node_name), "system_%s", alias);
for (i = 0; node_name[i]; i++) {
@ -287,8 +291,10 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
PW_SPA_NODE_FLAG_ACTIVATE | PW_SPA_NODE_FLAG_NO_REGISTER,
pr, sizeof(struct node) + user_data_size);
if (node == NULL)
if (node == NULL) {
pw_log_error("can't load spa node");
goto error;
}
n = pw_spa_node_get_user_data(node);
n->core = core;

View file

@ -44,7 +44,6 @@
#include <pipewire/device.h>
#include "spa-monitor.h"
#include "spa-node.h"
#include "spa-device.h"
struct monitor_item {
@ -81,7 +80,6 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this,
enum spa_monitor_item_state state;
struct spa_pod *info = NULL;
const struct spa_support *support;
enum pw_spa_node_flags flags;
uint32_t n_support, type;
if (spa_pod_object_parse(item,
@ -147,13 +145,6 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this,
mitem->type = type;
switch (type) {
case SPA_TYPE_INTERFACE_Node:
flags = PW_SPA_NODE_FLAG_ACTIVATE;
flags |= (state == SPA_MONITOR_ITEM_STATE_Available) ? 0 : PW_SPA_NODE_FLAG_DISABLE;
mitem->object = pw_spa_node_new(impl->core, NULL, impl->parent, name,
flags,
iface, handle, props, 0);
break;
case SPA_TYPE_INTERFACE_Device:
mitem->object = pw_spa_device_new(impl->core, NULL, impl->parent, name,
0, iface, handle, props, 0);