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