summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2003-03-02 14:00:11 +0000
committerWim Taymans <wim.taymans@gmail.com>2003-03-02 14:00:11 +0000
commita82c7a7572234b6415bde81b70f53de73083fe73 (patch)
tree9c0585d1c68ac8ee932ef5e4f2f99101fed2a58d /plugins
parentefaef0379d13cd92c6164c8abdb388a39d94e652 (diff)
Better capsnego
Original commit message from CVS: Better capsnego
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elements/gsttee.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c
index 34b23193a..a4be79fad 100644
--- a/plugins/elements/gsttee.c
+++ b/plugins/elements/gsttee.c
@@ -142,13 +142,52 @@ gst_tee_sinklink (GstPad *pad, GstCaps *caps)
if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC || !GST_PAD_IS_USABLE (outpad))
continue;
- if ((set_retval = gst_pad_try_set_caps (outpad, caps)) <= 0) {
+ if ((set_retval = gst_pad_proxy_link (outpad, caps)) <= 0) {
return set_retval;
}
}
return GST_PAD_LINK_OK;
}
+static GstPadLinkReturn
+gst_tee_srclink (GstPad *pad, GstCaps *caps)
+{
+ GstTee *tee;
+
+ tee = GST_TEE (gst_pad_get_parent (pad));
+
+ return gst_pad_proxy_link (tee->sinkpad, caps);
+}
+
+static GstCaps*
+gst_tee_sinkgetcaps (GstPad *pad, GstCaps *filter)
+{
+ GstCaps *caps = NULL;
+ GstTee *tee;
+ const GList *pads;
+
+ tee = GST_TEE (gst_pad_get_parent (pad));
+
+ pads = gst_element_get_pad_list (GST_ELEMENT (tee));
+
+ while (pads) {
+ GstPad *srcpad = GST_PAD_CAST (pads->data);
+ GstCaps *peercaps;
+
+ pads = g_list_next (pads);
+
+ if (!GST_PAD_IS_SRC (srcpad))
+ continue;
+
+ peercaps = gst_pad_get_caps (srcpad);
+ caps = gst_caps_intersect (caps, peercaps);
+ gst_caps_unref (caps);
+ gst_caps_unref (peercaps);
+ }
+
+ return caps;
+}
+
static void
gst_tee_init (GstTee *tee)
{
@@ -156,6 +195,7 @@ gst_tee_init (GstTee *tee)
gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain));
gst_pad_set_link_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_sinklink));
+ gst_pad_set_getcaps_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_sinkgetcaps));
tee->silent = FALSE;
tee->last_message = NULL;
@@ -213,6 +253,7 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
srcpad = gst_pad_new_from_template (templ, name);
g_free (name);
+ gst_pad_set_link_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_srclink));
gst_element_add_pad (GST_ELEMENT (tee), srcpad);
GST_PAD_ELEMENT_PRIVATE (srcpad) = NULL;