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