summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2cb0dd9)
raw | patch | inline | side by side (parent: 2cb0dd9)
author | Andy Wingo <wingo@pobox.com> | |
Tue, 19 Feb 2002 05:59:07 +0000 (05:59 +0000) | ||
committer | Andy Wingo <wingo@pobox.com> | |
Tue, 19 Feb 2002 05:59:07 +0000 (05:59 +0000) |
Original commit message from CVS:
* changes to spider:
* add padtemplates so the connect functions can connect two request-pad
elements
* add a hack in gstelement.c. please look at this, Company, and see how
we can get around this
* add backwards caps-propagation support in identity, int2float, float2int,
adder, speed, volume
* changes to spider:
* add padtemplates so the connect functions can connect two request-pad
elements
* add a hack in gstelement.c. please look at this, Company, and see how
we can get around this
* add backwards caps-propagation support in identity, int2float, float2int,
adder, speed, volume
gst/autoplug/gstspider.c | patch | blob | history | |
gst/elements/gstidentity.c | patch | blob | history | |
gst/gstelement.c | patch | blob | history | |
plugins/elements/gstidentity.c | patch | blob | history |
index 91f7822e30fe9073604060c1a7c01093d212c84b..9f51adc181c36e3aa0627265a72642a725500228 100644 (file)
--- a/gst/autoplug/gstspider.c
+++ b/gst/autoplug/gstspider.c
/* no signals yet
static guint gst_spider_signals[LAST_SIGNAL] = { 0 };*/
+/* let gstreamer know that we have some request pads available */
+GST_PADTEMPLATE_FACTORY (gst_spider_sink_template_factory,
+ "sink%d",
+ GST_PAD_SINK,
+ GST_PAD_REQUEST,
+ NULL
+);
+GST_PADTEMPLATE_FACTORY (gst_spider_src_template_factory,
+ "src%d",
+ GST_PAD_SRC,
+ GST_PAD_REQUEST,
+ NULL
+);
+
/* GObject and GStreamer init functions */
GType
gst_spider_get_type(void)
gobject_class->get_property = gst_spider_get_property;
gobject_class->dispose = gst_spider_dispose;
+ gst_element_class_add_padtemplate (gstelement_class, gst_spider_src_template_factory());
+ gst_element_class_add_padtemplate (gstelement_class, gst_spider_sink_template_factory());
+
gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR(gst_spider_request_new_pad);
}
static void
};
-
\ No newline at end of file
+
index 66a43e10571b4767b44f33bfc39a9b337125edfa..19418f0a6f5b9c757010d3d5ca878f09e45e8e73 100644 (file)
}
static GstPadConnectReturn
-gst_identity_connect_sink (GstPad *pad, GstCaps *caps)
+gst_identity_connect (GstPad *pad, GstCaps *caps)
{
GstIdentity *identity;
+ GstPad *otherpad;
identity = GST_IDENTITY (gst_pad_get_parent (pad));
+ otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
if (GST_CAPS_IS_FIXED (caps))
- if (gst_pad_try_set_caps (identity->srcpad, caps))
+ if (gst_pad_try_set_caps (otherpad, caps))
return GST_PAD_CONNECT_OK;
else
return GST_PAD_CONNECT_REFUSED;
gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad);
gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain));
gst_pad_set_bufferpool_function (identity->sinkpad, gst_identity_get_bufferpool);
- gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect_sink);
+ gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect);
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
+ gst_pad_set_connect_function (identity->srcpad, gst_identity_connect);
identity->loop_based = FALSE;
identity->sleep_time = 0;
{
GstIdentity *identity;
GstBuffer *buf;
- guint i;
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_IDENTITY (element));
diff --git a/gst/gstelement.c b/gst/gstelement.c
index 76a1d0cf09cfef9b24d13b9f8111f01547679d96..7b9a9e1324a81d087c7e3dce1908d3d2dbcc8826 100644 (file)
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -764,7 +764,7 @@ gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad, GstCa
{
GList *pads;
GstPadTemplate *templ;
- GstCaps *intersection;
+ GstCaps *intersection, *templcaps;
GstPad *foundpad = NULL;
/* checks */
@@ -792,16 +792,26 @@ gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad, GstCa
/* try to create a new one */
/* requesting is a little crazy, we need a template. Let's create one */
if (filtercaps != NULL) {
- filtercaps = gst_caps_intersect (filtercaps, (GstCaps *) GST_RPAD_CAPS (pad));
- if (filtercaps == NULL)
+ templcaps = gst_caps_intersect (filtercaps, (GstCaps *) GST_RPAD_CAPS (pad));
+ if (templcaps == NULL)
return NULL;
+ } else {
+ templcaps = gst_caps_copy (gst_pad_get_caps (pad));
}
+
templ = gst_padtemplate_new ((gchar *) GST_PAD_NAME (pad), GST_RPAD_DIRECTION (pad),
- GST_PAD_ALWAYS, filtercaps);
+ GST_PAD_ALWAYS, templcaps, NULL);
foundpad = gst_element_request_compatible_pad (element, templ);
- gst_object_unref (GST_OBJECT (templ));
- if (filtercaps != NULL)
- gst_caps_unref (filtercaps);
+ gst_object_unref (GST_OBJECT (templ)); /* this will take care of the caps too */
+
+ /* FIXME: this is broken, but it's in here so autoplugging elements that don't
+ have caps on their source padtemplates (spider) can connect... */
+ if (!foundpad && !filtercaps) {
+ templ = gst_padtemplate_new ((gchar *) GST_PAD_NAME (pad), GST_RPAD_DIRECTION (pad),
+ GST_PAD_ALWAYS, NULL, NULL);
+ foundpad = gst_element_request_compatible_pad (element, templ);
+ gst_object_unref (GST_OBJECT (templ));
+ }
return foundpad;
}
}
}
- GST_DEBUG (GST_CAT_ELEMENT_PADS, "we might have request pads on both sides, checking...");
+ GST_DEBUG (GST_CAT_ELEMENT_PADS, "we might have request pads on both sides, checking...\n");
srctempls = gst_element_get_padtemplate_list (src);
desttempls = gst_element_get_padtemplate_list (dest);
index 66a43e10571b4767b44f33bfc39a9b337125edfa..19418f0a6f5b9c757010d3d5ca878f09e45e8e73 100644 (file)
}
static GstPadConnectReturn
-gst_identity_connect_sink (GstPad *pad, GstCaps *caps)
+gst_identity_connect (GstPad *pad, GstCaps *caps)
{
GstIdentity *identity;
+ GstPad *otherpad;
identity = GST_IDENTITY (gst_pad_get_parent (pad));
+ otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
if (GST_CAPS_IS_FIXED (caps))
- if (gst_pad_try_set_caps (identity->srcpad, caps))
+ if (gst_pad_try_set_caps (otherpad, caps))
return GST_PAD_CONNECT_OK;
else
return GST_PAD_CONNECT_REFUSED;
gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad);
gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain));
gst_pad_set_bufferpool_function (identity->sinkpad, gst_identity_get_bufferpool);
- gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect_sink);
+ gst_pad_set_connect_function (identity->sinkpad, gst_identity_connect);
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
+ gst_pad_set_connect_function (identity->srcpad, gst_identity_connect);
identity->loop_based = FALSE;
identity->sleep_time = 0;
{
GstIdentity *identity;
GstBuffer *buf;
- guint i;
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_IDENTITY (element));