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