removed GST_*_CAST. Disabling of type checking is done in glib.
[platform/upstream/gstreamer.git] / gst / gstpad.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wim.taymans@chello.be>
4  *
5  * gstpad.h: Header for GstPad 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
24 #ifndef __GST_PAD_H__
25 #define __GST_PAD_H__
26
27 #include <gst/gstconfig.h>
28
29 #include <gst/gstobject.h>
30 #include <gst/gstbuffer.h>
31 #include <gst/gstcaps.h>
32 #include <gst/gstevent.h>
33 #include <gst/gstprobe.h>
34 #include <gst/gstquery.h>
35
36
37 G_BEGIN_DECLS
38
39 extern GType _gst_pad_type;
40 extern GType _gst_real_pad_type;
41 extern GType _gst_ghost_pad_type;
42
43 /* 
44  * Pad base class
45  */
46 #define GST_TYPE_PAD                    (_gst_pad_type) 
47 #define GST_IS_PAD(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
48 #define GST_IS_PAD_FAST(obj)            (G_OBJECT_TYPE(obj) == GST_TYPE_REAL_PAD || \
49                                          G_OBJECT_TYPE(obj) == GST_TYPE_GHOST_PAD)
50 #define GST_IS_PAD_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
51 #define GST_PAD(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
52 #define GST_PAD_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
53
54 /* 
55  * Real Pads
56  */
57 #define GST_TYPE_REAL_PAD               (_gst_real_pad_type)
58 #define GST_IS_REAL_PAD(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_REAL_PAD))
59 #define GST_IS_REAL_PAD_FAST(obj)       (G_OBJECT_TYPE(obj) == GST_TYPE_REAL_PAD)
60 #define GST_IS_REAL_PAD_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_REAL_PAD))
61 #define GST_REAL_PAD(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REAL_PAD, GstRealPad))
62 #define GST_REAL_PAD_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_REAL_PAD, GstRealPadClass))
63
64 /* 
65  * Ghost Pads
66  */
67 #define GST_TYPE_GHOST_PAD              (_gst_ghost_pad_type)
68 #define GST_IS_GHOST_PAD(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GHOST_PAD))
69 #define GST_IS_GHOST_PAD_FAST(obj)      (G_OBJECT_TYPE(obj) == GST_TYPE_GHOST_PAD)
70 #define GST_IS_GHOST_PAD_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GHOST_PAD))
71 #define GST_GHOST_PAD(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GHOST_PAD, GstGhostPad))
72 #define GST_GHOST_PAD_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GHOST_PAD, GstGhostPadClass))
73
74
75 /*typedef struct _GstPad GstPad; */
76 /*typedef struct _GstPadClass GstPadClass;*/
77 typedef struct _GstRealPad GstRealPad;
78 typedef struct _GstRealPadClass GstRealPadClass;
79 typedef struct _GstGhostPad GstGhostPad;
80 typedef struct _GstGhostPadClass GstGhostPadClass;
81 /*typedef struct _GstPadTemplate GstPadTemplate;*/
82 /*typedef struct _GstPadTemplateClass GstPadTemplateClass;*/
83
84
85 typedef enum {
86   GST_PAD_LINK_REFUSED = -1,
87   GST_PAD_LINK_DELAYED =  0,
88   GST_PAD_LINK_OK      =  1,
89   GST_PAD_LINK_DONE    =  2
90 } GstPadLinkReturn;
91
92 /* convenience functions */
93 #ifdef G_HAVE_ISO_VARARGS
94 #define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...)  GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, __VA_ARGS__);
95 #define GST_PAD_FORMATS_FUNCTION(functionname, ...)     GST_FORMATS_FUNCTION (GstPad *, functionname, __VA_ARGS__);
96 #define GST_PAD_EVENT_MASK_FUNCTION(functionname, ...)  GST_EVENT_MASK_FUNCTION (GstPad *, functionname, __VA_ARGS__);
97 #elif defined(G_HAVE_GNUC_VARARGS)
98 #define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) GST_QUERY_TYPE_FUNCTION (GstPad *, functionname, a);
99 #define GST_PAD_FORMATS_FUNCTION(functionname, a...)    GST_FORMATS_FUNCTION (GstPad *, functionname, a);
100 #define GST_PAD_EVENT_MASK_FUNCTION(functionname, a...) GST_EVENT_MASK_FUNCTION (GstPad *, functionname, a);
101 #endif
102
103  
104 /* this defines the functions used to chain buffers
105  * pad is the sink pad (so the same chain function can be used for N pads)
106  * buf is the buffer being passed */
107 typedef void                    (*GstPadChainFunction)          (GstPad *pad,GstData *data);
108 typedef GstData*                (*GstPadGetFunction)            (GstPad *pad);
109 typedef gboolean                (*GstPadEventFunction)          (GstPad *pad, GstEvent *event);
110 typedef gboolean                (*GstPadConvertFunction)        (GstPad *pad, 
111                                                                  GstFormat src_format,  gint64  src_value,
112                                                                  GstFormat *dest_format, gint64 *dest_value);
113 typedef gboolean                (*GstPadQueryFunction)          (GstPad *pad, GstQueryType type,
114                                                                  GstFormat *format, gint64  *value);
115 typedef GList*                  (*GstPadIntLinkFunction)        (GstPad *pad);
116 typedef const GstFormat*        (*GstPadFormatsFunction)        (GstPad *pad);
117 typedef const GstEventMask*     (*GstPadEventMaskFunction)      (GstPad *pad);
118 typedef const GstQueryType*     (*GstPadQueryTypeFunction)      (GstPad *pad);
119
120 typedef GstPadLinkReturn        (*GstPadLinkFunction)           (GstPad *pad, GstCaps *caps);
121 typedef void                    (*GstPadUnlinkFunction)         (GstPad *pad);
122 typedef GstCaps*                (*GstPadGetCapsFunction)        (GstPad *pad, GstCaps *caps);
123 typedef GstBufferPool*          (*GstPadBufferPoolFunction)     (GstPad *pad);
124
125 typedef gboolean                (*GstPadDispatcherFunction)     (GstPad *pad, gpointer data);
126
127 typedef enum {
128   GST_PAD_UNKNOWN,
129   GST_PAD_SRC,
130   GST_PAD_SINK
131 } GstPadDirection;
132
133 typedef enum {
134   GST_PAD_DISABLED              = GST_OBJECT_FLAG_LAST,
135   GST_PAD_NEGOTIATING,
136
137   GST_PAD_FLAG_LAST             = GST_OBJECT_FLAG_LAST + 4
138 } GstPadFlags;
139
140 struct _GstPad {
141   GstObject             object;
142
143   gpointer              element_private;
144
145   GstPadTemplate        *padtemplate;   /* the template for this pad */
146
147   gpointer _gst_reserved[GST_PADDING];
148 };
149
150 struct _GstPadClass {
151   GstObjectClass parent_class;
152
153   gpointer _gst_reserved[GST_PADDING];
154 };
155
156 struct _GstRealPad {
157   GstPad                         pad;
158
159   /* the pad capabilities */
160   GstCaps                       *caps;
161   GstCaps                       *filter;
162   GstCaps                       *appfilter;
163   GstPadGetCapsFunction          getcapsfunc;
164   
165   GstPadDirection                direction;
166
167   GstPadLinkFunction             linkfunc;
168   GstPadUnlinkFunction           unlinkfunc;
169   GstRealPad                    *peer;
170
171   gpointer                       sched_private;
172
173   /* data transport functions */
174   GstPadChainFunction            chainfunc;
175   GstPadChainFunction            chainhandler;
176   GstPadGetFunction              getfunc;
177   GstPadGetFunction              gethandler;
178   GstPadEventFunction            eventfunc;
179   GstPadEventFunction            eventhandler;
180   GstPadEventMaskFunction        eventmaskfunc;
181
182   GList                         *ghostpads;
183
184   /* query/convert/formats functions */
185   GstPadConvertFunction          convertfunc;
186   GstPadQueryFunction            queryfunc;
187   GstPadFormatsFunction          formatsfunc;
188   GstPadQueryTypeFunction        querytypefunc;
189   GstPadIntLinkFunction          intlinkfunc;
190
191   GstPadBufferPoolFunction       bufferpoolfunc;
192
193   GstProbeDispatcher             probedisp;
194
195   gpointer _gst_reserved[GST_PADDING];
196 };
197
198 struct _GstRealPadClass {
199   GstPadClass   parent_class;
200
201   /* signal callbacks */
202   void          (*caps_nego_failed)     (GstPad *pad, GstCaps *caps);
203
204   void          (*linked)               (GstPad *pad, GstPad *peer);
205   void          (*unlinked)             (GstPad *pad, GstPad *peer);
206
207   gpointer _gst_reserved[GST_PADDING];
208 };
209
210 struct _GstGhostPad {
211   GstPad pad;
212
213   GstRealPad *realpad;
214
215   gpointer _gst_reserved[GST_PADDING];
216 };
217
218 struct _GstGhostPadClass {
219   GstPadClass parent_class;
220
221   gpointer _gst_reserved[GST_PADDING];
222 };
223
224
225 /***** helper macros *****/
226 /* GstPad */
227 #define GST_PAD_NAME(pad)               (GST_OBJECT_NAME(pad))
228 #define GST_PAD_PARENT(pad)             ((GstElement *)(GST_OBJECT_PARENT(pad)))
229 #define GST_PAD_ELEMENT_PRIVATE(pad)    (((GstPad *)(pad))->element_private)
230 #define GST_PAD_PAD_TEMPLATE(pad)       (((GstPad *)(pad))->padtemplate)
231
232 /* GstRealPad */
233 #define GST_RPAD_DIRECTION(pad)         (((GstRealPad *)(pad))->direction)
234 #define GST_RPAD_CAPS(pad)              (((GstRealPad *)(pad))->caps)
235 #define GST_RPAD_FILTER(pad)            (((GstRealPad *)(pad))->filter)
236 #define GST_RPAD_APPFILTER(pad)         (((GstRealPad *)(pad))->appfilter)
237 #define GST_RPAD_PEER(pad)              (((GstRealPad *)(pad))->peer)
238 #define GST_RPAD_CHAINFUNC(pad)         (((GstRealPad *)(pad))->chainfunc)
239 #define GST_RPAD_CHAINHANDLER(pad)      (((GstRealPad *)(pad))->chainhandler)
240 #define GST_RPAD_GETFUNC(pad)           (((GstRealPad *)(pad))->getfunc)
241 #define GST_RPAD_GETHANDLER(pad)        (((GstRealPad *)(pad))->gethandler)
242 #define GST_RPAD_EVENTFUNC(pad)         (((GstRealPad *)(pad))->eventfunc)
243 #define GST_RPAD_EVENTHANDLER(pad)      (((GstRealPad *)(pad))->eventhandler)
244 #define GST_RPAD_CONVERTFUNC(pad)       (((GstRealPad *)(pad))->convertfunc)
245 #define GST_RPAD_QUERYFUNC(pad)         (((GstRealPad *)(pad))->queryfunc)
246 #define GST_RPAD_INTLINKFUNC(pad)       (((GstRealPad *)(pad))->intlinkfunc)
247 #define GST_RPAD_FORMATSFUNC(pad)       (((GstRealPad *)(pad))->formatsfunc)
248 #define GST_RPAD_QUERYTYPEFUNC(pad)     (((GstRealPad *)(pad))->querytypefunc)
249 #define GST_RPAD_EVENTMASKFUNC(pad)     (((GstRealPad *)(pad))->eventmaskfunc)
250
251 #define GST_RPAD_LINKFUNC(pad)          (((GstRealPad *)(pad))->linkfunc)
252 #define GST_RPAD_UNLINKFUNC(pad)        (((GstRealPad *)(pad))->unlinkfunc)
253 #define GST_RPAD_GETCAPSFUNC(pad)       (((GstRealPad *)(pad))->getcapsfunc)
254 #define GST_RPAD_BUFFERPOOLFUNC(pad)    (((GstRealPad *)(pad))->bufferpoolfunc)
255
256 /* GstGhostPad */
257 #define GST_GPAD_REALPAD(pad)           (((GstGhostPad *)(pad))->realpad)
258
259 /* Generic */
260 #define GST_PAD_REALIZE(pad)            (GST_IS_REAL_PAD(pad) ? ((GstRealPad *)(pad)) : GST_GPAD_REALPAD(pad))
261 #define GST_PAD_DIRECTION(pad)          GST_RPAD_DIRECTION(GST_PAD_REALIZE(pad))
262 #define GST_PAD_CAPS(pad)               GST_RPAD_CAPS(GST_PAD_REALIZE(pad))
263 #define GST_PAD_PEER(pad)               GST_PAD(GST_RPAD_PEER(GST_PAD_REALIZE(pad)))
264
265 /* Some check functions (unused?) */
266 #define GST_PAD_IS_LINKED(pad)          (GST_PAD_PEER(pad) != NULL)
267 #define GST_PAD_IS_ACTIVE(pad)          (!GST_FLAG_IS_SET(GST_PAD_REALIZE(pad), GST_PAD_DISABLED))
268 #define GST_PAD_IS_USABLE(pad)          (GST_PAD_IS_LINKED (pad) && \
269                                          GST_PAD_IS_ACTIVE(pad) && GST_PAD_IS_ACTIVE(GST_PAD_PEER (pad)))
270 #define GST_PAD_CAN_PULL(pad)           (GST_IS_REAL_PAD(pad) && GST_REAL_PAD(pad)->gethandler != NULL)
271 #define GST_PAD_IS_SRC(pad)             (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
272 #define GST_PAD_IS_SINK(pad)            (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
273
274 /***** PadTemplate *****/
275 #define GST_TYPE_PAD_TEMPLATE           (gst_pad_template_get_type ())
276 #define GST_PAD_TEMPLATE(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD_TEMPLATE,GstPadTemplate))
277 #define GST_PAD_TEMPLATE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD_TEMPLATE,GstPadTemplateClass))
278 #define GST_IS_PAD_TEMPLATE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD_TEMPLATE))
279 #define GST_IS_PAD_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD_TEMPLATE))
280
281 typedef enum {
282   GST_PAD_ALWAYS,
283   GST_PAD_SOMETIMES,
284   GST_PAD_REQUEST
285 } GstPadPresence;
286
287 #define GST_PAD_TEMPLATE_NAME_TEMPLATE(templ)   (((GstPadTemplate *)(templ))->name_template)
288 #define GST_PAD_TEMPLATE_DIRECTION(templ)       (((GstPadTemplate *)(templ))->direction)
289 #define GST_PAD_TEMPLATE_PRESENCE(templ)        (((GstPadTemplate *)(templ))->presence)
290 #define GST_PAD_TEMPLATE_CAPS(templ)            (((GstPadTemplate *)(templ))->caps)
291
292 typedef enum {
293   GST_PAD_TEMPLATE_FIXED        = GST_OBJECT_FLAG_LAST,
294
295   GST_PAD_TEMPLATE_FLAG_LAST    = GST_OBJECT_FLAG_LAST + 4
296 } GstPadTemplateFlags;
297
298 #define GST_PAD_TEMPLATE_IS_FIXED(templ)        (GST_FLAG_IS_SET(templ, GST_PAD_TEMPLATE_FIXED))
299
300 struct _GstPadTemplate {
301   GstObject        object;
302
303   gchar           *name_template;
304   GstPadDirection  direction;
305   GstPadPresence   presence;
306   GstCaps         *caps;
307
308   gpointer _gst_reserved[GST_PADDING];
309 };
310
311 struct _GstPadTemplateClass {
312   GstObjectClass   parent_class;
313
314   /* signal callbacks */
315   void (*pad_created)   (GstPadTemplate *templ, GstPad *pad);
316
317   gpointer _gst_reserved[GST_PADDING];
318 };
319
320 #ifdef G_HAVE_ISO_VARARGS
321 #define GST_PAD_TEMPLATE_NEW(padname, dir, pres, ...) \
322   gst_pad_template_new (                        \
323     padname,                                    \
324     dir,                                        \
325     pres,                                       \
326     __VA_ARGS__ ,                               \
327     NULL)
328
329 #define GST_PAD_TEMPLATE_FACTORY(name, padname, dir, pres, ...) \
330 static GstPadTemplate*                          \
331 name (void)                                     \
332 {                                               \
333   static GstPadTemplate *templ = NULL;          \
334   if (!templ) {                                 \
335     templ = GST_PAD_TEMPLATE_NEW (              \
336       padname,                                  \
337       dir,                                      \
338       pres,                                     \
339       __VA_ARGS__ );                            \
340   }                                             \
341   return (GstPadTemplate *)g_object_ref((GObject *)templ); \
342 }
343 #elif defined(G_HAVE_GNUC_VARARGS)
344 /* CR1: the space after 'a' is necessary because of preprocessing in gcc */
345 #define GST_PAD_TEMPLATE_NEW(padname, dir, pres, a...) \
346   gst_pad_template_new (                        \
347     padname,                                    \
348     dir,                                        \
349     pres,                                       \
350     a ,                                         \
351     NULL)
352
353 #define GST_PAD_TEMPLATE_FACTORY(name, padname, dir, pres, a...)         \
354 static GstPadTemplate*                          \
355 name (void)                                     \
356 {                                               \
357   static GstPadTemplate *templ = NULL;          \
358   if (!templ) {                                 \
359     templ = GST_PAD_TEMPLATE_NEW (              \
360       padname,                                  \
361       dir,                                      \
362       pres,                                     \
363       a );                                      \
364   }                                             \
365   return (GstPadTemplate *)g_object_ref((GObject *)templ); \
366 }
367 #endif
368
369 #define GST_PAD_TEMPLATE_GET(fact) (fact)()
370
371 GType                   gst_pad_get_type                        (void);
372 GType                   gst_real_pad_get_type                   (void);
373 GType                   gst_ghost_pad_get_type                  (void);
374
375 /* creating pads */
376 GstPad*                 gst_pad_new                             (const gchar *name, GstPadDirection direction);
377 GstPad*                 gst_pad_new_from_template               (GstPadTemplate *templ, const gchar *name);
378 GstPad*                 gst_pad_custom_new                      (GType type, const gchar *name, GstPadDirection direction);
379 GstPad*                 gst_pad_custom_new_from_template        (GType type, GstPadTemplate *templ, const gchar *name);
380
381 void                    gst_pad_set_name                        (GstPad *pad, const gchar *name);
382 G_CONST_RETURN gchar*   gst_pad_get_name                        (GstPad *pad);
383
384 GstPadDirection         gst_pad_get_direction                   (GstPad *pad);
385
386 void                    gst_pad_set_active                      (GstPad *pad, gboolean active);
387 gboolean                gst_pad_is_active                       (GstPad *pad);
388
389 void                    gst_pad_set_element_private             (GstPad *pad, gpointer priv);
390 gpointer                gst_pad_get_element_private             (GstPad *pad);
391
392 void                    gst_pad_set_parent                      (GstPad *pad, GstElement *parent);
393 GstElement*             gst_pad_get_parent                      (GstPad *pad);
394 GstElement*             gst_pad_get_real_parent                 (GstPad *pad);
395
396 GstScheduler*           gst_pad_get_scheduler                   (GstPad *pad);
397
398 void                    gst_pad_add_ghost_pad                   (GstPad *pad, GstPad *ghostpad);
399 void                    gst_pad_remove_ghost_pad                (GstPad *pad, GstPad *ghostpad);
400 GList*                  gst_pad_get_ghost_pad_list              (GstPad *pad);
401
402 GstPadTemplate*         gst_pad_get_pad_template                (GstPad *pad);
403
404 void                    gst_pad_set_bufferpool_function         (GstPad *pad, GstPadBufferPoolFunction bufpool);
405 GstBufferPool*          gst_pad_get_bufferpool                  (GstPad *pad);
406
407 /* data passing setup functions */
408 void                    gst_pad_set_chain_function              (GstPad *pad, GstPadChainFunction chain);
409 void                    gst_pad_set_get_function                (GstPad *pad, GstPadGetFunction get);
410 void                    gst_pad_set_event_function              (GstPad *pad, GstPadEventFunction event);
411 void                    gst_pad_set_event_mask_function         (GstPad *pad, GstPadEventMaskFunction mask_func);
412 G_CONST_RETURN GstEventMask*
413                         gst_pad_get_event_masks                 (GstPad *pad);
414 G_CONST_RETURN GstEventMask*
415                         gst_pad_get_event_masks_default         (GstPad *pad);
416
417 /* pad links */
418 void                    gst_pad_set_link_function               (GstPad *pad, GstPadLinkFunction link);
419 gboolean                gst_pad_can_link                        (GstPad *srcpad, GstPad *sinkpad);
420 gboolean                gst_pad_can_link_filtered               (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps);
421 void                    gst_pad_set_unlink_function             (GstPad *pad, GstPadUnlinkFunction unlink);
422
423 gboolean                gst_pad_link                            (GstPad *srcpad, GstPad *sinkpad);
424 gboolean                gst_pad_link_filtered                   (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps);
425 void                    gst_pad_unlink                          (GstPad *srcpad, GstPad *sinkpad);
426
427 GstPad*                 gst_pad_get_peer                        (GstPad *pad);
428
429 /* capsnego functions */
430 GstCaps*                gst_pad_get_caps                        (GstPad *pad);
431 GstCaps*                gst_pad_get_pad_template_caps           (GstPad *pad);
432 GstPadLinkReturn        gst_pad_try_set_caps                    (GstPad *pad, GstCaps *caps);
433 gboolean                gst_pad_check_compatibility             (GstPad *srcpad, GstPad *sinkpad);
434
435 void                    gst_pad_set_getcaps_function            (GstPad *pad, GstPadGetCapsFunction getcaps);
436 GstPadLinkReturn        gst_pad_proxy_link                      (GstPad *pad, GstCaps *caps);
437 gboolean                gst_pad_relink_filtered                 (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps);
438 gboolean                gst_pad_perform_negotiate               (GstPad *srcpad, GstPad *sinkpad);
439 gboolean                gst_pad_try_relink_filtered             (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps);
440 GstCaps*                gst_pad_get_allowed_caps                (GstPad *pad);
441 gboolean                gst_pad_recalc_allowed_caps             (GstPad *pad);
442
443 gboolean                gst_pad_recover_caps_error              (GstPad *pad, GstCaps *allowed);
444
445 /* data passing functions */
446 void                    gst_pad_push                            (GstPad *pad, GstData *data);
447 GstData*                gst_pad_pull                            (GstPad *pad);
448 gboolean                gst_pad_send_event                      (GstPad *pad, GstEvent *event);
449 gboolean                gst_pad_event_default                   (GstPad *pad, GstEvent *event);
450 GstPad*                 gst_pad_selectv                         (GList *padlist);
451 GstPad*                 gst_pad_select                          (GstPad *pad, ...);
452 GstPad*                 gst_pad_select_valist                   (GstPad *pad, va_list varargs);
453
454
455 /* convert/query/format functions */
456 void                    gst_pad_set_formats_function            (GstPad *pad, 
457                                                                  GstPadFormatsFunction formats);
458 G_CONST_RETURN GstFormat*
459                         gst_pad_get_formats                     (GstPad *pad);
460 G_CONST_RETURN GstFormat*
461                         gst_pad_get_formats_default             (GstPad *pad);
462
463 void                    gst_pad_set_convert_function            (GstPad *pad, GstPadConvertFunction convert);
464 gboolean                gst_pad_convert                         (GstPad *pad, 
465                                                                  GstFormat src_format,  gint64  src_value,
466                                                                  GstFormat *dest_format, gint64 *dest_value);
467 gboolean                gst_pad_convert_default                 (GstPad *pad,
468                                                                  GstFormat src_format,  gint64  src_value,
469                                                                  GstFormat *dest_format, gint64 *dest_value);
470
471 void                    gst_pad_set_query_function              (GstPad *pad, GstPadQueryFunction query);
472 void                    gst_pad_set_query_type_function         (GstPad *pad, GstPadQueryTypeFunction type_func);
473 G_CONST_RETURN GstQueryType*
474                         gst_pad_get_query_types                 (GstPad *pad);
475 G_CONST_RETURN GstQueryType*
476                         gst_pad_get_query_types_default         (GstPad *pad);
477 gboolean                gst_pad_query                           (GstPad *pad, GstQueryType type,
478                                                                  GstFormat *format, gint64 *value);
479 gboolean                gst_pad_query_default                   (GstPad *pad, GstQueryType type,
480                                                                  GstFormat *format, gint64 *value);
481
482 void                    gst_pad_set_internal_link_function      (GstPad *pad, GstPadIntLinkFunction intlink);
483 GList*                  gst_pad_get_internal_links              (GstPad *pad);
484 GList*                  gst_pad_get_internal_links_default      (GstPad *pad);
485         
486 /* misc helper functions */
487 gboolean                gst_pad_dispatcher                      (GstPad *pad, GstPadDispatcherFunction dispatch, 
488                                                                  gpointer data);
489
490 #define                 gst_pad_add_probe(pad, probe) \
491                         (gst_probe_dispatcher_add_probe (&(GST_REAL_PAD (pad)->probedisp), probe))
492 #define                 gst_pad_remove_probe(pad, probe) \
493                         (gst_probe_dispatcher_remove_probe (&(GST_REAL_PAD (pad)->probedisp), probe))
494
495 #ifndef GST_DISABLE_LOADSAVE
496 void                    gst_pad_load_and_link                   (xmlNodePtr self, GstObject *parent);
497 #endif
498
499
500 /* ghostpads */
501 GstPad*                 gst_ghost_pad_new                       (const gchar *name, GstPad *pad);
502
503
504 /* templates and factories */
505 GType                   gst_pad_template_get_type               (void);
506
507 GstPadTemplate*         gst_pad_template_new                    (const gchar *name_template,
508                                                                  GstPadDirection direction, GstPadPresence presence,
509                                                                  GstCaps *caps, ...);
510
511 GstPadTemplate*         gst_pad_template_newv                   (const gchar *name_template,
512                                                                  GstPadDirection direction, GstPadPresence presence,
513                                                                  GstCaps *caps, va_list var_args);
514
515 GstCaps*                gst_pad_template_get_caps               (GstPadTemplate *templ);
516 GstCaps*                gst_pad_template_get_caps_by_name       (GstPadTemplate *templ, const gchar *name);
517
518 #ifndef GST_DISABLE_LOADSAVE
519 xmlNodePtr              gst_ghost_pad_save_thyself              (GstPad *pad,
520                                                                  xmlNodePtr parent);
521 #endif
522
523 G_END_DECLS
524
525
526 #endif /* __GST_PAD_H__ */
527