GST_DEBUG reorganization containing loads of stuff:
[platform/upstream/gstreamer.git] / gst / autoplug / gstspider.h
1 /* GStreamer
2  * Copyright (C) 2002 Erik Walthinsen <omega@cse.ogi.edu>
3  *               2002 Wim Taymans <wtay@chello.be>
4  *
5  * gstspider.h: Header for GstSpider object
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22  
23 #ifndef __GST_SPIDER_H__
24 #define __GST_SPIDER_H__
25
26 #include <gst/gst.h>
27 #include "gstspideridentity.h"
28
29 G_BEGIN_DECLS
30         
31 extern GstElementDetails gst_spider_details;
32 GST_DEBUG_CATEGORY_EXTERN(gst_spider_debug);
33
34 /*
35  * Theory of operation:
36  * When connecting a sink to a source, GstSpiderConnections are used to keep track
37  * of the current status of the link. sink -> src is the path we intend to
38  * plug. current is how far we've come. If current equals
39  * - NULL, there is no possible path, 
40  * - src, the link is established.
41  * - sink, it wasn't tried to establish a link.
42  * - something else, we have come that far while plugging.
43  * signal_id is used to remember the signal_id when we are waiting for a "new_pad"
44  * callback during link.
45  * When a path is established, the elements in the path (excluding sink and src)
46  * are refcounted once for every path.
47  * A GstSpider keeps a list of all GstSpiderConnections in it.
48  */
49 typedef struct {
50   GstSpiderIdentity *src;
51   /* dunno if the path should stay here or if its too much load.
52    * it's at least easier then always searching it */
53   GList *path;
54   GstElement *current;
55   gulong signal_id;
56 } GstSpiderConnection;
57
58 #define GST_TYPE_SPIDER \
59   (gst_spider_get_type())
60 #define GST_SPIDER(obj) \
61   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPIDER,GstSpider))
62 #define GST_SPIDER_CLASS(klass) \
63   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPIDER,GstSpiderClass)) 
64 #define GST_IS_SPIDER(obj) \
65   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPIDER))
66 #define GST_IS_SPIDER_CLASS(obj) \
67   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPIDER))
68         
69 typedef struct _GstSpider GstSpider;
70 typedef struct _GstSpiderClass GstSpiderClass;
71
72 struct _GstSpider {
73   GstBin        parent;
74         
75   GstSpiderIdentity *sink_ident;
76   GList *       factories; /* factories to use for plugging */
77
78   GList *       links; /* GStSpiderConnection list of all links */
79 };
80         
81 struct _GstSpiderClass {
82   GstBinClass parent_class;
83 };
84
85 /* default initialization stuff */
86 GType           gst_spider_get_type             (void);
87
88 /* private link functions to be called by GstSpiderIdentity */
89 void            gst_spider_identity_plug        (GstSpiderIdentity *ident);
90 void            gst_spider_identity_unplug      (GstSpiderIdentity *ident);
91
92 G_END_DECLS
93
94 #endif /* __GST_SPIDER_H__ */