mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
stream: handle missing EnumFormat params
When we don't have an EnumFormat param, don't fail but fall back to the MEDIA_TYPE property to calculate the media class. Fixes things like: gst-launch-1.0 -v pipewiresrc stream-properties="props,media.type=Video" ! fakesink
This commit is contained in:
parent
fc49c1697a
commit
9eb9fe4fbe
1 changed files with 6 additions and 4 deletions
|
|
@ -1359,7 +1359,7 @@ static int find_format(struct stream *impl, enum pw_direction direction,
|
||||||
SPA_PARAM_EnumFormat, &state,
|
SPA_PARAM_EnumFormat, &state,
|
||||||
NULL, &format, &b)) != 1) {
|
NULL, &format, &b)) != 1) {
|
||||||
pw_log_warn(NAME" %p: no format given", impl);
|
pw_log_warn(NAME" %p: no format given", impl);
|
||||||
return -ENOENT;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((res = spa_format_parse(format, media_type, media_subtype)) < 0)
|
if ((res = spa_format_parse(format, media_type, media_subtype)) < 0)
|
||||||
|
|
@ -1389,9 +1389,9 @@ static const char *get_media_class(struct stream *impl)
|
||||||
case SPA_MEDIA_SUBTYPE_midi:
|
case SPA_MEDIA_SUBTYPE_midi:
|
||||||
return "Midi";
|
return "Midi";
|
||||||
}
|
}
|
||||||
/* fallthrough */
|
|
||||||
default:
|
|
||||||
return "Data";
|
return "Data";
|
||||||
|
default:
|
||||||
|
return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1473,10 +1473,12 @@ pw_stream_connect(struct pw_stream *stream,
|
||||||
impl->warn_mlock = SPA_FLAG_IS_SET(flags, PW_STREAM_FLAG_RT_PROCESS);
|
impl->warn_mlock = SPA_FLAG_IS_SET(flags, PW_STREAM_FLAG_RT_PROCESS);
|
||||||
pw_properties_set(stream->properties, "mem.warn-mlock", impl->warn_mlock ? "true" : "false");
|
pw_properties_set(stream->properties, "mem.warn-mlock", impl->warn_mlock ? "true" : "false");
|
||||||
|
|
||||||
|
|
||||||
if ((pw_properties_get(stream->properties, PW_KEY_MEDIA_CLASS) == NULL)) {
|
if ((pw_properties_get(stream->properties, PW_KEY_MEDIA_CLASS) == NULL)) {
|
||||||
|
const char *media_type = pw_properties_get(stream->properties, PW_KEY_MEDIA_TYPE);
|
||||||
pw_properties_setf(stream->properties, PW_KEY_MEDIA_CLASS, "Stream/%s/%s",
|
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));
|
media_type ? media_type : get_media_class(impl));
|
||||||
}
|
}
|
||||||
if ((str = pw_properties_get(stream->properties, PW_KEY_FORMAT_DSP)) != NULL)
|
if ((str = pw_properties_get(stream->properties, PW_KEY_FORMAT_DSP)) != NULL)
|
||||||
pw_properties_set(impl->port_props, PW_KEY_FORMAT_DSP, str);
|
pw_properties_set(impl->port_props, PW_KEY_FORMAT_DSP, str);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue