From 3e674f1646327b6539897c10df08008ca4f759f7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 12 Aug 2019 15:13:36 +0200 Subject: [PATCH] stream: find right media_class from format --- src/pipewire/stream.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 98afe93f7..fb7e2ba34 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1376,6 +1376,24 @@ static int find_format(struct stream *impl, enum pw_direction direction, return 0; } +static const char *get_media_class(struct stream *impl) +{ + switch (impl->media_type) { + case SPA_MEDIA_TYPE_audio: + return "Audio"; + case SPA_MEDIA_TYPE_video: + return "Video"; + case SPA_MEDIA_TYPE_stream: + switch(impl->media_subtype) { + case SPA_MEDIA_SUBTYPE_midi: + return "Midi"; + } + /* fallthrough */ + default: + return "Data"; + } +} + SPA_EXPORT int pw_stream_connect(struct pw_stream *stream, @@ -1436,8 +1454,9 @@ pw_stream_connect(struct pw_stream *stream, impl->alloc_buffers = SPA_FLAG_CHECK(flags, PW_STREAM_FLAG_ALLOC_BUFFERS); - pw_properties_setf(stream->properties, PW_KEY_MEDIA_CLASS, "Stream/%s/Audio", - direction == PW_DIRECTION_INPUT ? "Input" : "Output"); + pw_properties_setf(stream->properties, PW_KEY_MEDIA_CLASS, "Stream/%s/%s", + direction == PW_DIRECTION_INPUT ? "Input" : "Output", + get_media_class(impl)); state = pw_remote_get_state(stream->remote, NULL); impl->async_connect = (state == PW_REMOTE_STATE_UNCONNECTED ||