mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
stream: find right media_class from format
This commit is contained in:
parent
c6a7b3eedb
commit
3e674f1646
1 changed files with 21 additions and 2 deletions
|
|
@ -1376,6 +1376,24 @@ static int find_format(struct stream *impl, enum pw_direction direction,
|
||||||
return 0;
|
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
|
SPA_EXPORT
|
||||||
int
|
int
|
||||||
pw_stream_connect(struct pw_stream *stream,
|
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);
|
impl->alloc_buffers = SPA_FLAG_CHECK(flags, PW_STREAM_FLAG_ALLOC_BUFFERS);
|
||||||
|
|
||||||
pw_properties_setf(stream->properties, PW_KEY_MEDIA_CLASS, "Stream/%s/Audio",
|
pw_properties_setf(stream->properties, PW_KEY_MEDIA_CLASS, "Stream/%s/%s",
|
||||||
direction == PW_DIRECTION_INPUT ? "Input" : "Output");
|
direction == PW_DIRECTION_INPUT ? "Input" : "Output",
|
||||||
|
get_media_class(impl));
|
||||||
|
|
||||||
state = pw_remote_get_state(stream->remote, NULL);
|
state = pw_remote_get_state(stream->remote, NULL);
|
||||||
impl->async_connect = (state == PW_REMOTE_STATE_UNCONNECTED ||
|
impl->async_connect = (state == PW_REMOTE_STATE_UNCONNECTED ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue