inlined two more docs factored gstpadtemplate out of gstpad
[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/gstquery.h>
34 #include <gst/gstqueryutils.h>
35 #include <gst/gsttask.h>
36
37 G_BEGIN_DECLS
38
39 GST_EXPORT GType _gst_pad_type;
40
41 /*
42  * Pad base class
43  */
44 #define GST_TYPE_PAD                    (_gst_pad_type)
45 #define GST_IS_PAD(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
46 #define GST_IS_PAD_FAST(obj)            (G_OBJECT_TYPE(obj) == GST_TYPE_PAD) /* necessary? */
47 #define GST_IS_PAD_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
48 #define GST_PAD(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
49 #define GST_PAD_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
50 #define GST_PAD_CAST(obj)               ((GstPad*)(obj))
51
52 typedef struct _GstPad GstPad;
53 typedef struct _GstPadClass GstPadClass;
54
55 /**
56  * GstPadLinkReturn:
57  * @GST_PAD_LINK_OK             : link succeeded
58  * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
59  * @GST_PAD_LINK_WAS_LINKED     : pad was already linked
60  * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
61  * @GST_PAD_LINK_NOFORMAT       : pads do not have common format
62  * @GST_PAD_LINK_NOSCHED        : pads cannot cooperate in scheduling
63  * @GST_PAD_LINK_REFUSED        : refused for some reason
64  */
65 typedef enum {
66   GST_PAD_LINK_OK               =  0,
67   GST_PAD_LINK_WRONG_HIERARCHY  = -1,
68   GST_PAD_LINK_WAS_LINKED       = -2,
69   GST_PAD_LINK_WRONG_DIRECTION  = -3,
70   GST_PAD_LINK_NOFORMAT         = -4,
71   GST_PAD_LINK_NOSCHED          = -5,
72   GST_PAD_LINK_REFUSED          = -6,
73 } GstPadLinkReturn;
74
75 /**
76  * GST_PAD_LINK_FAILED:
77  * @ret: the #GstPadLinkReturn value
78  *
79  * Macro to test if the given #GstPadLinkReturn value indicates a failed
80  * negotiation step (REFUSED/DELAYED).
81  */
82 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
83
84 /**
85  * GST_PAD_LINK_SUCCESSFUL:
86  * @ret: the #GstPadLinkReturn value
87  *
88  * Macro to test if the given #GstPadLinkReturn value indicates a successfull
89  * negotiation step (OK/DONE).
90  */
91 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
92
93 typedef enum {
94   GST_FLOW_RESEND         =  1,         /* resend buffer, possibly with new caps */
95   GST_FLOW_OK             =  0,         /* data passing was ok */
96   /* expected failures */
97   GST_FLOW_NOT_LINKED     = -1,         /* pad is not linked */
98   GST_FLOW_WRONG_STATE    = -2,         /* pad is in wrong state */
99   /* error cases */
100   GST_FLOW_UNEXPECTED     = -3,         /* did not expect anything, like after EOS */
101   GST_FLOW_NOT_NEGOTIATED = -4,         /* pad is not negotiated */
102   GST_FLOW_ERROR          = -5,         /* some (fatal) error occured */
103   GST_FLOW_NOT_SUPPORTED  = -6          /* function not supported */
104 } GstFlowReturn;
105
106 #define GST_FLOW_IS_FATAL(ret) ((ret) <= GST_FLOW_UNEXPECTED)
107
108 typedef enum {
109   GST_ACTIVATE_NONE,
110   GST_ACTIVATE_PUSH,
111   GST_ACTIVATE_PULL,
112 } GstActivateMode;
113
114 #define GST_PAD_MODE_ACTIVATE(mode) ((mode) != GST_ACTIVATE_NONE)
115
116 /* pad states */
117 typedef gboolean                (*GstPadActivateFunction)       (GstPad *pad);
118 typedef gboolean                (*GstPadActivateModeFunction)   (GstPad *pad, gboolean active);
119
120
121 /* data passing */
122 /**
123  * GstPadChainFunction:
124  * @pad: the #GstPad that performed the chain.
125  * @buffer: the #GstBuffer that is chained.
126  * 
127  * A function that will be called when chaining buffers.
128  *
129  * 
130  */
131 typedef GstFlowReturn           (*GstPadChainFunction)          (GstPad *pad, GstBuffer *buffer);
132 typedef GstFlowReturn           (*GstPadGetRangeFunction)       (GstPad *pad, guint64 offset,
133                                                                  guint length, GstBuffer **buffer);
134
135 /**
136  * GstPadEventFunction:
137  * @pad: the #GstPad to handle the event.
138  * @event: the #GstEvent to handle.
139  *
140  * Function signature to handle an event for the pad.
141  *
142  * Returns: TRUE if the pad could handle the event.
143  */
144 typedef gboolean                (*GstPadEventFunction)          (GstPad *pad, GstEvent *event);
145
146
147 /* deprecate me, check range should use seeking query */
148 typedef gboolean                (*GstPadCheckGetRangeFunction)  (GstPad *pad);
149
150
151 /* internal links */
152 /**
153  * GstPadIntLinkFunction:
154  * @pad: The #GstPad to query.
155  *
156  * The signature of the internal pad link function.
157  *
158  * Returns: a newly allocated #GList of pads that are linked to the given pad on
159  *  the inside of the parent element.
160  *  The caller must call g_list_free() on it after use.
161  *
162  */
163 typedef GList*                  (*GstPadIntLinkFunction)        (GstPad *pad);
164
165
166 /* generic query function */
167 /**
168  * GstPadQueryTypeFunction:
169  * @pad: a #GstPad to query
170  *
171  * The signature of the query types function.
172  *
173  * Returns: an array of query types
174  */
175 typedef const GstQueryType*     (*GstPadQueryTypeFunction)      (GstPad *pad);
176
177 /**
178  * GstPadQueryFunction:
179  * @pad: the #GstPad to query.
180  * @query: the #GstQuery object to execute
181  *
182  * The signature of the query function.
183  * 
184  * Returns: TRUE if the query could be performed.
185  */
186 typedef gboolean                (*GstPadQueryFunction)          (GstPad *pad, GstQuery *query);
187
188
189 /* linking */
190 /**
191  * GstPadLinkFunction
192  * @pad: the #GstPad that is linked.
193  * @peer: the peer #GstPad of the link
194  *
195  * Function signature to handle a new link on the pad.
196  *
197  * Returns: the result of the link with the specified peer.
198  */
199 typedef GstPadLinkReturn        (*GstPadLinkFunction)           (GstPad *pad, GstPad *peer);
200 /**
201  * GstPadUnlinkFunction
202  * @pad: the #GstPad that is linked.
203  *
204  * Function signature to handle a unlinking the pad prom its peer.
205  */
206 typedef void                    (*GstPadUnlinkFunction)         (GstPad *pad);
207
208
209 /* caps nego */
210 /**
211  * GstPadGetCapsFunction:
212  * @pad: the #GstPad to get the capabilities of.
213  *
214  * Returns a copy of the capabilities of the specified pad. By default this
215  * function will return the pad template capabilities, but can optionally
216  * be overridden.
217  *
218  * Returns: a newly allocated copy #GstCaps of the pad.
219  */
220 typedef GstCaps*                (*GstPadGetCapsFunction)        (GstPad *pad);
221 typedef gboolean                (*GstPadSetCapsFunction)        (GstPad *pad, GstCaps *caps);
222 typedef gboolean                (*GstPadAcceptCapsFunction)     (GstPad *pad, GstCaps *caps);
223 typedef void                    (*GstPadFixateCapsFunction)     (GstPad *pad, GstCaps *caps);
224 typedef GstFlowReturn           (*GstPadBufferAllocFunction)    (GstPad *pad, guint64 offset, guint size,
225                                                                  GstCaps *caps, GstBuffer **buf);
226
227 /* misc */
228 /**
229  * GstPadDispatcherFunction:
230  * @pad: the #GstPad that is dispatched.
231  * @data: the gpointer to optional user data.
232  *
233  * A dispatcher function is called for all internally linked pads, see 
234  * gst_pad_dispatcher().
235  *
236  * Returns: TRUE if the dispatching procedure has to be stopped.
237  */
238 typedef gboolean                (*GstPadDispatcherFunction)     (GstPad *pad, gpointer data);
239
240 typedef void                    (*GstPadBlockCallback)          (GstPad *pad, gboolean blocked, gpointer user_data);
241
242 /**
243  * GstPadDirection:
244  * @GST_PAD_UNKNOWN: direction is unknown.
245  * @GST_PAD_SRC: the pad is a source pad.
246  * @GST_PAD_SINK: the pad is a sink pad.
247  *
248  * The direction of a pad.
249  */
250 typedef enum {
251   GST_PAD_UNKNOWN,
252   GST_PAD_SRC,
253   GST_PAD_SINK
254 } GstPadDirection;
255
256 typedef enum {
257   GST_PAD_BLOCKED               = GST_OBJECT_FLAG_LAST,
258   GST_PAD_FLUSHING,
259   GST_PAD_IN_GETCAPS,
260   GST_PAD_IN_SETCAPS,
261
262   GST_PAD_FLAG_LAST             = GST_OBJECT_FLAG_LAST + 8
263 } GstPadFlags;
264
265 /* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
266 typedef struct _GstPadTemplate GstPadTemplate;
267
268 struct _GstPad {
269   GstObject                     object;
270
271   gpointer                      element_private;
272
273   GstPadTemplate                *padtemplate;
274
275   /* direction cannot change after creating the pad */
276   GstPadDirection                direction;
277
278   /*< public >*/ /* with STREAM_LOCK */
279   /* streaming rec_lock */
280   GStaticRecMutex               *stream_rec_lock;
281   GstTask                       *task;
282   /*< public >*/ /* with PREROLL_LOCK */
283   GMutex                        *preroll_lock;
284   GCond                         *preroll_cond;
285
286   /*< public >*/ /* with LOCK */
287   /* block cond, mutex is from the object */
288   GCond                         *block_cond;
289   GstPadBlockCallback            block_callback;
290   gpointer                       block_data;
291
292   /* the pad capabilities */
293   GstCaps                       *caps;
294   GstPadGetCapsFunction         getcapsfunc;
295   GstPadSetCapsFunction         setcapsfunc;
296   GstPadAcceptCapsFunction       acceptcapsfunc;
297   GstPadFixateCapsFunction       fixatecapsfunc;
298
299   GstPadActivateFunction         activatefunc;
300   GstPadActivateModeFunction     activatepushfunc;
301   GstPadActivateModeFunction     activatepullfunc;
302
303   /* pad link */
304   GstPadLinkFunction             linkfunc;
305   GstPadUnlinkFunction           unlinkfunc;
306   GstPad                        *peer;
307
308   gpointer                       sched_private;
309
310   /* data transport functions */
311   GstPadChainFunction            chainfunc;
312   GstPadCheckGetRangeFunction    checkgetrangefunc;
313   GstPadGetRangeFunction         getrangefunc;
314   GstPadEventFunction            eventfunc;
315
316   GstActivateMode                mode;
317
318   /* generic query method */
319   GstPadQueryTypeFunction        querytypefunc;
320   GstPadQueryFunction            queryfunc;
321
322   /* internal links */
323   GstPadIntLinkFunction          intlinkfunc;
324
325   GstPadBufferAllocFunction      bufferallocfunc;
326
327   /* whether to emit signals for have-data. counts number
328    * of handlers attached. */
329   gint                           do_buffer_signals;
330   gint                           do_event_signals;
331
332   /*< private >*/
333   gpointer _gst_reserved[GST_PADDING];
334 };
335
336 struct _GstPadClass {
337   GstObjectClass        parent_class;
338
339   /* signal callbacks */
340   void          (*linked)               (GstPad *pad, GstPad *peer);
341   void          (*unlinked)             (GstPad *pad, GstPad *peer);
342   void          (*request_link)         (GstPad *pad);
343   gboolean      (*have_data)            (GstPad *pad, GstMiniObject *data);
344
345   /*< private >*/
346   gpointer _gst_reserved[GST_PADDING];
347 };
348
349
350 /***** helper macros *****/
351 /* GstPad */
352 #define GST_PAD_NAME(pad)               (GST_OBJECT_NAME(pad))
353 #define GST_PAD_PARENT(pad)             (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
354 #define GST_PAD_ELEMENT_PRIVATE(pad)    (GST_PAD_CAST(pad)->element_private)
355 #define GST_PAD_PAD_TEMPLATE(pad)       (GST_PAD_CAST(pad)->padtemplate)
356 #define GST_PAD_DIRECTION(pad)          (GST_PAD_CAST(pad)->direction)
357 #define GST_PAD_TASK(pad)               (GST_PAD_CAST(pad)->task)
358 #define GST_PAD_ACTIVATE_MODE(pad)      (GST_PAD_CAST(pad)->mode)
359
360 #define GST_PAD_ACTIVATEFUNC(pad)       (GST_PAD_CAST(pad)->activatefunc)
361 #define GST_PAD_ACTIVATEPUSHFUNC(pad)   (GST_PAD_CAST(pad)->activatepushfunc)
362 #define GST_PAD_ACTIVATEPULLFUNC(pad)   (GST_PAD_CAST(pad)->activatepullfunc)
363 #define GST_PAD_CHAINFUNC(pad)          (GST_PAD_CAST(pad)->chainfunc)
364 #define GST_PAD_CHECKGETRANGEFUNC(pad)  (GST_PAD_CAST(pad)->checkgetrangefunc)
365 #define GST_PAD_GETRANGEFUNC(pad)       (GST_PAD_CAST(pad)->getrangefunc)
366 #define GST_PAD_EVENTFUNC(pad)          (GST_PAD_CAST(pad)->eventfunc)
367 #define GST_PAD_QUERYTYPEFUNC(pad)      (GST_PAD_CAST(pad)->querytypefunc)
368 #define GST_PAD_QUERYFUNC(pad)          (GST_PAD_CAST(pad)->queryfunc)
369 #define GST_PAD_INTLINKFUNC(pad)        (GST_PAD_CAST(pad)->intlinkfunc)
370
371 #define GST_PAD_PEER(pad)               (GST_PAD_CAST(pad)->peer)
372 #define GST_PAD_LINKFUNC(pad)           (GST_PAD_CAST(pad)->linkfunc)
373 #define GST_PAD_UNLINKFUNC(pad)         (GST_PAD_CAST(pad)->unlinkfunc)
374
375 #define GST_PAD_CAPS(pad)               (GST_PAD_CAST(pad)->caps)
376 #define GST_PAD_GETCAPSFUNC(pad)        (GST_PAD_CAST(pad)->getcapsfunc)
377 #define GST_PAD_SETCAPSFUNC(pad)        (GST_PAD_CAST(pad)->setcapsfunc)
378 #define GST_PAD_ACCEPTCAPSFUNC(pad)     (GST_PAD_CAST(pad)->acceptcapsfunc)
379 #define GST_PAD_FIXATECAPSFUNC(pad)     (GST_PAD_CAST(pad)->fixatecapsfunc)
380
381 #define GST_PAD_BUFFERALLOCFUNC(pad)    (GST_PAD_CAST(pad)->bufferallocfunc)
382
383 #define GST_PAD_DO_BUFFER_SIGNALS(pad)  (GST_PAD_CAST(pad)->do_buffer_signals)
384 #define GST_PAD_DO_EVENT_SIGNALS(pad)   (GST_PAD_CAST(pad)->do_event_signals)
385
386 #define GST_PAD_IS_LINKED(pad)          (GST_PAD_PEER(pad) != NULL)
387 #define GST_PAD_IS_BLOCKED(pad)         (GST_FLAG_IS_SET (pad, GST_PAD_BLOCKED))
388 #define GST_PAD_IS_FLUSHING(pad)        (GST_FLAG_IS_SET (pad, GST_PAD_FLUSHING))
389 #define GST_PAD_IS_IN_GETCAPS(pad)      (GST_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS))
390 #define GST_PAD_IS_IN_SETCAPS(pad)      (GST_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS))
391 #define GST_PAD_IS_USABLE(pad)          (GST_PAD_IS_LINKED (pad) && \
392                                          !GST_PAD_IS_FLUSHING(pad) && !GST_PAD_IS_FLUSHING(GST_PAD_PEER (pad)))
393 #define GST_PAD_IS_SRC(pad)             (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
394 #define GST_PAD_IS_SINK(pad)            (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
395
396 #define GST_PAD_SET_FLUSHING(pad)       (GST_FLAG_SET (pad, GST_PAD_FLUSHING))
397 #define GST_PAD_UNSET_FLUSHING(pad)     (GST_FLAG_UNSET (pad, GST_PAD_FLUSHING))
398
399 #define GST_STREAM_GET_LOCK(pad)        (GST_PAD_CAST(pad)->stream_rec_lock)
400 #define GST_STREAM_LOCK(pad)            (g_static_rec_mutex_lock(GST_STREAM_GET_LOCK(pad)))
401 #define GST_STREAM_TRYLOCK(pad)         (g_static_rec_mutex_trylock(GST_STREAM_GET_LOCK(pad)))
402 #define GST_STREAM_UNLOCK(pad)          (g_static_rec_mutex_unlock(GST_STREAM_GET_LOCK(pad)))
403 #define GST_STREAM_UNLOCK_FULL(pad)     (g_static_rec_mutex_unlock_full(GST_STREAM_GET_LOCK(pad)))
404 #define GST_STREAM_LOCK_FULL(pad,t)     (g_static_rec_mutex_lock_full(GST_STREAM_GET_LOCK(pad), t))
405
406 #define GST_PREROLL_GET_LOCK(pad)       (GST_PAD_CAST(pad)->preroll_lock)
407 #define GST_PREROLL_LOCK(pad)           (g_mutex_lock(GST_PREROLL_GET_LOCK(pad)))
408 #define GST_PREROLL_TRYLOCK(pad)        (g_mutex_trylock(GST_PREROLL_GET_LOCK(pad)))
409 #define GST_PREROLL_UNLOCK(pad)         (g_mutex_unlock(GST_PREROLL_GET_LOCK(pad)))
410 #define GST_PREROLL_GET_COND(pad)       (GST_PAD_CAST(pad)->preroll_cond)
411 #define GST_PREROLL_WAIT(pad)           g_cond_wait (GST_PREROLL_GET_COND (pad), GST_PREROLL_GET_LOCK (pad))
412 #define GST_PREROLL_TIMED_WAIT(pad, timeval) g_cond_timed_wait (GST_PREROLL_GET_COND (pad), GST_PREROLL_GET_LOCK (pad),\
413                                              timeval)
414 #define GST_PREROLL_SIGNAL(pad)         g_cond_signal (GST_PREROLL_GET_COND (pad));
415 #define GST_PREROLL_BROADCAST(pad)      g_cond_broadcast (GST_PREROLL_GET_COND (pad));
416
417 #define GST_PAD_BLOCK_GET_COND(pad)     (GST_PAD_CAST(pad)->block_cond)
418 #define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_GET_LOCK (pad)))
419 #define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
420
421 /* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
422 #include <gst/gstpadtemplate.h>
423
424 GType                   gst_pad_get_type                        (void);
425
426 /* creating pads */
427 GstPad*                 gst_pad_new                             (const gchar *name, GstPadDirection direction);
428 GstPad*                 gst_pad_new_from_template               (GstPadTemplate *templ, const gchar *name);
429
430 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
431 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
432
433 GstPadDirection         gst_pad_get_direction                   (GstPad *pad);
434
435 gboolean                gst_pad_set_active                      (GstPad *pad, gboolean active);
436 gboolean                gst_pad_is_active                       (GstPad *pad);
437 gboolean                gst_pad_activate_pull                   (GstPad *pad, gboolean active);
438 gboolean                gst_pad_activate_push                   (GstPad *pad, gboolean active);
439
440 gboolean                gst_pad_set_blocked                     (GstPad *pad, gboolean blocked);
441 gboolean                gst_pad_set_blocked_async               (GstPad *pad, gboolean blocked,
442                                                                  GstPadBlockCallback callback, gpointer user_data);
443 gboolean                gst_pad_is_blocked                      (GstPad *pad);
444
445 void                    gst_pad_set_element_private             (GstPad *pad, gpointer priv);
446 gpointer                gst_pad_get_element_private             (GstPad *pad);
447
448 GstPadTemplate*         gst_pad_get_pad_template                (GstPad *pad);
449
450 void                    gst_pad_set_bufferalloc_function        (GstPad *pad, GstPadBufferAllocFunction bufalloc);
451 GstFlowReturn           gst_pad_alloc_buffer                    (GstPad *pad, guint64 offset, gint size,
452                                                                  GstCaps *caps, GstBuffer **buf);
453
454 /* data passing setup functions */
455 void                    gst_pad_set_activate_function           (GstPad *pad, GstPadActivateFunction activate);
456 void                    gst_pad_set_activatepull_function       (GstPad *pad, GstPadActivateModeFunction activatepull);
457 void                    gst_pad_set_activatepush_function       (GstPad *pad, GstPadActivateModeFunction activatepush);
458 void                    gst_pad_set_chain_function              (GstPad *pad, GstPadChainFunction chain);
459 void                    gst_pad_set_getrange_function           (GstPad *pad, GstPadGetRangeFunction get);
460 void                    gst_pad_set_checkgetrange_function      (GstPad *pad, GstPadCheckGetRangeFunction check);
461 void                    gst_pad_set_event_function              (GstPad *pad, GstPadEventFunction event);
462
463 /* pad links */
464 void                    gst_pad_set_link_function               (GstPad *pad, GstPadLinkFunction link);
465 void                    gst_pad_set_unlink_function             (GstPad *pad, GstPadUnlinkFunction unlink);
466
467 GstPadLinkReturn        gst_pad_link                            (GstPad *srcpad, GstPad *sinkpad);
468 gboolean                gst_pad_unlink                          (GstPad *srcpad, GstPad *sinkpad);
469 gboolean                gst_pad_is_linked                       (GstPad *pad);
470
471 GstPad*                 gst_pad_get_peer                        (GstPad *pad);
472
473 /* capsnego functions */
474 void                    gst_pad_set_getcaps_function            (GstPad *pad, GstPadGetCapsFunction getcaps);
475 void                    gst_pad_set_acceptcaps_function         (GstPad *pad, GstPadAcceptCapsFunction acceptcaps);
476 void                    gst_pad_set_fixatecaps_function         (GstPad *pad, GstPadFixateCapsFunction fixatecaps);
477 void                    gst_pad_set_setcaps_function            (GstPad *pad, GstPadSetCapsFunction setcaps);
478
479 G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps           (GstPad *pad);
480
481 /* capsnego function for connected/unconnected pads */
482 GstCaps *               gst_pad_get_caps                        (GstPad * pad);
483 void                    gst_pad_fixate_caps                     (GstPad * pad, GstCaps *caps);
484 gboolean                gst_pad_accept_caps                     (GstPad * pad, GstCaps *caps);
485 gboolean                gst_pad_set_caps                        (GstPad * pad, GstCaps *caps);
486
487 GstCaps *               gst_pad_peer_get_caps                   (GstPad * pad);
488 gboolean                gst_pad_peer_accept_caps                (GstPad * pad, GstCaps *caps);
489
490 /* capsnego for connected pads */
491 GstCaps *               gst_pad_get_allowed_caps                (GstPad * srcpad);
492 GstCaps *               gst_pad_get_negotiated_caps             (GstPad * pad);
493
494 /* data passing functions to peer */
495 GstFlowReturn           gst_pad_push                            (GstPad *pad, GstBuffer *buffer);
496 gboolean                gst_pad_check_pull_range                (GstPad *pad);
497 GstFlowReturn           gst_pad_pull_range                      (GstPad *pad, guint64 offset, guint size,
498                                                                  GstBuffer **buffer);
499 gboolean                gst_pad_push_event                      (GstPad *pad, GstEvent *event);
500 gboolean                gst_pad_event_default                   (GstPad *pad, GstEvent *event);
501
502 /* data passing functions on pad */
503 GstFlowReturn           gst_pad_chain                           (GstPad *pad, GstBuffer *buffer);
504 GstFlowReturn           gst_pad_get_range                       (GstPad *pad, guint64 offset, guint size,
505                                                                  GstBuffer **buffer);
506 gboolean                gst_pad_send_event                      (GstPad *pad, GstEvent *event);
507
508 /* pad tasks */
509 gboolean                gst_pad_start_task                      (GstPad *pad, GstTaskFunction func,
510                                                                  gpointer data);
511 gboolean                gst_pad_pause_task                      (GstPad *pad);
512 gboolean                gst_pad_stop_task                       (GstPad *pad);
513
514 /* internal links */
515 void                    gst_pad_set_internal_link_function      (GstPad *pad, GstPadIntLinkFunction intlink);
516 GList*                  gst_pad_get_internal_links              (GstPad *pad);
517 GList*                  gst_pad_get_internal_links_default      (GstPad *pad);
518
519 /* generic query function */
520 void                    gst_pad_set_query_type_function         (GstPad *pad, GstPadQueryTypeFunction type_func);
521 G_CONST_RETURN GstQueryType*
522                         gst_pad_get_query_types                 (GstPad *pad);
523 G_CONST_RETURN GstQueryType*
524                         gst_pad_get_query_types_default         (GstPad *pad);
525
526 gboolean                gst_pad_query                           (GstPad *pad, GstQuery *query);
527 void                    gst_pad_set_query_function              (GstPad *pad, GstPadQueryFunction query);
528 gboolean                gst_pad_query_default                   (GstPad *pad, GstQuery *query);
529
530 /* misc helper functions */
531 gboolean                gst_pad_dispatcher                      (GstPad *pad, GstPadDispatcherFunction dispatch,
532                                                                  gpointer data);
533
534 #ifndef GST_DISABLE_LOADSAVE
535 void                    gst_pad_load_and_link                   (xmlNodePtr self, GstObject *parent);
536 #endif
537
538 G_END_DECLS
539
540 #endif /* __GST_PAD_H__ */