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.
66 const gchar * gst_pad_mode_get_name (GstPadMode mode);
68 #include <gst/gstobject.h>
69 #include <gst/gstbuffer.h>
70 #include <gst/gstbufferlist.h>
71 #include <gst/gstcaps.h>
72 #include <gst/gstpadtemplate.h>
73 #include <gst/gstevent.h>
74 #include <gst/gstquery.h>
75 #include <gst/gsttask.h>
82 #define GST_TYPE_PAD (gst_pad_get_type ())
83 #define GST_IS_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
84 #define GST_IS_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
85 #define GST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
86 #define GST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
87 #define GST_PAD_CAST(obj) ((GstPad*)(obj))
93 * @GST_PAD_LINK_OK : link succeeded
94 * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
95 * @GST_PAD_LINK_WAS_LINKED : pad was already linked
96 * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
97 * @GST_PAD_LINK_NOFORMAT : pads do not have common format
98 * @GST_PAD_LINK_NOSCHED : pads cannot cooperate in scheduling
99 * @GST_PAD_LINK_REFUSED : refused for some reason
101 * Result values from gst_pad_link and friends.
105 GST_PAD_LINK_WRONG_HIERARCHY = -1,
106 GST_PAD_LINK_WAS_LINKED = -2,
107 GST_PAD_LINK_WRONG_DIRECTION = -3,
108 GST_PAD_LINK_NOFORMAT = -4,
109 GST_PAD_LINK_NOSCHED = -5,
110 GST_PAD_LINK_REFUSED = -6
114 * GST_PAD_LINK_FAILED:
115 * @ret: the #GstPadLinkReturn value
117 * Macro to test if the given #GstPadLinkReturn value indicates a failed
120 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
123 * GST_PAD_LINK_SUCCESSFUL:
124 * @ret: the #GstPadLinkReturn value
126 * Macro to test if the given #GstPadLinkReturn value indicates a successful
129 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
133 * @GST_FLOW_OK: Data passing was ok.
134 * @GST_FLOW_NOT_LINKED: Pad is not linked.
135 * @GST_FLOW_FLUSHING: Pad is flushing.
136 * @GST_FLOW_EOS: Pad is EOS.
137 * @GST_FLOW_NOT_NEGOTIATED: Pad is not negotiated.
138 * @GST_FLOW_ERROR: Some (fatal) error occurred. Element generating
139 * this error should post an error message with more
141 * @GST_FLOW_NOT_SUPPORTED: This operation is not supported.
142 * @GST_FLOW_CUSTOM_SUCCESS: Elements can use values starting from
143 * this (and higher) to define custom success
145 * @GST_FLOW_CUSTOM_SUCCESS_1: Pre-defined custom success code (define your
146 * custom success code to this to avoid compiler
148 * @GST_FLOW_CUSTOM_SUCCESS_2: Pre-defined custom success code.
149 * @GST_FLOW_CUSTOM_ERROR: Elements can use values starting from
150 * this (and lower) to define custom error codes.
151 * @GST_FLOW_CUSTOM_ERROR_1: Pre-defined custom error code (define your
152 * custom error code to this to avoid compiler
154 * @GST_FLOW_CUSTOM_ERROR_2: Pre-defined custom error code.
156 * The result of passing data to a pad.
158 * Note that the custom return values should not be exposed outside of the
162 /* custom success starts here */
163 GST_FLOW_CUSTOM_SUCCESS_2 = 102,
164 GST_FLOW_CUSTOM_SUCCESS_1 = 101,
165 GST_FLOW_CUSTOM_SUCCESS = 100,
167 /* core predefined */
169 /* expected failures */
170 GST_FLOW_NOT_LINKED = -1,
171 GST_FLOW_FLUSHING = -2,
174 GST_FLOW_NOT_NEGOTIATED = -4,
176 GST_FLOW_NOT_SUPPORTED = -6,
178 /* custom error starts here */
179 GST_FLOW_CUSTOM_ERROR = -100,
180 GST_FLOW_CUSTOM_ERROR_1 = -101,
181 GST_FLOW_CUSTOM_ERROR_2 = -102
184 const gchar* gst_flow_get_name (GstFlowReturn ret);
185 GQuark gst_flow_to_quark (GstFlowReturn ret);
186 const gchar* gst_pad_link_get_name (GstPadLinkReturn ret);
190 * @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility.
191 * @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents.
192 * Could be omitted if it is already known that the two elements that own the
193 * pads are in the same bin.
194 * @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using
195 * their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
196 * would be unsafe e.g. if one pad has %GST_CAPS_ANY.
197 * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
198 * caps returned by gst_pad_query_caps().
199 * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking
200 * pads (i.e. the ones used by gst_pad_link()).
202 * The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS
203 * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
204 * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed.
207 * Only disable some of the checks if you are 100% certain you know the link
208 * will not fail because of hierarchy/caps compatibility failures. If uncertain,
209 * use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
210 * for linking the pads.
215 GST_PAD_LINK_CHECK_NOTHING = 0,
216 GST_PAD_LINK_CHECK_HIERARCHY = 1 << 0,
217 GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1,
218 GST_PAD_LINK_CHECK_CAPS = 1 << 2,
220 GST_PAD_LINK_CHECK_DEFAULT = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS
225 * GstPadActivateFunction:
227 * @parent: the parent of @pad
229 * This function is called when the pad is activated during the element
230 * READY to PAUSED state change. By default this function will call the
231 * activate function that puts the pad in push mode but elements can
232 * override this function to activate the pad in pull mode if they wish.
234 * Returns: %TRUE if the pad could be activated.
236 typedef gboolean (*GstPadActivateFunction) (GstPad *pad, GstObject *parent);
238 * GstPadActivateModeFunction:
240 * @parent: the parent of @pad
241 * @mode: the requested activation mode of @pad
242 * @active: activate or deactivate the pad.
244 * The prototype of the push and pull activate functions.
246 * Returns: %TRUE if the pad could be activated or deactivated.
248 typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, GstObject *parent,
249 GstPadMode mode, gboolean active);
254 * GstPadChainFunction:
255 * @pad: the sink #GstPad that performed the chain.
256 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
257 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
258 * during the execution of this function.
259 * @buffer: (transfer full): the #GstBuffer that is chained, not %NULL.
261 * A function that will be called on sinkpads when chaining buffers.
262 * The function typically processes the data contained in the buffer and
263 * either consumes the data or passes it on to the internally linked pad(s).
265 * The implementer of this function receives a refcount to @buffer and should
266 * gst_buffer_unref() when the buffer is no longer needed.
268 * When a chain function detects an error in the data stream, it must post an
269 * error on the bus and return an appropriate #GstFlowReturn value.
271 * Returns: #GST_FLOW_OK for success
273 typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstObject *parent,
277 * GstPadChainListFunction:
278 * @pad: the sink #GstPad that performed the chain.
279 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
280 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
281 * during the execution of this function.
282 * @list: (transfer full): the #GstBufferList that is chained, not %NULL.
284 * A function that will be called on sinkpads when chaining buffer lists.
285 * The function typically processes the data contained in the buffer list and
286 * either consumes the data or passes it on to the internally linked pad(s).
288 * The implementer of this function receives a refcount to @list and
289 * should gst_buffer_list_unref() when the list is no longer needed.
291 * When a chainlist function detects an error in the data stream, it must
292 * post an error on the bus and return an appropriate #GstFlowReturn value.
294 * Returns: #GST_FLOW_OK for success
296 typedef GstFlowReturn (*GstPadChainListFunction) (GstPad *pad, GstObject *parent,
297 GstBufferList *list);
300 * GstPadGetRangeFunction:
301 * @pad: the src #GstPad to perform the getrange on.
302 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
303 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
304 * during the execution of this function.
305 * @offset: the offset of the range
306 * @length: the length of the range
307 * @buffer: a memory location to hold the result buffer, cannot be %NULL.
309 * This function will be called on source pads when a peer element
310 * request a buffer at the specified @offset and @length. If this function
311 * returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The
312 * contents of @buffer is invalid for any other return value.
314 * This function is installed on a source pad with
315 * gst_pad_set_getrange_function() and can only be called on source pads after
316 * they are successfully activated with gst_pad_activate_mode() with the
317 * #GST_PAD_MODE_PULL.
319 * @offset and @length are always given in byte units. @offset must normally be a value
320 * between 0 and the length in bytes of the data available on @pad. The
321 * length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a
322 * #GST_QUERY_SEEKING.
324 * Any @offset larger or equal than the length will make the function return
325 * #GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not
326 * contain a valid buffer.
328 * The buffer size of @buffer will only be smaller than @length when @offset is
329 * near the end of the stream. In all other cases, the size of @buffer must be
330 * exactly the requested size.
332 * It is allowed to call this function with a 0 @length and valid @offset, in
333 * which case @buffer will contain a 0-sized buffer and the function returns
336 * When this function is called with a -1 @offset, the sequentially next buffer
337 * of length @length in the stream is returned.
339 * When this function is called with a -1 @length, a buffer with a default
340 * optimal length is returned in @buffer. The length might depend on the value
343 * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other
344 * return value leaves @buffer undefined.
346 typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, GstObject *parent,
347 guint64 offset, guint length,
351 * GstPadEventFunction:
352 * @pad: the #GstPad to handle the event.
353 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
354 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
355 * during the execution of this function.
356 * @event: (transfer full): the #GstEvent to handle.
358 * Function signature to handle an event for the pad.
360 * Returns: %TRUE if the pad could handle the event.
362 typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstObject *parent,
368 * GstPadIterIntLinkFunction:
369 * @pad: The #GstPad to query.
370 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
371 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
372 * during the execution of this function.
374 * The signature of the internal pad link iterator function.
376 * Returns: a new #GstIterator that will iterate over all pads that are
377 * linked to the given pad on the inside of the parent element.
379 * the caller must call gst_iterator_free() after usage.
381 typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad, GstObject *parent);
383 /* generic query function */
385 * GstPadQueryFunction:
386 * @pad: the #GstPad to query.
387 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
388 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
389 * during the execution of this function.
390 * @query: the #GstQuery object to execute
392 * The signature of the query function.
394 * Returns: %TRUE if the query could be performed.
396 typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstObject *parent,
402 * GstPadLinkFunction:
403 * @pad: the #GstPad that is linked.
404 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
405 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
406 * during the execution of this function.
407 * @peer: the peer #GstPad of the link
409 * Function signature to handle a new link on the pad.
411 * Returns: the result of the link with the specified peer.
413 typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstObject *parent, GstPad *peer);
415 * GstPadUnlinkFunction:
416 * @pad: the #GstPad that is linked.
417 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
418 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
419 * during the execution of this function.
421 * Function signature to handle a unlinking the pad prom its peer.
423 typedef void (*GstPadUnlinkFunction) (GstPad *pad, GstObject *parent);
428 * GstPadForwardFunction:
429 * @pad: the #GstPad that is forwarded.
430 * @user_data: the gpointer to optional user data.
432 * A forward function is called for all internally linked pads, see
435 * Returns: %TRUE if the dispatching procedure has to be stopped.
437 typedef gboolean (*GstPadForwardFunction) (GstPad *pad, gpointer user_data);
441 * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
442 * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block
443 * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
444 * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
445 * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
446 * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
447 * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
448 * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be
449 * explicitly enabled and is not included in the
450 * @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
451 * @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
452 * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries
453 * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries
454 * @GST_PAD_PROBE_TYPE_PUSH: probe push
455 * @GST_PAD_PROBE_TYPE_PULL: probe pull
456 * @GST_PAD_PROBE_TYPE_BLOCKING: probe and block at the next opportunity, at data flow or when idle
457 * @GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM: probe downstream data (buffers, buffer lists, and events)
458 * @GST_PAD_PROBE_TYPE_DATA_UPSTREAM: probe upstream data (events)
459 * @GST_PAD_PROBE_TYPE_DATA_BOTH: probe upstream and downstream data (buffers, buffer lists, and events)
460 * @GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM: probe and block downstream data (buffers, buffer lists, and events)
461 * @GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM: probe and block upstream data (events)
462 * @GST_PAD_PROBE_TYPE_EVENT_BOTH: probe upstream and downstream events
463 * @GST_PAD_PROBE_TYPE_QUERY_BOTH: probe upstream and downstream queries
464 * @GST_PAD_PROBE_TYPE_ALL_BOTH: probe upstream events and queries and downstream buffers, buffer lists, events and queries
465 * @GST_PAD_PROBE_TYPE_SCHEDULING: probe push and pull
467 * The different probing types that can occur. When either one of
468 * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a
473 GST_PAD_PROBE_TYPE_INVALID = 0,
474 /* flags to control blocking */
475 GST_PAD_PROBE_TYPE_IDLE = (1 << 0),
476 GST_PAD_PROBE_TYPE_BLOCK = (1 << 1),
477 /* flags to select datatypes */
478 GST_PAD_PROBE_TYPE_BUFFER = (1 << 4),
479 GST_PAD_PROBE_TYPE_BUFFER_LIST = (1 << 5),
480 GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6),
481 GST_PAD_PROBE_TYPE_EVENT_UPSTREAM = (1 << 7),
482 GST_PAD_PROBE_TYPE_EVENT_FLUSH = (1 << 8),
483 GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9),
484 GST_PAD_PROBE_TYPE_QUERY_UPSTREAM = (1 << 10),
485 /* flags to select scheduling mode */
486 GST_PAD_PROBE_TYPE_PUSH = (1 << 12),
487 GST_PAD_PROBE_TYPE_PULL = (1 << 13),
489 /* flag combinations */
490 GST_PAD_PROBE_TYPE_BLOCKING = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK,
491 GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
492 GST_PAD_PROBE_TYPE_DATA_UPSTREAM = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
493 GST_PAD_PROBE_TYPE_DATA_BOTH = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
494 GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
495 GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
496 GST_PAD_PROBE_TYPE_EVENT_BOTH = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
497 GST_PAD_PROBE_TYPE_QUERY_BOTH = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
498 GST_PAD_PROBE_TYPE_ALL_BOTH = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH,
499 GST_PAD_PROBE_TYPE_SCHEDULING = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL
505 * @GST_PAD_PROBE_OK: normal probe return value. This leaves the probe in
506 * place, and defers decisions about dropping or passing data to other
507 * probes, if any. If there are no other probes, the default behaviour
508 * for the probe type applies (block for blocking probes, and pass for
509 * non-blocking probes).
510 * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
511 * the data item is not sent downstream. For pull mode, it means that
512 * the data item is not passed upstream. In both cases, no more probes
513 * are called and #GST_FLOW_OK or %TRUE is returned to the caller.
514 * @GST_PAD_PROBE_REMOVE: remove this probe.
515 * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on the
517 * @GST_PAD_PROBE_HANDLED: Data has been handled in the probe and will not be
518 * forwarded further. For events and buffers this is the same behaviour as
519 * @GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer
520 * or event yourself). For queries it will also return %TRUE to the caller.
521 * The probe can also modify the #GstFlowReturn value by using the
522 * #GST_PAD_PROBE_INFO_FLOW_RETURN() accessor.
523 * Note that the resulting query must contain valid entries.
526 * Different return values for the #GstPadProbeCallback.
532 GST_PAD_PROBE_REMOVE,
534 GST_PAD_PROBE_HANDLED
540 * @type: the current probe type
541 * @id: the id of the probe
542 * @data: (allow-none): type specific data, check the @type field to know the
543 * datatype. This field can be %NULL.
544 * @offset: offset of pull probe, this field is valid when @type contains
545 * #GST_PAD_PROBE_TYPE_PULL
546 * @size: size of pull probe, this field is valid when @type contains
547 * #GST_PAD_PROBE_TYPE_PULL
549 * Info passed in the #GstPadProbeCallback.
551 struct _GstPadProbeInfo
553 GstPadProbeType type;
561 gpointer _gst_reserved[GST_PADDING];
563 GstFlowReturn flow_ret;
568 #define GST_PAD_PROBE_INFO_TYPE(d) ((d)->type)
569 #define GST_PAD_PROBE_INFO_ID(d) ((d)->id)
570 #define GST_PAD_PROBE_INFO_DATA(d) ((d)->data)
571 #define GST_PAD_PROBE_INFO_FLOW_RETURN(d) ((d)->ABI.abi.flow_ret)
573 #define GST_PAD_PROBE_INFO_BUFFER(d) GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
574 #define GST_PAD_PROBE_INFO_BUFFER_LIST(d) GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
575 #define GST_PAD_PROBE_INFO_EVENT(d) GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
576 #define GST_PAD_PROBE_INFO_QUERY(d) GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
578 #define GST_PAD_PROBE_INFO_OFFSET(d) ((d)->offset)
579 #define GST_PAD_PROBE_INFO_SIZE(d) ((d)->size)
581 GstEvent* gst_pad_probe_info_get_event (GstPadProbeInfo * info);
582 GstQuery* gst_pad_probe_info_get_query (GstPadProbeInfo * info);
583 GstBuffer* gst_pad_probe_info_get_buffer (GstPadProbeInfo * info);
584 GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
587 * GstPadProbeCallback:
588 * @pad: the #GstPad that is blocked
589 * @info: #GstPadProbeInfo
590 * @user_data: the gpointer to optional user data.
592 * Callback used by gst_pad_add_probe(). Gets called to notify about the current
595 * The callback is allowed to modify the data pointer in @info.
597 * Returns: a #GstPadProbeReturn
599 typedef GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstPadProbeInfo *info,
603 * GstPadStickyEventsForeachFunction:
605 * @event: (allow-none): a sticky #GstEvent.
606 * @user_data: the #gpointer to optional user data.
608 * Callback used by gst_pad_sticky_events_foreach().
610 * When this function returns %TRUE, the next event will be
611 * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
613 * When @event is set to %NULL, the item will be removed from the list of sticky events.
614 * @event can be replaced by assigning a new reference to it.
615 * This function is responsible for unreffing the old event when
616 * removing or modifying.
618 * Returns: %TRUE if the iteration should continue
620 typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
625 * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
626 * @GST_PAD_FLAG_FLUSHING: is pad flushing
627 * @GST_PAD_FLAG_EOS: is pad in EOS state
628 * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
629 * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
630 * into the pad callbacks.
631 * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
632 * The flag has to be unset manually after
633 * reconfiguration happened.
634 * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
635 * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps. This means that
636 * once the caps are set on the pad, the default caps query function
637 * will only return those caps.
638 * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
639 * all events and queries to the internally linked pads
640 * instead of discarding them.
641 * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
642 * allocation queries to the internally linked pads
643 * instead of discarding them.
644 * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward
645 * scheduling queries to the internally linked pads
646 * instead of discarding them.
647 * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check
648 * it the caps intersect the query-caps result instead
649 * of checking for a subset. This is interesting for
650 * parsers that can accept incompletely specified caps.
651 * @GST_PAD_FLAG_ACCEPT_TEMPLATE: the default accept-caps handler will use
652 * the template pad caps instead of query caps to
653 * compare with the accept caps. Use this in combination
654 * with %GST_PAD_FLAG_ACCEPT_INTERSECT. (Since 1.6)
655 * @GST_PAD_FLAG_LAST: offset to define more flags
660 GST_PAD_FLAG_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
661 GST_PAD_FLAG_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
662 GST_PAD_FLAG_EOS = (GST_OBJECT_FLAG_LAST << 2),
663 GST_PAD_FLAG_BLOCKING = (GST_OBJECT_FLAG_LAST << 3),
664 GST_PAD_FLAG_NEED_PARENT = (GST_OBJECT_FLAG_LAST << 4),
665 GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
666 GST_PAD_FLAG_PENDING_EVENTS = (GST_OBJECT_FLAG_LAST << 6),
667 GST_PAD_FLAG_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 7),
668 GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 8),
669 GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9),
670 GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10),
671 GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11),
672 GST_PAD_FLAG_ACCEPT_TEMPLATE = (GST_OBJECT_FLAG_LAST << 12),
674 GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
679 * @element_private: private data owned by the parent element
680 * @padtemplate: padtemplate for this pad
681 * @direction: the direction of the pad, cannot change after creating
684 * The #GstPad structure. Use the functions to update the variables.
690 gpointer element_private;
692 GstPadTemplate *padtemplate;
694 GstPadDirection direction;
697 /* streaming rec_lock */
698 GRecMutex stream_rec_lock;
701 /* block cond, mutex is from the object */
706 GstPadActivateFunction activatefunc;
707 gpointer activatedata;
708 GDestroyNotify activatenotify;
709 GstPadActivateModeFunction activatemodefunc;
710 gpointer activatemodedata;
711 GDestroyNotify activatemodenotify;
715 GstPadLinkFunction linkfunc;
717 GDestroyNotify linknotify;
718 GstPadUnlinkFunction unlinkfunc;
720 GDestroyNotify unlinknotify;
722 /* data transport functions */
723 GstPadChainFunction chainfunc;
725 GDestroyNotify chainnotify;
726 GstPadChainListFunction chainlistfunc;
727 gpointer chainlistdata;
728 GDestroyNotify chainlistnotify;
729 GstPadGetRangeFunction getrangefunc;
730 gpointer getrangedata;
731 GDestroyNotify getrangenotify;
732 GstPadEventFunction eventfunc;
734 GDestroyNotify eventnotify;
739 /* generic query method */
740 GstPadQueryFunction queryfunc;
742 GDestroyNotify querynotify;
745 GstPadIterIntLinkFunction iterintlinkfunc;
746 gpointer iterintlinkdata;
747 GDestroyNotify iterintlinknotify;
749 /* counts number of probes attached. */
756 gpointer _gst_reserved[GST_PADDING];
758 GstFlowReturn last_flowret;
763 struct _GstPadClass {
764 GstObjectClass parent_class;
766 /* signal callbacks */
767 void (*linked) (GstPad *pad, GstPad *peer);
768 void (*unlinked) (GstPad *pad, GstPad *peer);
771 gpointer _gst_reserved[GST_PADDING];
775 /***** helper macros *****/
782 * Get name of the given pad.
783 * No locking is performed in this function, use gst_pad_get_name() instead.
785 #define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
790 * Get the @pad parent.
791 * No locking is performed in this function, use gst_pad_get_parent() instead.
793 #define GST_PAD_PARENT(pad) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
795 * GST_PAD_ELEMENT_PRIVATE:
798 * Get the private data of @pad, which is usually some pad- or stream-specific
799 * structure created by the element and set on the pad when creating it.
800 * No locking is performed in this function.
802 #define GST_PAD_ELEMENT_PRIVATE(pad) (GST_PAD_CAST(pad)->element_private)
804 * GST_PAD_PAD_TEMPLATE:
807 * Get the @pad #GstPadTemplate. It describes the possible media types
808 * a @pad or an element factory can handle.
810 #define GST_PAD_PAD_TEMPLATE(pad) (GST_PAD_CAST(pad)->padtemplate)
815 * Get the #GstPadDirection of the given @pad. Accessor macro, use
816 * gst_pad_get_direction() instead.
818 #define GST_PAD_DIRECTION(pad) (GST_PAD_CAST(pad)->direction)
823 * Get the #GstTask of @pad. Accessor macro used by GStreamer. Use the
824 * gst_pad_start_task(), gst_pad_stop_task() and gst_pad_pause_task()
827 #define GST_PAD_TASK(pad) (GST_PAD_CAST(pad)->task)
832 * Get the #GstPadMode of pad, which will be GST_PAD_MODE_NONE if the pad
833 * has not been activated yet, and otherwise either GST_PAD_MODE_PUSH or
834 * GST_PAD_MODE_PULL depending on which mode the pad was activated in.
836 #define GST_PAD_MODE(pad) (GST_PAD_CAST(pad)->mode)
838 * GST_PAD_ACTIVATEFUNC:
841 * Get the #GstPadActivateFunction from @pad.
843 #define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
845 * GST_PAD_ACTIVATEMODEFUNC:
848 * Get the #GstPadActivateModeFunction from the given @pad.
850 #define GST_PAD_ACTIVATEMODEFUNC(pad) (GST_PAD_CAST(pad)->activatemodefunc)
855 * Get the #GstPadChainFunction from the given @pad.
857 #define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
859 * GST_PAD_CHAINLISTFUNC:
862 * Get the #GstPadChainListFunction from the given @pad.
864 #define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc)
866 * GST_PAD_GETRANGEFUNC:
869 * Get the #GstPadGetRangeFunction from the given @pad.
871 #define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
876 * Get the #GstPadEventFunction from the given @pad, which
877 * is the function that handles events on the pad. You can
878 * use this to set your own event handling function on a pad
879 * after you create it. If your element derives from a base
880 * class, use the base class's virtual functions instead.
882 #define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
887 * Get the #GstPadQueryFunction from @pad, which is the function
888 * that handles queries on the pad. You can use this to set your
889 * own query handling function on a pad after you create it. If your
890 * element derives from a base class, use the base class's virtual
893 #define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
895 * GST_PAD_ITERINTLINKFUNC:
898 * Get the #GstPadIterIntLinkFunction from the given @pad.
900 #define GST_PAD_ITERINTLINKFUNC(pad) (GST_PAD_CAST(pad)->iterintlinkfunc)
905 * Return the pad's peer member. This member is a pointer to the linked @pad.
906 * No locking is performed in this function, use gst_pad_get_peer() instead.
908 #define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
913 * Get the #GstPadLinkFunction for the given @pad.
915 #define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
917 * GST_PAD_UNLINKFUNC:
920 * Get the #GstPadUnlinkFunction from the given @pad.
922 #define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
927 * Returns: %TRUE if the pad is a source pad (i.e. produces data).
929 #define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
934 * Returns: %TRUE if the pad is a sink pad (i.e. consumes data).
936 #define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
941 * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
944 #define GST_PAD_IS_LINKED(pad) (GST_PAD_PEER(pad) != NULL)
949 * Returns: %TRUE if the pad has been activated.
951 #define GST_PAD_IS_ACTIVE(pad) (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
953 * GST_PAD_IS_BLOCKED:
956 * Check if the dataflow on a @pad is blocked. Use gst_pad_is_blocked() instead.
958 #define GST_PAD_IS_BLOCKED(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
960 * GST_PAD_IS_BLOCKING:
963 * Check if the @pad is currently blocking on a buffer or event. Use
964 * gst_pad_is_blocking() instead.
966 #define GST_PAD_IS_BLOCKING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
968 * GST_PAD_IS_FLUSHING:
971 * Check if the given @pad is flushing.
973 #define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
975 * GST_PAD_SET_FLUSHING:
978 * Set the given @pad to flushing state, which means it will not accept any
979 * more events, queries or buffers, and return GST_FLOW_FLUSHING if any buffers
980 * are pushed on it. This usually happens when the pad is shut down or when
981 * a flushing seek happens. This is used inside GStreamer when flush start/stop
982 * events pass through pads, or when an element state is changed and pads are
983 * activated or deactivated.
985 #define GST_PAD_SET_FLUSHING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
987 * GST_PAD_UNSET_FLUSHING:
990 * Unset the flushing flag.
992 #define GST_PAD_UNSET_FLUSHING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
997 * Check if the @pad is in EOS state.
999 #define GST_PAD_IS_EOS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS))
1001 * GST_PAD_NEEDS_RECONFIGURE:
1004 * Check if the @pad should be reconfigured/renegotiated.
1005 * The flag has to be unset manually after reconfiguration happened.
1006 * Use gst_pad_needs_reconfigure() or gst_pad_check_reconfigure() instead.
1008 #define GST_PAD_NEEDS_RECONFIGURE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
1010 * GST_PAD_HAS_PENDING_EVENTS:
1013 * Check if the given @pad has pending events. This is used internally by
1016 #define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
1018 * GST_PAD_IS_FIXED_CAPS:
1021 * Check if the given @pad is using fixed caps, which means that
1022 * once the caps are set on the @pad, the caps query function will
1023 * only return those caps. See gst_pad_use_fixed_caps().
1025 #define GST_PAD_IS_FIXED_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
1027 * GST_PAD_NEEDS_PARENT:
1030 * Check if there is a parent object before calling into the @pad callbacks.
1031 * This is used internally by GStreamer.
1033 #define GST_PAD_NEEDS_PARENT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
1035 * GST_PAD_IS_PROXY_CAPS:
1038 * Check if the given @pad is set to proxy caps. This means that the default
1039 * event and query handler will forward all events and queries to the
1040 * internally linked @pads instead of discarding them.
1042 #define GST_PAD_IS_PROXY_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1044 * GST_PAD_SET_PROXY_CAPS:
1047 * Set @pad to proxy caps, so that all caps-related events and queries are
1048 * proxied down- or upstream to the other side of the element automatically.
1049 * Set this if the element always outputs data in the exact same format as it
1050 * receives as input. This is just for convenience to avoid implementing some
1051 * standard event and query handling code in an element.
1053 #define GST_PAD_SET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1055 * GST_PAD_UNSET_PROXY_CAPS:
1058 * Unset proxy caps flag.
1060 #define GST_PAD_UNSET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
1062 * GST_PAD_IS_PROXY_ALLOCATION:
1065 * Check if the given @pad is set as proxy allocation which means
1066 * that the default query handler will forward allocation queries to the
1067 * internally linked @pads instead of discarding them.
1069 #define GST_PAD_IS_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1071 * GST_PAD_SET_PROXY_ALLOCATION:
1074 * Set @pad to proxy allocation queries, which means that the default query
1075 * handler will forward allocation queries to the internally linked @pads
1076 * instead of discarding them.
1077 * Set this if the element always outputs data in the exact same format as it
1078 * receives as input. This is just for convenience to avoid implementing some
1079 * standard query handling code in an element.
1081 #define GST_PAD_SET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1083 * GST_PAD_UNSET_PROXY_ALLOCATION:
1086 * Unset proxy allocation flag.
1088 #define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1090 * GST_PAD_IS_PROXY_SCHEDULING:
1093 * Check if the given @pad is set to proxy scheduling queries, which means that
1094 * the default query handler will forward scheduling queries to the internally
1095 * linked @pads instead of discarding them.
1097 #define GST_PAD_IS_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1099 * GST_PAD_SET_PROXY_SCHEDULING:
1102 * Set @pad to proxy scheduling queries, which means that the default query
1103 * handler will forward scheduling queries to the internally linked @pads
1104 * instead of discarding them. You will usually want to handle scheduling
1105 * queries explicitly if your element supports multiple scheduling modes.
1107 #define GST_PAD_SET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1109 * GST_PAD_UNSET_PROXY_SCHEDULING:
1112 * Unset proxy scheduling flag.
1114 #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1116 * GST_PAD_IS_ACCEPT_INTERSECT:
1119 * Check if the pad's accept intersect flag is set. The default accept-caps
1120 * handler will check if the caps intersect the query-caps result instead of
1121 * checking for a subset. This is interesting for parser elements that can
1122 * accept incompletely specified caps.
1124 #define GST_PAD_IS_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1126 * GST_PAD_SET_ACCEPT_INTERSECT:
1129 * Set @pad to by default accept caps by intersecting the result instead of
1130 * checking for a subset. This is interesting for parser elements that can
1131 * accept incompletely specified caps.
1133 #define GST_PAD_SET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1135 * GST_PAD_UNSET_ACCEPT_INTERSECT:
1138 * Unset accept intersect flag.
1140 #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1142 * GST_PAD_IS_ACCEPT_TEMPLATE:
1145 * Check if the pad's accept caps operation will use the pad template caps.
1146 * The default accept-caps will do a query caps to get the caps, which might
1147 * be querying downstream causing unnecessary overhead. It is recommended to
1148 * implement a proper accept-caps query handler or to use this flag to prevent
1149 * recursive accept-caps handling.
1153 #define GST_PAD_IS_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1155 * GST_PAD_SET_ACCEPT_TEMPLATE:
1158 * Set @pad to by default use the pad template caps to compare with
1159 * the accept caps instead of using a caps query result.
1163 #define GST_PAD_SET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1165 * GST_PAD_UNSET_ACCEPT_TEMPLATE:
1168 * Unset accept template flag.
1172 #define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1174 * GST_PAD_GET_STREAM_LOCK:
1177 * Get the stream lock of @pad. The stream lock is protecting the
1178 * resources used in the data processing functions of @pad. Accessor
1179 * macro, use GST_PAD_STREAM_LOCK() and GST_PAD_STREAM_UNLOCK() instead
1180 * to take/release the pad's stream lock.
1182 #define GST_PAD_GET_STREAM_LOCK(pad) (&(GST_PAD_CAST(pad)->stream_rec_lock))
1184 * GST_PAD_STREAM_LOCK:
1187 * Take the pad's stream lock. The stream lock is recursive and will be taken
1188 * when buffers or serialized downstream events are pushed on a pad.
1190 #define GST_PAD_STREAM_LOCK(pad) g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
1192 * GST_PAD_STREAM_TRYLOCK:
1195 * Try to take the pad's stream lock, and return %TRUE if the lock could be
1196 * taken, and otherwise %FALSE.
1198 #define GST_PAD_STREAM_TRYLOCK(pad) g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
1200 * GST_PAD_STREAM_UNLOCK:
1203 * Release the pad's stream lock.
1205 #define GST_PAD_STREAM_UNLOCK(pad) g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
1207 * GST_PAD_LAST_FLOW_RETURN:
1210 * Gets the last flow return on this pad
1214 #define GST_PAD_LAST_FLOW_RETURN(pad) (GST_PAD_CAST(pad)->ABI.abi.last_flowret)
1216 #define GST_PAD_BLOCK_GET_COND(pad) (&GST_PAD_CAST(pad)->block_cond)
1217 #define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
1218 #define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
1219 #define GST_PAD_BLOCK_BROADCAST(pad) (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
1221 GType gst_pad_get_type (void);
1224 GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
1225 GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
1226 GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
1231 * @pad: the pad to get the name from
1233 * Get a copy of the name of the pad. g_free() after usage.
1237 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
1239 * gst_pad_get_parent:
1240 * @pad: the pad to get the parent of
1242 * Get the parent of @pad. This function increases the refcount
1243 * of the parent object so you should gst_object_unref() it after usage.
1244 * Can return %NULL if the pad did not have a parent.
1248 * Returns: (nullable): the parent
1250 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
1252 GstPadDirection gst_pad_get_direction (GstPad *pad);
1254 gboolean gst_pad_set_active (GstPad *pad, gboolean active);
1255 gboolean gst_pad_is_active (GstPad *pad);
1256 gboolean gst_pad_activate_mode (GstPad *pad, GstPadMode mode,
1259 gulong gst_pad_add_probe (GstPad *pad,
1260 GstPadProbeType mask,
1261 GstPadProbeCallback callback,
1263 GDestroyNotify destroy_data);
1264 void gst_pad_remove_probe (GstPad *pad, gulong id);
1266 gboolean gst_pad_is_blocked (GstPad *pad);
1267 gboolean gst_pad_is_blocking (GstPad *pad);
1269 void gst_pad_mark_reconfigure (GstPad *pad);
1270 gboolean gst_pad_needs_reconfigure (GstPad *pad);
1271 gboolean gst_pad_check_reconfigure (GstPad *pad);
1273 void gst_pad_set_element_private (GstPad *pad, gpointer priv);
1274 gpointer gst_pad_get_element_private (GstPad *pad);
1276 GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
1278 GstFlowReturn gst_pad_store_sticky_event (GstPad *pad, GstEvent *event);
1279 GstEvent* gst_pad_get_sticky_event (GstPad *pad, GstEventType event_type,
1281 void gst_pad_sticky_events_foreach (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
1283 /* data passing setup functions */
1284 void gst_pad_set_activate_function_full (GstPad *pad,
1285 GstPadActivateFunction activate,
1287 GDestroyNotify notify);
1288 void gst_pad_set_activatemode_function_full (GstPad *pad,
1289 GstPadActivateModeFunction activatemode,
1291 GDestroyNotify notify);
1292 /* data passing functions */
1293 void gst_pad_set_chain_function_full (GstPad *pad,
1294 GstPadChainFunction chain,
1296 GDestroyNotify notify);
1297 void gst_pad_set_chain_list_function_full (GstPad *pad,
1298 GstPadChainListFunction chainlist,
1300 GDestroyNotify notify);
1301 void gst_pad_set_getrange_function_full (GstPad *pad,
1302 GstPadGetRangeFunction get,
1304 GDestroyNotify notify);
1305 void gst_pad_set_event_function_full (GstPad *pad,
1306 GstPadEventFunction event,
1308 GDestroyNotify notify);
1310 #define gst_pad_set_activate_function(p,f) gst_pad_set_activate_function_full((p),(f),NULL,NULL)
1311 #define gst_pad_set_activatemode_function(p,f) gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
1312 #define gst_pad_set_chain_function(p,f) gst_pad_set_chain_function_full((p),(f),NULL,NULL)
1313 #define gst_pad_set_chain_list_function(p,f) gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
1314 #define gst_pad_set_getrange_function(p,f) gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
1315 #define gst_pad_set_event_function(p,f) gst_pad_set_event_function_full((p),(f),NULL,NULL)
1318 void gst_pad_set_link_function_full (GstPad *pad,
1319 GstPadLinkFunction link,
1321 GDestroyNotify notify);
1322 void gst_pad_set_unlink_function_full (GstPad *pad,
1323 GstPadUnlinkFunction unlink,
1325 GDestroyNotify notify);
1327 #define gst_pad_set_link_function(p,f) gst_pad_set_link_function_full((p),(f),NULL,NULL)
1328 #define gst_pad_set_unlink_function(p,f) gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
1330 gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
1331 GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
1332 GstPadLinkReturn gst_pad_link_full (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
1333 gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
1334 gboolean gst_pad_is_linked (GstPad *pad);
1336 GstPad* gst_pad_get_peer (GstPad *pad);
1338 GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
1340 /* capsnego function for linked/unlinked pads */
1341 GstCaps * gst_pad_get_current_caps (GstPad * pad);
1342 gboolean gst_pad_has_current_caps (GstPad * pad);
1344 /* capsnego for linked pads */
1345 GstCaps * gst_pad_get_allowed_caps (GstPad * pad);
1348 gint64 gst_pad_get_offset (GstPad *pad);
1349 void gst_pad_set_offset (GstPad *pad, gint64 offset);
1351 /* data passing functions to peer */
1352 GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
1353 GstFlowReturn gst_pad_push_list (GstPad *pad, GstBufferList *list);
1354 GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
1355 GstBuffer **buffer);
1356 gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
1357 gboolean gst_pad_event_default (GstPad *pad, GstObject *parent,
1359 GstFlowReturn gst_pad_get_last_flow_return (GstPad *pad);
1361 /* data passing functions on pad */
1362 GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
1363 GstFlowReturn gst_pad_chain_list (GstPad *pad, GstBufferList *list);
1364 GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
1365 GstBuffer **buffer);
1366 gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
1369 gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
1370 gpointer user_data, GDestroyNotify notify);
1371 gboolean gst_pad_pause_task (GstPad *pad);
1372 gboolean gst_pad_stop_task (GstPad *pad);
1374 /* internal links */
1375 void gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
1376 GstPadIterIntLinkFunction iterintlink,
1378 GDestroyNotify notify);
1379 GstIterator * gst_pad_iterate_internal_links (GstPad * pad);
1380 GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad, GstObject *parent);
1382 #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
1384 /* generic query function */
1385 gboolean gst_pad_query (GstPad *pad, GstQuery *query);
1386 gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query);
1387 void gst_pad_set_query_function_full (GstPad *pad, GstPadQueryFunction query,
1389 GDestroyNotify notify);
1390 gboolean gst_pad_query_default (GstPad *pad, GstObject *parent,
1393 #define gst_pad_set_query_function(p,f) gst_pad_set_query_function_full((p),(f),NULL,NULL)
1395 /* misc helper functions */
1396 gboolean gst_pad_forward (GstPad *pad, GstPadForwardFunction forward,
1397 gpointer user_data);
1401 #endif /* __GST_PAD_H__ */