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