2002-01-28 01:47:31 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2002 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2002 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
2003-01-09 20:02:34 +00:00
|
|
|
* gstspider.c: element to automatically link sinks and sources
|
2002-01-28 01:47:31 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2002-04-18 19:30:55 +00:00
|
|
|
/*
|
2002-01-28 01:47:31 +00:00
|
|
|
* TODO:
|
|
|
|
* - handle automatic removal of unneeded elements
|
|
|
|
* - make the spider handle and send events (esp. new media)
|
2002-02-05 17:08:08 +00:00
|
|
|
* - decide if we plug pads or elements, currently it's a mess
|
2003-01-09 20:02:34 +00:00
|
|
|
* - allow unlinking
|
2002-02-05 17:08:08 +00:00
|
|
|
* - implement proper saving/loading from xml
|
2002-01-28 01:47:31 +00:00
|
|
|
* - implement a way to allow merging/splitting (aka tee)
|
|
|
|
* - find ways to define which elements to use when plugging
|
|
|
|
* - remove pads
|
|
|
|
* - improve typefinding
|
|
|
|
* - react to errors inside the pipeline
|
|
|
|
* - implement more properties, change the current
|
|
|
|
* - emit signals (most important: "NOT PLUGGABLE")
|
|
|
|
* - implement something for reporting the state of the spider
|
|
|
|
* to allow easier debugging.
|
|
|
|
* (could be useful for bins in general)
|
|
|
|
* - fix bugs
|
|
|
|
* ...
|
|
|
|
*/
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2004-02-17 17:59:32 +00:00
|
|
|
#include "../gst-i18n-lib.h"
|
2002-01-28 01:47:31 +00:00
|
|
|
#include "gstspider.h"
|
|
|
|
#include "gstspideridentity.h"
|
|
|
|
#include "gstsearchfuncs.h"
|
2003-06-29 14:05:49 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY (gst_spider_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_spider_debug
|
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* signals and args */
|
|
|
|
enum {
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ARG_0,
|
2002-02-05 17:08:08 +00:00
|
|
|
ARG_FACTORIES,
|
2002-01-28 01:47:31 +00:00
|
|
|
/* FILL ME TOO */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* generic templates */
|
2003-12-22 01:39:35 +00:00
|
|
|
static GstStaticPadTemplate spider_src_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE (
|
2002-03-18 04:41:37 +00:00
|
|
|
"src_%d",
|
2002-01-28 01:47:31 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_REQUEST,
|
2003-12-22 01:39:35 +00:00
|
|
|
GST_STATIC_CAPS_ANY
|
2002-01-28 01:47:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/* standard GObject stuff */
|
2002-02-11 08:18:09 +00:00
|
|
|
static void gst_spider_class_init (GstSpiderClass *klass);
|
|
|
|
static void gst_spider_init (GstSpider *spider);
|
|
|
|
static void gst_spider_dispose (GObject *object);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* element class functions */
|
2002-02-11 08:18:09 +00:00
|
|
|
static GstPad* gst_spider_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *name);
|
|
|
|
static void gst_spider_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
|
|
|
static void gst_spider_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
|
|
|
|
2003-01-09 14:15:37 +00:00
|
|
|
/* link functions */
|
|
|
|
static GstSpiderConnection * gst_spider_link_new (GstSpiderIdentity *src);
|
|
|
|
static void gst_spider_link_destroy (GstSpiderConnection *conn);
|
|
|
|
static void gst_spider_link_reset (GstSpiderConnection *conn, GstElement *to);
|
|
|
|
static void gst_spider_link_add (GstSpiderConnection *conn, GstElement *element);
|
|
|
|
static GstSpiderConnection * gst_spider_link_find (GstSpiderIdentity *src);
|
|
|
|
static GstSpiderConnection * gst_spider_link_get (GstSpiderIdentity *src);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* autoplugging functions */
|
2002-02-11 08:18:09 +00:00
|
|
|
static GstElement * gst_spider_find_element_to_plug (GstElement *src, GstElementFactory *fac, GstPadDirection dir);
|
2003-01-09 22:59:37 +00:00
|
|
|
static GstPadLinkReturn gst_spider_plug (GstSpiderConnection *conn);
|
|
|
|
static GstPadLinkReturn gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad);
|
|
|
|
/*static GstPadLinkReturn gst_spider_plug_peers (GstSpider *spider, GstPad *srcpad, GstPad *sinkpad); */
|
|
|
|
static GstPadLinkReturn gst_spider_create_and_plug (GstSpiderConnection *conn, GList *plugpath);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* random functions */
|
2002-02-11 08:18:09 +00:00
|
|
|
static gchar * gst_spider_unused_elementname (GstBin *bin, const gchar *startwith);
|
|
|
|
|
|
|
|
/* debugging stuff
|
|
|
|
static void print_spider_contents (GstSpider *spider);
|
2003-01-09 14:15:37 +00:00
|
|
|
static void print_spider_link (GstSpiderConnection *conn); */
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* === variables === */
|
2002-02-11 08:18:09 +00:00
|
|
|
static GstElementClass * parent_class = NULL;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* no signals yet
|
|
|
|
static guint gst_spider_signals[LAST_SIGNAL] = { 0 };*/
|
|
|
|
|
|
|
|
/* GObject and GStreamer init functions */
|
|
|
|
GType
|
|
|
|
gst_spider_get_type(void)
|
|
|
|
{
|
|
|
|
static GType spider_type = 0;
|
|
|
|
|
|
|
|
if (!spider_type) {
|
|
|
|
static const GTypeInfo spider_info = {
|
2002-02-05 17:08:08 +00:00
|
|
|
sizeof(GstSpiderClass),
|
2002-01-28 01:47:31 +00:00
|
|
|
NULL,
|
2002-02-05 17:08:08 +00:00
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_spider_class_init,
|
2002-01-28 01:47:31 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof(GstSpider),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc)gst_spider_init,
|
|
|
|
};
|
|
|
|
spider_type = g_type_register_static (GST_TYPE_BIN, "GstSpider", &spider_info, 0);
|
|
|
|
}
|
|
|
|
return spider_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_spider_class_init (GstSpiderClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2002-02-05 17:08:08 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass*) klass;
|
|
|
|
gstelement_class = (GstElementClass*) klass;
|
|
|
|
|
|
|
|
parent_class = g_type_class_ref(GST_TYPE_BIN);
|
|
|
|
|
|
|
|
/* properties */
|
2002-02-05 17:08:08 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FACTORIES,
|
|
|
|
g_param_spec_pointer ("factories", "allowed factories", "allowed factories for autoplugging", G_PARAM_READWRITE));
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_spider_set_property;
|
|
|
|
gobject_class->get_property = gst_spider_get_property;
|
2002-02-05 17:08:08 +00:00
|
|
|
gobject_class->dispose = gst_spider_dispose;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&spider_src_factory));
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_element_class_set_details (gstelement_class, &gst_spider_details);
|
2002-02-19 05:59:07 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR(gst_spider_request_new_pad);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
gst_spider_init (GstSpider *spider)
|
|
|
|
{
|
2002-02-05 17:08:08 +00:00
|
|
|
/* use only elements which have sources and sinks and where the sinks have caps */
|
|
|
|
/* FIXME: How do we handle factories that are added after the spider was constructed? */
|
2002-05-08 20:40:48 +00:00
|
|
|
spider->factories = gst_autoplug_factories_filters_with_sink_caps ((GList *)
|
|
|
|
gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY));
|
2002-02-11 08:18:09 +00:00
|
|
|
|
2003-01-09 14:15:37 +00:00
|
|
|
spider->links = NULL;
|
2002-12-01 01:37:58 +00:00
|
|
|
|
|
|
|
spider->sink_ident = gst_spider_identity_new_sink ("sink_ident");
|
|
|
|
gst_bin_add (GST_BIN (spider), GST_ELEMENT (spider->sink_ident));
|
|
|
|
gst_element_add_ghost_pad (GST_ELEMENT(spider), spider->sink_ident->sink, "sink");
|
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
2002-02-05 17:08:08 +00:00
|
|
|
static void
|
|
|
|
gst_spider_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GstSpider *spider;
|
|
|
|
|
|
|
|
spider = GST_SPIDER (object);
|
|
|
|
g_list_free (spider->factories);
|
|
|
|
|
|
|
|
((GObjectClass *) parent_class)->dispose (object);
|
|
|
|
}
|
2002-01-28 01:47:31 +00:00
|
|
|
static GstPad *
|
|
|
|
gst_spider_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *name)
|
|
|
|
{
|
|
|
|
GstPad *returnpad;
|
|
|
|
gchar *padname;
|
|
|
|
GstSpiderIdentity *identity;
|
|
|
|
GstSpider *spider;
|
|
|
|
|
|
|
|
g_return_val_if_fail (templ != NULL, NULL);
|
2002-04-11 20:35:18 +00:00
|
|
|
g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);
|
2002-12-01 01:37:58 +00:00
|
|
|
g_return_val_if_fail (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC, NULL);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
spider = GST_SPIDER (element);
|
|
|
|
|
|
|
|
/* create an identity object, so we have a pad */
|
2002-12-01 01:37:58 +00:00
|
|
|
padname = gst_spider_unused_elementname ((GstBin *)spider, "src_");
|
|
|
|
identity = gst_spider_identity_new_src (padname);
|
|
|
|
returnpad = identity->src;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* FIXME: use the requested name for the pad */
|
|
|
|
|
2003-05-06 23:47:07 +00:00
|
|
|
gst_object_replace ((GstObject **) &returnpad->padtemplate, (GstObject *) templ);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (element), GST_ELEMENT (identity));
|
|
|
|
|
|
|
|
returnpad = gst_element_add_ghost_pad (element, returnpad, padname);
|
2004-02-05 02:44:34 +00:00
|
|
|
g_free (padname);
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_new (identity);
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("successuflly created requested pad %s:%s", GST_DEBUG_PAD_NAME (returnpad));
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
return returnpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_spider_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GstSpider *spider;
|
2002-02-05 17:08:08 +00:00
|
|
|
GList *list;
|
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* it's not null if we got it, but it might not be ours */
|
|
|
|
g_return_if_fail (GST_IS_SPIDER (object));
|
|
|
|
|
|
|
|
spider = GST_SPIDER (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2002-02-05 17:08:08 +00:00
|
|
|
case ARG_FACTORIES:
|
|
|
|
list = (GList *) g_value_get_pointer (value);
|
|
|
|
while (list)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-05 17:08:08 +00:00
|
|
|
g_return_if_fail (list->data != NULL);
|
2002-04-11 20:35:18 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT_FACTORY (list->data));
|
2002-02-05 17:08:08 +00:00
|
|
|
list = g_list_next (list);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2002-02-05 17:08:08 +00:00
|
|
|
g_list_free (spider->factories);
|
|
|
|
spider->factories = (GList *) g_value_get_pointer (value);
|
2002-01-28 01:47:31 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
gst_spider_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GstSpider *spider;
|
|
|
|
|
|
|
|
/* it's not null if we got it, but it might not be ours */
|
|
|
|
spider = GST_SPIDER(object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2002-02-05 17:08:08 +00:00
|
|
|
case ARG_FACTORIES:
|
|
|
|
g_value_set_pointer (value, spider->factories);
|
2002-01-28 01:47:31 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* get a name for an element that isn't used yet */
|
|
|
|
static gchar *
|
|
|
|
gst_spider_unused_elementname (GstBin *bin, const gchar *startwith)
|
|
|
|
{
|
|
|
|
gchar * name = g_strdup_printf ("%s%d", startwith, 0);
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; gst_bin_get_by_name (bin, name) != NULL; )
|
|
|
|
{
|
|
|
|
g_free (name);
|
|
|
|
name = g_strdup_printf ("%s%d", startwith, ++i);
|
|
|
|
}
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
static void
|
2003-01-09 20:02:34 +00:00
|
|
|
gst_spider_link_sometimes (GstElement *src, GstPad *pad, GstSpiderConnection *conn)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-11 08:18:09 +00:00
|
|
|
gulong signal_id = conn->signal_id;
|
|
|
|
|
2002-02-05 17:08:08 +00:00
|
|
|
/* try to autoplug the elements */
|
2003-01-09 20:02:34 +00:00
|
|
|
if (gst_spider_plug_from_srcpad (conn, pad) != GST_PAD_LINK_REFUSED) {
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("%s:%s was autoplugged to %s:%s, removing callback",
|
|
|
|
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_PAD_NAME (conn->src->sink));
|
2002-02-11 08:18:09 +00:00
|
|
|
g_signal_handler_disconnect (src, signal_id);
|
|
|
|
signal_id = 0;
|
2002-02-05 17:08:08 +00:00
|
|
|
}
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2003-01-09 14:15:37 +00:00
|
|
|
/* create a new link from those two elements */
|
2002-02-11 08:18:09 +00:00
|
|
|
static GstSpiderConnection *
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_new (GstSpiderIdentity *src)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-12-01 01:37:58 +00:00
|
|
|
GstSpider *spider = GST_SPIDER (GST_OBJECT_PARENT (src));
|
2002-02-11 08:18:09 +00:00
|
|
|
|
|
|
|
GstSpiderConnection *conn = g_new0 (GstSpiderConnection, 1);
|
|
|
|
conn->src = src;
|
|
|
|
conn->path = NULL;
|
2002-12-01 01:37:58 +00:00
|
|
|
conn->current = (GstElement *) spider->sink_ident;
|
2003-01-09 14:15:37 +00:00
|
|
|
spider->links = g_list_prepend (spider->links, conn);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
return conn;
|
|
|
|
}
|
|
|
|
static void
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_destroy (GstSpiderConnection *conn)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
2002-12-01 01:37:58 +00:00
|
|
|
GstSpider *spider = GST_SPIDER (GST_OBJECT_PARENT (conn->src));
|
2003-01-09 14:15:37 +00:00
|
|
|
/* reset link to unplugged */
|
|
|
|
gst_spider_link_reset (conn, (GstElement *) spider->sink_ident);
|
2002-02-11 08:18:09 +00:00
|
|
|
g_free (conn);
|
|
|
|
}
|
|
|
|
static void
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_reset (GstSpiderConnection *conn, GstElement *to)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
2002-12-01 01:37:58 +00:00
|
|
|
GstSpider *spider = GST_SPIDER (GST_OBJECT_PARENT (conn->src));
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("resetting link from %s to %s, currently at %s to %s", GST_ELEMENT_NAME (spider->sink_ident),
|
2002-02-11 08:18:09 +00:00
|
|
|
GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (to));
|
|
|
|
while ((conn->path != NULL) && ((GstElement *) conn->path->data != to))
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-11 08:18:09 +00:00
|
|
|
gst_object_unref ((GstObject *) conn->path->data);
|
|
|
|
conn->path = g_list_delete_link (conn->path, conn->path);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2002-02-11 08:18:09 +00:00
|
|
|
if (conn->path == NULL)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-12-01 01:37:58 +00:00
|
|
|
conn->current = (GstElement *) spider->sink_ident;
|
2002-02-11 08:18:09 +00:00
|
|
|
} else {
|
|
|
|
conn->current = to;
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
}
|
2003-01-09 14:15:37 +00:00
|
|
|
/* add an element to the link */
|
2002-02-11 08:18:09 +00:00
|
|
|
static void
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_add (GstSpiderConnection *conn, GstElement *element)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-11 08:18:09 +00:00
|
|
|
gst_object_ref ((GstObject *) element);
|
|
|
|
gst_object_sink ((GstObject *) element);
|
|
|
|
conn->path = g_list_prepend (conn->path, element);
|
|
|
|
conn->current = element;
|
|
|
|
}
|
2003-01-09 14:15:37 +00:00
|
|
|
/* find the link from those two elements */
|
2002-02-11 08:18:09 +00:00
|
|
|
static GstSpiderConnection *
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_find (GstSpiderIdentity *src)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
|
|
|
GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (src);
|
2003-01-09 14:15:37 +00:00
|
|
|
GList *list = spider->links;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
while (list)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-11 08:18:09 +00:00
|
|
|
GstSpiderConnection *conn = (GstSpiderConnection *) list->data;
|
2002-12-01 01:37:58 +00:00
|
|
|
if (conn->src == src){
|
2002-02-11 08:18:09 +00:00
|
|
|
return conn;
|
2002-12-01 01:37:58 +00:00
|
|
|
}
|
2002-02-11 08:18:09 +00:00
|
|
|
list = g_list_next(list);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-01-09 14:15:37 +00:00
|
|
|
/* get a new link from those two elements
|
2002-02-11 08:18:09 +00:00
|
|
|
* search first; if none is found, create a new one */
|
|
|
|
static GstSpiderConnection *
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_get (GstSpiderIdentity *src)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
|
|
|
GstSpiderConnection *ret;
|
|
|
|
|
2003-01-09 14:15:37 +00:00
|
|
|
if ((ret = gst_spider_link_find (src)) != NULL)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
2003-01-09 14:15:37 +00:00
|
|
|
return gst_spider_link_new (src);
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
|
|
|
void
|
|
|
|
gst_spider_identity_plug (GstSpiderIdentity *ident)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
GstSpider *spider;
|
2002-09-12 20:52:03 +00:00
|
|
|
const GList *padlist;
|
2002-02-11 08:18:09 +00:00
|
|
|
GstPadDirection dir;
|
|
|
|
GstSpiderConnection *conn;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* checks */
|
|
|
|
g_return_if_fail (ident != NULL);
|
|
|
|
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
|
|
|
|
spider = GST_SPIDER (GST_ELEMENT_PARENT (ident));
|
|
|
|
g_assert (spider != NULL);
|
|
|
|
g_assert (GST_IS_SPIDER (spider));
|
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
/* return if we're already plugged */
|
2002-01-28 01:47:31 +00:00
|
|
|
if (ident->plugged) return;
|
2002-02-11 08:18:09 +00:00
|
|
|
|
2004-02-17 17:59:32 +00:00
|
|
|
/* check if there is at least one element factory that can handle the
|
|
|
|
identity's src caps */
|
|
|
|
{
|
|
|
|
GstCaps *src_caps = gst_pad_get_caps (ident->src);
|
|
|
|
if (! gst_caps_is_empty (src_caps) && ! gst_caps_is_any (src_caps))
|
|
|
|
{
|
|
|
|
GList *factories;
|
|
|
|
GstPadTemplate *padtemp;
|
|
|
|
gboolean found = FALSE;
|
|
|
|
|
|
|
|
factories = spider->factories;
|
|
|
|
while (factories)
|
|
|
|
{
|
|
|
|
if ((padtemp = gst_autoplug_can_connect_src (factories->data, src_caps)))
|
|
|
|
{
|
|
|
|
const GstCaps *caps = gst_pad_template_get_caps (padtemp);
|
|
|
|
GST_DEBUG ("can connect src to pad template: %" GST_PTR_FORMAT, caps);
|
|
|
|
found = TRUE;
|
|
|
|
}
|
|
|
|
factories = factories->next;
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
{
|
2004-03-06 18:25:59 +00:00
|
|
|
const char *mime;
|
|
|
|
|
|
|
|
mime = gst_structure_get_name (gst_caps_get_structure (src_caps, 0));
|
|
|
|
|
2004-02-17 17:59:32 +00:00
|
|
|
GST_ELEMENT_ERROR (spider, STREAM, CODEC_NOT_FOUND,
|
|
|
|
(_("There is no element present to handle the stream's mime type %s."), mime),
|
|
|
|
(NULL));
|
2004-03-06 18:25:59 +00:00
|
|
|
gst_caps_free (src_caps);
|
2004-02-17 17:59:32 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2004-03-06 18:25:59 +00:00
|
|
|
gst_caps_free (src_caps);
|
2004-02-17 17:59:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
/* get the direction of our ident */
|
|
|
|
if (GST_PAD_PEER (ident->sink))
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-11 08:18:09 +00:00
|
|
|
if (GST_PAD_PEER (ident->src))
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2003-01-09 20:02:34 +00:00
|
|
|
/* Hey, the ident is linked on both sides */
|
|
|
|
g_warning ("Trying to autoplug a linked element. Aborting...");
|
2002-01-28 01:47:31 +00:00
|
|
|
return;
|
|
|
|
} else {
|
2002-02-11 08:18:09 +00:00
|
|
|
dir = GST_PAD_SINK;
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-02-11 08:18:09 +00:00
|
|
|
if (GST_PAD_PEER (ident->src))
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-11 08:18:09 +00:00
|
|
|
dir = GST_PAD_SRC;
|
2002-01-28 01:47:31 +00:00
|
|
|
} else {
|
2003-01-09 20:02:34 +00:00
|
|
|
/* the ident isn't linked on either side */
|
|
|
|
g_warning ("Trying to autoplug an unlinked element. Aborting...");
|
2002-01-28 01:47:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-09 20:02:34 +00:00
|
|
|
/* now iterate all possible pads and link when needed */
|
2002-02-11 08:18:09 +00:00
|
|
|
padlist = gst_element_get_pad_list (GST_ELEMENT (spider));
|
|
|
|
while (padlist)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-04-18 19:30:55 +00:00
|
|
|
GstPad *otherpad;
|
|
|
|
GstSpiderIdentity *peer;
|
|
|
|
|
|
|
|
g_assert (GST_IS_PAD (padlist->data));
|
|
|
|
otherpad = (GstPad *) GST_GPAD_REALPAD (padlist->data);
|
|
|
|
peer = (GstSpiderIdentity *) GST_PAD_PARENT (otherpad);
|
2003-01-09 20:02:34 +00:00
|
|
|
/* we only want to link to the other side */
|
2002-02-11 08:18:09 +00:00
|
|
|
if (dir != GST_PAD_DIRECTION (otherpad))
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2003-01-09 20:02:34 +00:00
|
|
|
/* we only link to plugged in elements */
|
2002-01-28 01:47:31 +00:00
|
|
|
if (peer->plugged == TRUE)
|
|
|
|
{
|
|
|
|
/* plug in the right direction */
|
2002-02-11 08:18:09 +00:00
|
|
|
if (dir == GST_PAD_SINK)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2003-01-09 14:15:37 +00:00
|
|
|
conn = gst_spider_link_get (peer);
|
2002-01-28 01:47:31 +00:00
|
|
|
} else {
|
2003-01-09 14:15:37 +00:00
|
|
|
conn = gst_spider_link_get (ident);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2002-12-01 01:37:58 +00:00
|
|
|
if ((GstElement *) spider->sink_ident == conn->current)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
|
|
|
gst_spider_plug (conn);
|
|
|
|
}
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
}
|
2002-02-11 08:18:09 +00:00
|
|
|
padlist = g_list_next (padlist);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
ident->plugged = TRUE;
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2002-02-11 08:18:09 +00:00
|
|
|
void
|
|
|
|
gst_spider_identity_unplug (GstSpiderIdentity *ident)
|
|
|
|
{
|
|
|
|
GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (ident);
|
2003-01-09 14:15:37 +00:00
|
|
|
GList *list = spider->links;
|
2002-02-11 08:18:09 +00:00
|
|
|
|
|
|
|
while (list)
|
|
|
|
{
|
|
|
|
GstSpiderConnection *conn = list->data;
|
|
|
|
GList *cur = list;
|
|
|
|
list = g_list_next (list);
|
2002-12-01 01:37:58 +00:00
|
|
|
if (conn->src == ident)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
2003-01-09 14:15:37 +00:00
|
|
|
g_list_delete_link (spider->links, cur);
|
|
|
|
gst_spider_link_destroy (conn);
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ident->plugged = FALSE;
|
|
|
|
}
|
2003-01-09 20:02:34 +00:00
|
|
|
/* links src to sink using the elementfactories in plugpath
|
2002-02-11 08:18:09 +00:00
|
|
|
* plugpath will be removed afterwards */
|
2003-01-09 22:59:37 +00:00
|
|
|
static GstPadLinkReturn
|
2002-02-11 08:18:09 +00:00
|
|
|
gst_spider_create_and_plug (GstSpiderConnection *conn, GList *plugpath)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-12-01 01:37:58 +00:00
|
|
|
GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (conn->src);
|
2002-02-11 08:18:09 +00:00
|
|
|
GList *endelements = NULL, *templist = NULL;
|
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
/* exit if plugging is already done */
|
|
|
|
if ((GstElement *) conn->src == conn->current)
|
2003-01-09 20:02:34 +00:00
|
|
|
return GST_PAD_LINK_DONE;
|
2002-02-11 08:18:09 +00:00
|
|
|
|
2003-01-09 14:15:37 +00:00
|
|
|
/* try to shorten the list at the end and not duplicate link code */
|
2002-02-11 08:18:09 +00:00
|
|
|
if (plugpath != NULL)
|
|
|
|
{
|
|
|
|
templist = g_list_last (plugpath);
|
|
|
|
element = (GstElement *) conn->src;
|
|
|
|
while ((plugpath != NULL) && (element = gst_spider_find_element_to_plug (element, (GstElementFactory *) plugpath->data, GST_PAD_SINK)))
|
|
|
|
{
|
|
|
|
GList *cur = templist;
|
|
|
|
endelements = g_list_prepend (endelements, element);
|
|
|
|
templist = g_list_previous (templist);
|
|
|
|
g_list_delete_link (cur, cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-09 20:02:34 +00:00
|
|
|
/* do the linking */
|
2002-02-11 08:18:09 +00:00
|
|
|
while (conn->current != (GstElement *) (endelements == NULL ? conn->src : endelements->data))
|
|
|
|
{
|
|
|
|
/* get sink element to plug, src is conn->current */
|
|
|
|
if (plugpath == NULL)
|
|
|
|
{
|
|
|
|
element = (GstElement *) (endelements == NULL ? conn->src : endelements->data);
|
|
|
|
} else {
|
2002-04-11 20:35:18 +00:00
|
|
|
element = gst_element_factory_create ((GstElementFactory *) plugpath->data, NULL);
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("Adding element %s of type %s and syncing state with autoplugger",
|
2003-05-06 23:47:07 +00:00
|
|
|
GST_ELEMENT_NAME (element), GST_PLUGIN_FEATURE_NAME (plugpath->data));
|
2002-02-11 08:18:09 +00:00
|
|
|
gst_bin_add (GST_BIN (spider), element);
|
|
|
|
}
|
2003-01-09 20:02:34 +00:00
|
|
|
/* insert and link new element */
|
2003-05-17 17:08:58 +00:00
|
|
|
if (gst_element_link (conn->current, element)) {
|
|
|
|
gst_element_sync_state_with_parent (element);
|
|
|
|
} else {
|
2003-01-09 20:02:34 +00:00
|
|
|
/* check if the src has SOMETIMES templates. If so, link a callback */
|
2002-04-11 20:35:18 +00:00
|
|
|
GList *templs = gst_element_get_pad_template_list (conn->current);
|
2002-02-11 08:18:09 +00:00
|
|
|
|
2003-01-09 20:02:34 +00:00
|
|
|
/* remove element that couldn't be linked, if it wasn't the endpoint */
|
2002-02-11 08:18:09 +00:00
|
|
|
if (element != (GstElement *) conn->src)
|
|
|
|
gst_bin_remove (GST_BIN (spider), element);
|
|
|
|
|
|
|
|
while (templs) {
|
|
|
|
GstPadTemplate *templ = (GstPadTemplate *) templs->data;
|
2002-04-11 20:35:18 +00:00
|
|
|
if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) && (GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES))
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("adding callback to link element %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
2002-02-11 08:18:09 +00:00
|
|
|
conn->signal_id = g_signal_connect (G_OBJECT (conn->current), "new_pad",
|
2003-01-09 20:02:34 +00:00
|
|
|
G_CALLBACK (gst_spider_link_sometimes), conn);
|
2002-02-11 08:18:09 +00:00
|
|
|
g_list_free (plugpath);
|
2003-01-09 20:02:34 +00:00
|
|
|
return GST_PAD_LINK_DELAYED;
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
|
|
|
templs = g_list_next (templs);
|
|
|
|
}
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("no chance to link element %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
2002-02-11 08:18:09 +00:00
|
|
|
g_list_free (plugpath);
|
2003-01-09 20:02:34 +00:00
|
|
|
return GST_PAD_LINK_REFUSED;
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("added element %s and attached it to element %s", GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (conn->current));
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_add (conn, element);
|
2002-02-11 08:18:09 +00:00
|
|
|
if (plugpath != NULL)
|
|
|
|
plugpath = g_list_delete_link (plugpath, plugpath);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ref all elements at the end */
|
|
|
|
while (endelements)
|
|
|
|
{
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_add (conn, endelements->data);
|
2002-02-11 08:18:09 +00:00
|
|
|
endelements = g_list_delete_link (endelements, endelements);
|
|
|
|
}
|
|
|
|
|
2003-01-09 20:02:34 +00:00
|
|
|
return GST_PAD_LINK_DONE;
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
2003-01-09 20:02:34 +00:00
|
|
|
/* checks, if src is already linked to an element from factory fac on direction dir */
|
2002-02-11 08:18:09 +00:00
|
|
|
static GstElement *
|
|
|
|
gst_spider_find_element_to_plug (GstElement *src, GstElementFactory *fac, GstPadDirection dir)
|
|
|
|
{
|
|
|
|
GList *padlist = GST_ELEMENT_PADS (src);
|
|
|
|
|
|
|
|
while (padlist)
|
|
|
|
{
|
|
|
|
GstPad *pad = (GstPad *) GST_PAD_REALIZE (padlist->data);
|
2003-01-09 20:02:34 +00:00
|
|
|
/* is the pad on the right side and is it linked? */
|
2002-04-20 12:31:41 +00:00
|
|
|
if ((GST_PAD_DIRECTION (pad) == dir) && (pad = (GstPad *) (GST_RPAD_PEER (pad))))
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
2003-01-09 20:02:34 +00:00
|
|
|
/* is the element the pad is linked to of the right type? */
|
2002-02-11 08:18:09 +00:00
|
|
|
GstElement *element = GST_PAD_PARENT (pad);
|
2003-10-31 19:32:47 +00:00
|
|
|
|
|
|
|
if (G_TYPE_FROM_INSTANCE (element) == gst_element_factory_get_element_type (fac)) {
|
2002-02-11 08:18:09 +00:00
|
|
|
return element;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
padlist = g_list_next (padlist);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-01-09 14:15:37 +00:00
|
|
|
/* try to establish the link */
|
2003-01-09 22:59:37 +00:00
|
|
|
static GstPadLinkReturn
|
2002-02-11 08:18:09 +00:00
|
|
|
gst_spider_plug (GstSpiderConnection *conn)
|
|
|
|
{
|
2002-12-01 01:37:58 +00:00
|
|
|
GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (conn->src);
|
2002-02-11 08:18:09 +00:00
|
|
|
if ((GstElement *) conn->src == conn->current)
|
2003-01-09 20:02:34 +00:00
|
|
|
return GST_PAD_LINK_DONE;
|
2002-12-01 01:37:58 +00:00
|
|
|
if ((GstElement *) spider->sink_ident == conn->current)
|
|
|
|
return gst_spider_plug_from_srcpad (conn, spider->sink_ident->src);
|
2002-02-11 08:18:09 +00:00
|
|
|
g_warning ("FIXME: autoplugging only possible from GstSpiderIdentity conn->sink yet (yep, that's technical)\n");
|
2003-01-09 20:02:34 +00:00
|
|
|
return GST_PAD_LINK_REFUSED;
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
2003-01-09 14:15:37 +00:00
|
|
|
/* try to establish the link using this pad */
|
2003-01-09 22:59:37 +00:00
|
|
|
static GstPadLinkReturn
|
2002-02-11 08:18:09 +00:00
|
|
|
gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad)
|
|
|
|
{
|
|
|
|
GstElement *element;
|
2002-01-28 01:47:31 +00:00
|
|
|
GList *plugpath;
|
|
|
|
gboolean result = TRUE;
|
2002-02-11 08:18:09 +00:00
|
|
|
GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (conn->src);
|
|
|
|
GstElement *startelement = conn->current;
|
2004-02-05 02:44:34 +00:00
|
|
|
GstCaps *caps1;
|
|
|
|
GstCaps *caps2;
|
2002-02-05 17:08:08 +00:00
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
g_assert ((GstElement *) GST_OBJECT_PARENT (srcpad) == conn->current);
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("trying to plug from %s:%s to %s",
|
2002-10-01 12:14:13 +00:00
|
|
|
GST_DEBUG_PAD_NAME (srcpad), GST_ELEMENT_NAME (conn->src));
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2003-12-09 16:28:34 +00:00
|
|
|
/* see if they match already */
|
|
|
|
if (gst_pad_link (srcpad, conn->src->sink)) {
|
|
|
|
GST_DEBUG ("%s:%s and %s:%s can link directly",
|
|
|
|
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (conn->src->sink));
|
|
|
|
gst_pad_unlink (srcpad, conn->src->sink);
|
|
|
|
gst_spider_create_and_plug (conn, NULL);
|
|
|
|
return GST_PAD_LINK_OK;
|
|
|
|
}
|
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
/* find a path from src to sink */
|
2004-02-05 02:44:34 +00:00
|
|
|
caps1 = gst_pad_get_caps (srcpad);
|
|
|
|
caps2 = gst_pad_get_caps (conn->src->sink);
|
|
|
|
plugpath = gst_autoplug_sp (caps1, caps2, spider->factories);
|
|
|
|
gst_caps_free (caps1);
|
|
|
|
gst_caps_free (caps2);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2002-02-11 08:18:09 +00:00
|
|
|
/* prints out the path that was found for plugging */
|
|
|
|
/* g_print ("found path from %s to %s:\n", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
2002-02-05 17:08:08 +00:00
|
|
|
templist = plugpath;
|
|
|
|
while (templist)
|
|
|
|
{
|
|
|
|
g_print("%s\n", GST_OBJECT_NAME (templist->data));
|
|
|
|
templist = g_list_next (templist);
|
2002-02-11 08:18:09 +00:00
|
|
|
}*/
|
2002-02-05 17:08:08 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* if there is no way to plug: return */
|
|
|
|
if (plugpath == NULL) {
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("no chance to plug from %s to %s", GST_ELEMENT_NAME (conn->current), GST_ELEMENT_NAME (conn->src));
|
2003-01-09 20:02:34 +00:00
|
|
|
return GST_PAD_LINK_REFUSED;
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("found a link that needs %d elements", g_list_length (plugpath));
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* now remove non-needed elements from the beginning of the path
|
|
|
|
* alter src to point to the new element where we need to start
|
|
|
|
* plugging and alter the plugpath to represent the elements, that must be plugged
|
|
|
|
*/
|
2002-02-11 08:18:09 +00:00
|
|
|
element = conn->current;
|
|
|
|
while ((plugpath != NULL) && (element = gst_spider_find_element_to_plug (element, (GstElementFactory *) plugpath->data, GST_PAD_SRC)))
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_add (conn, element);
|
2002-01-28 01:47:31 +00:00
|
|
|
plugpath = g_list_delete_link (plugpath, plugpath);
|
|
|
|
}
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG ("%d elements must be inserted to establish the link", g_list_length (plugpath));
|
2002-01-28 01:47:31 +00:00
|
|
|
/* create the elements and plug them */
|
2002-02-11 08:18:09 +00:00
|
|
|
result = gst_spider_create_and_plug (conn, plugpath);
|
|
|
|
|
|
|
|
/* reset the "current" element */
|
2003-01-09 20:02:34 +00:00
|
|
|
if (result == GST_PAD_LINK_REFUSED)
|
2002-02-11 08:18:09 +00:00
|
|
|
{
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_spider_link_reset (conn, startelement);
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
GstElementDetails gst_spider_details = GST_ELEMENT_DETAILS (
|
2002-01-28 01:47:31 +00:00
|
|
|
"Spider",
|
2002-04-20 21:42:53 +00:00
|
|
|
"Generic",
|
2003-01-09 20:02:34 +00:00
|
|
|
"Automatically link sinks and sources",
|
2003-10-31 19:32:47 +00:00
|
|
|
"Benjamin Otte <in7y118@public.uni-hamburg.de>"
|
|
|
|
);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
static gboolean
|
2003-10-31 19:32:47 +00:00
|
|
|
plugin_init (GstPlugin *plugin)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_spider_debug, "spider", 0, "spider autoplugging element");
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
if (!gst_element_register (plugin, "spider", GST_RANK_SECONDARY, GST_TYPE_SPIDER))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_element_register (plugin, "spideridentity", GST_RANK_NONE, GST_TYPE_SPIDER_IDENTITY))
|
|
|
|
return FALSE;
|
2002-09-12 18:49:22 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
GST_PLUGIN_DEFINE (
|
2002-01-28 01:47:31 +00:00
|
|
|
GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"gstspider",
|
2003-10-31 19:32:47 +00:00
|
|
|
"a 1:n autoplugger",
|
|
|
|
plugin_init,
|
|
|
|
VERSION,
|
|
|
|
GST_LICENSE,
|
|
|
|
GST_PACKAGE,
|
|
|
|
GST_ORIGIN
|
|
|
|
)
|