gstobject: add FIXME and docs for the disabled notify on parent
[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., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23
24 #ifndef __GST_PAD_H__
25 #define __GST_PAD_H__
26
27 #include <gst/gstconfig.h>
28
29 typedef struct _GstPad GstPad;
30 typedef struct _GstPadPrivate GstPadPrivate;
31 typedef struct _GstPadClass GstPadClass;
32 typedef struct _GstPadProbeInfo GstPadProbeInfo;
33
34 /**
35  * GstPadDirection:
36  * @GST_PAD_UNKNOWN: direction is unknown.
37  * @GST_PAD_SRC: the pad is a source pad.
38  * @GST_PAD_SINK: the pad is a sink pad.
39  *
40  * The direction of a pad.
41  */
42 typedef enum {
43   GST_PAD_UNKNOWN,
44   GST_PAD_SRC,
45   GST_PAD_SINK
46 } GstPadDirection;
47
48 /**
49  * GstPadMode:
50  * @GST_PAD_MODE_NONE: Pad will not handle dataflow
51  * @GST_PAD_MODE_PUSH: Pad handles dataflow in downstream push mode
52  * @GST_PAD_MODE_PULL: Pad handles dataflow in upstream pull mode
53  *
54  * The status of a GstPad. After activating a pad, which usually happens when the
55  * parent element goes from READY to PAUSED, the GstPadMode defines if the
56  * pad operates in push or pull mode.
57  */
58 typedef enum {
59   GST_PAD_MODE_NONE,
60   GST_PAD_MODE_PUSH,
61   GST_PAD_MODE_PULL
62 } GstPadMode;
63
64 const gchar   * gst_pad_mode_get_name (GstPadMode mode);
65
66 #include <gst/gstobject.h>
67 #include <gst/gstbuffer.h>
68 #include <gst/gstbufferlist.h>
69 #include <gst/gstcaps.h>
70 #include <gst/gstpadtemplate.h>
71 #include <gst/gstevent.h>
72 #include <gst/gstquery.h>
73 #include <gst/gsttask.h>
74
75 G_BEGIN_DECLS
76
77 /*
78  * Pad base class
79  */
80 #define GST_TYPE_PAD                    (gst_pad_get_type ())
81 #define GST_IS_PAD(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
82 #define GST_IS_PAD_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
83 #define GST_PAD(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
84 #define GST_PAD_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
85 #define GST_PAD_CAST(obj)               ((GstPad*)(obj))
86
87
88
89 /**
90  * GstPadLinkReturn:
91  * @GST_PAD_LINK_OK             : link succeeded
92  * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
93  * @GST_PAD_LINK_WAS_LINKED     : pad was already linked
94  * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
95  * @GST_PAD_LINK_NOFORMAT       : pads do not have common format
96  * @GST_PAD_LINK_NOSCHED        : pads cannot cooperate in scheduling
97  * @GST_PAD_LINK_REFUSED        : refused for some reason
98  *
99  * Result values from gst_pad_link and friends.
100  */
101 typedef enum {
102   GST_PAD_LINK_OK               =  0,
103   GST_PAD_LINK_WRONG_HIERARCHY  = -1,
104   GST_PAD_LINK_WAS_LINKED       = -2,
105   GST_PAD_LINK_WRONG_DIRECTION  = -3,
106   GST_PAD_LINK_NOFORMAT         = -4,
107   GST_PAD_LINK_NOSCHED          = -5,
108   GST_PAD_LINK_REFUSED          = -6
109 } GstPadLinkReturn;
110
111 /**
112  * GST_PAD_LINK_FAILED:
113  * @ret: the #GstPadLinkReturn value
114  *
115  * Macro to test if the given #GstPadLinkReturn value indicates a failed
116  * link step.
117  */
118 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
119
120 /**
121  * GST_PAD_LINK_SUCCESSFUL:
122  * @ret: the #GstPadLinkReturn value
123  *
124  * Macro to test if the given #GstPadLinkReturn value indicates a successful
125  * link step.
126  */
127 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
128
129 /**
130  * GstFlowReturn:
131  * @GST_FLOW_OK:                 Data passing was ok.
132  * @GST_FLOW_NOT_LINKED:         Pad is not linked.
133  * @GST_FLOW_FLUSHING:           Pad is flushing.
134  * @GST_FLOW_EOS:                Pad is EOS.
135  * @GST_FLOW_NOT_NEGOTIATED:     Pad is not negotiated.
136  * @GST_FLOW_ERROR:              Some (fatal) error occurred. Element generating
137  *                               this error should post an error message with more
138  *                               details.
139  * @GST_FLOW_NOT_SUPPORTED:      This operation is not supported.
140  * @GST_FLOW_CUSTOM_SUCCESS:     Elements can use values starting from
141  *                               this (and higher) to define custom success
142  *                               codes.
143  * @GST_FLOW_CUSTOM_SUCCESS_1:   Pre-defined custom success code (define your
144  *                               custom success code to this to avoid compiler
145  *                               warnings).
146  * @GST_FLOW_CUSTOM_SUCCESS_2:   Pre-defined custom success code.
147  * @GST_FLOW_CUSTOM_ERROR:       Elements can use values starting from
148  *                               this (and lower) to define custom error codes.
149  * @GST_FLOW_CUSTOM_ERROR_1:     Pre-defined custom error code (define your
150  *                               custom error code to this to avoid compiler
151  *                               warnings).
152  * @GST_FLOW_CUSTOM_ERROR_2:     Pre-defined custom error code.
153  *
154  * The result of passing data to a pad.
155  *
156  * Note that the custom return values should not be exposed outside of the
157  * element scope.
158  */
159 typedef enum {
160   /* custom success starts here */
161   GST_FLOW_CUSTOM_SUCCESS_2 = 102,
162   GST_FLOW_CUSTOM_SUCCESS_1 = 101,
163   GST_FLOW_CUSTOM_SUCCESS = 100,
164
165   /* core predefined */
166   GST_FLOW_OK             =  0,
167   /* expected failures */
168   GST_FLOW_NOT_LINKED     = -1,
169   GST_FLOW_FLUSHING       = -2,
170   /* error cases */
171   GST_FLOW_EOS            = -3,
172   GST_FLOW_NOT_NEGOTIATED = -4,
173   GST_FLOW_ERROR          = -5,
174   GST_FLOW_NOT_SUPPORTED  = -6,
175
176   /* custom error starts here */
177   GST_FLOW_CUSTOM_ERROR   = -100,
178   GST_FLOW_CUSTOM_ERROR_1 = -101,
179   GST_FLOW_CUSTOM_ERROR_2 = -102
180 } GstFlowReturn;
181
182 const gchar*            gst_flow_get_name       (GstFlowReturn ret);
183 GQuark                  gst_flow_to_quark       (GstFlowReturn ret);
184
185 /**
186  * GstPadLinkCheck:
187  * @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility.
188  * @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents.
189  *   Could be omitted if it is already known that the two elements that own the
190  *   pads are in the same bin.
191  * @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using
192  *   their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
193  *   would be unsafe e.g. if one pad has %GST_CAPS_ANY.
194  * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
195  *   caps returned by gst_pad_query_caps().
196  * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking
197  *   pads (i.e. the ones used by gst_pad_link()).
198  *
199  * The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS
200  * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
201  * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed.
202  *
203  * <warning><para>
204  * Only disable some of the checks if you are 100% certain you know the link
205  * will not fail because of hierarchy/caps compatibility failures. If uncertain,
206  * use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
207  * for linking the pads.
208  * </para></warning>
209  */
210
211 typedef enum {
212   GST_PAD_LINK_CHECK_NOTHING       = 0,
213   GST_PAD_LINK_CHECK_HIERARCHY     = 1 << 0,
214   GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1,
215   GST_PAD_LINK_CHECK_CAPS          = 1 << 2,
216
217   GST_PAD_LINK_CHECK_DEFAULT       = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS
218 } GstPadLinkCheck;
219
220 /* pad states */
221 /**
222  * GstPadActivateFunction:
223  * @pad: a #GstPad
224  * @parent: the parent of @pad
225  *
226  * This function is called when the pad is activated during the element
227  * READY to PAUSED state change. By default this function will call the
228  * activate function that puts the pad in push mode but elements can
229  * override this function to activate the pad in pull mode if they wish.
230  *
231  * Returns: TRUE if the pad could be activated.
232  */
233 typedef gboolean                (*GstPadActivateFunction)       (GstPad *pad, GstObject *parent);
234 /**
235  * GstPadActivateModeFunction:
236  * @pad: a #GstPad
237  * @parent: the parent of @pad
238  * @mode: the requested activation mode of @pad
239  * @active: activate or deactivate the pad.
240  *
241  * The prototype of the push and pull activate functions.
242  *
243  * Returns: TRUE if the pad could be activated or deactivated.
244  */
245 typedef gboolean                (*GstPadActivateModeFunction)   (GstPad *pad, GstObject *parent,
246                                                                  GstPadMode mode, gboolean active);
247
248
249 /* data passing */
250 /**
251  * GstPadChainFunction:
252  * @pad: the sink #GstPad that performed the chain.
253  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
254  *          @parent is guaranteed to be not-NULL and remain valid during the
255  *          execution of this function.
256  * @buffer: the #GstBuffer that is chained, not %NULL.
257  *
258  * A function that will be called on sinkpads when chaining buffers.
259  * The function typically processes the data contained in the buffer and
260  * either consumes the data or passes it on to the internally linked pad(s).
261  *
262  * The implementer of this function receives a refcount to @buffer and should
263  * gst_buffer_unref() when the buffer is no longer needed.
264  *
265  * When a chain function detects an error in the data stream, it must post an
266  * error on the bus and return an appropriate #GstFlowReturn value.
267  *
268  * Returns: #GST_FLOW_OK for success
269  */
270 typedef GstFlowReturn           (*GstPadChainFunction)          (GstPad *pad, GstObject *parent,
271                                                                  GstBuffer *buffer);
272
273 /**
274  * GstPadChainListFunction:
275  * @pad: the sink #GstPad that performed the chain.
276  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
277  *          @parent is guaranteed to be not-NULL and remain valid during the
278  *          execution of this function.
279  * @list: the #GstBufferList that is chained, not %NULL.
280  *
281  * A function that will be called on sinkpads when chaining buffer lists.
282  * The function typically processes the data contained in the buffer list and
283  * either consumes the data or passes it on to the internally linked pad(s).
284  *
285  * The implementer of this function receives a refcount to @list and
286  * should gst_buffer_list_unref() when the list is no longer needed.
287  *
288  * When a chainlist function detects an error in the data stream, it must
289  * post an error on the bus and return an appropriate #GstFlowReturn value.
290  *
291  * Returns: #GST_FLOW_OK for success
292  */
293 typedef GstFlowReturn           (*GstPadChainListFunction)      (GstPad *pad, GstObject *parent,
294                                                                  GstBufferList *list);
295
296 /**
297  * GstPadGetRangeFunction:
298  * @pad: the src #GstPad to perform the getrange on.
299  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
300  *          @parent is guaranteed to be not-NULL and remain valid during the
301  *          execution of this function.
302  * @offset: the offset of the range
303  * @length: the length of the range
304  * @buffer: a memory location to hold the result buffer, cannot be NULL.
305  *
306  * This function will be called on source pads when a peer element
307  * request a buffer at the specified @offset and @length. If this function
308  * returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The
309  * contents of @buffer is invalid for any other return value.
310  *
311  * This function is installed on a source pad with
312  * gst_pad_set_getrange_function() and can only be called on source pads after
313  * they are successfully activated with gst_pad_activate_mode() with the
314  * #GST_PAD_MODE_PULL.
315  *
316  * @offset and @length are always given in byte units. @offset must normally be a value
317  * between 0 and the length in bytes of the data available on @pad. The
318  * length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a
319  * #GST_QUERY_SEEKING.
320  *
321  * Any @offset larger or equal than the length will make the function return
322  * #GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not
323  * contain a valid buffer.
324  *
325  * The buffer size of @buffer will only be smaller than @length when @offset is
326  * near the end of the stream. In all other cases, the size of @buffer must be
327  * exactly the requested size.
328  *
329  * It is allowed to call this function with a 0 @length and valid @offset, in
330  * which case @buffer will contain a 0-sized buffer and the function returns
331  * #GST_FLOW_OK.
332  *
333  * When this function is called with a -1 @offset, the sequentially next buffer
334  * of length @length in the stream is returned.
335  *
336  * When this function is called with a -1 @length, a buffer with a default
337  * optimal length is returned in @buffer. The length might depend on the value
338  * of @offset.
339  *
340  * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other
341  * return value leaves @buffer undefined.
342  */
343 typedef GstFlowReturn           (*GstPadGetRangeFunction)       (GstPad *pad, GstObject *parent,
344                                                                  guint64 offset, guint length,
345                                                                  GstBuffer **buffer);
346
347 /**
348  * GstPadEventFunction:
349  * @pad: the #GstPad to handle the event.
350  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
351  *          @parent is guaranteed to be not-NULL and remain valid during the
352  *          execution of this function.
353  * @event: the #GstEvent to handle.
354  *
355  * Function signature to handle an event for the pad.
356  *
357  * Returns: TRUE if the pad could handle the event.
358  */
359 typedef gboolean                (*GstPadEventFunction)          (GstPad *pad, GstObject *parent,
360                                                                  GstEvent *event);
361
362
363 /* internal links */
364 /**
365  * GstPadIterIntLinkFunction:
366  * @pad: The #GstPad to query.
367  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
368  *          @parent is guaranteed to be not-NULL and remain valid during the
369  *          execution of this function.
370  *
371  * The signature of the internal pad link iterator function.
372  *
373  * Returns: a new #GstIterator that will iterate over all pads that are
374  * linked to the given pad on the inside of the parent element.
375  *
376  * the caller must call gst_iterator_free() after usage.
377  */
378 typedef GstIterator*           (*GstPadIterIntLinkFunction)    (GstPad *pad, GstObject *parent);
379
380 /* generic query function */
381 /**
382  * GstPadQueryFunction:
383  * @pad: the #GstPad to query.
384  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
385  *          @parent is guaranteed to be not-NULL and remain valid during the
386  *          execution of this function.
387  * @query: the #GstQuery object to execute
388  *
389  * The signature of the query function.
390  *
391  * Returns: TRUE if the query could be performed.
392  */
393 typedef gboolean                (*GstPadQueryFunction)          (GstPad *pad, GstObject *parent,
394                                                                  GstQuery *query);
395
396
397 /* linking */
398 /**
399  * GstPadLinkFunction:
400  * @pad: the #GstPad that is linked.
401  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
402  *          @parent is guaranteed to be not-NULL and remain valid during the
403  *          execution of this function.
404  * @peer: the peer #GstPad of the link
405  *
406  * Function signature to handle a new link on the pad.
407  *
408  * Returns: the result of the link with the specified peer.
409  */
410 typedef GstPadLinkReturn        (*GstPadLinkFunction)           (GstPad *pad, GstObject *parent, GstPad *peer);
411 /**
412  * GstPadUnlinkFunction:
413  * @pad: the #GstPad that is linked.
414  * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
415  *          @parent is guaranteed to be not-NULL and remain valid during the
416  *          execution of this function.
417  *
418  * Function signature to handle a unlinking the pad prom its peer.
419  */
420 typedef void                    (*GstPadUnlinkFunction)         (GstPad *pad, GstObject *parent);
421
422
423 /* misc */
424 /**
425  * GstPadForwardFunction:
426  * @pad: the #GstPad that is forwarded.
427  * @user_data: the gpointer to optional user data.
428  *
429  * A forward function is called for all internally linked pads, see
430  * gst_pad_forward().
431  *
432  * Returns: TRUE if the dispatching procedure has to be stopped.
433  */
434 typedef gboolean                (*GstPadForwardFunction)        (GstPad *pad, gpointer user_data);
435
436 /**
437  * GstPadProbeType:
438  * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
439  * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block
440  * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
441  * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
442  * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
443  * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
444  * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
445  * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be
446  *     explicitly enabled and is not included in the
447  *     @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
448  *     @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
449  * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries
450  * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries
451  * @GST_PAD_PROBE_TYPE_PUSH: probe push
452  * @GST_PAD_PROBE_TYPE_PULL: probe pull
453  * @GST_PAD_PROBE_TYPE_BLOCKING: probe and block at the next opportunity, at data flow or when idle
454  * @GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM: probe downstream data (buffers, buffer lists, and events)
455  * @GST_PAD_PROBE_TYPE_DATA_UPSTREAM: probe upstream data (events)
456  * @GST_PAD_PROBE_TYPE_DATA_BOTH: probe upstream and downstream data (buffers, buffer lists, and events)
457  * @GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM: probe and block downstream data (buffers, buffer lists, and events)
458  * @GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM: probe and block upstream data (events)
459  * @GST_PAD_PROBE_TYPE_EVENT_BOTH: probe upstream and downstream events
460  * @GST_PAD_PROBE_TYPE_QUERY_BOTH: probe upstream and downstream queries
461  * @GST_PAD_PROBE_TYPE_ALL_BOTH: probe upstream events and queries and downstream buffers, buffer lists, events and queries
462  * @GST_PAD_PROBE_TYPE_SCHEDULING: probe push and pull
463  *
464  * The different probing types that can occur. When either one of
465  * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a
466  * blocking probe.
467  */
468 typedef enum
469 {
470   GST_PAD_PROBE_TYPE_INVALID          = 0,
471   /* flags to control blocking */
472   GST_PAD_PROBE_TYPE_IDLE             = (1 << 0),
473   GST_PAD_PROBE_TYPE_BLOCK            = (1 << 1),
474   /* flags to select datatypes */
475   GST_PAD_PROBE_TYPE_BUFFER           = (1 << 4),
476   GST_PAD_PROBE_TYPE_BUFFER_LIST      = (1 << 5),
477   GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6),
478   GST_PAD_PROBE_TYPE_EVENT_UPSTREAM   = (1 << 7),
479   GST_PAD_PROBE_TYPE_EVENT_FLUSH      = (1 << 8),
480   GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9),
481   GST_PAD_PROBE_TYPE_QUERY_UPSTREAM   = (1 << 10),
482   /* flags to select scheduling mode */
483   GST_PAD_PROBE_TYPE_PUSH             = (1 << 12),
484   GST_PAD_PROBE_TYPE_PULL             = (1 << 13),
485
486   /* flag combinations */
487   GST_PAD_PROBE_TYPE_BLOCKING         = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK,
488   GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM  = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
489   GST_PAD_PROBE_TYPE_DATA_UPSTREAM    = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
490   GST_PAD_PROBE_TYPE_DATA_BOTH        = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
491   GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
492   GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM   = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
493   GST_PAD_PROBE_TYPE_EVENT_BOTH       = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
494   GST_PAD_PROBE_TYPE_QUERY_BOTH       = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
495   GST_PAD_PROBE_TYPE_ALL_BOTH         = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH,
496   GST_PAD_PROBE_TYPE_SCHEDULING       = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL
497 } GstPadProbeType;
498
499
500 /**
501  * GstPadProbeReturn:
502  * @GST_PAD_PROBE_OK: normal probe return value
503  * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
504  *        the data item is not sent downstream. For pull mode, it means that the
505  *        data item is not passed upstream. In both cases, this result code
506  *        means that #GST_FLOW_OK or %TRUE is returned to the caller.
507  * @GST_PAD_PROBE_REMOVE: remove probe
508  * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on
509  *                         the next item
510  *
511  * Different return values for the #GstPadProbeCallback.
512  */
513 typedef enum
514 {
515   GST_PAD_PROBE_DROP,
516   GST_PAD_PROBE_OK,
517   GST_PAD_PROBE_REMOVE,
518   GST_PAD_PROBE_PASS,
519 } GstPadProbeReturn;
520
521
522 /**
523  * GstPadProbeInfo:
524  * @type: the current probe type
525  * @id: the id of the probe
526  * @data: type specific data, check the @type field to know the datatype.
527  *    This field can be NULL.
528  * @offset: offset of pull probe, this field is valid when @type contains
529  *    #GST_PAD_PROBE_TYPE_PULL
530  * @size: size of pull probe, this field is valid when @type contains
531  *    #GST_PAD_PROBE_TYPE_PULL
532  *
533  * Info passed in the #GstPadProbeCallback.
534  */
535 struct _GstPadProbeInfo
536 {
537   GstPadProbeType type;
538   gulong id;
539   gpointer data;
540   guint64 offset;
541   guint size;
542
543   /*< private >*/
544   gpointer _gst_reserved[GST_PADDING];
545 };
546
547 #define GST_PAD_PROBE_INFO_TYPE(d)         ((d)->type)
548 #define GST_PAD_PROBE_INFO_ID(d)           ((d)->id)
549 #define GST_PAD_PROBE_INFO_DATA(d)         ((d)->data)
550
551 #define GST_PAD_PROBE_INFO_BUFFER(d)       GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
552 #define GST_PAD_PROBE_INFO_BUFFER_LIST(d)  GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
553 #define GST_PAD_PROBE_INFO_EVENT(d)        GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
554 #define GST_PAD_PROBE_INFO_QUERY(d)        GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
555
556 #define GST_PAD_PROBE_INFO_OFFSET(d)       ((d)->offset)
557 #define GST_PAD_PROBE_INFO_SIZE(d)         ((d)->size)
558
559 GstEvent*      gst_pad_probe_info_get_event       (GstPadProbeInfo * info);
560 GstQuery*      gst_pad_probe_info_get_query       (GstPadProbeInfo * info);
561 GstBuffer*     gst_pad_probe_info_get_buffer      (GstPadProbeInfo * info);
562 GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
563
564 /**
565  * GstPadProbeCallback:
566  * @pad: the #GstPad that is blocked
567  * @info: #GstPadProbeInfo
568  * @user_data: the gpointer to optional user data.
569  *
570  * Callback used by gst_pad_add_probe(). Gets called to notify about the current
571  * blocking type.
572  *
573  * The callback is allowed to modify the data pointer in @info.
574  *
575  * Returns: a #GstPadProbeReturn
576  */
577 typedef GstPadProbeReturn   (*GstPadProbeCallback)   (GstPad *pad, GstPadProbeInfo *info,
578                                                       gpointer user_data);
579
580 /**
581  * GstPadStickyEventsForeachFunction:
582  * @pad: the #GstPad.
583  * @event: a sticky #GstEvent.
584  * @user_data: the #gpointer to optional user data.
585  *
586  * Callback used by gst_pad_sticky_events_foreach().
587  *
588  * When this function returns %TRUE, the next event will be
589  * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
590  *
591  * When @event is set to NULL, the item will be removed from the list of sticky events.
592  * @event can be replaced by assigning a new reference to it.
593  * This function is responsible for unreffing the old event when
594  * removing or modifying.
595  *
596  * Returns: %TRUE if the iteration should continue
597  */
598 typedef gboolean  (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
599                                                         gpointer user_data);
600
601 /**
602  * GstPadFlags:
603  * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
604  * @GST_PAD_FLAG_FLUSHING: is pad flushing
605  * @GST_PAD_FLAG_EOS: is pad in EOS state
606  * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
607  * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
608  *                       into the pad callbacks.
609  * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
610  *                            The flag has to be unset manually after
611  *                            reconfiguration happened.
612  * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
613  * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps this means that once the
614  *                      caps are set on the pad, the caps query function will only
615  *                      return those caps.
616  * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
617  *                      all events and queries to the internally linked pads
618  *                      instead of discarding them.
619  * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
620  *                      allocation queries to the internally linked pads
621  *                      instead of discarding them.
622  * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward
623  *                      scheduling queries to the internally linked pads
624  *                      instead of discarding them.
625  * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check
626  *                      it the caps intersect the query-caps result instead
627  *                      of checking for a subset. This is interesting for
628  *                      parsers that can accept incompletely specified caps.
629  * @GST_PAD_FLAG_LAST: offset to define more flags
630  *
631  * Pad state flags
632  */
633 typedef enum {
634   GST_PAD_FLAG_BLOCKED          = (GST_OBJECT_FLAG_LAST << 0),
635   GST_PAD_FLAG_FLUSHING         = (GST_OBJECT_FLAG_LAST << 1),
636   GST_PAD_FLAG_EOS              = (GST_OBJECT_FLAG_LAST << 2),
637   GST_PAD_FLAG_BLOCKING         = (GST_OBJECT_FLAG_LAST << 3),
638   GST_PAD_FLAG_NEED_PARENT      = (GST_OBJECT_FLAG_LAST << 4),
639   GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
640   GST_PAD_FLAG_PENDING_EVENTS   = (GST_OBJECT_FLAG_LAST << 6),
641   GST_PAD_FLAG_FIXED_CAPS       = (GST_OBJECT_FLAG_LAST << 7),
642   GST_PAD_FLAG_PROXY_CAPS       = (GST_OBJECT_FLAG_LAST << 8),
643   GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9),
644   GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10),
645   GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11),
646   /* padding */
647   GST_PAD_FLAG_LAST        = (GST_OBJECT_FLAG_LAST << 16)
648 } GstPadFlags;
649
650 /**
651  * GstPad:
652  * @element_private: private data owned by the parent element
653  * @padtemplate: padtemplate for this pad
654  * @direction: the direction of the pad, cannot change after creating
655  *             the pad.
656  *
657  * The #GstPad structure. Use the functions to update the variables.
658  */
659 struct _GstPad {
660   GstObject                      object;
661
662   /*< public >*/
663   gpointer                       element_private;
664
665   GstPadTemplate                *padtemplate;
666
667   GstPadDirection                direction;
668
669   /*< private >*/
670   /* streaming rec_lock */
671   GRecMutex                      stream_rec_lock;
672   GstTask                       *task;
673
674   /* block cond, mutex is from the object */
675   GCond                          block_cond;
676   GHookList                      probes;
677
678   GstPadMode                     mode;
679   GstPadActivateFunction         activatefunc;
680   gpointer                       activatedata;
681   GDestroyNotify                 activatenotify;
682   GstPadActivateModeFunction     activatemodefunc;
683   gpointer                       activatemodedata;
684   GDestroyNotify                 activatemodenotify;
685
686   /* pad link */
687   GstPad                        *peer;
688   GstPadLinkFunction             linkfunc;
689   gpointer                       linkdata;
690   GDestroyNotify                 linknotify;
691   GstPadUnlinkFunction           unlinkfunc;
692   gpointer                       unlinkdata;
693   GDestroyNotify                 unlinknotify;
694
695   /* data transport functions */
696   GstPadChainFunction            chainfunc;
697   gpointer                       chaindata;
698   GDestroyNotify                 chainnotify;
699   GstPadChainListFunction        chainlistfunc;
700   gpointer                       chainlistdata;
701   GDestroyNotify                 chainlistnotify;
702   GstPadGetRangeFunction         getrangefunc;
703   gpointer                       getrangedata;
704   GDestroyNotify                 getrangenotify;
705   GstPadEventFunction            eventfunc;
706   gpointer                       eventdata;
707   GDestroyNotify                 eventnotify;
708
709   /* pad offset */
710   gint64                         offset;
711
712   /* generic query method */
713   GstPadQueryFunction            queryfunc;
714   gpointer                       querydata;
715   GDestroyNotify                 querynotify;
716
717   /* internal links */
718   GstPadIterIntLinkFunction      iterintlinkfunc;
719   gpointer                       iterintlinkdata;
720   GDestroyNotify                 iterintlinknotify;
721
722   /* counts number of probes attached. */
723   gint                           num_probes;
724   gint                           num_blocked;
725
726   GstPadPrivate                 *priv;
727
728   gpointer _gst_reserved[GST_PADDING];
729 };
730
731 struct _GstPadClass {
732   GstObjectClass        parent_class;
733
734   /* signal callbacks */
735   void          (*linked)               (GstPad *pad, GstPad *peer);
736   void          (*unlinked)             (GstPad *pad, GstPad *peer);
737
738   /*< private >*/
739   gpointer _gst_reserved[GST_PADDING];
740 };
741
742
743 /***** helper macros *****/
744 /* GstPad */
745 #define GST_PAD_NAME(pad)               (GST_OBJECT_NAME(pad))
746 #define GST_PAD_PARENT(pad)             (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
747 #define GST_PAD_ELEMENT_PRIVATE(pad)    (GST_PAD_CAST(pad)->element_private)
748 #define GST_PAD_PAD_TEMPLATE(pad)       (GST_PAD_CAST(pad)->padtemplate)
749 #define GST_PAD_DIRECTION(pad)          (GST_PAD_CAST(pad)->direction)
750 #define GST_PAD_TASK(pad)               (GST_PAD_CAST(pad)->task)
751 #define GST_PAD_MODE(pad)               (GST_PAD_CAST(pad)->mode)
752
753 #define GST_PAD_ACTIVATEFUNC(pad)       (GST_PAD_CAST(pad)->activatefunc)
754 #define GST_PAD_ACTIVATEMODEFUNC(pad)   (GST_PAD_CAST(pad)->activatemodefunc)
755 #define GST_PAD_CHAINFUNC(pad)          (GST_PAD_CAST(pad)->chainfunc)
756 #define GST_PAD_CHAINLISTFUNC(pad)      (GST_PAD_CAST(pad)->chainlistfunc)
757 #define GST_PAD_GETRANGEFUNC(pad)       (GST_PAD_CAST(pad)->getrangefunc)
758 #define GST_PAD_EVENTFUNC(pad)          (GST_PAD_CAST(pad)->eventfunc)
759 #define GST_PAD_QUERYFUNC(pad)          (GST_PAD_CAST(pad)->queryfunc)
760 #define GST_PAD_ITERINTLINKFUNC(pad)    (GST_PAD_CAST(pad)->iterintlinkfunc)
761
762 #define GST_PAD_PEER(pad)               (GST_PAD_CAST(pad)->peer)
763 #define GST_PAD_LINKFUNC(pad)           (GST_PAD_CAST(pad)->linkfunc)
764 #define GST_PAD_UNLINKFUNC(pad)         (GST_PAD_CAST(pad)->unlinkfunc)
765
766 #define GST_PAD_IS_SRC(pad)             (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
767 #define GST_PAD_IS_SINK(pad)            (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
768
769 #define GST_PAD_IS_LINKED(pad)          (GST_PAD_PEER(pad) != NULL)
770
771 #define GST_PAD_IS_ACTIVE(pad)          (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
772
773 #define GST_PAD_IS_BLOCKED(pad)         (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
774 #define GST_PAD_IS_BLOCKING(pad)        (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
775
776 #define GST_PAD_IS_FLUSHING(pad)        (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
777 #define GST_PAD_SET_FLUSHING(pad)       (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
778 #define GST_PAD_UNSET_FLUSHING(pad)     (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
779
780 #define GST_PAD_IS_EOS(pad)             (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS))
781
782 #define GST_PAD_NEEDS_RECONFIGURE(pad)  (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
783 #define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
784 #define GST_PAD_IS_FIXED_CAPS(pad)      (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
785 #define GST_PAD_NEEDS_PARENT(pad)       (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
786
787 #define GST_PAD_IS_PROXY_CAPS(pad)      (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
788 #define GST_PAD_SET_PROXY_CAPS(pad)     (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
789 #define GST_PAD_UNSET_PROXY_CAPS(pad)   (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
790
791 #define GST_PAD_IS_PROXY_ALLOCATION(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
792 #define GST_PAD_SET_PROXY_ALLOCATION(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
793 #define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
794
795 #define GST_PAD_IS_PROXY_SCHEDULING(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
796 #define GST_PAD_SET_PROXY_SCHEDULING(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
797 #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
798
799 #define GST_PAD_IS_ACCEPT_INTERSECT(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
800 #define GST_PAD_SET_ACCEPT_INTERSECT(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
801 #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
802
803 /**
804  * GST_PAD_GET_STREAM_LOCK:
805  * @pad: a #GstPad
806  *
807  * Get the stream lock of @pad. The stream lock is protecting the
808  * resources used in the data processing functions of @pad.
809  */
810 #define GST_PAD_GET_STREAM_LOCK(pad)    (&(GST_PAD_CAST(pad)->stream_rec_lock))
811 /**
812  * GST_PAD_STREAM_LOCK:
813  * @pad: a #GstPad
814  *
815  * Lock the stream lock of @pad.
816  */
817 #define GST_PAD_STREAM_LOCK(pad)        g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
818 /**
819  * GST_PAD_STREAM_TRYLOCK:
820  * @pad: a #GstPad
821  *
822  * Try to Lock the stream lock of the pad, return TRUE if the lock could be
823  * taken.
824  */
825 #define GST_PAD_STREAM_TRYLOCK(pad)     g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
826 /**
827  * GST_PAD_STREAM_UNLOCK:
828  * @pad: a #GstPad
829  *
830  * Unlock the stream lock of @pad.
831  */
832 #define GST_PAD_STREAM_UNLOCK(pad)      g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
833
834 #define GST_PAD_BLOCK_GET_COND(pad)     (&GST_PAD_CAST(pad)->block_cond)
835 #define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
836 #define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
837 #define GST_PAD_BLOCK_BROADCAST(pad)    (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
838
839 GType                   gst_pad_get_type                        (void);
840
841 /* creating pads */
842 GstPad*                 gst_pad_new                             (const gchar *name, GstPadDirection direction);
843 GstPad*                 gst_pad_new_from_template               (GstPadTemplate *templ, const gchar *name);
844 GstPad*                 gst_pad_new_from_static_template        (GstStaticPadTemplate *templ, const gchar *name);
845
846
847 /**
848  * gst_pad_get_name:
849  * @pad: the pad to get the name from
850  *
851  * Get a copy of the name of the pad. g_free() after usage.
852  *
853  * MT safe.
854  */
855 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
856 /**
857  * gst_pad_get_parent:
858  * @pad: the pad to get the parent of
859  *
860  * Get the parent of @pad. This function increases the refcount
861  * of the parent object so you should gst_object_unref() it after usage.
862  * Can return NULL if the pad did not have a parent.
863  *
864  * MT safe.
865  */
866 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
867
868 GstPadDirection         gst_pad_get_direction                   (GstPad *pad);
869
870 gboolean                gst_pad_set_active                      (GstPad *pad, gboolean active);
871 gboolean                gst_pad_is_active                       (GstPad *pad);
872 gboolean                gst_pad_activate_mode                   (GstPad *pad, GstPadMode mode,
873                                                                  gboolean active);
874
875 gulong                  gst_pad_add_probe                       (GstPad *pad,
876                                                                  GstPadProbeType mask,
877                                                                  GstPadProbeCallback callback,
878                                                                  gpointer user_data,
879                                                                  GDestroyNotify destroy_data);
880 void                    gst_pad_remove_probe                    (GstPad *pad, gulong id);
881
882 gboolean                gst_pad_is_blocked                      (GstPad *pad);
883 gboolean                gst_pad_is_blocking                     (GstPad *pad);
884
885 void                    gst_pad_mark_reconfigure                (GstPad *pad);
886 gboolean                gst_pad_needs_reconfigure               (GstPad *pad);
887 gboolean                gst_pad_check_reconfigure               (GstPad *pad);
888
889 void                    gst_pad_set_element_private             (GstPad *pad, gpointer priv);
890 gpointer                gst_pad_get_element_private             (GstPad *pad);
891
892 GstPadTemplate*         gst_pad_get_pad_template                (GstPad *pad);
893
894 GstFlowReturn           gst_pad_store_sticky_event              (GstPad *pad, GstEvent *event);
895 GstEvent*               gst_pad_get_sticky_event                (GstPad *pad, GstEventType event_type,
896                                                                  guint idx);
897 void                    gst_pad_sticky_events_foreach           (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
898
899 /* data passing setup functions */
900 void                    gst_pad_set_activate_function_full      (GstPad *pad,
901                                                                  GstPadActivateFunction activate,
902                                                                  gpointer user_data,
903                                                                  GDestroyNotify notify);
904 void                    gst_pad_set_activatemode_function_full  (GstPad *pad,
905                                                                  GstPadActivateModeFunction activatemode,
906                                                                  gpointer user_data,
907                                                                  GDestroyNotify notify);
908 /* data passing functions */
909 void                    gst_pad_set_chain_function_full         (GstPad *pad,
910                                                                  GstPadChainFunction chain,
911                                                                  gpointer user_data,
912                                                                  GDestroyNotify notify);
913 void                    gst_pad_set_chain_list_function_full    (GstPad *pad,
914                                                                  GstPadChainListFunction chainlist,
915                                                                  gpointer user_data,
916                                                                  GDestroyNotify notify);
917 void                    gst_pad_set_getrange_function_full      (GstPad *pad,
918                                                                  GstPadGetRangeFunction get,
919                                                                  gpointer user_data,
920                                                                  GDestroyNotify notify);
921 void                    gst_pad_set_event_function_full         (GstPad *pad,
922                                                                  GstPadEventFunction event,
923                                                                  gpointer user_data,
924                                                                  GDestroyNotify notify);
925
926 #define gst_pad_set_activate_function(p,f)      gst_pad_set_activate_function_full((p),(f),NULL,NULL)
927 #define gst_pad_set_activatemode_function(p,f)  gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
928 #define gst_pad_set_chain_function(p,f)         gst_pad_set_chain_function_full((p),(f),NULL,NULL)
929 #define gst_pad_set_chain_list_function(p,f)    gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
930 #define gst_pad_set_getrange_function(p,f)      gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
931 #define gst_pad_set_event_function(p,f)         gst_pad_set_event_function_full((p),(f),NULL,NULL)
932
933 /* pad links */
934 void                    gst_pad_set_link_function_full          (GstPad *pad,
935                                                                  GstPadLinkFunction link,
936                                                                  gpointer user_data,
937                                                                  GDestroyNotify notify);
938 void                    gst_pad_set_unlink_function_full        (GstPad *pad,
939                                                                  GstPadUnlinkFunction unlink,
940                                                                  gpointer user_data,
941                                                                  GDestroyNotify notify);
942
943 #define gst_pad_set_link_function(p,f)          gst_pad_set_link_function_full((p),(f),NULL,NULL)
944 #define gst_pad_set_unlink_function(p,f)        gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
945
946 gboolean                gst_pad_can_link                        (GstPad *srcpad, GstPad *sinkpad);
947 GstPadLinkReturn        gst_pad_link                            (GstPad *srcpad, GstPad *sinkpad);
948 GstPadLinkReturn        gst_pad_link_full                       (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
949 gboolean                gst_pad_unlink                          (GstPad *srcpad, GstPad *sinkpad);
950 gboolean                gst_pad_is_linked                       (GstPad *pad);
951
952 GstPad*                 gst_pad_get_peer                        (GstPad *pad);
953
954 GstCaps*                gst_pad_get_pad_template_caps           (GstPad *pad);
955
956 /* capsnego function for linked/unlinked pads */
957 GstCaps *               gst_pad_get_current_caps                (GstPad * pad);
958 gboolean                gst_pad_has_current_caps                (GstPad * pad);
959
960 /* capsnego for linked pads */
961 GstCaps *               gst_pad_get_allowed_caps                (GstPad * pad);
962
963 /* pad offsets */
964 gint64                  gst_pad_get_offset                      (GstPad *pad);
965 void                    gst_pad_set_offset                      (GstPad *pad, gint64 offset);
966
967 /* data passing functions to peer */
968 GstFlowReturn           gst_pad_push                            (GstPad *pad, GstBuffer *buffer);
969 GstFlowReturn           gst_pad_push_list                       (GstPad *pad, GstBufferList *list);
970 GstFlowReturn           gst_pad_pull_range                      (GstPad *pad, guint64 offset, guint size,
971                                                                  GstBuffer **buffer);
972 gboolean                gst_pad_push_event                      (GstPad *pad, GstEvent *event);
973 gboolean                gst_pad_event_default                   (GstPad *pad, GstObject *parent,
974                                                                  GstEvent *event);
975
976 /* data passing functions on pad */
977 GstFlowReturn           gst_pad_chain                           (GstPad *pad, GstBuffer *buffer);
978 GstFlowReturn           gst_pad_chain_list                      (GstPad *pad, GstBufferList *list);
979 GstFlowReturn           gst_pad_get_range                       (GstPad *pad, guint64 offset, guint size,
980                                                                  GstBuffer **buffer);
981 gboolean                gst_pad_send_event                      (GstPad *pad, GstEvent *event);
982
983 /* pad tasks */
984 gboolean                gst_pad_start_task                      (GstPad *pad, GstTaskFunction func,
985                                                                  gpointer user_data, GDestroyNotify notify);
986 gboolean                gst_pad_pause_task                      (GstPad *pad);
987 gboolean                gst_pad_stop_task                       (GstPad *pad);
988
989 /* internal links */
990 void                    gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
991                                                                  GstPadIterIntLinkFunction iterintlink,
992                                                                  gpointer user_data,
993                                                                  GDestroyNotify notify);
994 GstIterator *           gst_pad_iterate_internal_links          (GstPad * pad);
995 GstIterator *           gst_pad_iterate_internal_links_default  (GstPad * pad, GstObject *parent);
996
997 #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
998
999 /* generic query function */
1000 gboolean                gst_pad_query                           (GstPad *pad, GstQuery *query);
1001 gboolean                gst_pad_peer_query                      (GstPad *pad, GstQuery *query);
1002 void                    gst_pad_set_query_function_full         (GstPad *pad, GstPadQueryFunction query,
1003                                                                  gpointer user_data,
1004                                                                  GDestroyNotify notify);
1005 gboolean                gst_pad_query_default                   (GstPad *pad, GstObject *parent,
1006                                                                  GstQuery *query);
1007
1008 #define gst_pad_set_query_function(p,f)   gst_pad_set_query_function_full((p),(f),NULL,NULL)
1009
1010 /* misc helper functions */
1011 gboolean                gst_pad_forward                         (GstPad *pad, GstPadForwardFunction forward,
1012                                                                  gpointer user_data);
1013
1014 G_END_DECLS
1015
1016 #endif /* __GST_PAD_H__ */