mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
imagefreeze: Response caps query from srcpad
... and chain up to default query handler for unhandled query types. Unhandled query shouldn't be returned with FALSE if there's no special needs. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/731>
This commit is contained in:
parent
e64227f585
commit
027940a416
1 changed files with 21 additions and 10 deletions
|
@ -76,8 +76,8 @@ static gboolean gst_image_freeze_sink_event (GstPad * pad, GstObject * parent,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
static gboolean gst_image_freeze_sink_setcaps (GstImageFreeze * self,
|
static gboolean gst_image_freeze_sink_setcaps (GstImageFreeze * self,
|
||||||
GstCaps * caps);
|
GstCaps * caps);
|
||||||
static GstCaps *gst_image_freeze_sink_getcaps (GstImageFreeze * self,
|
static GstCaps *gst_image_freeze_query_caps (GstImageFreeze * self,
|
||||||
GstCaps * filter);
|
GstPad * pad, GstCaps * filter);
|
||||||
static gboolean gst_image_freeze_sink_query (GstPad * pad, GstObject * parent,
|
static gboolean gst_image_freeze_sink_query (GstPad * pad, GstObject * parent,
|
||||||
GstQuery * query);
|
GstQuery * query);
|
||||||
static void gst_image_freeze_src_loop (GstPad * pad);
|
static void gst_image_freeze_src_loop (GstPad * pad);
|
||||||
|
@ -333,25 +333,26 @@ gst_image_freeze_remove_fps (GstImageFreeze * self, GstCaps * caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_image_freeze_sink_getcaps (GstImageFreeze * self, GstCaps * filter)
|
gst_image_freeze_query_caps (GstImageFreeze * self, GstPad * pad,
|
||||||
|
GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstCaps *ret, *tmp, *templ;
|
GstCaps *ret, *tmp, *templ;
|
||||||
GstPad *pad;
|
GstPad *otherpad;
|
||||||
|
|
||||||
pad = self->sinkpad;
|
otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad;
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
filter = gst_caps_copy (filter);
|
filter = gst_caps_copy (filter);
|
||||||
gst_image_freeze_remove_fps (self, filter);
|
gst_image_freeze_remove_fps (self, filter);
|
||||||
}
|
}
|
||||||
templ = gst_pad_get_pad_template_caps (pad);
|
templ = gst_pad_get_pad_template_caps (pad);
|
||||||
tmp = gst_pad_peer_query_caps (self->srcpad, filter);
|
tmp = gst_pad_peer_query_caps (otherpad, filter);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
GST_LOG_OBJECT (self, "peer caps %" GST_PTR_FORMAT, tmp);
|
GST_LOG_OBJECT (otherpad, "peer caps %" GST_PTR_FORMAT, tmp);
|
||||||
ret = gst_caps_intersect (tmp, templ);
|
ret = gst_caps_intersect (tmp, templ);
|
||||||
gst_caps_unref (tmp);
|
gst_caps_unref (tmp);
|
||||||
} else {
|
} else {
|
||||||
GST_LOG_OBJECT (self, "going to copy");
|
GST_LOG_OBJECT (otherpad, "going to copy");
|
||||||
ret = gst_caps_copy (templ);
|
ret = gst_caps_copy (templ);
|
||||||
}
|
}
|
||||||
if (templ)
|
if (templ)
|
||||||
|
@ -382,7 +383,7 @@ gst_image_freeze_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
gst_query_parse_caps (query, &caps);
|
gst_query_parse_caps (query, &caps);
|
||||||
caps = gst_image_freeze_sink_getcaps (self, caps);
|
caps = gst_image_freeze_query_caps (self, pad, caps);
|
||||||
gst_query_set_caps_result (query, caps);
|
gst_query_set_caps_result (query, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
@ -580,8 +581,18 @@ gst_image_freeze_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
}
|
}
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
|
case GST_QUERY_CAPS:
|
||||||
|
{
|
||||||
|
GstCaps *caps;
|
||||||
|
gst_query_parse_caps (query, &caps);
|
||||||
|
caps = gst_image_freeze_query_caps (self, pad, caps);
|
||||||
|
gst_query_set_caps_result (query, caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
ret = FALSE;
|
ret = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue