2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wim.taymans@chello.be>
5 * gstpad.h: Header for GstPad object
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.
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.
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.
27 #include <gst/gstconfig.h>
29 typedef struct _GstPad GstPad;
30 typedef struct _GstPadPrivate GstPadPrivate;
31 typedef struct _GstPadClass GstPadClass;
32 typedef struct _GstPadProbeInfo GstPadProbeInfo;
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.
40 * The direction of a pad.
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
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.
67 const gchar * gst_pad_mode_get_name (GstPadMode mode);
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>
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))
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
102 * Result values from gst_pad_link and friends.
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
115 * GST_PAD_LINK_FAILED:
116 * @ret: the #GstPadLinkReturn value
118 * Macro to test if the given #GstPadLinkReturn value indicates a failed
121 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
124 * GST_PAD_LINK_SUCCESSFUL:
125 * @ret: the #GstPadLinkReturn value
127 * Macro to test if the given #GstPadLinkReturn value indicates a successful
130 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
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
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
146 * @GST_FLOW_CUSTOM_SUCCESS_1: Pre-defined custom success code (define your
147 * custom success code to this to avoid compiler
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
155 * @GST_FLOW_CUSTOM_ERROR_2: Pre-defined custom error code.
157 * The result of passing data to a pad.
159 * Note that the custom return values should not be exposed outside of the
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,
168 /* core predefined */
170 /* expected failures */
171 GST_FLOW_NOT_LINKED = -1,
172 GST_FLOW_FLUSHING = -2,
175 GST_FLOW_NOT_NEGOTIATED = -4,
177 GST_FLOW_NOT_SUPPORTED = -6,
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
186 const gchar * gst_flow_get_name (GstFlowReturn ret);
189 GQuark gst_flow_to_quark (GstFlowReturn ret);
192 const gchar * gst_pad_link_get_name (GstPadLinkReturn ret);
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
207 * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking
208 * pads (i.e. the ones used by gst_pad_link()).
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.
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.
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,
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,
231 GST_PAD_LINK_CHECK_DEFAULT = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS
236 * GstPadActivateFunction:
238 * @parent: the parent of @pad
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.
245 * Returns: %TRUE if the pad could be activated.
247 typedef gboolean (*GstPadActivateFunction) (GstPad *pad, GstObject *parent);
249 * GstPadActivateModeFunction:
251 * @parent: the parent of @pad
252 * @mode: the requested activation mode of @pad
253 * @active: activate or deactivate the pad.
255 * The prototype of the push and pull activate functions.
257 * Returns: %TRUE if the pad could be activated or deactivated.
259 typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, GstObject *parent,
260 GstPadMode mode, gboolean active);
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.
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).
276 * The implementer of this function receives a refcount to @buffer and should
277 * gst_buffer_unref() when the buffer is no longer needed.
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.
282 * Returns: #GST_FLOW_OK for success
284 typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstObject *parent,
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.
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).
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.
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.
305 * Returns: #GST_FLOW_OK for success
307 typedef GstFlowReturn (*GstPadChainListFunction) (GstPad *pad, GstObject *parent,
308 GstBufferList *list);
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.
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.
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.
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.
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.
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.
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
347 * When this function is called with a -1 @offset, the sequentially next buffer
348 * of length @length in the stream is returned.
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
354 * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other
355 * return value leaves @buffer undefined.
357 typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, GstObject *parent,
358 guint64 offset, guint length,
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.
369 * Function signature to handle an event for the pad.
371 * Returns: %TRUE if the pad could handle the event.
373 typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstObject *parent,
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.
384 * Function signature to handle an event for the pad.
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
390 * Returns: %GST_FLOW_OK if the event was handled properly, or any other
391 * #GstFlowReturn dependent on downstream state.
395 typedef GstFlowReturn (*GstPadEventFullFunction) (GstPad *pad, GstObject *parent,
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.
407 * The signature of the internal pad link iterator function.
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.
412 * the caller must call gst_iterator_free() after usage.
414 typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad, GstObject *parent);
416 /* generic query function */
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
425 * The signature of the query function.
427 * Returns: %TRUE if the query could be performed.
429 typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstObject *parent,
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
442 * Function signature to handle a new link on the pad.
444 * Returns: the result of the link with the specified peer.
446 typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstObject *parent, GstPad *peer);
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.
454 * Function signature to handle a unlinking the pad prom its peer.
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.
459 typedef void (*GstPadUnlinkFunction) (GstPad *pad, GstObject *parent);
464 * GstPadForwardFunction:
465 * @pad: the #GstPad that is forwarded.
466 * @user_data: the gpointer to optional user data.
468 * A forward function is called for all internally linked pads, see
471 * Returns: %TRUE if the dispatching procedure has to be stopped.
473 typedef gboolean (*GstPadForwardFunction) (GstPad *pad, gpointer user_data);
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
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
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),
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
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
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
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.
563 * Different return values for the #GstPadProbeCallback.
569 GST_PAD_PROBE_REMOVE,
571 GST_PAD_PROBE_HANDLED
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
586 * Info passed in the #GstPadProbeCallback.
588 struct _GstPadProbeInfo
590 GstPadProbeType type;
598 gpointer _gst_reserved[GST_PADDING];
600 GstFlowReturn flow_ret;
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)
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))
615 #define GST_PAD_PROBE_INFO_OFFSET(d) ((d)->offset)
616 #define GST_PAD_PROBE_INFO_SIZE(d) ((d)->size)
619 GstEvent* gst_pad_probe_info_get_event (GstPadProbeInfo * info);
622 GstQuery* gst_pad_probe_info_get_query (GstPadProbeInfo * info);
625 GstBuffer* gst_pad_probe_info_get_buffer (GstPadProbeInfo * info);
628 GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
631 * GstPadProbeCallback:
632 * @pad: the #GstPad that is blocked
633 * @info: #GstPadProbeInfo
634 * @user_data: the gpointer to optional user data.
636 * Callback used by gst_pad_add_probe(). Gets called to notify about the current
639 * The callback is allowed to modify the data pointer in @info.
641 * Returns: a #GstPadProbeReturn
643 typedef GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstPadProbeInfo *info,
647 * GstPadStickyEventsForeachFunction:
649 * @event: (allow-none): a sticky #GstEvent.
650 * @user_data: the #gpointer to optional user data.
652 * Callback used by gst_pad_sticky_events_foreach().
654 * When this function returns %TRUE, the next event will be
655 * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
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.
662 * Returns: %TRUE if the iteration should continue
664 typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
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
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),
718 GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
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
728 * The #GstPad structure. Use the functions to update the variables.
734 gpointer element_private;
736 GstPadTemplate *padtemplate;
738 GstPadDirection direction;
741 /* streaming rec_lock */
742 GRecMutex stream_rec_lock;
745 /* block cond, mutex is from the object */
750 GstPadActivateFunction activatefunc;
751 gpointer activatedata;
752 GDestroyNotify activatenotify;
753 GstPadActivateModeFunction activatemodefunc;
754 gpointer activatemodedata;
755 GDestroyNotify activatemodenotify;
759 GstPadLinkFunction linkfunc;
761 GDestroyNotify linknotify;
762 GstPadUnlinkFunction unlinkfunc;
764 GDestroyNotify unlinknotify;
766 /* data transport functions */
767 GstPadChainFunction chainfunc;
769 GDestroyNotify chainnotify;
770 GstPadChainListFunction chainlistfunc;
771 gpointer chainlistdata;
772 GDestroyNotify chainlistnotify;
773 GstPadGetRangeFunction getrangefunc;
774 gpointer getrangedata;
775 GDestroyNotify getrangenotify;
776 GstPadEventFunction eventfunc;
778 GDestroyNotify eventnotify;
783 /* generic query method */
784 GstPadQueryFunction queryfunc;
786 GDestroyNotify querynotify;
789 GstPadIterIntLinkFunction iterintlinkfunc;
790 gpointer iterintlinkdata;
791 GDestroyNotify iterintlinknotify;
793 /* counts number of probes attached. */
800 gpointer _gst_reserved[GST_PADDING];
802 GstFlowReturn last_flowret;
803 GstPadEventFullFunction eventfullfunc;
808 struct _GstPadClass {
809 GstObjectClass parent_class;
811 /* signal callbacks */
812 void (*linked) (GstPad *pad, GstPad *peer);
813 void (*unlinked) (GstPad *pad, GstPad *peer);
816 gpointer _gst_reserved[GST_PADDING];
820 /***** helper macros *****/
827 * Get name of the given pad.
828 * No locking is performed in this function, use gst_pad_get_name() instead.
830 #define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
835 * Get the @pad parent.
836 * No locking is performed in this function, use gst_pad_get_parent() instead.
838 #define GST_PAD_PARENT(pad) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
840 * GST_PAD_ELEMENT_PRIVATE:
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.
847 #define GST_PAD_ELEMENT_PRIVATE(pad) (GST_PAD_CAST(pad)->element_private)
849 * GST_PAD_PAD_TEMPLATE:
852 * Get the @pad #GstPadTemplate. It describes the possible media types
853 * a @pad or an element factory can handle.
855 #define GST_PAD_PAD_TEMPLATE(pad) (GST_PAD_CAST(pad)->padtemplate)
860 * Get the #GstPadDirection of the given @pad. Accessor macro, use
861 * gst_pad_get_direction() instead.
863 #define GST_PAD_DIRECTION(pad) (GST_PAD_CAST(pad)->direction)
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()
872 #define GST_PAD_TASK(pad) (GST_PAD_CAST(pad)->task)
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.
881 #define GST_PAD_MODE(pad) (GST_PAD_CAST(pad)->mode)
883 * GST_PAD_ACTIVATEFUNC:
886 * Get the #GstPadActivateFunction from @pad.
888 #define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
890 * GST_PAD_ACTIVATEMODEFUNC:
893 * Get the #GstPadActivateModeFunction from the given @pad.
895 #define GST_PAD_ACTIVATEMODEFUNC(pad) (GST_PAD_CAST(pad)->activatemodefunc)
900 * Get the #GstPadChainFunction from the given @pad.
902 #define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
904 * GST_PAD_CHAINLISTFUNC:
907 * Get the #GstPadChainListFunction from the given @pad.
909 #define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc)
911 * GST_PAD_GETRANGEFUNC:
914 * Get the #GstPadGetRangeFunction from the given @pad.
916 #define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
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.
927 #define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
929 * GST_PAD_EVENTFULLFUNC:
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.
940 #define GST_PAD_EVENTFULLFUNC(pad) (GST_PAD_CAST(pad)->ABI.abi.eventfullfunc)
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
951 #define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
953 * GST_PAD_ITERINTLINKFUNC:
956 * Get the #GstPadIterIntLinkFunction from the given @pad.
958 #define GST_PAD_ITERINTLINKFUNC(pad) (GST_PAD_CAST(pad)->iterintlinkfunc)
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.
966 #define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
971 * Get the #GstPadLinkFunction for the given @pad.
973 #define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
975 * GST_PAD_UNLINKFUNC:
978 * Get the #GstPadUnlinkFunction from the given @pad.
980 #define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
985 * Returns: %TRUE if the pad is a source pad (i.e. produces data).
987 #define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
992 * Returns: %TRUE if the pad is a sink pad (i.e. consumes data).
994 #define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
999 * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
1002 #define GST_PAD_IS_LINKED(pad) (GST_PAD_PEER(pad) != NULL)
1004 * GST_PAD_IS_ACTIVE:
1007 * Returns: %TRUE if the pad has been activated.
1009 #define GST_PAD_IS_ACTIVE(pad) (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
1011 * GST_PAD_IS_BLOCKED:
1014 * Check if the dataflow on a @pad is blocked. Use gst_pad_is_blocked() instead.
1016 #define GST_PAD_IS_BLOCKED(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
1018 * GST_PAD_IS_BLOCKING:
1021 * Check if the @pad is currently blocking on a buffer or event. Use
1022 * gst_pad_is_blocking() instead.
1024 #define GST_PAD_IS_BLOCKING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
1026 * GST_PAD_IS_FLUSHING:
1029 * Check if the given @pad is flushing.
1031 #define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
1033 * GST_PAD_SET_FLUSHING:
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.
1043 #define GST_PAD_SET_FLUSHING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
1045 * GST_PAD_UNSET_FLUSHING:
1048 * Unset the flushing flag.
1050 #define GST_PAD_UNSET_FLUSHING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
1055 * Check if the @pad is in EOS state.
1057 #define GST_PAD_IS_EOS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS))
1059 * GST_PAD_NEEDS_RECONFIGURE:
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.
1066 #define GST_PAD_NEEDS_RECONFIGURE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
1068 * GST_PAD_HAS_PENDING_EVENTS:
1071 * Check if the given @pad has pending events. This is used internally by
1074 #define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
1076 * GST_PAD_IS_FIXED_CAPS:
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().
1083 #define GST_PAD_IS_FIXED_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
1085 * GST_PAD_NEEDS_PARENT:
1088 * Check if there is a parent object before calling into the @pad callbacks.
1089 * This is used internally by GStreamer.
1091 #define GST_PAD_NEEDS_PARENT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
1093 * GST_PAD_IS_PROXY_CAPS:
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.
1100 #define GST_PAD_IS_PROXY_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1102 * GST_PAD_SET_PROXY_CAPS:
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.
1111 #define GST_PAD_SET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1113 * GST_PAD_UNSET_PROXY_CAPS:
1116 * Unset proxy caps flag.
1118 #define GST_PAD_UNSET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
1120 * GST_PAD_IS_PROXY_ALLOCATION:
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.
1127 #define GST_PAD_IS_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1129 * GST_PAD_SET_PROXY_ALLOCATION:
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.
1139 #define GST_PAD_SET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1141 * GST_PAD_UNSET_PROXY_ALLOCATION:
1144 * Unset proxy allocation flag.
1146 #define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1148 * GST_PAD_IS_PROXY_SCHEDULING:
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.
1155 #define GST_PAD_IS_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1157 * GST_PAD_SET_PROXY_SCHEDULING:
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.
1165 #define GST_PAD_SET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1167 * GST_PAD_UNSET_PROXY_SCHEDULING:
1170 * Unset proxy scheduling flag.
1172 #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1174 * GST_PAD_IS_ACCEPT_INTERSECT:
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.
1182 #define GST_PAD_IS_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1184 * GST_PAD_SET_ACCEPT_INTERSECT:
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.
1191 #define GST_PAD_SET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1193 * GST_PAD_UNSET_ACCEPT_INTERSECT:
1196 * Unset accept intersect flag.
1198 #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1200 * GST_PAD_IS_ACCEPT_TEMPLATE:
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.
1211 #define GST_PAD_IS_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1213 * GST_PAD_SET_ACCEPT_TEMPLATE:
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.
1221 #define GST_PAD_SET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1223 * GST_PAD_UNSET_ACCEPT_TEMPLATE:
1226 * Unset accept template flag.
1230 #define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1232 * GST_PAD_GET_STREAM_LOCK:
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.
1240 #define GST_PAD_GET_STREAM_LOCK(pad) (&(GST_PAD_CAST(pad)->stream_rec_lock))
1242 * GST_PAD_STREAM_LOCK:
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.
1248 #define GST_PAD_STREAM_LOCK(pad) g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
1250 * GST_PAD_STREAM_TRYLOCK:
1253 * Try to take the pad's stream lock, and return %TRUE if the lock could be
1254 * taken, and otherwise %FALSE.
1256 #define GST_PAD_STREAM_TRYLOCK(pad) g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
1258 * GST_PAD_STREAM_UNLOCK:
1261 * Release the pad's stream lock.
1263 #define GST_PAD_STREAM_UNLOCK(pad) g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
1265 * GST_PAD_LAST_FLOW_RETURN:
1268 * Gets the last flow return on this pad
1272 #define GST_PAD_LAST_FLOW_RETURN(pad) (GST_PAD_CAST(pad)->ABI.abi.last_flowret)
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)))
1280 GType gst_pad_get_type (void);
1285 GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
1288 GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
1291 GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
1296 * @pad: the pad to get the name from
1298 * Get a copy of the name of the pad. g_free() after usage.
1302 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
1304 * gst_pad_get_parent:
1305 * @pad: the pad to get the parent of
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.
1313 * Returns: (nullable): the parent
1315 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
1318 GstPadDirection gst_pad_get_direction (GstPad *pad);
1321 gboolean gst_pad_set_active (GstPad *pad, gboolean active);
1324 gboolean gst_pad_is_active (GstPad *pad);
1327 gboolean gst_pad_activate_mode (GstPad *pad, GstPadMode mode,
1330 gulong gst_pad_add_probe (GstPad *pad,
1331 GstPadProbeType mask,
1332 GstPadProbeCallback callback,
1334 GDestroyNotify destroy_data);
1336 void gst_pad_remove_probe (GstPad *pad, gulong id);
1339 gboolean gst_pad_is_blocked (GstPad *pad);
1342 gboolean gst_pad_is_blocking (GstPad *pad);
1345 void gst_pad_mark_reconfigure (GstPad *pad);
1348 gboolean gst_pad_needs_reconfigure (GstPad *pad);
1351 gboolean gst_pad_check_reconfigure (GstPad *pad);
1354 void gst_pad_set_element_private (GstPad *pad, gpointer priv);
1357 gpointer gst_pad_get_element_private (GstPad *pad);
1360 GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
1363 GstFlowReturn gst_pad_store_sticky_event (GstPad *pad, GstEvent *event);
1366 GstEvent* gst_pad_get_sticky_event (GstPad *pad, GstEventType event_type,
1370 void gst_pad_sticky_events_foreach (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
1372 /* data passing setup functions */
1375 void gst_pad_set_activate_function_full (GstPad *pad,
1376 GstPadActivateFunction activate,
1378 GDestroyNotify notify);
1380 void gst_pad_set_activatemode_function_full (GstPad *pad,
1381 GstPadActivateModeFunction activatemode,
1383 GDestroyNotify notify);
1384 /* data passing functions */
1387 void gst_pad_set_chain_function_full (GstPad *pad,
1388 GstPadChainFunction chain,
1390 GDestroyNotify notify);
1392 void gst_pad_set_chain_list_function_full (GstPad *pad,
1393 GstPadChainListFunction chainlist,
1395 GDestroyNotify notify);
1397 void gst_pad_set_getrange_function_full (GstPad *pad,
1398 GstPadGetRangeFunction get,
1400 GDestroyNotify notify);
1402 void gst_pad_set_event_function_full (GstPad *pad,
1403 GstPadEventFunction event,
1405 GDestroyNotify notify);
1407 void gst_pad_set_event_full_function_full (GstPad *pad,
1408 GstPadEventFullFunction event,
1410 GDestroyNotify notify);
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)
1423 void gst_pad_set_link_function_full (GstPad *pad,
1424 GstPadLinkFunction link,
1426 GDestroyNotify notify);
1428 void gst_pad_set_unlink_function_full (GstPad *pad,
1429 GstPadUnlinkFunction unlink,
1431 GDestroyNotify notify);
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)
1437 gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
1440 GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
1443 GstPadLinkReturn gst_pad_link_full (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
1446 gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
1449 gboolean gst_pad_is_linked (GstPad *pad);
1452 GstPad* gst_pad_get_peer (GstPad *pad);
1455 GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
1457 /* capsnego function for linked/unlinked pads */
1460 GstCaps * gst_pad_get_current_caps (GstPad * pad);
1463 gboolean gst_pad_has_current_caps (GstPad * pad);
1465 /* capsnego for linked pads */
1468 GstCaps * gst_pad_get_allowed_caps (GstPad * pad);
1473 gint64 gst_pad_get_offset (GstPad *pad);
1476 void gst_pad_set_offset (GstPad *pad, gint64 offset);
1478 /* data passing functions to peer */
1481 GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
1484 GstFlowReturn gst_pad_push_list (GstPad *pad, GstBufferList *list);
1487 GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
1488 GstBuffer **buffer);
1490 gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
1493 gboolean gst_pad_event_default (GstPad *pad, GstObject *parent,
1496 GstFlowReturn gst_pad_get_last_flow_return (GstPad *pad);
1498 /* data passing functions on pad */
1501 GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
1504 GstFlowReturn gst_pad_chain_list (GstPad *pad, GstBufferList *list);
1507 GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
1508 GstBuffer **buffer);
1510 gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
1515 gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
1516 gpointer user_data, GDestroyNotify notify);
1518 gboolean gst_pad_pause_task (GstPad *pad);
1521 gboolean gst_pad_stop_task (GstPad *pad);
1524 GstTaskState gst_pad_get_task_state (GstPad *pad);
1526 /* internal links */
1529 void gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
1530 GstPadIterIntLinkFunction iterintlink,
1532 GDestroyNotify notify);
1535 GstIterator * gst_pad_iterate_internal_links (GstPad * pad);
1538 GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad, GstObject *parent);
1540 #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
1542 /* generic query function */
1545 gboolean gst_pad_query (GstPad *pad, GstQuery *query);
1548 gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query);
1551 void gst_pad_set_query_function_full (GstPad *pad, GstPadQueryFunction query,
1553 GDestroyNotify notify);
1555 gboolean gst_pad_query_default (GstPad *pad, GstObject *parent,
1558 #define gst_pad_set_query_function(p,f) gst_pad_set_query_function_full((p),(f),NULL,NULL)
1560 /* misc helper functions */
1563 gboolean gst_pad_forward (GstPad *pad, GstPadForwardFunction forward,
1564 gpointer user_data);
1566 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
1567 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPad, gst_object_unref)
1572 #endif /* __GST_PAD_H__ */