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