1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  *                    2000 Wim Taymans <wim.taymans@chello.be>
4  *
5  * gstpad.h: Header for GstPad object
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 
24 #ifndef __GST_PAD_H__
25 #define __GST_PAD_H__
26 
27 #include <gst/gstconfig.h>
28 
29 typedef struct _GstPad GstPad;
30 typedef struct _GstPadPrivate GstPadPrivate;
31 typedef struct _GstPadClass GstPadClass;
32 typedef struct _GstPadProbeInfo GstPadProbeInfo;
33 
34 /**
35  * GstPadDirection:
36  * @GST_PAD_UNKNOWN: direction is unknown.
37  * @GST_PAD_SRC: the pad is a source pad.
38  * @GST_PAD_SINK: the pad is a sink pad.
39  *
40  * The direction of a pad.
41  */
42 typedef enum {
43   GST_PAD_UNKNOWN,
44   GST_PAD_SRC,
45   GST_PAD_SINK
46 } GstPadDirection;
47 
48 /**
49  * GstPadMode:
50  * @GST_PAD_MODE_NONE: Pad will not handle dataflow
51  * @GST_PAD_MODE_PUSH: Pad handles dataflow in downstream push mode
52  * @GST_PAD_MODE_PULL: Pad handles dataflow in upstream pull mode
53  *
54  * The status of a GstPad. After activating a pad, which usually happens when the
55  * parent element goes from READY to PAUSED, the GstPadMode defines if the
56  * pad operates in push or pull mode.
57  */
58 typedef enum {
59   GST_PAD_MODE_NONE,
60   GST_PAD_MODE_PUSH,
61   GST_PAD_MODE_PULL
62 } GstPadMode;
63 
64 #include <glib.h>
65 
66 GST_API
67 const gchar   * gst_pad_mode_get_name (GstPadMode mode);
68 
69 #include <gst/gstobject.h>
70 #include <gst/gstbuffer.h>
71 #include <gst/gstbufferlist.h>
72 #include <gst/gstcaps.h>
73 #include <gst/gstpadtemplate.h>
74 #include <gst/gstevent.h>
75 #include <gst/gstquery.h>
76 #include <gst/gsttask.h>
77 
78 G_BEGIN_DECLS
79 
80 /*
81  * Pad base class
82  */
83 #define GST_TYPE_PAD			(gst_pad_get_type ())
84 #define GST_IS_PAD(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
85 #define GST_IS_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
86 #define GST_PAD(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
87 #define GST_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
88 #define GST_PAD_CAST(obj)		((GstPad*)(obj))
89 
90 
91 
92 /**
93  * GstPadLinkReturn:
94  * @GST_PAD_LINK_OK		: link succeeded
95  * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
96  * @GST_PAD_LINK_WAS_LINKED	: pad was already linked
97  * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
98  * @GST_PAD_LINK_NOFORMAT	: pads do not have common format
99  * @GST_PAD_LINK_NOSCHED	: pads cannot cooperate in scheduling
100  * @GST_PAD_LINK_REFUSED	: refused for some reason
101  *
102  * Result values from gst_pad_link and friends.
103  */
104 typedef enum {
105   GST_PAD_LINK_OK               =  0,
106   GST_PAD_LINK_WRONG_HIERARCHY  = -1,
107   GST_PAD_LINK_WAS_LINKED       = -2,
108   GST_PAD_LINK_WRONG_DIRECTION  = -3,
109   GST_PAD_LINK_NOFORMAT         = -4,
110   GST_PAD_LINK_NOSCHED          = -5,
111   GST_PAD_LINK_REFUSED          = -6
112 } GstPadLinkReturn;
113 
114 /**
115  * GST_PAD_LINK_FAILED:
116  * @ret: the #GstPadLinkReturn value
117  *
118  * Macro to test if the given #GstPadLinkReturn value indicates a failed
119  * link step.
120  */
121 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
122 
123 /**
124  * GST_PAD_LINK_SUCCESSFUL:
125  * @ret: the #GstPadLinkReturn value
126  *
127  * Macro to test if the given #GstPadLinkReturn value indicates a successful
128  * link step.
129  */
130 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
131 
132 /**
133  * GstFlowReturn:
134  * @GST_FLOW_OK:		 Data passing was ok.
135  * @GST_FLOW_NOT_LINKED:	 Pad is not linked.
136  * @GST_FLOW_FLUSHING:	         Pad is flushing.
137  * @GST_FLOW_EOS:                Pad is EOS.
138  * @GST_FLOW_NOT_NEGOTIATED:	 Pad is not negotiated.
139  * @GST_FLOW_ERROR:		 Some (fatal) error occurred. Element generating
140  *                               this error should post an error message with more
141  *                               details.
142  * @GST_FLOW_NOT_SUPPORTED:	 This operation is not supported.
143  * @GST_FLOW_CUSTOM_SUCCESS:	 Elements can use values starting from
144  *                               this (and higher) to define custom success
145  *                               codes.
146  * @GST_FLOW_CUSTOM_SUCCESS_1:	 Pre-defined custom success code (define your
147  *                               custom success code to this to avoid compiler
148  *                               warnings).
149  * @GST_FLOW_CUSTOM_SUCCESS_2:	 Pre-defined custom success code.
150  * @GST_FLOW_CUSTOM_ERROR:	 Elements can use values starting from
151  *                               this (and lower) to define custom error codes.
152  * @GST_FLOW_CUSTOM_ERROR_1:	 Pre-defined custom error code (define your
153  *                               custom error code to this to avoid compiler
154  *                               warnings).
155  * @GST_FLOW_CUSTOM_ERROR_2:	 Pre-defined custom error code.
156  *
157  * The result of passing data to a pad.
158  *
159  * Note that the custom return values should not be exposed outside of the
160  * element scope.
161  */
162 typedef enum {
163   /* custom success starts here */
164   GST_FLOW_CUSTOM_SUCCESS_2 = 102,
165   GST_FLOW_CUSTOM_SUCCESS_1 = 101,
166   GST_FLOW_CUSTOM_SUCCESS = 100,
167 
168   /* core predefined */
169   GST_FLOW_OK		  =  0,
170   /* expected failures */
171   GST_FLOW_NOT_LINKED     = -1,
172   GST_FLOW_FLUSHING       = -2,
173   /* error cases */
174   GST_FLOW_EOS            = -3,
175   GST_FLOW_NOT_NEGOTIATED = -4,
176   GST_FLOW_ERROR	  = -5,
177   GST_FLOW_NOT_SUPPORTED  = -6,
178 
179   /* custom error starts here */
180   GST_FLOW_CUSTOM_ERROR   = -100,
181   GST_FLOW_CUSTOM_ERROR_1 = -101,
182   GST_FLOW_CUSTOM_ERROR_2 = -102
183 } GstFlowReturn;
184 
185 GST_API
186 const gchar *         gst_flow_get_name (GstFlowReturn ret);
187 
188 GST_API
189 GQuark                gst_flow_to_quark (GstFlowReturn ret);
190 
191 GST_API
192 const gchar *         gst_pad_link_get_name (GstPadLinkReturn ret);
193 
194 /**
195  * GstPadLinkCheck:
196  * @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility.
197  * @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents.
198  *   Could be omitted if it is already known that the two elements that own the
199  *   pads are in the same bin.
200  * @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using
201  *   their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
202  *   would be unsafe e.g. if one pad has %GST_CAPS_ANY.
203  * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
204  *   caps returned by gst_pad_query_caps().
205  * @GST_PAD_LINK_CHECK_NO_RECONFIGURE: Disables pushing a reconfigure event when pads are
206  *   linked.
207  * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking
208  *   pads (i.e. the ones used by gst_pad_link()).
209  *
210  * The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS
211  * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
212  * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed.
213  *
214  * > Only disable some of the checks if you are 100% certain you know the link
215  * > will not fail because of hierarchy/caps compatibility failures. If uncertain,
216  * > use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
217  * > for linking the pads.
218  */
219 
220 typedef enum {
221   GST_PAD_LINK_CHECK_NOTHING       = 0,
222   GST_PAD_LINK_CHECK_HIERARCHY     = 1 << 0,
223   GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1,
224   GST_PAD_LINK_CHECK_CAPS          = 1 << 2,
225 
226 
227   /* Not really checks, more like flags
228    * Added here to avoid creating a new gst_pad_link_variant */
229   GST_PAD_LINK_CHECK_NO_RECONFIGURE = 1 << 3,
230 
231   GST_PAD_LINK_CHECK_DEFAULT       = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS
232 } GstPadLinkCheck;
233 
234 /* pad states */
235 /**
236  * GstPadActivateFunction:
237  * @pad: a #GstPad
238  * @parent: the parent of @pad
239  *
240  * This function is called when the pad is activated during the element
241  * READY to PAUSED state change. By default this function will call the
242  * activate function that puts the pad in push mode but elements can
243  * override this function to activate the pad in pull mode if they wish.
244  *
245  * Returns: %TRUE if the pad could be activated.
246  */
247 typedef gboolean		(*GstPadActivateFunction)	(GstPad *pad, GstObject *parent);
248 /**
249  * GstPadActivateModeFunction:
250  * @pad: a #GstPad
251  * @parent: the parent of @pad
252  * @mode: the requested activation mode of @pad
253  * @active: activate or deactivate the pad.
254  *
255  * The prototype of the push and pull activate functions.
256  *
257  * Returns: %TRUE if the pad could be activated or deactivated.
258  */
259 typedef gboolean		(*GstPadActivateModeFunction)	(GstPad *pad, GstObject *parent,
260                                                                  GstPadMode mode, gboolean active);
261 
262 
263 /* data passing */
264 /**
265  * GstPadChainFunction:
266  * @pad: the sink #GstPad that performed the chain.
267  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
268  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
269  *          during the execution of this function.
270  * @buffer: (transfer full): the #GstBuffer that is chained, not %NULL.
271  *
272  * A function that will be called on sinkpads when chaining buffers.
273  * The function typically processes the data contained in the buffer and
274  * either consumes the data or passes it on to the internally linked pad(s).
275  *
276  * The implementer of this function receives a refcount to @buffer and should
277  * gst_buffer_unref() when the buffer is no longer needed.
278  *
279  * When a chain function detects an error in the data stream, it must post an
280  * error on the bus and return an appropriate #GstFlowReturn value.
281  *
282  * Returns: #GST_FLOW_OK for success
283  */
284 typedef GstFlowReturn		(*GstPadChainFunction)		(GstPad *pad, GstObject *parent,
285                                                                  GstBuffer *buffer);
286 
287 /**
288  * GstPadChainListFunction:
289  * @pad: the sink #GstPad that performed the chain.
290  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
291  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
292  *          during the execution of this function.
293  * @list: (transfer full): the #GstBufferList that is chained, not %NULL.
294  *
295  * A function that will be called on sinkpads when chaining buffer lists.
296  * The function typically processes the data contained in the buffer list and
297  * either consumes the data or passes it on to the internally linked pad(s).
298  *
299  * The implementer of this function receives a refcount to @list and
300  * should gst_buffer_list_unref() when the list is no longer needed.
301  *
302  * When a chainlist function detects an error in the data stream, it must
303  * post an error on the bus and return an appropriate #GstFlowReturn value.
304  *
305  * Returns: #GST_FLOW_OK for success
306  */
307 typedef GstFlowReturn		(*GstPadChainListFunction)	(GstPad *pad, GstObject *parent,
308                                                                  GstBufferList *list);
309 
310 /**
311  * GstPadGetRangeFunction:
312  * @pad: the src #GstPad to perform the getrange on.
313  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
314  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
315  *          during the execution of this function.
316  * @offset: the offset of the range
317  * @length: the length of the range
318  * @buffer: a memory location to hold the result buffer, cannot be %NULL.
319  *
320  * This function will be called on source pads when a peer element
321  * request a buffer at the specified @offset and @length. If this function
322  * returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The
323  * contents of @buffer is invalid for any other return value.
324  *
325  * This function is installed on a source pad with
326  * gst_pad_set_getrange_function() and can only be called on source pads after
327  * they are successfully activated with gst_pad_activate_mode() with the
328  * #GST_PAD_MODE_PULL.
329  *
330  * @offset and @length are always given in byte units. @offset must normally be a value
331  * between 0 and the length in bytes of the data available on @pad. The
332  * length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a
333  * #GST_QUERY_SEEKING.
334  *
335  * Any @offset larger or equal than the length will make the function return
336  * #GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not
337  * contain a valid buffer.
338  *
339  * The buffer size of @buffer will only be smaller than @length when @offset is
340  * near the end of the stream. In all other cases, the size of @buffer must be
341  * exactly the requested size.
342  *
343  * It is allowed to call this function with a 0 @length and valid @offset, in
344  * which case @buffer will contain a 0-sized buffer and the function returns
345  * #GST_FLOW_OK.
346  *
347  * When this function is called with a -1 @offset, the sequentially next buffer
348  * of length @length in the stream is returned.
349  *
350  * When this function is called with a -1 @length, a buffer with a default
351  * optimal length is returned in @buffer. The length might depend on the value
352  * of @offset.
353  *
354  * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other
355  * return value leaves @buffer undefined.
356  */
357 typedef GstFlowReturn		(*GstPadGetRangeFunction)	(GstPad *pad, GstObject *parent,
358                                                                  guint64 offset, guint length,
359                                                                  GstBuffer **buffer);
360 
361 /**
362  * GstPadEventFunction:
363  * @pad: the #GstPad to handle the event.
364  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
365  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
366  *          during the execution of this function.
367  * @event: (transfer full): the #GstEvent to handle.
368  *
369  * Function signature to handle an event for the pad.
370  *
371  * Returns: %TRUE if the pad could handle the event.
372  */
373 typedef gboolean		(*GstPadEventFunction)		(GstPad *pad, GstObject *parent,
374                                                                  GstEvent *event);
375 
376 /**
377  * GstPadEventFullFunction:
378  * @pad: the #GstPad to handle the event.
379  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
380  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
381  *          during the execution of this function.
382  * @event: (transfer full): the #GstEvent to handle.
383  *
384  * Function signature to handle an event for the pad.
385  *
386  * This variant is for specific elements that will take into account the
387  * last downstream flow return (from a pad push), in which case they can
388  * return it.
389  *
390  * Returns: %GST_FLOW_OK if the event was handled properly, or any other
391  * #GstFlowReturn dependent on downstream state.
392  *
393  * Since: 1.8
394  */
395 typedef GstFlowReturn		(*GstPadEventFullFunction)	(GstPad *pad, GstObject *parent,
396                                                                  GstEvent *event);
397 
398 
399 /* internal links */
400 /**
401  * GstPadIterIntLinkFunction:
402  * @pad: The #GstPad to query.
403  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
404  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
405  *          during the execution of this function.
406  *
407  * The signature of the internal pad link iterator function.
408  *
409  * Returns: a new #GstIterator that will iterate over all pads that are
410  * linked to the given pad on the inside of the parent element.
411  *
412  * the caller must call gst_iterator_free() after usage.
413  */
414 typedef GstIterator*           (*GstPadIterIntLinkFunction)    (GstPad *pad, GstObject *parent);
415 
416 /* generic query function */
417 /**
418  * GstPadQueryFunction:
419  * @pad: the #GstPad to query.
420  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
421  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
422  *          during the execution of this function.
423  * @query: the #GstQuery object to execute
424  *
425  * The signature of the query function.
426  *
427  * Returns: %TRUE if the query could be performed.
428  */
429 typedef gboolean		(*GstPadQueryFunction)		(GstPad *pad, GstObject *parent,
430                                                                  GstQuery *query);
431 
432 
433 /* linking */
434 /**
435  * GstPadLinkFunction:
436  * @pad: the #GstPad that is linked.
437  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
438  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
439  *          during the execution of this function.
440  * @peer: the peer #GstPad of the link
441  *
442  * Function signature to handle a new link on the pad.
443  *
444  * Returns: the result of the link with the specified peer.
445  */
446 typedef GstPadLinkReturn	(*GstPadLinkFunction)		(GstPad *pad, GstObject *parent, GstPad *peer);
447 /**
448  * GstPadUnlinkFunction:
449  * @pad: the #GstPad that is linked.
450  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
451  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid
452  *          during the execution of this function.
453  *
454  * Function signature to handle a unlinking the pad prom its peer.
455  *
456  * The pad's lock is already held when the unlink function is called, so most
457  * pad functions cannot be called from within the callback.
458  */
459 typedef void			(*GstPadUnlinkFunction)		(GstPad *pad, GstObject *parent);
460 
461 
462 /* misc */
463 /**
464  * GstPadForwardFunction:
465  * @pad: the #GstPad that is forwarded.
466  * @user_data: the gpointer to optional user data.
467  *
468  * A forward function is called for all internally linked pads, see
469  * gst_pad_forward().
470  *
471  * Returns: %TRUE if the dispatching procedure has to be stopped.
472  */
473 typedef gboolean		(*GstPadForwardFunction)	(GstPad *pad, gpointer user_data);
474 
475 /**
476  * GstPadProbeType:
477  * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
478  * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block while the callback is called
479  * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
480  * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
481  * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
482  * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
483  * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
484  * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be
485  *     explicitly enabled and is not included in the
486  *     @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
487  *     @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
488  * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries
489  * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries
490  * @GST_PAD_PROBE_TYPE_PUSH: probe push
491  * @GST_PAD_PROBE_TYPE_PULL: probe pull
492  * @GST_PAD_PROBE_TYPE_BLOCKING: probe and block at the next opportunity, at data flow or when idle
493  * @GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM: probe downstream data (buffers, buffer lists, and events)
494  * @GST_PAD_PROBE_TYPE_DATA_UPSTREAM: probe upstream data (events)
495  * @GST_PAD_PROBE_TYPE_DATA_BOTH: probe upstream and downstream data (buffers, buffer lists, and events)
496  * @GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM: probe and block downstream data (buffers, buffer lists, and events)
497  * @GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM: probe and block upstream data (events)
498  * @GST_PAD_PROBE_TYPE_EVENT_BOTH: probe upstream and downstream events
499  * @GST_PAD_PROBE_TYPE_QUERY_BOTH: probe upstream and downstream queries
500  * @GST_PAD_PROBE_TYPE_ALL_BOTH: probe upstream events and queries and downstream buffers, buffer lists, events and queries
501  * @GST_PAD_PROBE_TYPE_SCHEDULING: probe push and pull
502  *
503  * The different probing types that can occur. When either one of
504  * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a
505  * blocking probe.
506  */
507 typedef enum
508 {
509   GST_PAD_PROBE_TYPE_INVALID          = 0,
510   /* flags to control blocking */
511   GST_PAD_PROBE_TYPE_IDLE             = (1 << 0),
512   GST_PAD_PROBE_TYPE_BLOCK            = (1 << 1),
513   /* flags to select datatypes */
514   GST_PAD_PROBE_TYPE_BUFFER           = (1 << 4),
515   GST_PAD_PROBE_TYPE_BUFFER_LIST      = (1 << 5),
516   GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6),
517   GST_PAD_PROBE_TYPE_EVENT_UPSTREAM   = (1 << 7),
518   GST_PAD_PROBE_TYPE_EVENT_FLUSH      = (1 << 8),
519   GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9),
520   GST_PAD_PROBE_TYPE_QUERY_UPSTREAM   = (1 << 10),
521   /* flags to select scheduling mode */
522   GST_PAD_PROBE_TYPE_PUSH             = (1 << 12),
523   GST_PAD_PROBE_TYPE_PULL             = (1 << 13),
524 
525   /* flag combinations */
526   GST_PAD_PROBE_TYPE_BLOCKING         = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK,
527   GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM  = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
528   GST_PAD_PROBE_TYPE_DATA_UPSTREAM    = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
529   GST_PAD_PROBE_TYPE_DATA_BOTH        = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
530   GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
531   GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM   = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
532   GST_PAD_PROBE_TYPE_EVENT_BOTH       = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
533   GST_PAD_PROBE_TYPE_QUERY_BOTH       = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
534   GST_PAD_PROBE_TYPE_ALL_BOTH         = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH,
535   GST_PAD_PROBE_TYPE_SCHEDULING       = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL
536 } GstPadProbeType;
537 
538 
539 /**
540  * GstPadProbeReturn:
541  * @GST_PAD_PROBE_OK: normal probe return value. This leaves the probe in
542  *        place, and defers decisions about dropping or passing data to other
543  *        probes, if any. If there are no other probes, the default behaviour
544  *        for the probe type applies ('block' for blocking probes,
545  *        and 'pass' for non-blocking probes).
546  * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
547  *        the data item is not sent downstream. For pull mode, it means that
548  *        the data item is not passed upstream. In both cases, no other probes
549  *        are called for this item and %GST_FLOW_OK or %TRUE is returned to the
550  *        caller.
551  * @GST_PAD_PROBE_REMOVE: remove this probe.
552  * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on the
553  *        next item.
554  * @GST_PAD_PROBE_HANDLED: Data has been handled in the probe and will not be
555  *        forwarded further. For events and buffers this is the same behaviour as
556  *        %GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer
557  *        or event yourself). For queries it will also return %TRUE to the caller.
558  *        The probe can also modify the #GstFlowReturn value by using the
559  *        #GST_PAD_PROBE_INFO_FLOW_RETURN() accessor.
560  *        Note that the resulting query must contain valid entries.
561  *        Since: 1.6
562  *
563  * Different return values for the #GstPadProbeCallback.
564  */
565 typedef enum
566 {
567   GST_PAD_PROBE_DROP,
568   GST_PAD_PROBE_OK,
569   GST_PAD_PROBE_REMOVE,
570   GST_PAD_PROBE_PASS,
571   GST_PAD_PROBE_HANDLED
572 } GstPadProbeReturn;
573 
574 
575 /**
576  * GstPadProbeInfo:
577  * @type: the current probe type
578  * @id: the id of the probe
579  * @data: (allow-none): type specific data, check the @type field to know the
580  *    datatype.  This field can be %NULL.
581  * @offset: offset of pull probe, this field is valid when @type contains
582  *    #GST_PAD_PROBE_TYPE_PULL
583  * @size: size of pull probe, this field is valid when @type contains
584  *    #GST_PAD_PROBE_TYPE_PULL
585  *
586  * Info passed in the #GstPadProbeCallback.
587  */
588 struct _GstPadProbeInfo
589 {
590   GstPadProbeType type;
591   gulong id;
592   gpointer data;
593   guint64 offset;
594   guint size;
595 
596   /*< private >*/
597   union {
598     gpointer _gst_reserved[GST_PADDING];
599     struct {
600       GstFlowReturn flow_ret;
601     } abi;
602   } ABI;
603 };
604 
605 #define GST_PAD_PROBE_INFO_TYPE(d)         ((d)->type)
606 #define GST_PAD_PROBE_INFO_ID(d)           ((d)->id)
607 #define GST_PAD_PROBE_INFO_DATA(d)         ((d)->data)
608 #define GST_PAD_PROBE_INFO_FLOW_RETURN(d)  ((d)->ABI.abi.flow_ret)
609 
610 #define GST_PAD_PROBE_INFO_BUFFER(d)       GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
611 #define GST_PAD_PROBE_INFO_BUFFER_LIST(d)  GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
612 #define GST_PAD_PROBE_INFO_EVENT(d)        GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
613 #define GST_PAD_PROBE_INFO_QUERY(d)        GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
614 
615 #define GST_PAD_PROBE_INFO_OFFSET(d)       ((d)->offset)
616 #define GST_PAD_PROBE_INFO_SIZE(d)         ((d)->size)
617 
618 GST_API
619 GstEvent*      gst_pad_probe_info_get_event       (GstPadProbeInfo * info);
620 
621 GST_API
622 GstQuery*      gst_pad_probe_info_get_query       (GstPadProbeInfo * info);
623 
624 GST_API
625 GstBuffer*     gst_pad_probe_info_get_buffer      (GstPadProbeInfo * info);
626 
627 GST_API
628 GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
629 
630 /**
631  * GstPadProbeCallback:
632  * @pad: the #GstPad that is blocked
633  * @info: #GstPadProbeInfo
634  * @user_data: the gpointer to optional user data.
635  *
636  * Callback used by gst_pad_add_probe(). Gets called to notify about the current
637  * blocking type.
638  *
639  * The callback is allowed to modify the data pointer in @info.
640  *
641  * Returns: a #GstPadProbeReturn
642  */
643 typedef GstPadProbeReturn   (*GstPadProbeCallback)   (GstPad *pad, GstPadProbeInfo *info,
644                                                       gpointer user_data);
645 
646 /**
647  * GstPadStickyEventsForeachFunction:
648  * @pad: the #GstPad.
649  * @event: (allow-none): a sticky #GstEvent.
650  * @user_data: the #gpointer to optional user data.
651  *
652  * Callback used by gst_pad_sticky_events_foreach().
653  *
654  * When this function returns %TRUE, the next event will be
655  * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
656  *
657  * When @event is set to %NULL, the item will be removed from the list of sticky events.
658  * @event can be replaced by assigning a new reference to it.
659  * This function is responsible for unreffing the old event when
660  * removing or modifying.
661  *
662  * Returns: %TRUE if the iteration should continue
663  */
664 typedef gboolean  (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
665                                                         gpointer user_data);
666 
667 /**
668  * GstPadFlags:
669  * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
670  * @GST_PAD_FLAG_FLUSHING: is pad flushing
671  * @GST_PAD_FLAG_EOS: is pad in EOS state
672  * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
673  * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
674  *                       into the pad callbacks.
675  * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
676  *                            The flag has to be unset manually after
677  *                            reconfiguration happened.
678  * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
679  * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps. This means that
680  *     once the caps are set on the pad, the default caps query function
681  *     will only return those caps.
682  * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
683  *                      all events and queries to the internally linked pads
684  *                      instead of discarding them.
685  * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
686  *                      allocation queries to the internally linked pads
687  *                      instead of discarding them.
688  * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward
689  *                      scheduling queries to the internally linked pads
690  *                      instead of discarding them.
691  * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check
692  *                      it the caps intersect the query-caps result instead
693  *                      of checking for a subset. This is interesting for
694  *                      parsers that can accept incompletely specified caps.
695  * @GST_PAD_FLAG_ACCEPT_TEMPLATE: the default accept-caps handler will use
696  *                      the template pad caps instead of query caps to
697  *                      compare with the accept caps. Use this in combination
698  *                      with %GST_PAD_FLAG_ACCEPT_INTERSECT. (Since: 1.6)
699  * @GST_PAD_FLAG_LAST: offset to define more flags
700  *
701  * Pad state flags
702  */
703 typedef enum {
704   GST_PAD_FLAG_BLOCKED          = (GST_OBJECT_FLAG_LAST << 0),
705   GST_PAD_FLAG_FLUSHING         = (GST_OBJECT_FLAG_LAST << 1),
706   GST_PAD_FLAG_EOS              = (GST_OBJECT_FLAG_LAST << 2),
707   GST_PAD_FLAG_BLOCKING         = (GST_OBJECT_FLAG_LAST << 3),
708   GST_PAD_FLAG_NEED_PARENT      = (GST_OBJECT_FLAG_LAST << 4),
709   GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
710   GST_PAD_FLAG_PENDING_EVENTS   = (GST_OBJECT_FLAG_LAST << 6),
711   GST_PAD_FLAG_FIXED_CAPS       = (GST_OBJECT_FLAG_LAST << 7),
712   GST_PAD_FLAG_PROXY_CAPS       = (GST_OBJECT_FLAG_LAST << 8),
713   GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9),
714   GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10),
715   GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11),
716   GST_PAD_FLAG_ACCEPT_TEMPLATE  = (GST_OBJECT_FLAG_LAST << 12),
717   /* padding */
718   GST_PAD_FLAG_LAST        = (GST_OBJECT_FLAG_LAST << 16)
719 } GstPadFlags;
720 
721 /**
722  * GstPad:
723  * @element_private: private data owned by the parent element
724  * @padtemplate: padtemplate for this pad
725  * @direction: the direction of the pad, cannot change after creating
726  *             the pad.
727  *
728  * The #GstPad structure. Use the functions to update the variables.
729  */
730 struct _GstPad {
731   GstObject                      object;
732 
733   /*< public >*/
734   gpointer                       element_private;
735 
736   GstPadTemplate                *padtemplate;
737 
738   GstPadDirection                direction;
739 
740   /*< private >*/
741   /* streaming rec_lock */
742   GRecMutex		         stream_rec_lock;
743   GstTask			*task;
744 
745   /* block cond, mutex is from the object */
746   GCond				 block_cond;
747   GHookList                      probes;
748 
749   GstPadMode		         mode;
750   GstPadActivateFunction	 activatefunc;
751   gpointer                       activatedata;
752   GDestroyNotify                 activatenotify;
753   GstPadActivateModeFunction	 activatemodefunc;
754   gpointer                       activatemodedata;
755   GDestroyNotify                 activatemodenotify;
756 
757   /* pad link */
758   GstPad			*peer;
759   GstPadLinkFunction		 linkfunc;
760   gpointer                       linkdata;
761   GDestroyNotify                 linknotify;
762   GstPadUnlinkFunction		 unlinkfunc;
763   gpointer                       unlinkdata;
764   GDestroyNotify                 unlinknotify;
765 
766   /* data transport functions */
767   GstPadChainFunction		 chainfunc;
768   gpointer                       chaindata;
769   GDestroyNotify                 chainnotify;
770   GstPadChainListFunction        chainlistfunc;
771   gpointer                       chainlistdata;
772   GDestroyNotify                 chainlistnotify;
773   GstPadGetRangeFunction	 getrangefunc;
774   gpointer                       getrangedata;
775   GDestroyNotify                 getrangenotify;
776   GstPadEventFunction		 eventfunc;
777   gpointer                       eventdata;
778   GDestroyNotify                 eventnotify;
779 
780   /* pad offset */
781   gint64                         offset;
782 
783   /* generic query method */
784   GstPadQueryFunction		 queryfunc;
785   gpointer                       querydata;
786   GDestroyNotify                 querynotify;
787 
788   /* internal links */
789   GstPadIterIntLinkFunction      iterintlinkfunc;
790   gpointer                       iterintlinkdata;
791   GDestroyNotify                 iterintlinknotify;
792 
793   /* counts number of probes attached. */
794   gint				 num_probes;
795   gint				 num_blocked;
796 
797   GstPadPrivate                 *priv;
798 
799   union {
800     gpointer _gst_reserved[GST_PADDING];
801     struct {
802       GstFlowReturn last_flowret;
803       GstPadEventFullFunction eventfullfunc;
804     } abi;
805   } ABI;
806 };
807 
808 struct _GstPadClass {
809   GstObjectClass	parent_class;
810 
811   /* signal callbacks */
812   void		(*linked)		(GstPad *pad, GstPad *peer);
813   void		(*unlinked)		(GstPad *pad, GstPad *peer);
814 
815   /*< private >*/
816   gpointer _gst_reserved[GST_PADDING];
817 };
818 
819 
820 /***** helper macros *****/
821 /* GstPad */
822 
823 /**
824  * GST_PAD_NAME:
825  * @pad: a #GstPad
826  *
827  * Get name of the given pad.
828  * No locking is performed in this function, use gst_pad_get_name() instead.
829  */
830 #define GST_PAD_NAME(pad)		(GST_OBJECT_NAME(pad))
831 /**
832  * GST_PAD_PARENT:
833  * @pad: a #GstPad
834  *
835  * Get the @pad parent.
836  * No locking is performed in this function, use gst_pad_get_parent() instead.
837  */
838 #define GST_PAD_PARENT(pad)		(GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
839 /**
840  * GST_PAD_ELEMENT_PRIVATE:
841  * @pad: a #GstPad
842  *
843  * Get the private data of @pad, which is usually some pad- or stream-specific
844  * structure created by the element and set on the pad when creating it.
845  * No locking is performed in this function.
846  */
847 #define GST_PAD_ELEMENT_PRIVATE(pad)    (GST_PAD_CAST(pad)->element_private)
848 /**
849  * GST_PAD_PAD_TEMPLATE:
850  * @pad: a #GstPad
851  *
852  * Get the @pad #GstPadTemplate. It describes the possible media types
853  * a @pad or an element factory can handle.
854  */
855 #define GST_PAD_PAD_TEMPLATE(pad)	(GST_PAD_CAST(pad)->padtemplate)
856 /**
857  * GST_PAD_DIRECTION:
858  * @pad: a #GstPad
859  *
860  * Get the #GstPadDirection of the given @pad. Accessor macro, use
861  * gst_pad_get_direction() instead.
862  */
863 #define GST_PAD_DIRECTION(pad)		(GST_PAD_CAST(pad)->direction)
864 /**
865  * GST_PAD_TASK:
866  * @pad: a #GstPad
867  *
868  * Get the #GstTask of @pad. Accessor macro used by GStreamer. Use the
869  * gst_pad_start_task(), gst_pad_stop_task() and gst_pad_pause_task()
870  * functions instead.
871  */
872 #define GST_PAD_TASK(pad)		(GST_PAD_CAST(pad)->task)
873 /**
874  * GST_PAD_MODE:
875  * @pad: a #GstPad
876  *
877  * Get the #GstPadMode of pad, which will be GST_PAD_MODE_NONE if the pad
878  * has not been activated yet, and otherwise either GST_PAD_MODE_PUSH or
879  * GST_PAD_MODE_PULL depending on which mode the pad was activated in.
880  */
881 #define GST_PAD_MODE(pad)	        (GST_PAD_CAST(pad)->mode)
882 /**
883  * GST_PAD_ACTIVATEFUNC:
884  * @pad: a #GstPad
885  *
886  * Get the #GstPadActivateFunction from @pad.
887  */
888 #define GST_PAD_ACTIVATEFUNC(pad)	(GST_PAD_CAST(pad)->activatefunc)
889 /**
890  * GST_PAD_ACTIVATEMODEFUNC:
891  * @pad: a #GstPad
892  *
893  * Get the #GstPadActivateModeFunction from the given @pad.
894  */
895 #define GST_PAD_ACTIVATEMODEFUNC(pad)	(GST_PAD_CAST(pad)->activatemodefunc)
896 /**
897  * GST_PAD_CHAINFUNC:
898  * @pad: a #GstPad
899  *
900  * Get the #GstPadChainFunction from the given @pad.
901  */
902 #define GST_PAD_CHAINFUNC(pad)		(GST_PAD_CAST(pad)->chainfunc)
903 /**
904  * GST_PAD_CHAINLISTFUNC:
905  * @pad: a #GstPad
906  *
907  * Get the #GstPadChainListFunction from the given @pad.
908  */
909 #define GST_PAD_CHAINLISTFUNC(pad)      (GST_PAD_CAST(pad)->chainlistfunc)
910 /**
911  * GST_PAD_GETRANGEFUNC:
912  * @pad: a #GstPad
913  *
914  * Get the #GstPadGetRangeFunction from the given @pad.
915  */
916 #define GST_PAD_GETRANGEFUNC(pad)	(GST_PAD_CAST(pad)->getrangefunc)
917 /**
918  * GST_PAD_EVENTFUNC:
919  * @pad: a #GstPad
920  *
921  * Get the #GstPadEventFunction from the given @pad, which
922  * is the function that handles events on the pad. You can
923  * use this to set your own event handling function on a pad
924  * after you create it.  If your element derives from a base
925  * class, use the base class's virtual functions instead.
926  */
927 #define GST_PAD_EVENTFUNC(pad)		(GST_PAD_CAST(pad)->eventfunc)
928 /**
929  * GST_PAD_EVENTFULLFUNC:
930  * @pad: a #GstPad
931  *
932  * Get the #GstPadEventFullFunction from the given @pad, which
933  * is the function that handles events on the pad. You can
934  * use this to set your own event handling function on a pad
935  * after you create it.  If your element derives from a base
936  * class, use the base class's virtual functions instead.
937  *
938  * Since: 1.8
939  */
940 #define GST_PAD_EVENTFULLFUNC(pad)	(GST_PAD_CAST(pad)->ABI.abi.eventfullfunc)
941 /**
942  * GST_PAD_QUERYFUNC:
943  * @pad: a #GstPad
944  *
945  * Get the #GstPadQueryFunction from @pad, which is the function
946  * that handles queries on the pad. You can  use this to set your
947  * own query handling function on a pad after you create it. If your
948  * element derives from a base class, use the base class's virtual
949  * functions instead.
950  */
951 #define GST_PAD_QUERYFUNC(pad)		(GST_PAD_CAST(pad)->queryfunc)
952 /**
953  * GST_PAD_ITERINTLINKFUNC:
954  * @pad: a #GstPad
955  *
956  * Get the #GstPadIterIntLinkFunction from the given @pad.
957  */
958 #define GST_PAD_ITERINTLINKFUNC(pad)    (GST_PAD_CAST(pad)->iterintlinkfunc)
959 /**
960  * GST_PAD_PEER:
961  * @pad: a #GstPad
962  *
963  * Return the pad's peer member. This member is a pointer to the linked @pad.
964  * No locking is performed in this function, use gst_pad_get_peer() instead.
965  */
966 #define GST_PAD_PEER(pad)		(GST_PAD_CAST(pad)->peer)
967 /**
968  * GST_PAD_LINKFUNC:
969  * @pad: a #GstPad
970  *
971  * Get the #GstPadLinkFunction for the given @pad.
972  */
973 #define GST_PAD_LINKFUNC(pad)		(GST_PAD_CAST(pad)->linkfunc)
974 /**
975  * GST_PAD_UNLINKFUNC:
976  * @pad: a #GstPad
977  *
978  * Get the #GstPadUnlinkFunction from the given @pad.
979  */
980 #define GST_PAD_UNLINKFUNC(pad)		(GST_PAD_CAST(pad)->unlinkfunc)
981 /**
982  * GST_PAD_IS_SRC:
983  * @pad: a #GstPad
984  *
985  * Returns: %TRUE if the pad is a source pad (i.e. produces data).
986  */
987 #define GST_PAD_IS_SRC(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
988 /**
989  * GST_PAD_IS_SINK:
990  * @pad: a #GstPad
991  *
992  * Returns: %TRUE if the pad is a sink pad (i.e. consumes data).
993  */
994 #define GST_PAD_IS_SINK(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
995 /**
996  * GST_PAD_IS_LINKED:
997  * @pad: a #GstPad
998  *
999  * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
1000  * instead.
1001  */
1002 #define GST_PAD_IS_LINKED(pad)		(GST_PAD_PEER(pad) != NULL)
1003 /**
1004  * GST_PAD_IS_ACTIVE:
1005  * @pad: a #GstPad
1006  *
1007  * Returns: %TRUE if the pad has been activated.
1008  */
1009 #define GST_PAD_IS_ACTIVE(pad)          (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
1010 /**
1011  * GST_PAD_IS_BLOCKED:
1012  * @pad: a #GstPad
1013  *
1014  * Check if the dataflow on a @pad is blocked. Use gst_pad_is_blocked() instead.
1015  */
1016 #define GST_PAD_IS_BLOCKED(pad)		(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
1017 /**
1018  * GST_PAD_IS_BLOCKING:
1019  * @pad: a #GstPad
1020  *
1021  * Check if the @pad is currently blocking on a buffer or event. Use
1022  * gst_pad_is_blocking() instead.
1023  */
1024 #define GST_PAD_IS_BLOCKING(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
1025 /**
1026  * GST_PAD_IS_FLUSHING:
1027  * @pad: a #GstPad
1028  *
1029  * Check if the given @pad is flushing.
1030  */
1031 #define GST_PAD_IS_FLUSHING(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
1032 /**
1033  * GST_PAD_SET_FLUSHING:
1034  * @pad: a #GstPad
1035  *
1036  * Set the given @pad to flushing state, which means it will not accept any
1037  * more events, queries or buffers, and return GST_FLOW_FLUSHING if any buffers
1038  * are pushed on it. This usually happens when the pad is shut down or when
1039  * a flushing seek happens. This is used inside GStreamer when flush start/stop
1040  * events pass through pads, or when an element state is changed and pads are
1041  * activated or deactivated.
1042  */
1043 #define GST_PAD_SET_FLUSHING(pad)	(GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
1044 /**
1045  * GST_PAD_UNSET_FLUSHING:
1046  * @pad: a #GstPad
1047  *
1048  * Unset the flushing flag.
1049  */
1050 #define GST_PAD_UNSET_FLUSHING(pad)	(GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
1051 /**
1052  * GST_PAD_IS_EOS:
1053  * @pad: a #GstPad
1054  *
1055  * Check if the @pad is in EOS state.
1056  */
1057 #define GST_PAD_IS_EOS(pad)	        (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS))
1058 /**
1059  * GST_PAD_NEEDS_RECONFIGURE:
1060  * @pad: a #GstPad
1061  *
1062  * Check if the @pad should be reconfigured/renegotiated.
1063  * The flag has to be unset manually after reconfiguration happened.
1064  * Use gst_pad_needs_reconfigure() or gst_pad_check_reconfigure() instead.
1065  */
1066 #define GST_PAD_NEEDS_RECONFIGURE(pad)  (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
1067 /**
1068  * GST_PAD_HAS_PENDING_EVENTS:
1069  * @pad: a #GstPad
1070  *
1071  * Check if the given @pad has pending events. This is used internally by
1072  * GStreamer.
1073  */
1074 #define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
1075 /**
1076  * GST_PAD_IS_FIXED_CAPS:
1077  * @pad: a #GstPad
1078  *
1079  * Check if the given @pad is using fixed caps, which means that
1080  * once the caps are set on the @pad, the caps query function will
1081  * only return those caps. See gst_pad_use_fixed_caps().
1082  */
1083 #define GST_PAD_IS_FIXED_CAPS(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
1084 /**
1085  * GST_PAD_NEEDS_PARENT:
1086  * @pad: a #GstPad
1087  *
1088  * Check if there is a parent object before calling into the @pad callbacks.
1089  * This is used internally by GStreamer.
1090  */
1091 #define GST_PAD_NEEDS_PARENT(pad)       (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
1092 /**
1093  * GST_PAD_IS_PROXY_CAPS:
1094  * @pad: a #GstPad
1095  *
1096  * Check if the given @pad is set to proxy caps. This means that the default
1097  * event and query handler will forward all events and queries to the
1098  * internally linked @pads instead of discarding them.
1099  */
1100 #define GST_PAD_IS_PROXY_CAPS(pad)      (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1101 /**
1102  * GST_PAD_SET_PROXY_CAPS:
1103  * @pad: a #GstPad
1104  *
1105  * Set @pad to proxy caps, so that all caps-related events and queries are
1106  * proxied down- or upstream to the other side of the element automatically.
1107  * Set this if the element always outputs data in the exact same format as it
1108  * receives as input. This is just for convenience to avoid implementing some
1109  * standard event and query handling code in an element.
1110  */
1111 #define GST_PAD_SET_PROXY_CAPS(pad)     (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1112 /**
1113  * GST_PAD_UNSET_PROXY_CAPS:
1114  * @pad: a #GstPad
1115  *
1116  * Unset proxy caps flag.
1117  */
1118 #define GST_PAD_UNSET_PROXY_CAPS(pad)   (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
1119 /**
1120  * GST_PAD_IS_PROXY_ALLOCATION:
1121  * @pad: a #GstPad
1122  *
1123  * Check if the given @pad is set as proxy allocation which means
1124  * that the default query handler will forward allocation queries to the
1125  * internally linked @pads instead of discarding them.
1126  */
1127 #define GST_PAD_IS_PROXY_ALLOCATION(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1128 /**
1129  * GST_PAD_SET_PROXY_ALLOCATION:
1130  * @pad: a #GstPad
1131  *
1132  * Set @pad to proxy allocation queries, which means that the default query
1133  * handler will forward allocation queries to the internally linked @pads
1134  * instead of discarding them.
1135  * Set this if the element always outputs data in the exact same format as it
1136  * receives as input. This is just for convenience to avoid implementing some
1137  * standard query handling code in an element.
1138  */
1139 #define GST_PAD_SET_PROXY_ALLOCATION(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1140 /**
1141  * GST_PAD_UNSET_PROXY_ALLOCATION:
1142  * @pad: a #GstPad
1143  *
1144  * Unset proxy allocation flag.
1145  */
1146 #define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1147 /**
1148  * GST_PAD_IS_PROXY_SCHEDULING:
1149  * @pad: a #GstPad
1150  *
1151  * Check if the given @pad is set to proxy scheduling queries, which means that
1152  * the default query handler will forward scheduling queries to the internally
1153  * linked @pads instead of discarding them.
1154  */
1155 #define GST_PAD_IS_PROXY_SCHEDULING(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1156 /**
1157  * GST_PAD_SET_PROXY_SCHEDULING:
1158  * @pad: a #GstPad
1159  *
1160  * Set @pad to proxy scheduling queries, which means that the default query
1161  * handler will forward scheduling queries to the internally linked @pads
1162  * instead of discarding them. You will usually want to handle scheduling
1163  * queries explicitly if your element supports multiple scheduling modes.
1164  */
1165 #define GST_PAD_SET_PROXY_SCHEDULING(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1166 /**
1167  * GST_PAD_UNSET_PROXY_SCHEDULING:
1168  * @pad: a #GstPad
1169  *
1170  * Unset proxy scheduling flag.
1171  */
1172 #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1173 /**
1174  * GST_PAD_IS_ACCEPT_INTERSECT:
1175  * @pad: a #GstPad
1176  *
1177  * Check if the pad's accept intersect flag is set. The default accept-caps
1178  * handler will check if the caps intersect the query-caps result instead of
1179  * checking for a subset. This is interesting for parser elements that can
1180  * accept incompletely specified caps.
1181  */
1182 #define GST_PAD_IS_ACCEPT_INTERSECT(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1183 /**
1184  * GST_PAD_SET_ACCEPT_INTERSECT:
1185  * @pad: a #GstPad
1186  *
1187  * Set @pad to by default accept caps by intersecting the result instead of
1188  * checking for a subset. This is interesting for parser elements that can
1189  * accept incompletely specified caps.
1190  */
1191 #define GST_PAD_SET_ACCEPT_INTERSECT(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1192 /**
1193  * GST_PAD_UNSET_ACCEPT_INTERSECT:
1194  * @pad: a #GstPad
1195  *
1196  * Unset accept intersect flag.
1197  */
1198 #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1199 /**
1200  * GST_PAD_IS_ACCEPT_TEMPLATE:
1201  * @pad: a #GstPad
1202  *
1203  * Check if the pad's accept caps operation will use the pad template caps.
1204  * The default accept-caps will do a query caps to get the caps, which might
1205  * be querying downstream causing unnecessary overhead. It is recommended to
1206  * implement a proper accept-caps query handler or to use this flag to prevent
1207  * recursive accept-caps handling.
1208  *
1209  * Since: 1.6
1210  */
1211 #define GST_PAD_IS_ACCEPT_TEMPLATE(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1212 /**
1213  * GST_PAD_SET_ACCEPT_TEMPLATE:
1214  * @pad: a #GstPad
1215  *
1216  * Set @pad to by default use the pad template caps to compare with
1217  * the accept caps instead of using a caps query result.
1218  *
1219  * Since: 1.6
1220  */
1221 #define GST_PAD_SET_ACCEPT_TEMPLATE(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1222 /**
1223  * GST_PAD_UNSET_ACCEPT_TEMPLATE:
1224  * @pad: a #GstPad
1225  *
1226  * Unset accept template flag.
1227  *
1228  * Since: 1.6
1229  */
1230 #define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1231 /**
1232  * GST_PAD_GET_STREAM_LOCK:
1233  * @pad: a #GstPad
1234  *
1235  * Get the stream lock of @pad. The stream lock is protecting the
1236  * resources used in the data processing functions of @pad. Accessor
1237  * macro, use GST_PAD_STREAM_LOCK() and GST_PAD_STREAM_UNLOCK() instead
1238  * to take/release the pad's stream lock.
1239  */
1240 #define GST_PAD_GET_STREAM_LOCK(pad)    (&(GST_PAD_CAST(pad)->stream_rec_lock))
1241 /**
1242  * GST_PAD_STREAM_LOCK:
1243  * @pad: a #GstPad
1244  *
1245  * Take the pad's stream lock. The stream lock is recursive and will be taken
1246  * when buffers or serialized downstream events are pushed on a pad.
1247  */
1248 #define GST_PAD_STREAM_LOCK(pad)        g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
1249 /**
1250  * GST_PAD_STREAM_TRYLOCK:
1251  * @pad: a #GstPad
1252  *
1253  * Try to take the pad's stream lock, and return %TRUE if the lock could be
1254  * taken, and otherwise %FALSE.
1255  */
1256 #define GST_PAD_STREAM_TRYLOCK(pad)     g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
1257 /**
1258  * GST_PAD_STREAM_UNLOCK:
1259  * @pad: a #GstPad
1260  *
1261  * Release the pad's stream lock.
1262  */
1263 #define GST_PAD_STREAM_UNLOCK(pad)      g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
1264 /**
1265  * GST_PAD_LAST_FLOW_RETURN:
1266  * @pad: a #GstPad
1267  *
1268  * Gets the last flow return on this pad
1269  *
1270  * Since: 1.4
1271  */
1272 #define GST_PAD_LAST_FLOW_RETURN(pad)   (GST_PAD_CAST(pad)->ABI.abi.last_flowret)
1273 
1274 #define GST_PAD_BLOCK_GET_COND(pad)     (&GST_PAD_CAST(pad)->block_cond)
1275 #define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
1276 #define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
1277 #define GST_PAD_BLOCK_BROADCAST(pad)    (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
1278 
1279 GST_API
1280 GType			gst_pad_get_type			(void);
1281 
1282 /* creating pads */
1283 
1284 GST_API
1285 GstPad*			gst_pad_new				(const gchar *name, GstPadDirection direction);
1286 
1287 GST_API
1288 GstPad*			gst_pad_new_from_template		(GstPadTemplate *templ, const gchar *name);
1289 
1290 GST_API
1291 GstPad*			gst_pad_new_from_static_template	(GstStaticPadTemplate *templ, const gchar *name);
1292 
1293 
1294 /**
1295  * gst_pad_get_name:
1296  * @pad: the pad to get the name from
1297  *
1298  * Get a copy of the name of the pad. g_free() after usage.
1299  *
1300  * MT safe.
1301  */
1302 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
1303 /**
1304  * gst_pad_get_parent:
1305  * @pad: the pad to get the parent of
1306  *
1307  * Get the parent of @pad. This function increases the refcount
1308  * of the parent object so you should gst_object_unref() it after usage.
1309  * Can return %NULL if the pad did not have a parent.
1310  *
1311  * MT safe.
1312  *
1313  * Returns: (nullable): the parent
1314  */
1315 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
1316 
1317 GST_API
1318 GstPadDirection		gst_pad_get_direction			(GstPad *pad);
1319 
1320 GST_API
1321 gboolean		gst_pad_set_active			(GstPad *pad, gboolean active);
1322 
1323 GST_API
1324 gboolean		gst_pad_is_active			(GstPad *pad);
1325 
1326 GST_API
1327 gboolean		gst_pad_activate_mode			(GstPad *pad, GstPadMode mode,
1328                                                                  gboolean active);
1329 GST_API
1330 gulong                  gst_pad_add_probe                       (GstPad *pad,
1331 								 GstPadProbeType mask,
1332 								 GstPadProbeCallback callback,
1333                                                                  gpointer user_data,
1334                                                                  GDestroyNotify destroy_data);
1335 GST_API
1336 void                    gst_pad_remove_probe                    (GstPad *pad, gulong id);
1337 
1338 GST_API
1339 gboolean		gst_pad_is_blocked			(GstPad *pad);
1340 
1341 GST_API
1342 gboolean		gst_pad_is_blocking			(GstPad *pad);
1343 
1344 GST_API
1345 void                    gst_pad_mark_reconfigure                (GstPad *pad);
1346 
1347 GST_API
1348 gboolean		gst_pad_needs_reconfigure               (GstPad *pad);
1349 
1350 GST_API
1351 gboolean		gst_pad_check_reconfigure               (GstPad *pad);
1352 
1353 GST_API
1354 void			gst_pad_set_element_private		(GstPad *pad, gpointer priv);
1355 
1356 GST_API
1357 gpointer		gst_pad_get_element_private		(GstPad *pad);
1358 
1359 GST_API
1360 GstPadTemplate*		gst_pad_get_pad_template		(GstPad *pad);
1361 
1362 GST_API
1363 GstFlowReturn           gst_pad_store_sticky_event              (GstPad *pad, GstEvent *event);
1364 
1365 GST_API
1366 GstEvent*               gst_pad_get_sticky_event                (GstPad *pad, GstEventType event_type,
1367                                                                  guint idx);
1368 
1369 GST_API
1370 void                    gst_pad_sticky_events_foreach           (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
1371 
1372 /* data passing setup functions */
1373 
1374 GST_API
1375 void			gst_pad_set_activate_function_full	(GstPad *pad,
1376                                                                  GstPadActivateFunction activate,
1377                                                                  gpointer user_data,
1378                                                                  GDestroyNotify notify);
1379 GST_API
1380 void			gst_pad_set_activatemode_function_full	(GstPad *pad,
1381                                                                  GstPadActivateModeFunction activatemode,
1382                                                                  gpointer user_data,
1383                                                                  GDestroyNotify notify);
1384 /* data passing functions */
1385 
1386 GST_API
1387 void			gst_pad_set_chain_function_full		(GstPad *pad,
1388                                                                  GstPadChainFunction chain,
1389                                                                  gpointer user_data,
1390                                                                  GDestroyNotify notify);
1391 GST_API
1392 void			gst_pad_set_chain_list_function_full	(GstPad *pad,
1393                                                                  GstPadChainListFunction chainlist,
1394                                                                  gpointer user_data,
1395                                                                  GDestroyNotify notify);
1396 GST_API
1397 void			gst_pad_set_getrange_function_full	(GstPad *pad,
1398                                                                  GstPadGetRangeFunction get,
1399                                                                  gpointer user_data,
1400                                                                  GDestroyNotify notify);
1401 GST_API
1402 void			gst_pad_set_event_function_full		(GstPad *pad,
1403                                                                  GstPadEventFunction event,
1404                                                                  gpointer user_data,
1405                                                                  GDestroyNotify notify);
1406 GST_API
1407 void			gst_pad_set_event_full_function_full	(GstPad *pad,
1408                                                                  GstPadEventFullFunction event,
1409                                                                  gpointer user_data,
1410                                                                  GDestroyNotify notify);
1411 
1412 #define gst_pad_set_activate_function(p,f)      gst_pad_set_activate_function_full((p),(f),NULL,NULL)
1413 #define gst_pad_set_activatemode_function(p,f)  gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
1414 #define gst_pad_set_chain_function(p,f)         gst_pad_set_chain_function_full((p),(f),NULL,NULL)
1415 #define gst_pad_set_chain_list_function(p,f)    gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
1416 #define gst_pad_set_getrange_function(p,f)      gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
1417 #define gst_pad_set_event_function(p,f)         gst_pad_set_event_function_full((p),(f),NULL,NULL)
1418 #define gst_pad_set_event_full_function(p,f)    gst_pad_set_event_full_function_full((p),(f),NULL,NULL)
1419 
1420 /* pad links */
1421 
1422 GST_API
1423 void			gst_pad_set_link_function_full		(GstPad *pad,
1424                                                                  GstPadLinkFunction link,
1425                                                                  gpointer user_data,
1426                                                                  GDestroyNotify notify);
1427 GST_API
1428 void			gst_pad_set_unlink_function_full        (GstPad *pad,
1429                                                                  GstPadUnlinkFunction unlink,
1430                                                                  gpointer user_data,
1431                                                                  GDestroyNotify notify);
1432 
1433 #define gst_pad_set_link_function(p,f)          gst_pad_set_link_function_full((p),(f),NULL,NULL)
1434 #define gst_pad_set_unlink_function(p,f)        gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
1435 
1436 GST_API
1437 gboolean                gst_pad_can_link                        (GstPad *srcpad, GstPad *sinkpad);
1438 
1439 GST_API
1440 GstPadLinkReturn        gst_pad_link				(GstPad *srcpad, GstPad *sinkpad);
1441 
1442 GST_API
1443 GstPadLinkReturn        gst_pad_link_full			(GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
1444 
1445 GST_API
1446 gboolean		gst_pad_unlink				(GstPad *srcpad, GstPad *sinkpad);
1447 
1448 GST_API
1449 gboolean		gst_pad_is_linked			(GstPad *pad);
1450 
1451 GST_API
1452 GstPad*			gst_pad_get_peer			(GstPad *pad);
1453 
1454 GST_API
1455 GstCaps*                gst_pad_get_pad_template_caps		(GstPad *pad);
1456 
1457 /* capsnego function for linked/unlinked pads */
1458 
1459 GST_API
1460 GstCaps *		gst_pad_get_current_caps                (GstPad * pad);
1461 
1462 GST_API
1463 gboolean		gst_pad_has_current_caps                (GstPad * pad);
1464 
1465 /* capsnego for linked pads */
1466 
1467 GST_API
1468 GstCaps *		gst_pad_get_allowed_caps		(GstPad * pad);
1469 
1470 /* pad offsets */
1471 
1472 GST_API
1473 gint64                  gst_pad_get_offset                      (GstPad *pad);
1474 
1475 GST_API
1476 void                    gst_pad_set_offset                      (GstPad *pad, gint64 offset);
1477 
1478 /* data passing functions to peer */
1479 
1480 GST_API
1481 GstFlowReturn		gst_pad_push				(GstPad *pad, GstBuffer *buffer);
1482 
1483 GST_API
1484 GstFlowReturn		gst_pad_push_list			(GstPad *pad, GstBufferList *list);
1485 
1486 GST_API
1487 GstFlowReturn		gst_pad_pull_range			(GstPad *pad, guint64 offset, guint size,
1488 								 GstBuffer **buffer);
1489 GST_API
1490 gboolean		gst_pad_push_event			(GstPad *pad, GstEvent *event);
1491 
1492 GST_API
1493 gboolean		gst_pad_event_default			(GstPad *pad, GstObject *parent,
1494                                                                  GstEvent *event);
1495 GST_API
1496 GstFlowReturn           gst_pad_get_last_flow_return            (GstPad *pad);
1497 
1498 /* data passing functions on pad */
1499 
1500 GST_API
1501 GstFlowReturn		gst_pad_chain				(GstPad *pad, GstBuffer *buffer);
1502 
1503 GST_API
1504 GstFlowReturn		gst_pad_chain_list                      (GstPad *pad, GstBufferList *list);
1505 
1506 GST_API
1507 GstFlowReturn		gst_pad_get_range			(GstPad *pad, guint64 offset, guint size,
1508 								 GstBuffer **buffer);
1509 GST_API
1510 gboolean		gst_pad_send_event			(GstPad *pad, GstEvent *event);
1511 
1512 /* pad tasks */
1513 
1514 GST_API
1515 gboolean		gst_pad_start_task			(GstPad *pad, GstTaskFunction func,
1516 								 gpointer user_data, GDestroyNotify notify);
1517 GST_API
1518 gboolean		gst_pad_pause_task			(GstPad *pad);
1519 
1520 GST_API
1521 gboolean		gst_pad_stop_task			(GstPad *pad);
1522 
1523 GST_API
1524 GstTaskState	gst_pad_get_task_state		(GstPad *pad);
1525 
1526 /* internal links */
1527 
1528 GST_API
1529 void                    gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
1530                                                                  GstPadIterIntLinkFunction iterintlink,
1531                                                                  gpointer user_data,
1532                                                                  GDestroyNotify notify);
1533 
1534 GST_API
1535 GstIterator *           gst_pad_iterate_internal_links          (GstPad * pad);
1536 
1537 GST_API
1538 GstIterator *           gst_pad_iterate_internal_links_default  (GstPad * pad, GstObject *parent);
1539 
1540 #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
1541 
1542 /* generic query function */
1543 
1544 GST_API
1545 gboolean		gst_pad_query				(GstPad *pad, GstQuery *query);
1546 
1547 GST_API
1548 gboolean		gst_pad_peer_query			(GstPad *pad, GstQuery *query);
1549 
1550 GST_API
1551 void			gst_pad_set_query_function_full		(GstPad *pad, GstPadQueryFunction query,
1552                                                                  gpointer user_data,
1553                                                                  GDestroyNotify notify);
1554 GST_API
1555 gboolean		gst_pad_query_default			(GstPad *pad, GstObject *parent,
1556                                                                  GstQuery *query);
1557 
1558 #define gst_pad_set_query_function(p,f)   gst_pad_set_query_function_full((p),(f),NULL,NULL)
1559 
1560 /* misc helper functions */
1561 
1562 GST_API
1563 gboolean		gst_pad_forward                         (GstPad *pad, GstPadForwardFunction forward,
1564 								 gpointer user_data);
1565 
1566 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
1567 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPad, gst_object_unref)
1568 #endif
1569 
1570 G_END_DECLS
1571 
1572 #endif /* __GST_PAD_H__ */
1573