mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
glmixer: override the caps query in order to 'convert' capsfeatures
Otherwise, it is only possible for the sink pads and the src pads to have the exact same caps features. We can convert from any feature to another feature so support that.
This commit is contained in:
parent
1bd6e87cfc
commit
0b2e5c3f95
1 changed files with 42 additions and 0 deletions
|
@ -287,6 +287,37 @@ gst_gl_mixer_pad_sink_acceptcaps (GstPad * pad, GstGLMixer * mix,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_gl_mixer_pad_sink_getcaps (GstPad * pad, GstGLMixer * mix, GstCaps * filter)
|
||||
{
|
||||
GstCaps *srccaps;
|
||||
GstCaps *template_caps;
|
||||
GstCaps *filtered_caps;
|
||||
GstCaps *returned_caps;
|
||||
gboolean had_current_caps = TRUE;
|
||||
|
||||
template_caps = gst_pad_get_pad_template_caps (pad);
|
||||
|
||||
srccaps = gst_pad_get_current_caps (pad);
|
||||
if (srccaps == NULL) {
|
||||
had_current_caps = FALSE;
|
||||
srccaps = template_caps;
|
||||
}
|
||||
|
||||
filtered_caps = srccaps;
|
||||
if (filter)
|
||||
filtered_caps = gst_caps_intersect (srccaps, filter);
|
||||
returned_caps = gst_caps_intersect (filtered_caps, template_caps);
|
||||
|
||||
gst_caps_unref (srccaps);
|
||||
if (filter)
|
||||
gst_caps_unref (filtered_caps);
|
||||
if (had_current_caps)
|
||||
gst_caps_unref (template_caps);
|
||||
|
||||
return returned_caps;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_mixer_sink_query (GstAggregator * agg, GstAggregatorPad * bpad,
|
||||
GstQuery * query)
|
||||
|
@ -297,6 +328,17 @@ gst_gl_mixer_sink_query (GstAggregator * agg, GstAggregatorPad * bpad,
|
|||
GST_TRACE ("QUERY %" GST_PTR_FORMAT, query);
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_CAPS:
|
||||
{
|
||||
GstCaps *filter, *caps;
|
||||
|
||||
gst_query_parse_caps (query, &filter);
|
||||
caps = gst_gl_mixer_pad_sink_getcaps (GST_PAD (bpad), mix, filter);
|
||||
gst_query_set_caps_result (query, caps);
|
||||
gst_caps_unref (caps);
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_ACCEPT_CAPS:
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
|
Loading…
Reference in a new issue