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