alsa: set MEDIA_CLASS in nodes

This commit is contained in:
Wim Taymans 2019-11-05 16:34:12 +01:00
parent 1f5aa26452
commit 60cd74fdb0
2 changed files with 11 additions and 0 deletions

View file

@ -88,6 +88,7 @@ static const struct pw_client_endpoint_proxy_events client_endpoint_events = {
.stream_set_param = client_endpoint_stream_set_param,
};
/** fallback, one stream for each node */
static int setup_alsa_fallback_endpoint(struct alsa_object *obj)
{
struct alsa_node *n;
@ -110,6 +111,10 @@ static int setup_alsa_fallback_endpoint(struct alsa_object *obj)
return 0;
}
/** UCM.
*
* We create 1 stream for each verb + modifier combination
*/
static int setup_alsa_ucm_endpoint(struct alsa_object *obj)
{
const char *str, *card_name = NULL;

View file

@ -168,6 +168,12 @@ static struct alsa_node *alsa_create_node(struct alsa_object *obj, uint32_t id,
pw_properties_setf(node->props, PW_KEY_PRIORITY_SESSION, "%d", priority);
}
if (pw_properties_get(node->props, SPA_KEY_MEDIA_CLASS) == NULL) {
if (!strcmp(stream, "capture"))
pw_properties_setf(node->props, SPA_KEY_MEDIA_CLASS, "Audio/Source");
else
pw_properties_setf(node->props, SPA_KEY_MEDIA_CLASS, "Audio/Sink");
}
if (pw_properties_get(node->props, SPA_KEY_NODE_NAME) == NULL) {
const char *devname;
if ((devname = pw_properties_get(obj->props, SPA_KEY_DEVICE_NAME)) == NULL)