parsebin: accept-caps handling for elements with unusual pad names

In case the last element of the parse chain doesn´t have a sink pad named
"sink", send the accept-caps query to the first sink pad of the element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7255>
This commit is contained in:
Philippe Normand 2024-07-29 10:03:58 +01:00 committed by GStreamer Marge Bot
parent 8faefccfd5
commit bd64374174

View file

@ -3190,9 +3190,28 @@ gst_parse_chain_accept_caps (GstParseChain * chain, GstCaps * caps)
GST_ELEMENT_NAME (initial_element->element), caps);
sink = gst_element_get_static_pad (initial_element->element, "sink");
ret = gst_pad_query_accept_caps (sink, caps);
gst_object_unref (sink);
if (sink) {
ret = gst_pad_query_accept_caps (sink, caps);
gst_object_unref (sink);
} else {
GST_OBJECT_LOCK (initial_element->element);
if (G_UNLIKELY (!initial_element->element->numsinkpads)) {
GST_ERROR_OBJECT (chain->parsebin,
"element %" GST_PTR_FORMAT " has no sink pad",
initial_element->element);
GST_OBJECT_UNLOCK (initial_element->element);
return FALSE;
}
GstPad *pad =
GST_PAD_CAST (gst_object_ref (initial_element->element->sinkpads));
GST_OBJECT_UNLOCK (initial_element->element);
GST_DEBUG_OBJECT (chain->parsebin,
"element %" GST_PTR_FORMAT
" doesn't have a 'sink' pad, sending accept-caps query to "
"%" GST_PTR_FORMAT, initial_element->element, pad);
ret = gst_pad_query_accept_caps (pad, caps);
gst_object_unref (pad);
}
GST_DEBUG_OBJECT (chain->parsebin, "Chain can%s handle caps",
ret ? "" : " NOT");