mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
pwg: fix more negotiation for 1.0
This commit is contained in:
parent
4710b36bda
commit
58d21a49d1
1 changed files with 48 additions and 16 deletions
|
@ -423,26 +423,58 @@ gst_my_filter_chain (GstPad *pad,
|
||||||
#include "init.func"
|
#include "init.func"
|
||||||
--><!-- example-end getcaps.c a -->
|
--><!-- example-end getcaps.c a -->
|
||||||
<!-- example-begin getcaps.c b -->
|
<!-- example-begin getcaps.c b -->
|
||||||
static GstCaps *
|
static gboolean
|
||||||
gst_my_filter_getcaps (GstPad *pad)
|
gst_my_filter_query (GstPad *pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstMyFilter *filter = GST_MY_FILTER (GST_OBJECT_PARENT (pad));
|
gboolean ret;
|
||||||
GstPad *otherpad = (pad == filter->srcpad) ? filter->sinkpad :
|
GstMyFilter *filter = GST_MY_FILTER (parent);
|
||||||
filter->srcpad;
|
|
||||||
GstCaps *othercaps = gst_pad_get_allowed_caps (otherpad), *caps;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
/* We support *any* samplerate, indifferent from the samplerate
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
* supported by the linked elements on both sides. */
|
case GST_QUERY_CAPS
|
||||||
for (i = 0; i < gst_caps_get_size (othercaps); i++) {
|
{
|
||||||
GstStructure *structure = gst_caps_get_structure (othercaps, i);
|
GstPad *otherpad;
|
||||||
|
GstCaps *temp, *caps, *filter, *tcaps;
|
||||||
|
gint i;
|
||||||
|
|
||||||
gst_structure_remove_field (structure, "rate");
|
otherpad = (pad == filter->srcpad) ? filter->sinkpad :
|
||||||
|
filter->srcpad;
|
||||||
|
caps = gst_pad_get_allowed_caps (otherpad);
|
||||||
|
|
||||||
|
gst_query_parse_caps (query, &filter);
|
||||||
|
|
||||||
|
/* We support *any* samplerate, indifferent from the samplerate
|
||||||
|
* supported by the linked elements on both sides. */
|
||||||
|
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
||||||
|
GstStructure *structure = gst_caps_get_structure (caps, i);
|
||||||
|
|
||||||
|
gst_structure_remove_field (structure, "rate");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* make sure we only return results that intersect our
|
||||||
|
* padtemplate */
|
||||||
|
tcaps = gst_pad_get_pad_template_caps (pad);
|
||||||
|
if (tcaps) {
|
||||||
|
temp = gst_caps_intersect (caps, tcaps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
gst_caps_unref (tcaps);
|
||||||
|
caps = temp;
|
||||||
|
}
|
||||||
|
/* filter against the query filter when needed */
|
||||||
|
if (filter) {
|
||||||
|
temp = gst_caps_intersect (caps, filter);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
caps = temp;
|
||||||
|
}
|
||||||
|
gst_query_set_caps_result (query, caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
ret = gst_pad_query_default (pad, parent, query);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
caps = gst_caps_intersect (othercaps, gst_pad_get_pad_template_caps (pad));
|
return ret;
|
||||||
gst_caps_unref (othercaps);
|
|
||||||
|
|
||||||
return caps;
|
|
||||||
}
|
}
|
||||||
<!-- example-end getcaps.c b -->
|
<!-- example-end getcaps.c b -->
|
||||||
<!-- example-begin getcaps.c c --><!--
|
<!-- example-begin getcaps.c c --><!--
|
||||||
|
|
Loading…
Reference in a new issue