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