mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-02-13 02:30:30 +01:00
monitor: add a flag to activate alsa devices
In current pw master the behavior has been changed to not activate the "On" profile on alsa devices by default, because of the DeviceReserve D-Bus API implementation in media-session. This is a hack here to get the previous behavior. In the future we should have a way to configure profiles, as well as to pick a sensible default by autodetection.
This commit is contained in:
parent
bbca2ca236
commit
7e41d5aa52
3 changed files with 20 additions and 2 deletions
|
|
@ -302,6 +302,18 @@ node_new (struct object *dev, uint32_t id,
|
|||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
set_profile(struct spa_device * dev, int index)
|
||||
{
|
||||
char buf[1024];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
|
||||
spa_device_set_param (dev,
|
||||
SPA_PARAM_Profile, 0,
|
||||
spa_pod_builder_add_object(&b,
|
||||
SPA_TYPE_OBJECT_ParamProfile, 0,
|
||||
SPA_PARAM_PROFILE_index, SPA_POD_Int(index)));
|
||||
}
|
||||
|
||||
static struct object *
|
||||
device_new (WpMonitor *self, uint32_t id, const gchar *factory_name,
|
||||
WpProperties *properties, GError **error)
|
||||
|
|
@ -362,6 +374,10 @@ device_new (WpMonitor *self, uint32_t id, const gchar *factory_name,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* HACK this is very specific to the current alsa pcm profiles */
|
||||
if (self->flags & WP_MONITOR_FLAG_ACTIVATE_DEVICES)
|
||||
set_profile ((struct spa_device *) dev->spa_dev->interface, 1);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
|
@ -555,7 +571,8 @@ wp_monitor_start (WpMonitor *self, GError **error)
|
|||
|
||||
core = g_weak_ref_get (&self->core);
|
||||
|
||||
g_debug ("WpMonitor:%p:%s starting monitor", self, self->factory_name);
|
||||
g_debug ("WpMonitor:%p:%s starting monitor, flags 0x%x", self,
|
||||
self->factory_name, self->flags);
|
||||
|
||||
self->device = device_new (self, -1, self->factory_name, self->properties,
|
||||
&err);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ G_BEGIN_DECLS
|
|||
typedef enum { /*< flags, prefix=WP_MONITOR_FLAG_ >*/
|
||||
WP_MONITOR_FLAG_LOCAL_NODES = (1 << 0),
|
||||
WP_MONITOR_FLAG_USE_ADAPTER = (1 << 1),
|
||||
WP_MONITOR_FLAG_ACTIVATE_DEVICES = (1 << 2),
|
||||
} WpMonitorFlags;
|
||||
|
||||
#define WP_MONITOR_KEY_OBJECT_ID "wp.monitor.object.id"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ load-module C libwireplumber-module-mixer {
|
|||
|
||||
load-module C libwireplumber-module-monitor {
|
||||
"factory": <"api.alsa.enum.udev">,
|
||||
"flags": <["use-adapter"]>
|
||||
"flags": <["use-adapter", "activate-devices"]>
|
||||
}
|
||||
|
||||
load-module C libwireplumber-module-monitor {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue