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.
64 const gchar * gst_pad_mode_get_name (GstPadMode mode);
66 #include <gst/gstobject.h>
67 #include <gst/gstbuffer.h>
68 #include <gst/gstbufferlist.h>
69 #include <gst/gstcaps.h>
70 #include <gst/gstpadtemplate.h>
71 #include <gst/gstevent.h>
72 #include <gst/gstquery.h>
73 #include <gst/gsttask.h>
80 #define GST_TYPE_PAD (gst_pad_get_type ())
81 #define GST_IS_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
82 #define GST_IS_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
83 #define GST_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
84 #define GST_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
85 #define GST_PAD_CAST(obj) ((GstPad*)(obj))
91 * @GST_PAD_LINK_OK : link succeeded
92 * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
93 * @GST_PAD_LINK_WAS_LINKED : pad was already linked
94 * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
95 * @GST_PAD_LINK_NOFORMAT : pads do not have common format
96 * @GST_PAD_LINK_NOSCHED : pads cannot cooperate in scheduling
97 * @GST_PAD_LINK_REFUSED : refused for some reason
99 * Result values from gst_pad_link and friends.
103 GST_PAD_LINK_WRONG_HIERARCHY = -1,
104 GST_PAD_LINK_WAS_LINKED = -2,
105 GST_PAD_LINK_WRONG_DIRECTION = -3,
106 GST_PAD_LINK_NOFORMAT = -4,
107 GST_PAD_LINK_NOSCHED = -5,
108 GST_PAD_LINK_REFUSED = -6
112 * GST_PAD_LINK_FAILED:
113 * @ret: the #GstPadLinkReturn value
115 * Macro to test if the given #GstPadLinkReturn value indicates a failed
118 #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
121 * GST_PAD_LINK_SUCCESSFUL:
122 * @ret: the #GstPadLinkReturn value
124 * Macro to test if the given #GstPadLinkReturn value indicates a successful
127 #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
131 * @GST_FLOW_OK: Data passing was ok.
132 * @GST_FLOW_NOT_LINKED: Pad is not linked.
133 * @GST_FLOW_FLUSHING: Pad is flushing.
134 * @GST_FLOW_EOS: Pad is EOS.
135 * @GST_FLOW_NOT_NEGOTIATED: Pad is not negotiated.
136 * @GST_FLOW_ERROR: Some (fatal) error occurred. Element generating
137 * this error should post an error message with more
139 * @GST_FLOW_NOT_SUPPORTED: This operation is not supported.
140 * @GST_FLOW_CUSTOM_SUCCESS: Elements can use values starting from
141 * this (and higher) to define custom success
143 * @GST_FLOW_CUSTOM_SUCCESS_1: Pre-defined custom success code (define your
144 * custom success code to this to avoid compiler
146 * @GST_FLOW_CUSTOM_SUCCESS_2: Pre-defined custom success code.
147 * @GST_FLOW_CUSTOM_ERROR: Elements can use values starting from
148 * this (and lower) to define custom error codes.
149 * @GST_FLOW_CUSTOM_ERROR_1: Pre-defined custom error code (define your
150 * custom error code to this to avoid compiler
152 * @GST_FLOW_CUSTOM_ERROR_2: Pre-defined custom error code.
154 * The result of passing data to a pad.
156 * Note that the custom return values should not be exposed outside of the
160 /* custom success starts here */
161 GST_FLOW_CUSTOM_SUCCESS_2 = 102,
162 GST_FLOW_CUSTOM_SUCCESS_1 = 101,
163 GST_FLOW_CUSTOM_SUCCESS = 100,
165 /* core predefined */
167 /* expected failures */
168 GST_FLOW_NOT_LINKED = -1,
169 GST_FLOW_FLUSHING = -2,
172 GST_FLOW_NOT_NEGOTIATED = -4,
174 GST_FLOW_NOT_SUPPORTED = -6,
176 /* custom error starts here */
177 GST_FLOW_CUSTOM_ERROR = -100,
178 GST_FLOW_CUSTOM_ERROR_1 = -101,
179 GST_FLOW_CUSTOM_ERROR_2 = -102
182 const gchar* gst_flow_get_name (GstFlowReturn ret);
183 GQuark gst_flow_to_quark (GstFlowReturn ret);
184 const gchar* gst_pad_link_get_name (GstPadLinkReturn ret);
188 * @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility.
189 * @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents.
190 * Could be omitted if it is already known that the two elements that own the
191 * pads are in the same bin.
192 * @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using
193 * their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
194 * would be unsafe e.g. if one pad has %GST_CAPS_ANY.
195 * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
196 * caps returned by gst_pad_query_caps().
197 * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking
198 * pads (i.e. the ones used by gst_pad_link()).
200 * The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS
201 * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
202 * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed.
205 * Only disable some of the checks if you are 100% certain you know the link
206 * will not fail because of hierarchy/caps compatibility failures. If uncertain,
207 * use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
208 * for linking the pads.
213 GST_PAD_LINK_CHECK_NOTHING = 0,
214 GST_PAD_LINK_CHECK_HIERARCHY = 1 << 0,
215 GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1,
216 GST_PAD_LINK_CHECK_CAPS = 1 << 2,
218 GST_PAD_LINK_CHECK_DEFAULT = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS
223 * GstPadActivateFunction:
225 * @parent: the parent of @pad
227 * This function is called when the pad is activated during the element
228 * READY to PAUSED state change. By default this function will call the
229 * activate function that puts the pad in push mode but elements can
230 * override this function to activate the pad in pull mode if they wish.
232 * Returns: %TRUE if the pad could be activated.
234 typedef gboolean (*GstPadActivateFunction) (GstPad *pad, GstObject *parent);
236 * GstPadActivateModeFunction:
238 * @parent: the parent of @pad
239 * @mode: the requested activation mode of @pad
240 * @active: activate or deactivate the pad.
242 * The prototype of the push and pull activate functions.
244 * Returns: %TRUE if the pad could be activated or deactivated.
246 typedef gboolean (*GstPadActivateModeFunction) (GstPad *pad, GstObject *parent,
247 GstPadMode mode, gboolean active);
252 * GstPadChainFunction:
253 * @pad: the sink #GstPad that performed the chain.
254 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
255 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
256 * during the execution of this function.
257 * @buffer: (transfer full): the #GstBuffer that is chained, not %NULL.
259 * A function that will be called on sinkpads when chaining buffers.
260 * The function typically processes the data contained in the buffer and
261 * either consumes the data or passes it on to the internally linked pad(s).
263 * The implementer of this function receives a refcount to @buffer and should
264 * gst_buffer_unref() when the buffer is no longer needed.
266 * When a chain function detects an error in the data stream, it must post an
267 * error on the bus and return an appropriate #GstFlowReturn value.
269 * Returns: #GST_FLOW_OK for success
271 typedef GstFlowReturn (*GstPadChainFunction) (GstPad *pad, GstObject *parent,
275 * GstPadChainListFunction:
276 * @pad: the sink #GstPad that performed the chain.
277 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
278 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
279 * during the execution of this function.
280 * @list: (transfer full): the #GstBufferList that is chained, not %NULL.
282 * A function that will be called on sinkpads when chaining buffer lists.
283 * The function typically processes the data contained in the buffer list and
284 * either consumes the data or passes it on to the internally linked pad(s).
286 * The implementer of this function receives a refcount to @list and
287 * should gst_buffer_list_unref() when the list is no longer needed.
289 * When a chainlist function detects an error in the data stream, it must
290 * post an error on the bus and return an appropriate #GstFlowReturn value.
292 * Returns: #GST_FLOW_OK for success
294 typedef GstFlowReturn (*GstPadChainListFunction) (GstPad *pad, GstObject *parent,
295 GstBufferList *list);
298 * GstPadGetRangeFunction:
299 * @pad: the src #GstPad to perform the getrange on.
300 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
301 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
302 * during the execution of this function.
303 * @offset: the offset of the range
304 * @length: the length of the range
305 * @buffer: a memory location to hold the result buffer, cannot be %NULL.
307 * This function will be called on source pads when a peer element
308 * request a buffer at the specified @offset and @length. If this function
309 * returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The
310 * contents of @buffer is invalid for any other return value.
312 * This function is installed on a source pad with
313 * gst_pad_set_getrange_function() and can only be called on source pads after
314 * they are successfully activated with gst_pad_activate_mode() with the
315 * #GST_PAD_MODE_PULL.
317 * @offset and @length are always given in byte units. @offset must normally be a value
318 * between 0 and the length in bytes of the data available on @pad. The
319 * length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a
320 * #GST_QUERY_SEEKING.
322 * Any @offset larger or equal than the length will make the function return
323 * #GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not
324 * contain a valid buffer.
326 * The buffer size of @buffer will only be smaller than @length when @offset is
327 * near the end of the stream. In all other cases, the size of @buffer must be
328 * exactly the requested size.
330 * It is allowed to call this function with a 0 @length and valid @offset, in
331 * which case @buffer will contain a 0-sized buffer and the function returns
334 * When this function is called with a -1 @offset, the sequentially next buffer
335 * of length @length in the stream is returned.
337 * When this function is called with a -1 @length, a buffer with a default
338 * optimal length is returned in @buffer. The length might depend on the value
341 * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other
342 * return value leaves @buffer undefined.
344 typedef GstFlowReturn (*GstPadGetRangeFunction) (GstPad *pad, GstObject *parent,
345 guint64 offset, guint length,
349 * GstPadEventFunction:
350 * @pad: the #GstPad to handle the event.
351 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
352 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
353 * during the execution of this function.
354 * @event: (transfer full): the #GstEvent to handle.
356 * Function signature to handle an event for the pad.
358 * Returns: %TRUE if the pad could handle the event.
360 typedef gboolean (*GstPadEventFunction) (GstPad *pad, GstObject *parent,
366 * GstPadIterIntLinkFunction:
367 * @pad: The #GstPad to query.
368 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
369 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
370 * during the execution of this function.
372 * The signature of the internal pad link iterator function.
374 * Returns: a new #GstIterator that will iterate over all pads that are
375 * linked to the given pad on the inside of the parent element.
377 * the caller must call gst_iterator_free() after usage.
379 typedef GstIterator* (*GstPadIterIntLinkFunction) (GstPad *pad, GstObject *parent);
381 /* generic query function */
383 * GstPadQueryFunction:
384 * @pad: the #GstPad to query.
385 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
386 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
387 * during the execution of this function.
388 * @query: the #GstQuery object to execute
390 * The signature of the query function.
392 * Returns: %TRUE if the query could be performed.
394 typedef gboolean (*GstPadQueryFunction) (GstPad *pad, GstObject *parent,
400 * GstPadLinkFunction:
401 * @pad: the #GstPad that is linked.
402 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
403 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
404 * during the execution of this function.
405 * @peer: the peer #GstPad of the link
407 * Function signature to handle a new link on the pad.
409 * Returns: the result of the link with the specified peer.
411 typedef GstPadLinkReturn (*GstPadLinkFunction) (GstPad *pad, GstObject *parent, GstPad *peer);
413 * GstPadUnlinkFunction:
414 * @pad: the #GstPad that is linked.
415 * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT
416 * flag is set, @parent is guaranteed to be not-%NULL and remain valid
417 * during the execution of this function.
419 * Function signature to handle a unlinking the pad prom its peer.
421 typedef void (*GstPadUnlinkFunction) (GstPad *pad, GstObject *parent);
426 * GstPadForwardFunction:
427 * @pad: the #GstPad that is forwarded.
428 * @user_data: the gpointer to optional user data.
430 * A forward function is called for all internally linked pads, see
433 * Returns: %TRUE if the dispatching procedure has to be stopped.
435 typedef gboolean (*GstPadForwardFunction) (GstPad *pad, gpointer user_data);
439 * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
440 * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block
441 * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
442 * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
443 * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
444 * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
445 * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
446 * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be
447 * explicitly enabled and is not included in the
448 * @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
449 * @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
450 * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries
451 * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries
452 * @GST_PAD_PROBE_TYPE_PUSH: probe push
453 * @GST_PAD_PROBE_TYPE_PULL: probe pull
454 * @GST_PAD_PROBE_TYPE_BLOCKING: probe and block at the next opportunity, at data flow or when idle
455 * @GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM: probe downstream data (buffers, buffer lists, and events)
456 * @GST_PAD_PROBE_TYPE_DATA_UPSTREAM: probe upstream data (events)
457 * @GST_PAD_PROBE_TYPE_DATA_BOTH: probe upstream and downstream data (buffers, buffer lists, and events)
458 * @GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM: probe and block downstream data (buffers, buffer lists, and events)
459 * @GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM: probe and block upstream data (events)
460 * @GST_PAD_PROBE_TYPE_EVENT_BOTH: probe upstream and downstream events
461 * @GST_PAD_PROBE_TYPE_QUERY_BOTH: probe upstream and downstream queries
462 * @GST_PAD_PROBE_TYPE_ALL_BOTH: probe upstream events and queries and downstream buffers, buffer lists, events and queries
463 * @GST_PAD_PROBE_TYPE_SCHEDULING: probe push and pull
465 * The different probing types that can occur. When either one of
466 * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a
471 GST_PAD_PROBE_TYPE_INVALID = 0,
472 /* flags to control blocking */
473 GST_PAD_PROBE_TYPE_IDLE = (1 << 0),
474 GST_PAD_PROBE_TYPE_BLOCK = (1 << 1),
475 /* flags to select datatypes */
476 GST_PAD_PROBE_TYPE_BUFFER = (1 << 4),
477 GST_PAD_PROBE_TYPE_BUFFER_LIST = (1 << 5),
478 GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6),
479 GST_PAD_PROBE_TYPE_EVENT_UPSTREAM = (1 << 7),
480 GST_PAD_PROBE_TYPE_EVENT_FLUSH = (1 << 8),
481 GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9),
482 GST_PAD_PROBE_TYPE_QUERY_UPSTREAM = (1 << 10),
483 /* flags to select scheduling mode */
484 GST_PAD_PROBE_TYPE_PUSH = (1 << 12),
485 GST_PAD_PROBE_TYPE_PULL = (1 << 13),
487 /* flag combinations */
488 GST_PAD_PROBE_TYPE_BLOCKING = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK,
489 GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
490 GST_PAD_PROBE_TYPE_DATA_UPSTREAM = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
491 GST_PAD_PROBE_TYPE_DATA_BOTH = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
492 GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
493 GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM,
494 GST_PAD_PROBE_TYPE_EVENT_BOTH = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
495 GST_PAD_PROBE_TYPE_QUERY_BOTH = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM,
496 GST_PAD_PROBE_TYPE_ALL_BOTH = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH,
497 GST_PAD_PROBE_TYPE_SCHEDULING = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL
503 * @GST_PAD_PROBE_OK: normal probe return value. This leaves the probe in
504 * place, and defers decisions about dropping or passing data to other
505 * probes, if any. If there are no other probes, the default behaviour
506 * for the probe type applies (block for blocking probes, and pass for
507 * non-blocking probes).
508 * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
509 * the data item is not sent downstream. For pull mode, it means that
510 * the data item is not passed upstream. In both cases, no more probes
511 * are called and #GST_FLOW_OK or %TRUE is returned to the caller.
512 * @GST_PAD_PROBE_REMOVE: remove this probe.
513 * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on the
516 * Different return values for the #GstPadProbeCallback.
522 GST_PAD_PROBE_REMOVE,
529 * @type: the current probe type
530 * @id: the id of the probe
531 * @data: (allow-none): type specific data, check the @type field to know the
532 * datatype. This field can be %NULL.
533 * @offset: offset of pull probe, this field is valid when @type contains
534 * #GST_PAD_PROBE_TYPE_PULL
535 * @size: size of pull probe, this field is valid when @type contains
536 * #GST_PAD_PROBE_TYPE_PULL
538 * Info passed in the #GstPadProbeCallback.
540 struct _GstPadProbeInfo
542 GstPadProbeType type;
549 gpointer _gst_reserved[GST_PADDING];
552 #define GST_PAD_PROBE_INFO_TYPE(d) ((d)->type)
553 #define GST_PAD_PROBE_INFO_ID(d) ((d)->id)
554 #define GST_PAD_PROBE_INFO_DATA(d) ((d)->data)
556 #define GST_PAD_PROBE_INFO_BUFFER(d) GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
557 #define GST_PAD_PROBE_INFO_BUFFER_LIST(d) GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
558 #define GST_PAD_PROBE_INFO_EVENT(d) GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
559 #define GST_PAD_PROBE_INFO_QUERY(d) GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
561 #define GST_PAD_PROBE_INFO_OFFSET(d) ((d)->offset)
562 #define GST_PAD_PROBE_INFO_SIZE(d) ((d)->size)
564 GstEvent* gst_pad_probe_info_get_event (GstPadProbeInfo * info);
565 GstQuery* gst_pad_probe_info_get_query (GstPadProbeInfo * info);
566 GstBuffer* gst_pad_probe_info_get_buffer (GstPadProbeInfo * info);
567 GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info);
570 * GstPadProbeCallback:
571 * @pad: the #GstPad that is blocked
572 * @info: #GstPadProbeInfo
573 * @user_data: the gpointer to optional user data.
575 * Callback used by gst_pad_add_probe(). Gets called to notify about the current
578 * The callback is allowed to modify the data pointer in @info.
580 * Returns: a #GstPadProbeReturn
582 typedef GstPadProbeReturn (*GstPadProbeCallback) (GstPad *pad, GstPadProbeInfo *info,
586 * GstPadStickyEventsForeachFunction:
588 * @event: (allow-none): a sticky #GstEvent.
589 * @user_data: the #gpointer to optional user data.
591 * Callback used by gst_pad_sticky_events_foreach().
593 * When this function returns %TRUE, the next event will be
594 * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
596 * When @event is set to %NULL, the item will be removed from the list of sticky events.
597 * @event can be replaced by assigning a new reference to it.
598 * This function is responsible for unreffing the old event when
599 * removing or modifying.
601 * Returns: %TRUE if the iteration should continue
603 typedef gboolean (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
608 * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
609 * @GST_PAD_FLAG_FLUSHING: is pad flushing
610 * @GST_PAD_FLAG_EOS: is pad in EOS state
611 * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
612 * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
613 * into the pad callbacks.
614 * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
615 * The flag has to be unset manually after
616 * reconfiguration happened.
617 * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
618 * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps. This means that
619 * once the caps are set on the pad, the default caps query function
620 * will only return those caps.
621 * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
622 * all events and queries to the internally linked pads
623 * instead of discarding them.
624 * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
625 * allocation queries to the internally linked pads
626 * instead of discarding them.
627 * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward
628 * scheduling queries to the internally linked pads
629 * instead of discarding them.
630 * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check
631 * it the caps intersect the query-caps result instead
632 * of checking for a subset. This is interesting for
633 * parsers that can accept incompletely specified caps.
634 * @GST_PAD_FLAG_ACCEPT_TEMPLATE: the default accept-caps handler will use
635 * the template pad caps instead of query caps to
636 * compare with the accept caps. Use this in combination
637 * with %GST_PAD_FLAG_ACCEPT_INTERSECT. (Since 1.6)
638 * @GST_PAD_FLAG_LAST: offset to define more flags
643 GST_PAD_FLAG_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
644 GST_PAD_FLAG_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
645 GST_PAD_FLAG_EOS = (GST_OBJECT_FLAG_LAST << 2),
646 GST_PAD_FLAG_BLOCKING = (GST_OBJECT_FLAG_LAST << 3),
647 GST_PAD_FLAG_NEED_PARENT = (GST_OBJECT_FLAG_LAST << 4),
648 GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
649 GST_PAD_FLAG_PENDING_EVENTS = (GST_OBJECT_FLAG_LAST << 6),
650 GST_PAD_FLAG_FIXED_CAPS = (GST_OBJECT_FLAG_LAST << 7),
651 GST_PAD_FLAG_PROXY_CAPS = (GST_OBJECT_FLAG_LAST << 8),
652 GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9),
653 GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10),
654 GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11),
655 GST_PAD_FLAG_ACCEPT_TEMPLATE = (GST_OBJECT_FLAG_LAST << 12),
657 GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
662 * @element_private: private data owned by the parent element
663 * @padtemplate: padtemplate for this pad
664 * @direction: the direction of the pad, cannot change after creating
667 * The #GstPad structure. Use the functions to update the variables.
673 gpointer element_private;
675 GstPadTemplate *padtemplate;
677 GstPadDirection direction;
680 /* streaming rec_lock */
681 GRecMutex stream_rec_lock;
684 /* block cond, mutex is from the object */
689 GstPadActivateFunction activatefunc;
690 gpointer activatedata;
691 GDestroyNotify activatenotify;
692 GstPadActivateModeFunction activatemodefunc;
693 gpointer activatemodedata;
694 GDestroyNotify activatemodenotify;
698 GstPadLinkFunction linkfunc;
700 GDestroyNotify linknotify;
701 GstPadUnlinkFunction unlinkfunc;
703 GDestroyNotify unlinknotify;
705 /* data transport functions */
706 GstPadChainFunction chainfunc;
708 GDestroyNotify chainnotify;
709 GstPadChainListFunction chainlistfunc;
710 gpointer chainlistdata;
711 GDestroyNotify chainlistnotify;
712 GstPadGetRangeFunction getrangefunc;
713 gpointer getrangedata;
714 GDestroyNotify getrangenotify;
715 GstPadEventFunction eventfunc;
717 GDestroyNotify eventnotify;
722 /* generic query method */
723 GstPadQueryFunction queryfunc;
725 GDestroyNotify querynotify;
728 GstPadIterIntLinkFunction iterintlinkfunc;
729 gpointer iterintlinkdata;
730 GDestroyNotify iterintlinknotify;
732 /* counts number of probes attached. */
739 gpointer _gst_reserved[GST_PADDING];
741 GstFlowReturn last_flowret;
746 struct _GstPadClass {
747 GstObjectClass parent_class;
749 /* signal callbacks */
750 void (*linked) (GstPad *pad, GstPad *peer);
751 void (*unlinked) (GstPad *pad, GstPad *peer);
754 gpointer _gst_reserved[GST_PADDING];
758 /***** helper macros *****/
765 * Get name of the given pad.
766 * No locking is performed in this function, use gst_pad_get_name() instead.
768 #define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
773 * Get the @pad parent.
774 * No locking is performed in this function, use gst_pad_get_parent() instead.
776 #define GST_PAD_PARENT(pad) (GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
778 * GST_PAD_ELEMENT_PRIVATE:
781 * Get the private data of @pad, which is usually some pad- or stream-specific
782 * structure created by the element and set on the pad when creating it.
783 * No locking is performed in this function.
785 #define GST_PAD_ELEMENT_PRIVATE(pad) (GST_PAD_CAST(pad)->element_private)
787 * GST_PAD_PAD_TEMPLATE:
790 * Get the @pad #GstPadTemplate. It describes the possible media types
791 * a @pad or an element factory can handle.
793 #define GST_PAD_PAD_TEMPLATE(pad) (GST_PAD_CAST(pad)->padtemplate)
798 * Get the #GstPadDirection of the given @pad. Accessor macro, use
799 * gst_pad_get_direction() instead.
801 #define GST_PAD_DIRECTION(pad) (GST_PAD_CAST(pad)->direction)
806 * Get the #GstTask of @pad. Accessor macro used by GStreamer. Use the
807 * gst_pad_start_task(), gst_pad_stop_task() and gst_pad_pause_task()
810 #define GST_PAD_TASK(pad) (GST_PAD_CAST(pad)->task)
815 * Get the #GstPadMode of pad, which will be GST_PAD_MODE_NONE if the pad
816 * has not been activated yet, and otherwise either GST_PAD_MODE_PUSH or
817 * GST_PAD_MODE_PULL depending on which mode the pad was activated in.
819 #define GST_PAD_MODE(pad) (GST_PAD_CAST(pad)->mode)
821 * GST_PAD_ACTIVATEFUNC:
824 * Get the #GstPadActivateFunction from @pad.
826 #define GST_PAD_ACTIVATEFUNC(pad) (GST_PAD_CAST(pad)->activatefunc)
828 * GST_PAD_ACTIVATEMODEFUNC:
831 * Get the #GstPadActivateModeFunction from the given @pad.
833 #define GST_PAD_ACTIVATEMODEFUNC(pad) (GST_PAD_CAST(pad)->activatemodefunc)
838 * Get the #GstPadChainFunction from the given @pad.
840 #define GST_PAD_CHAINFUNC(pad) (GST_PAD_CAST(pad)->chainfunc)
842 * GST_PAD_CHAINLISTFUNC:
845 * Get the #GstPadChainListFunction from the given @pad.
847 #define GST_PAD_CHAINLISTFUNC(pad) (GST_PAD_CAST(pad)->chainlistfunc)
849 * GST_PAD_GETRANGEFUNC:
852 * Get the #GstPadGetRangeFunction from the given @pad.
854 #define GST_PAD_GETRANGEFUNC(pad) (GST_PAD_CAST(pad)->getrangefunc)
859 * Get the #GstPadEventFunction from the given @pad, which
860 * is the function that handles events on the pad. You can
861 * use this to set your own event handling function on a pad
862 * after you create it. If your element derives from a base
863 * class, use the base class's virtual functions instead.
865 #define GST_PAD_EVENTFUNC(pad) (GST_PAD_CAST(pad)->eventfunc)
870 * Get the #GstPadQueryFunction from @pad, which is the function
871 * that handles queries on the pad. You can use this to set your
872 * own query handling function on a pad after you create it. If your
873 * element derives from a base class, use the base class's virtual
876 #define GST_PAD_QUERYFUNC(pad) (GST_PAD_CAST(pad)->queryfunc)
878 * GST_PAD_ITERINTLINKFUNC:
881 * Get the #GstPadIterIntLinkFunction from the given @pad.
883 #define GST_PAD_ITERINTLINKFUNC(pad) (GST_PAD_CAST(pad)->iterintlinkfunc)
888 * Return the pad's peer member. This member is a pointer to the linked @pad.
889 * No locking is performed in this function, use gst_pad_get_peer() instead.
891 #define GST_PAD_PEER(pad) (GST_PAD_CAST(pad)->peer)
896 * Get the #GstPadLinkFunction for the given @pad.
898 #define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
900 * GST_PAD_UNLINKFUNC:
903 * Get the #GstPadUnlinkFunction from the given @pad.
905 #define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
910 * Returns: %TRUE if the pad is a source pad (i.e. produces data).
912 #define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
917 * Returns: %TRUE if the pad is a sink pad (i.e. consumes data).
919 #define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
924 * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked()
927 #define GST_PAD_IS_LINKED(pad) (GST_PAD_PEER(pad) != NULL)
932 * Returns: %TRUE if the pad has been activated.
934 #define GST_PAD_IS_ACTIVE(pad) (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
936 * GST_PAD_IS_BLOCKED:
939 * Check if the dataflow on a @pad is blocked. Use gst_pad_is_blocked() instead.
941 #define GST_PAD_IS_BLOCKED(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
943 * GST_PAD_IS_BLOCKING:
946 * Check if the @pad is currently blocking on a buffer or event. Use
947 * gst_pad_is_blocking() instead.
949 #define GST_PAD_IS_BLOCKING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
951 * GST_PAD_IS_FLUSHING:
954 * Check if the given @pad is flushing.
956 #define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
958 * GST_PAD_SET_FLUSHING:
961 * Set the given @pad to flushing state, which means it will not accept any
962 * more events, queries or buffers, and return GST_FLOW_FLUSHING if any buffers
963 * are pushed on it. This usually happens when the pad is shut down or when
964 * a flushing seek happens. This is used inside GStreamer when flush start/stop
965 * events pass through pads, or when an element state is changed and pads are
966 * activated or deactivated.
968 #define GST_PAD_SET_FLUSHING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
970 * GST_PAD_UNSET_FLUSHING:
973 * Unset the flushing flag.
975 #define GST_PAD_UNSET_FLUSHING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
980 * Check if the @pad is in EOS state.
982 #define GST_PAD_IS_EOS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS))
984 * GST_PAD_NEEDS_RECONFIGURE:
987 * Check if the @pad should be reconfigured/renegotiated.
988 * The flag has to be unset manually after reconfiguration happened.
989 * Use gst_pad_needs_reconfigure() or gst_pad_check_reconfigure() instead.
991 #define GST_PAD_NEEDS_RECONFIGURE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
993 * GST_PAD_HAS_PENDING_EVENTS:
996 * Check if the given @pad has pending events. This is used internally by
999 #define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
1001 * GST_PAD_IS_FIXED_CAPS:
1004 * Check if the given @pad is using fixed caps, which means that
1005 * once the caps are set on the @pad, the caps query function will
1006 * only return those caps. See gst_pad_use_fixed_caps().
1008 #define GST_PAD_IS_FIXED_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
1010 * GST_PAD_NEEDS_PARENT:
1013 * Check if there is a parent object before calling into the @pad callbacks.
1014 * This is used internally by GStreamer.
1016 #define GST_PAD_NEEDS_PARENT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
1018 * GST_PAD_IS_PROXY_CAPS:
1021 * Check if the given @pad is set to proxy caps. This means that the default
1022 * event and query handler will forward all events and queries to the
1023 * internally linked @pads instead of discarding them.
1025 #define GST_PAD_IS_PROXY_CAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1027 * GST_PAD_SET_PROXY_CAPS:
1030 * Set @pad to proxy caps, so that all caps-related events and queries are
1031 * proxied down- or upstream to the other side of the element automatically.
1032 * Set this if the element always outputs data in the exact same format as it
1033 * receives as input. This is just for convenience to avoid implementing some
1034 * standard event and query handling code in an element.
1036 #define GST_PAD_SET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
1038 * GST_PAD_UNSET_PROXY_CAPS:
1041 * Unset proxy caps flag.
1043 #define GST_PAD_UNSET_PROXY_CAPS(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
1045 * GST_PAD_IS_PROXY_ALLOCATION:
1048 * Check if the given @pad is set as proxy allocation which means
1049 * that the default query handler will forward allocation queries to the
1050 * internally linked @pads instead of discarding them.
1052 #define GST_PAD_IS_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1054 * GST_PAD_SET_PROXY_ALLOCATION:
1057 * Set @pad to proxy allocation queries, which means that the default query
1058 * handler will forward allocation queries to the internally linked @pads
1059 * instead of discarding them.
1060 * Set this if the element always outputs data in the exact same format as it
1061 * receives as input. This is just for convenience to avoid implementing some
1062 * standard query handling code in an element.
1064 #define GST_PAD_SET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1066 * GST_PAD_UNSET_PROXY_ALLOCATION:
1069 * Unset proxy allocation flag.
1071 #define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
1073 * GST_PAD_IS_PROXY_SCHEDULING:
1076 * Check if the given @pad is set to proxy scheduling queries, which means that
1077 * the default query handler will forward scheduling queries to the internally
1078 * linked @pads instead of discarding them.
1080 #define GST_PAD_IS_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1082 * GST_PAD_SET_PROXY_SCHEDULING:
1085 * Set @pad to proxy scheduling queries, which means that the default query
1086 * handler will forward scheduling queries to the internally linked @pads
1087 * instead of discarding them. You will usually want to handle scheduling
1088 * queries explicitly if your element supports multiple scheduling modes.
1090 #define GST_PAD_SET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1092 * GST_PAD_UNSET_PROXY_SCHEDULING:
1095 * Unset proxy scheduling flag.
1097 #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING))
1099 * GST_PAD_IS_ACCEPT_INTERSECT:
1102 * Check if the pad's accept intersect flag is set. The default accept-caps
1103 * handler will check it the caps intersect the query-caps result instead of
1104 * checking for a subset. This is interesting for parser elements that can
1105 * accept incompletely specified caps.
1107 #define GST_PAD_IS_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1109 * GST_PAD_SET_ACCEPT_INTERSECT:
1112 * Set @pad to by default accept caps by intersecting the result instead of
1113 * checking for a subset. This is interesting for parser elements that can
1114 * accept incompletely specified caps.
1116 #define GST_PAD_SET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1118 * GST_PAD_UNSET_ACCEPT_INTERSECT:
1121 * Unset accept intersect flag.
1123 #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT))
1125 * GST_PAD_IS_ACCEPT_TEMPLATE:
1128 * Check if the pad's accept caps operation will use the pad template caps.
1129 * The default accept-caps will do a query caps to get the caps, which might
1130 * be querying downstream causing unnecessary overhead. It is recommended to
1131 * implement a proper accept-caps query handler or to use this flag to prevent
1132 * recursive accept-caps handling.
1136 #define GST_PAD_IS_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1138 * GST_PAD_SET_ACCEPT_TEMPLATE:
1141 * Set @pad to by default use the pad template caps to compare with
1142 * the accept caps instead of using a caps query result.
1146 #define GST_PAD_SET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1148 * GST_PAD_UNSET_ACCEPT_TEMPLATE:
1151 * Unset accept template flag.
1155 #define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE))
1157 * GST_PAD_GET_STREAM_LOCK:
1160 * Get the stream lock of @pad. The stream lock is protecting the
1161 * resources used in the data processing functions of @pad. Accessor
1162 * macro, use GST_PAD_STREAM_LOCK() and GST_PAD_STREAM_UNLOCK() instead
1163 * to take/release the pad's stream lock.
1165 #define GST_PAD_GET_STREAM_LOCK(pad) (&(GST_PAD_CAST(pad)->stream_rec_lock))
1167 * GST_PAD_STREAM_LOCK:
1170 * Take the pad's stream lock. The stream lock is recursive and will be taken
1171 * when buffers or serialized downstream events are pushed on a pad.
1173 #define GST_PAD_STREAM_LOCK(pad) g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
1175 * GST_PAD_STREAM_TRYLOCK:
1178 * Try to take the pad's stream lock, and return %TRUE if the lock could be
1179 * taken, and otherwise %FALSE.
1181 #define GST_PAD_STREAM_TRYLOCK(pad) g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
1183 * GST_PAD_STREAM_UNLOCK:
1186 * Release the pad's stream lock.
1188 #define GST_PAD_STREAM_UNLOCK(pad) g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
1190 * GST_PAD_LAST_FLOW_RETURN:
1193 * Gets the last flow return on this pad
1197 #define GST_PAD_LAST_FLOW_RETURN(pad) (GST_PAD_CAST(pad)->ABI.abi.last_flowret)
1199 #define GST_PAD_BLOCK_GET_COND(pad) (&GST_PAD_CAST(pad)->block_cond)
1200 #define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
1201 #define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
1202 #define GST_PAD_BLOCK_BROADCAST(pad) (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
1204 GType gst_pad_get_type (void);
1207 GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
1208 GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
1209 GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
1214 * @pad: the pad to get the name from
1216 * Get a copy of the name of the pad. g_free() after usage.
1220 #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
1222 * gst_pad_get_parent:
1223 * @pad: the pad to get the parent of
1225 * Get the parent of @pad. This function increases the refcount
1226 * of the parent object so you should gst_object_unref() it after usage.
1227 * Can return %NULL if the pad did not have a parent.
1231 * Returns: (nullable): the parent
1233 #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
1235 GstPadDirection gst_pad_get_direction (GstPad *pad);
1237 gboolean gst_pad_set_active (GstPad *pad, gboolean active);
1238 gboolean gst_pad_is_active (GstPad *pad);
1239 gboolean gst_pad_activate_mode (GstPad *pad, GstPadMode mode,
1242 gulong gst_pad_add_probe (GstPad *pad,
1243 GstPadProbeType mask,
1244 GstPadProbeCallback callback,
1246 GDestroyNotify destroy_data);
1247 void gst_pad_remove_probe (GstPad *pad, gulong id);
1249 gboolean gst_pad_is_blocked (GstPad *pad);
1250 gboolean gst_pad_is_blocking (GstPad *pad);
1252 void gst_pad_mark_reconfigure (GstPad *pad);
1253 gboolean gst_pad_needs_reconfigure (GstPad *pad);
1254 gboolean gst_pad_check_reconfigure (GstPad *pad);
1256 void gst_pad_set_element_private (GstPad *pad, gpointer priv);
1257 gpointer gst_pad_get_element_private (GstPad *pad);
1259 GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
1261 GstFlowReturn gst_pad_store_sticky_event (GstPad *pad, GstEvent *event);
1262 GstEvent* gst_pad_get_sticky_event (GstPad *pad, GstEventType event_type,
1264 void gst_pad_sticky_events_foreach (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
1266 /* data passing setup functions */
1267 void gst_pad_set_activate_function_full (GstPad *pad,
1268 GstPadActivateFunction activate,
1270 GDestroyNotify notify);
1271 void gst_pad_set_activatemode_function_full (GstPad *pad,
1272 GstPadActivateModeFunction activatemode,
1274 GDestroyNotify notify);
1275 /* data passing functions */
1276 void gst_pad_set_chain_function_full (GstPad *pad,
1277 GstPadChainFunction chain,
1279 GDestroyNotify notify);
1280 void gst_pad_set_chain_list_function_full (GstPad *pad,
1281 GstPadChainListFunction chainlist,
1283 GDestroyNotify notify);
1284 void gst_pad_set_getrange_function_full (GstPad *pad,
1285 GstPadGetRangeFunction get,
1287 GDestroyNotify notify);
1288 void gst_pad_set_event_function_full (GstPad *pad,
1289 GstPadEventFunction event,
1291 GDestroyNotify notify);
1293 #define gst_pad_set_activate_function(p,f) gst_pad_set_activate_function_full((p),(f),NULL,NULL)
1294 #define gst_pad_set_activatemode_function(p,f) gst_pad_set_activatemode_function_full((p),(f),NULL,NULL)
1295 #define gst_pad_set_chain_function(p,f) gst_pad_set_chain_function_full((p),(f),NULL,NULL)
1296 #define gst_pad_set_chain_list_function(p,f) gst_pad_set_chain_list_function_full((p),(f),NULL,NULL)
1297 #define gst_pad_set_getrange_function(p,f) gst_pad_set_getrange_function_full((p),(f),NULL,NULL)
1298 #define gst_pad_set_event_function(p,f) gst_pad_set_event_function_full((p),(f),NULL,NULL)
1301 void gst_pad_set_link_function_full (GstPad *pad,
1302 GstPadLinkFunction link,
1304 GDestroyNotify notify);
1305 void gst_pad_set_unlink_function_full (GstPad *pad,
1306 GstPadUnlinkFunction unlink,
1308 GDestroyNotify notify);
1310 #define gst_pad_set_link_function(p,f) gst_pad_set_link_function_full((p),(f),NULL,NULL)
1311 #define gst_pad_set_unlink_function(p,f) gst_pad_set_unlink_function_full((p),(f),NULL,NULL)
1313 gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad);
1314 GstPadLinkReturn gst_pad_link (GstPad *srcpad, GstPad *sinkpad);
1315 GstPadLinkReturn gst_pad_link_full (GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags);
1316 gboolean gst_pad_unlink (GstPad *srcpad, GstPad *sinkpad);
1317 gboolean gst_pad_is_linked (GstPad *pad);
1319 GstPad* gst_pad_get_peer (GstPad *pad);
1321 GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
1323 /* capsnego function for linked/unlinked pads */
1324 GstCaps * gst_pad_get_current_caps (GstPad * pad);
1325 gboolean gst_pad_has_current_caps (GstPad * pad);
1327 /* capsnego for linked pads */
1328 GstCaps * gst_pad_get_allowed_caps (GstPad * pad);
1331 gint64 gst_pad_get_offset (GstPad *pad);
1332 void gst_pad_set_offset (GstPad *pad, gint64 offset);
1334 /* data passing functions to peer */
1335 GstFlowReturn gst_pad_push (GstPad *pad, GstBuffer *buffer);
1336 GstFlowReturn gst_pad_push_list (GstPad *pad, GstBufferList *list);
1337 GstFlowReturn gst_pad_pull_range (GstPad *pad, guint64 offset, guint size,
1338 GstBuffer **buffer);
1339 gboolean gst_pad_push_event (GstPad *pad, GstEvent *event);
1340 gboolean gst_pad_event_default (GstPad *pad, GstObject *parent,
1342 GstFlowReturn gst_pad_get_last_flow_return (GstPad *pad);
1344 /* data passing functions on pad */
1345 GstFlowReturn gst_pad_chain (GstPad *pad, GstBuffer *buffer);
1346 GstFlowReturn gst_pad_chain_list (GstPad *pad, GstBufferList *list);
1347 GstFlowReturn gst_pad_get_range (GstPad *pad, guint64 offset, guint size,
1348 GstBuffer **buffer);
1349 gboolean gst_pad_send_event (GstPad *pad, GstEvent *event);
1352 gboolean gst_pad_start_task (GstPad *pad, GstTaskFunction func,
1353 gpointer user_data, GDestroyNotify notify);
1354 gboolean gst_pad_pause_task (GstPad *pad);
1355 gboolean gst_pad_stop_task (GstPad *pad);
1357 /* internal links */
1358 void gst_pad_set_iterate_internal_links_function_full (GstPad * pad,
1359 GstPadIterIntLinkFunction iterintlink,
1361 GDestroyNotify notify);
1362 GstIterator * gst_pad_iterate_internal_links (GstPad * pad);
1363 GstIterator * gst_pad_iterate_internal_links_default (GstPad * pad, GstObject *parent);
1365 #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL)
1367 /* generic query function */
1368 gboolean gst_pad_query (GstPad *pad, GstQuery *query);
1369 gboolean gst_pad_peer_query (GstPad *pad, GstQuery *query);
1370 void gst_pad_set_query_function_full (GstPad *pad, GstPadQueryFunction query,
1372 GDestroyNotify notify);
1373 gboolean gst_pad_query_default (GstPad *pad, GstObject *parent,
1376 #define gst_pad_set_query_function(p,f) gst_pad_set_query_function_full((p),(f),NULL,NULL)
1378 /* misc helper functions */
1379 gboolean gst_pad_forward (GstPad *pad, GstPadForwardFunction forward,
1380 gpointer user_data);
1384 #endif /* __GST_PAD_H__ */