mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
typefind: clean up src query handler
This commit is contained in:
parent
374d5c36f9
commit
fed0284d3c
1 changed files with 22 additions and 16 deletions
|
@ -384,27 +384,33 @@ gst_type_find_handle_src_query (GstPad * pad, GstObject * parent,
|
||||||
GST_DEBUG_OBJECT (typefind, "Handling src query %s",
|
GST_DEBUG_OBJECT (typefind, "Handling src query %s",
|
||||||
GST_QUERY_TYPE_NAME (query));
|
GST_QUERY_TYPE_NAME (query));
|
||||||
|
|
||||||
/* We can hijack caps query if we typefind already */
|
|
||||||
if (GST_QUERY_TYPE (query) == GST_QUERY_CAPS) {
|
|
||||||
GST_DEBUG_OBJECT (typefind, "Got caps query, our caps are %" GST_PTR_FORMAT,
|
|
||||||
typefind->caps);
|
|
||||||
if (typefind->caps) {
|
|
||||||
gst_query_set_caps_result (query, typefind->caps);
|
|
||||||
res = TRUE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res = gst_pad_peer_query (typefind->sink, query);
|
|
||||||
if (!res)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
case GST_QUERY_SCHEDULING:
|
||||||
|
/* FIXME, filter out the scheduling modes that we understand */
|
||||||
|
res = gst_pad_peer_query (typefind->sink, query);
|
||||||
|
break;
|
||||||
|
case GST_QUERY_CAPS:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (typefind,
|
||||||
|
"Got caps query, our caps are %" GST_PTR_FORMAT, typefind->caps);
|
||||||
|
|
||||||
|
/* We can hijack caps query if we typefind already */
|
||||||
|
if (typefind->caps) {
|
||||||
|
gst_query_set_caps_result (query, typefind->caps);
|
||||||
|
res = TRUE;
|
||||||
|
} else {
|
||||||
|
res = gst_pad_peer_query (typefind->sink, query);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
{
|
{
|
||||||
gint64 peer_pos;
|
gint64 peer_pos;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
|
|
||||||
|
if (!(res = gst_pad_peer_query (typefind->sink, query)))
|
||||||
|
goto out;
|
||||||
|
|
||||||
gst_query_parse_position (query, &format, &peer_pos);
|
gst_query_parse_position (query, &format, &peer_pos);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (typefind);
|
GST_OBJECT_LOCK (typefind);
|
||||||
|
@ -422,9 +428,9 @@ gst_type_find_handle_src_query (GstPad * pad, GstObject * parent,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue