[gst-devel] linking pads (was: wingo gstreamer: gstreamer/ gstreamer/gst/)

Andy Wingo wingo at pobox.com
Tue Mar 16 05:55:05 CET 2004


On Wed, 2004-03-10 at 21:58, David Schleef wrote:
> On Wed, Mar 10, 2004 at 04:37:35PM +0100, Benjamin Otte wrote:
> > I'd like to have gst_pad_can_link_filtered as a function that I can throw any 
> > two pads at and see if they can connect without having to think about them any 
> > more.
> 
> Keep in mind that it's not possible to properly test whether two pads
> can be linked without actually linking them.

It will always be that way. In general, you don't know if calling a
pad's link function will be successful.

However, if you test your app and know what a specific plugin is going
to do, you can call gst_pad_link without can_link and be sure of the
results. If you don't know anything about the plugin or the pads or the
network, you need to test before linking.

For that reason,

> Most application code does not check gst_pad_can_link() before linking
> pads.  It's rather silly to have to check if you can do something
> before doing something

Most code that actually checks the retval does a g_assert (or the like)
on it. If you want to query, use the query function. However, if you
already know structurally and historically that it is a valid link, you
just call gst_pad_link.

Regards,
-- 
Andy Wingo <wingo at pobox.com>




More information about the gstreamer-devel mailing list