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