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 typedef void (*GstPadUnlinkFunction) (GstPad *pad, GstObject *parent);
461 * GstPadForwardFunction:
462 * @pad: the #GstPad that is forwarded.
463 * @user_data: the gpointer to optional user data.
465 * A forward function is called for all internally linked pads, see
468 * Returns: %TRUE if the dispatching procedure has to be stopped.
470 typedef gboolean (*GstPadForwardFunction) (GstPad *pad, gpointer user_data);
474 * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
475 * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block while the callback is called
476 * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
477 * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
478 * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
479 * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
480 * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
481 * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be
482 * explicitly enabled and is not included in the
483 * @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
484 * @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
485 * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries
486 * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries
487 * @GST_PAD_PROBE_TYPE_PUSH: probe push
488 * @GST_PAD_PROBE_TYPE_PULL: probe pull
489 * @GST_PAD_PROBE_TYPE_BLOCKING: probe and block at the next opportunity, at data flow or when idle
490 * @GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM: probe downstream data (buffers, buffer lists, and events)
491 * @GST_PAD_PROBE_TYPE_DATA_UPSTREAM: probe upstream data (events)
492 * @GST_PAD_PROBE_TYPE_DATA_BOTH: probe upstream and downstream data (buffers, buffer lists, and events)
493 * @GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM: probe and block downstream data (buffers, buffer lists, and events)
494 * @GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM: probe and block upstream data (events)
495 * @GST_PAD_PROBE_TYPE_EVENT_BOTH: probe upstream and downstream events
496 * @GST_PAD_PROBE_TYPE_QUERY_BOTH: probe upstream and downstream queries
497 * @GST_PAD_PROBE_TYPE_ALL_BOTH: probe upstream events and queries and downstream buffers, buffer lists, events and queries
498 * @GST_PAD_PROBE_TYPE_SCHEDULING: probe push and pull
500 * The different probing types that can occur. When either one of
501 * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a
506 GST_PAD_PROBE_TYPE_INVALID = 0,
507 /* flags to control blocking */
508 GST_PAD_PROBE_TYPE_IDLE = (1 << 0),
509 GST_PAD_PROBE_TYPE_BLOCK = (1 << 1),
510 /* flags to select datatypes */
511 GST_PAD_PROBE_TYPE_BUFFER = (1 << 4),
512 GST_PAD_PROBE_TYPE_BUFFER_LIST = (1 << 5),
513 GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6),
514 GST_PAD_PROBE_TYPE_EVENT_UPSTREAM = (1 << 7),
515 GST_PAD_PROBE_TYPE_EVENT_FLUSH = (1 << 8),
516 GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9),
517 GST_PAD_PROBE_TYPE_QUERY_UPSTREAM = (1 << 10),
518 /* flags to select scheduling mode */
519 GST_PAD_PROBE_TYPE_PUSH = (1 << 12),
520 GST_PAD_PROBE_TYPE_PULL = (1 << 13),
522 /* flag combinations */
523 GST_PAD_PROBE_TYPE_BLOCKING = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK,
524 GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
525 GST_PAD_PROBE_TYPE_DATA_UPSTREAM = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
526 GST_PAD_PROBE_TYPE_DATA_BOTH = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
527 GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
528 GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
529 GST_PAD_PROBE_TYPE_EVENT_BOTH = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
530 GST_PAD_PROBE_TYPE_QUERY_BOTH = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
531 GST_PAD_PROBE_TYPE_ALL_BOTH = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH,
532 GST_PAD_PROBE_TYPE_SCHEDULING = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL
538 * @GST_PAD_PROBE_OK: normal probe return value. This leaves the probe in
539 * place, and defers decisions about dropping or passing data to other
540 * probes, if any. If there are no other probes, the default behaviour
541 * for the probe type applies ('block' for blocking probes,
542 * and 'pass' for non-blocking probes).
543 * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
544 * the data item is not sent downstream. For pull mode, it means that
545 * the data item is not passed upstream. In both cases, no other probes
546 * are called for this item and %GST_FLOW_OK or %TRUE is returned to the
548 * @GST_PAD_PROBE_REMOVE: remove this probe.
549 * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on the
551 * @GST_PAD_PROBE_HANDLED: Data has been handled in the probe and will not be
552 * forwarded further. For events and buffers this is the same behaviour as
553 * %GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer
554 * or event yourself). For queries it will also return %TRUE to the caller.
555 * The probe can also modify the #GstFlowReturn value by using the
556 * #GST_PAD_PROBE_INFO_FLOW_RETURN() accessor.
557 * Note that the resulting query must contain valid entries.
560 * Different return values for the #GstPadProbeCallback.
566 GST_PAD_PROBE_REMOVE,
568 GST_PAD_PROBE_HANDLED
574 * @type: the current probe type
575 * @id: the id of the probe
576 * @data: (allow-none): type specific data, check the @type field to know the
577 * datatype. This field can be %NULL.
578 * @offset: offset of pull probe, this field is valid when @type contains
579 * #GST_PAD_PROBE_TYPE_PULL
580 * @size: size of pull probe, this field is valid when @type contains
581 * #GST_PAD_PROBE_TYPE_PULL
583 * Info passed in the #GstPadProbeCallback.
585 struct _GstPadProbeInfo
587 GstPadProbeType type;
595 gpointer _gst_reserved[GST_PADDING];
597 GstFlowReturn flow_ret;
602 #define GST_PAD_PROBE_INFO_TYPE(d) ((d)->type)
603 #define GST_PAD_PROBE_INFO_ID(d) ((d)->id)
604 #define GST_PAD_PROBE_INFO_DATA(d) ((d)->data)
605 #define GST_PAD_PROBE_INFO_FLOW_RETURN(d) ((d)->ABI.abi.flow_ret)
607 #define GST_PAD_PROBE_INFO_BUFFER(d) GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
608 #define GST_PAD_PROBE_INFO_BUFFER_LIST(d) GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
609 #define GST_PAD_PROBE_INFO_EVENT(d) GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
610 #define GST_PAD_PROBE_INFO_QUERY(d) GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
612 #define GST_PAD_PROBE_INFO_OFFSET(d) ((d)->offset)
613 #define GST_PAD_PROBE_INFO_SIZE(d) ((d)->size)
616 GstEvent* gst_pad_probe_info_get_event (GstPadProbeInfo * info);
619 GstQuery* gst_pad_probe_info_get_query (GstPadProbeInfo * info);
622 GstBuffer* gst_pad_probe_info_get_buffer (GstPadProbeInfo * info);
625 GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
628 * GstPadProbeCallback:
629 * @pad: the #GstPad that is blocked
630 * @info: #GstPadProbeInfo
631 * @user_data: the gpointer to optional user data.
633 * Callback used by gst_pad_add_probe(). Gets called to notify about the current
636 * The callback is allowed to modify the data pointer in @info.
638 * Returns: a #GstPadProbeReturn
640 typedef GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstPadProbeInfo *info,
644 * GstPadStickyEventsForeachFunction:
646 * @event: (allow-none): a sticky #GstEvent.
647 * @user_data: the #gpointer to optional user data.
649 * Callback used by gst_pad_sticky_events_foreach().
651 * When this function returns %TRUE, the next event will be
652 * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
654 * When @event is set to %NULL, the item will be removed from the list of sticky events.
655 * @event can be replaced by assigning a new reference to it.
656 * This function is responsible for unreffing the old event when
657 * removing or modifying.
659 * Returns: %TRUE if the iteration should continue
661 typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
666 * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
667 * @GST_PAD_FLAG_FLUSHING: is pad flushing
668 * @GST_PAD_FLAG_EOS: is pad in EOS state
669 * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
670 * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
671 * into the pad callbacks.
672 * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
673 * The flag has to be unset manually after
674 * reconfiguration happened.
675 * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
676 * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps. This means that
677 * once the caps are set on the pad, the default caps query function
678 * will only return those caps.
679 * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
680 * all events and queries to the internally linked pads
681 * instead of discarding them.
682 * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
683 * allocation queries to the internally linked pads
684 * instead of discarding them.
685 * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward
686 * scheduling queries to the internally linked pads
687 * instead of discarding them.
688 * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check
689 * it the caps intersect the query-caps result instead
690 * of checking for a subset. This is interesting for
691 * parsers that can accept incompletely specified caps.
692 * @GST_PAD_FLAG_ACCEPT_TEMPLATE: the default accept-caps handler will use
693 * the template pad caps instead of query caps to
694 * compare with the accept caps. Use this in combination
695 * with %GST_PAD_FLAG_ACCEPT_INTERSECT. (Since 1.6)
696 * @GST_PAD_FLAG_LAST: offset to define more flags
701 GST_PAD_FLAG_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
702 GST_PAD_FLAG_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
703 GST_PAD_FLAG_EOS = (GST_OBJECT_FLAG_LAST << 2),
704 GST_PAD_FLAG_BLOCKING = (GST_OBJECT_FLAG_LAST << 3),
705 GST_PAD_FLAG_NEED_PARENT = (GST_OBJECT_FLAG_LAST << 4),
706 GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
707 GST_PAD_FLAG_PENDING_EVENTS = (GST_OBJECT_FLAG_LAST << 6),
708 GST_PAD_FLAG_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 7),
709 GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 8),
710 GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9),
711 GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10),
712 GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11),
713 GST_PAD_FLAG_ACCEPT_TEMPLATE = (GST_OBJECT_FLAG_LAST << 12),
715 GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
720 * @element_private: private data owned by the parent element
721 * @padtemplate: padtemplate for this pad
722 * @direction: the direction of the pad, cannot change after creating
725 * The #GstPad structure. Use the functions to update the variables.
731 gpointer element_private;
733 GstPadTemplate *padtemplate;
735 GstPadDirection direction;
738 /* streaming rec_lock */
739 GRecMutex stream_rec_lock;
742 /* block cond, mutex is from the object */
747 GstPadActivateFunction activatefunc;
748 gpointer activatedata;
749 GDestroyNotify activatenotify;
750 GstPadActivateModeFunction activatemodefunc;
751 gpointer activatemodedata;
752 GDestroyNotify activatemodenotify;
756 GstPadLinkFunction linkfunc;
758 GDestroyNotify linknotify;
759 GstPadUnlinkFunction unlinkfunc;
761 GDestroyNotify unlinknotify;
763 /* data transport functions */
764 GstPadChainFunction chainfunc;
766 GDestroyNotify chainnotify;
767 GstPadChainListFunction chainlistfunc;
768 gpointer chainlistdata;
769 GDestroyNotify chainlistnotify;
770 GstPadGetRangeFunction getrangefunc;
771 gpointer getrangedata;
772 GDestroyNotify getrangenotify;
773 GstPadEventFunction eventfunc;
775 GDestroyNotify eventnotify;
780 /* generic query method */
781 GstPadQueryFunction queryfunc;
783 GDestroyNotify querynotify;
786 GstPadIterIntLinkFunction iterintlinkfunc;
787 gpointer iterintlinkdata;
788 GDestroyNotify iterintlinknotify;
790 /* counts number of probes attached. */
797 gpointer _gst_reserved[GST_PADDING];
799 GstFlowReturn last_flowret;
800 GstPadEventFullFunction eventfullfunc;
805 struct _GstPadClass {
806 GstObjectClass parent_class;
808 /* signal callbacks */
809 void (*linked) (GstPad *pad, GstPad *peer);
810 void (*unlinked) (GstPad *pad, GstPad *peer);
813 gpointer _gst_reserved[GST_PADDING];
817 /***** helper macros *****/
824 * Get name of the given pad.
825 * No locking is performed in this function, use gst_pad_get_name() instead.
827 #define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
832 * Get the @pad parent.
833 * No locking is performed in this function, use gst_pad_get_parent() instead.
835 #define GST_PAD_PARENT(pad) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
837 * GST_PAD_ELEMENT_PRIVATE:
840 * Get the private data of @pad, which is usually some pad- or stream-specific
841 * structure created by the element and set on the pad when creating it.
842 * No locking is performed in this function.
844 #define GST_PAD_ELEMENT_PRIVATE(pad) (GST_PAD_CAST(pad)->element_private)
846 * GST_PAD_PAD_TEMPLATE:
849 * Get the @pad #GstPadTemplate. It describes the possible media types
850 * a @pad or an element factory can handle.
852 #define GST_PAD_PAD_TEMPLATE(pad) (GST_PAD_CAST(pad)->padtemplate)
857 * Get the #GstPadDirection of the given @pad. Accessor macro, use
858 * gst_pad_get_direction() instead.
860 #define GST_PAD_DIRECTION(pad) (GST_PAD_CAST(pad)->direction)
865 * Get the #GstTask of @pad. Accessor macro used by GStreamer. Use the
866 * gst_pad_start_task(), gst_pad_stop_task() and gst_pad_pause_task()
869 #define GST_PAD_TASK(pad) (GST_PAD_CAST(pad)->task)
874 * Get the #GstPadMode of pad, which will be GST_PAD_MODE_NONE if the pad
875 * has not been activated yet, and otherwise either GST_PAD_MODE_PUSH or
876 * GST_PAD_MODE_PULL depending on which mode the pad was activated in.
878 #define GST_PAD_MODE(pad) (GST_PAD_CAST(pad)->mode)
880 * GST_PAD_ACTIVATEFUNC:
883 * Get the #GstPadActivateFunction from @pad.
885 #define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
887 * GST_PAD_ACTIVATEMODEFUNC:
890 * Get the #GstPadActivateModeFunction from the given @pad.
892 #define GST_PAD_ACTIVATEMODEFUNC(pad) (GST_PAD_CAST(pad)->activatemodefunc)
897 * Get the #GstPadChainFunction from the given @pad.
899 #define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
901 * GST_PAD_CHAINLISTFUNC:
904 * Get the #GstPadChainListFunction from the given @pad.
906 #define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc)
908 * GST_PAD_GETRANGEFUNC:
911 * Get the #GstPadGetRangeFunction from the given @pad.
913 #define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
918 * Get the #GstPadEventFunction from the given @pad, which
919 * is the function that handles events on the pad. You can
920 * use this to set your own event handling function on a pad
921 * after you create it. If your element derives from a base
922 * class, use the base class's virtual functions instead.
924 #define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
926 * GST_PAD_EVENTFULLFUNC:
929 * Get the #GstPadEventFullFunction from the given @pad, which
930 * is the function that handles events on the pad. You can
931 * use this to set your own event handling function on a pad
932 * after you create it. If your element derives from a base
933 * class, use the base class's virtual functions instead.
937 #define GST_PAD_EVENTFULLFUNC(pad) (GST_PAD_CAST(pad)->ABI.abi.eventfullfunc)
942 * Get the #GstPadQueryFunction from @pad, which is the function
943 * that handles queries on the pad. You can use this to set your
944 * own query handling function on a pad after you create it. If your
945 * element derives from a base class, use the base class's virtual
948 #define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
950 * GST_PAD_ITERINTLINKFUNC:
953 * Get the #GstPadIterIntLinkFunction from the given @pad.
955 #define GST_PAD_ITERINTLINKFUNC(pad) (GST_PAD_CAST(pad)->iterintlinkfunc)
960 * Return the pad's peer member. This member is a pointer to the linked @pad.
961 * No locking is performed in this function, use gst_pad_get_peer() instead.
963 #define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
968 * Get the #GstPadLinkFunction for the given @pad.
970 #define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
972 * GST_PAD_UNLINKFUNC:
975 * Get the #GstPadUnlinkFunction from the given @pad.
977 #define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
982 * Returns: %TRUE if the pad is a source pad (i.e. produces data).
984 #define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
989 * Returns: %TRUE if the pad is a sink pad (i.e. consumes data).
991 #define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
996 * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
999 #define GST_PAD_IS_LINKED(pad) (GST_PAD_PEER(pad) != NULL)
1001 * GST_PAD_IS_ACTIVE:
1004 * Returns: %TRUE if the pad has been activated.
1006 #define GST_PAD_IS_ACTIVE(pad) (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
1008 * GST_PAD_IS_BLOCKED:
1011 * Check if the dataflow on a @pad is blocked. Use gst_pad_is_blocked() instead.
1013 #define GST_PAD_IS_BLOCKED(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
1015 * GST_PAD_IS_BLOCKING:
1018 * Check if the @pad is currently blocking on a buffer or event. Use
1019 * gst_pad_is_blocking() instead.
1021 #define GST_PAD_IS_BLOCKING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
1023 * GST_PAD_IS_FLUSHING:
1026 * Check if the given @pad is flushing.
1028 #define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
1030 * GST_PAD_SET_FLUSHING:
1033 * Set the given @pad to flushing state, which means it will not accept any
1034 * more events, queries or buffers, and return GST_FLOW_FLUSHING if any buffers
1035 * are pushed on it. This usually happens when the pad is shut down or when
1036 * a flushing seek happens. This is used inside GStreamer when flush start/stop
1037 * events pass through pads, or when an element state is changed and pads are
1038 * activated or deactivated.
1040 #define GST_PAD_SET_FLUSHING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
1042 * GST_PAD_UNSET_FLUSHING:
1045 * Unset the flushing flag.
1047 #define GST_PAD_UNSET_FLUSHING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
1052 * Check if the @pad is in EOS state.
1054 #define GST_PAD_IS_EOS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS))
1056 * GST_PAD_NEEDS_RECONFIGURE:
1059 * Check if the @pad should be reconfigured/renegotiated.
1060 * The flag has to be unset manually after reconfiguration happened.
1061 * Use gst_pad_needs_reconfigure() or gst_pad_check_reconfigure() instead.
1063 #define GST_PAD_NEEDS_RECONFIGURE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
1065 * GST_PAD_HAS_PENDING_EVENTS:
1068 * Check if the given @pad has pending events. This is used internally by
1071 #define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
1073 * GST_PAD_IS_FIXED_CAPS:
1076 * Check if the given @pad is using fixed caps, which means that
1077 * once the caps are set on the @pad, the caps query function will
1078 * only return those caps. See gst_pad_use_fixed_caps().
1080 #define GST_PAD_IS_FIXED_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
1082 * GST_PAD_NEEDS_PARENT:
1085 * Check if there is a parent object before calling into the @pad callbacks.
1086 * This is used internally by GStreamer.
1088 #define GST_PAD_NEEDS_PARENT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
1090 * GST_PAD_IS_PROXY_CAPS:
1093 * Check if the given @pad is set to proxy caps. This means that the default
1094 * event and query handler will forward all events and queries to the
1095 * internally linked @pads instead of discarding them.
1097 #define GST_PAD_IS_PROXY_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1099 * GST_PAD_SET_PROXY_CAPS:
1102 * Set @pad to proxy caps, so that all caps-related events and queries are
1103 * proxied down- or upstream to the other side of the element automatically.
1104 * Set this if the element always outputs data in the exact same format as it
1105 * receives as input. This is just for convenience to avoid implementing some
1106 * standard event and query handling code in an element.
1108 #define GST_PAD_SET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1110 * GST_PAD_UNSET_PROXY_CAPS:
1113 * Unset proxy caps flag.
1115 #define GST_PAD_UNSET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
1117 * GST_PAD_IS_PROXY_ALLOCATION:
1120 * Check if the given @pad is set as proxy allocation which means
1121 * that the default query handler will forward allocation queries to the
1122 * internally linked @pads instead of discarding them.
1124 #define GST_PAD_IS_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1126 * GST_PAD_SET_PROXY_ALLOCATION:
1129 * Set @pad to proxy allocation queries, which means that the default query
1130 * handler will forward allocation queries to the internally linked @pads
1131 * instead of discarding them.
1132 * Set this if the element always outputs data in the exact same format as it
1133 * receives as input. This is just for convenience to avoid implementing some
1134 * standard query handling code in an element.
1136 #define GST_PAD_SET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1138 * GST_PAD_UNSET_PROXY_ALLOCATION:
1141 * Unset proxy allocation flag.
1143 #define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1145 * GST_PAD_IS_PROXY_SCHEDULING:
1148 * Check if the given @pad is set to proxy scheduling queries, which means that
1149 * the default query handler will forward scheduling queries to the internally
1150 * linked @pads instead of discarding them.
1152 #define GST_PAD_IS_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1154 * GST_PAD_SET_PROXY_SCHEDULING:
1157 * Set @pad to proxy scheduling queries, which means that the default query
1158 * handler will forward scheduling queries to the internally linked @pads
1159 * instead of discarding them. You will usually want to handle scheduling
1160 * queries explicitly if your element supports multiple scheduling modes.
1162 #define GST_PAD_SET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1164 * GST_PAD_UNSET_PROXY_SCHEDULING:
1167 * Unset proxy scheduling flag.
1169 #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1171 * GST_PAD_IS_ACCEPT_INTERSECT:
1174 * Check if the pad's accept intersect flag is set. The default accept-caps
1175 * handler will check if the caps intersect the query-caps result instead of
1176 * checking for a subset. This is interesting for parser elements that can
1177 * accept incompletely specified caps.
1179 #define GST_PAD_IS_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1181 * GST_PAD_SET_ACCEPT_INTERSECT:
1184 * Set @pad to by default accept caps by intersecting the result instead of
1185 * checking for a subset. This is interesting for parser elements that can
1186 * accept incompletely specified caps.
1188 #define GST_PAD_SET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1190 * GST_PAD_UNSET_ACCEPT_INTERSECT:
1193 * Unset accept intersect flag.
1195 #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1197 * GST_PAD_IS_ACCEPT_TEMPLATE:
1200 * Check if the pad's accept caps operation will use the pad template caps.
1201 * The default accept-caps will do a query caps to get the caps, which might
1202 * be querying downstream causing unnecessary overhead. It is recommended to
1203 * implement a proper accept-caps query handler or to use this flag to prevent
1204 * recursive accept-caps handling.
1208 #define GST_PAD_IS_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1210 * GST_PAD_SET_ACCEPT_TEMPLATE:
1213 * Set @pad to by default use the pad template caps to compare with
1214 * the accept caps instead of using a caps query result.
1218 #define GST_PAD_SET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1220 * GST_PAD_UNSET_ACCEPT_TEMPLATE:
1223 * Unset accept template flag.
1227 #define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1229 * GST_PAD_GET_STREAM_LOCK:
1232 * Get the stream lock of @pad. The stream lock is protecting the
1233 * resources used in the data processing functions of @pad. Accessor
1234 * macro, use GST_PAD_STREAM_LOCK() and GST_PAD_STREAM_UNLOCK() instead
1235 * to take/release the pad's stream lock.
1237 #define GST_PAD_GET_STREAM_LOCK(pad) (&(GST_PAD_CAST(pad)->stream_rec_lock))
1239 * GST_PAD_STREAM_LOCK:
1242 * Take the pad's stream lock. The stream lock is recursive and will be taken
1243 * when buffers or serialized downstream events are pushed on a pad.
1245 #define GST_PAD_STREAM_LOCK(pad) g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
1247 * GST_PAD_STREAM_TRYLOCK:
1250 * Try to take the pad's stream lock, and return %TRUE if the lock could be
1251 * taken, and otherwise %FALSE.
1253 #define GST_PAD_STREAM_TRYLOCK(pad) g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
1255 * GST_PAD_STREAM_UNLOCK:
1258 * Release the pad's stream lock.
1260 #define GST_PAD_STREAM_UNLOCK(pad) g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
1262 * GST_PAD_LAST_FLOW_RETURN:
1265 * Gets the last flow return on this pad
1269 #define GST_PAD_LAST_FLOW_RETURN(pad) (GST_PAD_CAST(pad)->ABI.abi.last_flowret)
1271 #define GST_PAD_BLOCK_GET_COND(pad) (&GST_PAD_CAST(pad)->block_cond)
1272 #define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
1273 #define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
1274 #define GST_PAD_BLOCK_BROADCAST(pad) (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
1277 GType gst_pad_get_type (void);
1282 GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
1285 GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
1288 GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
1293 * @pad: the pad to get the name from
1295 * Get a copy of the name of the pad. g_free() after usage.
1299 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
1301 * gst_pad_get_parent:
1302 * @pad: the pad to get the parent of
1304 * Get the parent of @pad. This function increases the refcount
1305 * of the parent object so you should gst_object_unref() it after usage.
1306 * Can return %NULL if the pad did not have a parent.
1310 * Returns: (nullable): the parent
1312 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
1315 GstPadDirection gst_pad_get_direction (GstPad *pad);
1318 gboolean gst_pad_set_active (GstPad *pad, gboolean active);
1321 gboolean gst_pad_is_active (GstPad *pad);
1324 gboolean gst_pad_activate_mode (GstPad *pad, GstPadMode mode,
1327 gulong gst_pad_add_probe (GstPad *pad,
1328 GstPadProbeType mask,
1329 GstPadProbeCallback callback,
1331 GDestroyNotify destroy_data);
1333 void gst_pad_remove_probe (GstPad *pad, gulong id);
1336 gboolean gst_pad_is_blocked (GstPad *pad);
1339 gboolean gst_pad_is_blocking (GstPad *pad);
1342 void gst_pad_mark_reconfigure (GstPad *pad);
1345 gboolean gst_pad_needs_reconfigure (GstPad *pad);
1348 gboolean gst_pad_check_reconfigure (GstPad *pad);
1351 void gst_pad_set_element_private (GstPad *pad, gpointer priv);
1354 gpointer gst_pad_get_element_private (GstPad *pad);
1357 GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
1360 GstFlowReturn gst_pad_store_sticky_event (GstPad *pad, GstEvent *event);
1363 GstEvent* gst_pad_get_sticky_event (GstPad *pad, GstEventType event_type,
1367 void gst_pad_sticky_events_foreach (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
1369 /* data passing setup functions */
1372 void gst_pad_set_activate_function_full (GstPad *pad,
1373 GstPadActivateFunction activate,
1375 GDestroyNotify notify);
1377 void gst_pad_set_activatemode_function_full (GstPad *pad,
1378 GstPadActivateModeFunction activatemode,
1380 GDestroyNotify notify);
1381 /* data passing functions */
1384 void gst_pad_set_chain_function_full (GstPad *pad,
1385 GstPadChainFunction chain,
1387 GDestroyNotify notify);
1389 void gst_pad_set_chain_list_function_full (GstPad *pad,
1390 GstPadChainListFunction chainlist,
1392 GDestroyNotify notify);
1394 void gst_pad_set_getrange_function_full (GstPad *pad,
1395 GstPadGetRangeFunction get,
1397 GDestroyNotify notify);
1399 void gst_pad_set_event_function_full (GstPad *pad,
1400 GstPadEventFunction event,
1402 GDestroyNotify notify);
1404 void gst_pad_set_event_full_function_full (GstPad *pad,
1405 GstPadEventFullFunction event,
1407 GDestroyNotify notify);
1409 #define gst_pad_set_activate_function(p,f) gst_pad_set_activate_function_full((p),(f),NULL,NULL)
1410 #define gst_pad_set_activatemode_function(p,f) gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
1411 #define gst_pad_set_chain_function(p,f) gst_pad_set_chain_function_full((p),(f),NULL,NULL)
1412 #define gst_pad_set_chain_list_function(p,f) gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
1413 #define gst_pad_set_getrange_function(p,f) gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
1414 #define gst_pad_set_event_function(p,f) gst_pad_set_event_function_full((p),(f),NULL,NULL)
1415 #define gst_pad_set_event_full_function(p,f) gst_pad_set_event_full_function_full((p),(f),NULL,NULL)
1420 void gst_pad_set_link_function_full (GstPad *pad,
1421 GstPadLinkFunction link,
1423 GDestroyNotify notify);
1425 void gst_pad_set_unlink_function_full (GstPad *pad,
1426 GstPadUnlinkFunction unlink,
1428 GDestroyNotify notify);
1430 #define gst_pad_set_link_function(p,f) gst_pad_set_link_function_full((p),(f),NULL,NULL)
1431 #define gst_pad_set_unlink_function(p,f) gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
1434 gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
1437 GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
1440 GstPadLinkReturn gst_pad_link_full (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
1443 gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
1446 gboolean gst_pad_is_linked (GstPad *pad);
1449 GstPad* gst_pad_get_peer (GstPad *pad);
1452 GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
1454 /* capsnego function for linked/unlinked pads */
1457 GstCaps * gst_pad_get_current_caps (GstPad * pad);
1460 gboolean gst_pad_has_current_caps (GstPad * pad);
1462 /* capsnego for linked pads */
1465 GstCaps * gst_pad_get_allowed_caps (GstPad * pad);
1470 gint64 gst_pad_get_offset (GstPad *pad);
1473 void gst_pad_set_offset (GstPad *pad, gint64 offset);
1475 /* data passing functions to peer */
1478 GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
1481 GstFlowReturn gst_pad_push_list (GstPad *pad, GstBufferList *list);
1484 GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
1485 GstBuffer **buffer);
1487 gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
1490 gboolean gst_pad_event_default (GstPad *pad, GstObject *parent,
1493 GstFlowReturn gst_pad_get_last_flow_return (GstPad *pad);
1495 /* data passing functions on pad */
1498 GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
1501 GstFlowReturn gst_pad_chain_list (GstPad *pad, GstBufferList *list);
1504 GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
1505 GstBuffer **buffer);
1507 gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
1512 gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
1513 gpointer user_data, GDestroyNotify notify);
1515 gboolean gst_pad_pause_task (GstPad *pad);
1518 gboolean gst_pad_stop_task (GstPad *pad);
1521 GstTaskState gst_pad_get_task_state (GstPad *pad);
1523 /* internal links */
1526 void gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
1527 GstPadIterIntLinkFunction iterintlink,
1529 GDestroyNotify notify);
1532 GstIterator * gst_pad_iterate_internal_links (GstPad * pad);
1535 GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad, GstObject *parent);
1537 #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
1539 /* generic query function */
1542 gboolean gst_pad_query (GstPad *pad, GstQuery *query);
1545 gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query);
1548 void gst_pad_set_query_function_full (GstPad *pad, GstPadQueryFunction query,
1550 GDestroyNotify notify);
1552 gboolean gst_pad_query_default (GstPad *pad, GstObject *parent,
1555 #define gst_pad_set_query_function(p,f) gst_pad_set_query_function_full((p),(f),NULL,NULL)
1557 /* misc helper functions */
1560 gboolean gst_pad_forward (GstPad *pad, GstPadForwardFunction forward,
1561 gpointer user_data);
1563 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
1564 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPad, gst_object_unref)
1569 #endif /* __GST_PAD_H__ */