gstpad.h 39.9 KB
Newer Older
1 2
/* GStreamer
 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3
 *                    2000 Wim Taymans <wim.taymans@chello.be>
4 5
 *
 * gstpad.h: Header for GstPad object
Erik Walthinsen's avatar
Erik Walthinsen committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */


#ifndef __GST_PAD_H__
#define __GST_PAD_H__

27
#include <gst/gstconfig.h>
28

Wim Taymans's avatar
Wim Taymans committed
29 30 31
typedef struct _GstPad GstPad;
typedef struct _GstPadPrivate GstPadPrivate;
typedef struct _GstPadClass GstPadClass;
Wim Taymans's avatar
Wim Taymans committed
32
typedef struct _GstPadProbeInfo GstPadProbeInfo;
Wim Taymans's avatar
Wim Taymans committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

/**
 * GstPadDirection:
 * @GST_PAD_UNKNOWN: direction is unknown.
 * @GST_PAD_SRC: the pad is a source pad.
 * @GST_PAD_SINK: the pad is a sink pad.
 *
 * The direction of a pad.
 */
typedef enum {
  GST_PAD_UNKNOWN,
  GST_PAD_SRC,
  GST_PAD_SINK
} GstPadDirection;

Wim Taymans's avatar
Wim Taymans committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
/**
 * GstPadMode:
 * @GST_PAD_MODE_NONE: Pad will not handle dataflow
 * @GST_PAD_MODE_PUSH: Pad handles dataflow in downstream push mode
 * @GST_PAD_MODE_PULL: Pad handles dataflow in upstream pull mode
 *
 * The status of a GstPad. After activating a pad, which usually happens when the
 * parent element goes from READY to PAUSED, the GstPadMode defines if the
 * pad operates in push or pull mode.
 */
typedef enum {
  GST_PAD_MODE_NONE,
  GST_PAD_MODE_PUSH,
  GST_PAD_MODE_PULL
} GstPadMode;

Erik Walthinsen's avatar
Erik Walthinsen committed
64 65
#include <gst/gstobject.h>
#include <gst/gstbuffer.h>
66
#include <gst/gstbufferlist.h>
67
#include <gst/gstcaps.h>
Wim Taymans's avatar
Wim Taymans committed
68
#include <gst/gstpadtemplate.h>
Wim Taymans's avatar
Wim Taymans committed
69
#include <gst/gstevent.h>
70
#include <gst/gstquery.h>
Wim Taymans's avatar
Wim Taymans committed
71
#include <gst/gsttask.h>
Erik Walthinsen's avatar
Erik Walthinsen committed
72

73 74
G_BEGIN_DECLS

75
/*
76 77
 * Pad base class
 */
78
#define GST_TYPE_PAD			(gst_pad_get_type ())
79
#define GST_IS_PAD(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD))
Wim Taymans's avatar
Wim Taymans committed
80
#define GST_IS_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD))
81 82
#define GST_PAD(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad))
#define GST_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass))
83
#define GST_PAD_CAST(obj)		((GstPad*)(obj))
84

85

86

87 88
/**
 * GstPadLinkReturn:
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
89 90 91 92 93 94 95
 * @GST_PAD_LINK_OK		: link succeeded
 * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent
 * @GST_PAD_LINK_WAS_LINKED	: pad was already linked
 * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction
 * @GST_PAD_LINK_NOFORMAT	: pads do not have common format
 * @GST_PAD_LINK_NOSCHED	: pads cannot cooperate in scheduling
 * @GST_PAD_LINK_REFUSED	: refused for some reason
Wim Taymans's avatar
Wim Taymans committed
96 97
 *
 * Result values from gst_pad_link and friends.
98
 */
99
typedef enum {
100 101 102 103 104 105
  GST_PAD_LINK_OK               =  0,
  GST_PAD_LINK_WRONG_HIERARCHY  = -1,
  GST_PAD_LINK_WAS_LINKED       = -2,
  GST_PAD_LINK_WRONG_DIRECTION  = -3,
  GST_PAD_LINK_NOFORMAT         = -4,
  GST_PAD_LINK_NOSCHED          = -5,
106
  GST_PAD_LINK_REFUSED          = -6
107
} GstPadLinkReturn;
108

109 110 111 112 113
/**
 * GST_PAD_LINK_FAILED:
 * @ret: the #GstPadLinkReturn value
 *
 * Macro to test if the given #GstPadLinkReturn value indicates a failed
114
 * link step.
115
 */
Wim Taymans's avatar
Wim Taymans committed
116
#define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK)
117 118 119 120 121

/**
 * GST_PAD_LINK_SUCCESSFUL:
 * @ret: the #GstPadLinkReturn value
 *
122
 * Macro to test if the given #GstPadLinkReturn value indicates a successful
123
 * link step.
124
 */
Wim Taymans's avatar
Wim Taymans committed
125
#define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK)
126

127 128
/**
 * GstFlowReturn:
129
 * @GST_FLOW_OK:		 Data passing was ok.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
130
 * @GST_FLOW_NOT_LINKED:	 Pad is not linked.
131
 * @GST_FLOW_FLUSHING:	         Pad is flushing.
132
 * @GST_FLOW_EOS:                Pad is EOS.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
133
 * @GST_FLOW_NOT_NEGOTIATED:	 Pad is not negotiated.
134 135 136
 * @GST_FLOW_ERROR:		 Some (fatal) error occured. Element generating
 *                               this error should post an error message with more
 *                               details.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
137
 * @GST_FLOW_NOT_SUPPORTED:	 This operation is not supported.
138 139 140 141 142 143 144
 * @GST_FLOW_CUSTOM_SUCCESS:	 Elements can use values starting from
 *                               this (and higher) to define custom success
 *                               codes. Since 0.10.7.
 * @GST_FLOW_CUSTOM_SUCCESS_1:	 Pre-defined custom success code (define your
 *                               custom success code to this to avoid compiler
 *                               warnings). Since 0.10.29.
 * @GST_FLOW_CUSTOM_SUCCESS_2:	 Pre-defined custom success code. Since 0.10.29.
145
 * @GST_FLOW_CUSTOM_ERROR:	 Elements can use values starting from
146 147 148 149 150 151
 *                               this (and lower) to define custom error codes.
 *                               Since 0.10.7.
 * @GST_FLOW_CUSTOM_ERROR_1:	 Pre-defined custom error code (define your
 *                               custom error code to this to avoid compiler
 *                               warnings). Since 0.10.29.
 * @GST_FLOW_CUSTOM_ERROR_2:	 Pre-defined custom error code. Since 0.10.29.
152
 *
153
 * The result of passing data to a pad.
154
 *
155
 * Note that the custom return values should not be exposed outside of the
156
 * element scope and are available since 0.10.7.
157
 */
158
/* FIXME 0.11: remove custom flow returns */
159
typedef enum {
160
  /* custom success starts here */
161 162
  GST_FLOW_CUSTOM_SUCCESS_2 = 102,
  GST_FLOW_CUSTOM_SUCCESS_1 = 101,
163 164
  GST_FLOW_CUSTOM_SUCCESS = 100,

165
  /* core predefined */
166
  GST_FLOW_OK		  =  0,
167
  /* expected failures */
168
  GST_FLOW_NOT_LINKED     = -1,
169
  GST_FLOW_FLUSHING       = -2,
170
  /* error cases */
171
  GST_FLOW_EOS            = -3,
172 173
  GST_FLOW_NOT_NEGOTIATED = -4,
  GST_FLOW_ERROR	  = -5,
174 175
  GST_FLOW_NOT_SUPPORTED  = -6,

176
  /* custom error starts here */
177 178 179
  GST_FLOW_CUSTOM_ERROR   = -100,
  GST_FLOW_CUSTOM_ERROR_1 = -101,
  GST_FLOW_CUSTOM_ERROR_2 = -102
180 181
} GstFlowReturn;

182
const gchar*	        gst_flow_get_name	(GstFlowReturn ret);
183 184
GQuark			gst_flow_to_quark	(GstFlowReturn ret);

185 186
/**
 * GstPadLinkCheck:
187 188
 * @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility.
 * @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents.
189
 *   Could be omitted if it is already known that the two elements that own the
Stefan Kost's avatar
Stefan Kost committed
190
 *   pads are in the same bin.
191 192 193 194
 * @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using
 *   their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
 *   would be unsafe e.g. if one pad has %GST_CAPS_ANY.
 * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
195
 *   caps returned by gst_pad_query_caps().
196 197 198 199 200 201 202 203 204 205 206
 *
 * The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS
 * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
 * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed.
 *
 * <warning><para>
 * Only disable some of the checks if you are 100% certain you know the link
 * will not fail because of hierarchy/caps compatibility failures. If uncertain,
 * use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods
 * for linking the pads.
 * </para></warning>
207
 *
208 209 210 211
 * Since: 0.10.30
 */

typedef enum {
212 213 214
  GST_PAD_LINK_CHECK_NOTHING       = 0,
  GST_PAD_LINK_CHECK_HIERARCHY     = 1 << 0,
  GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1,
215
  GST_PAD_LINK_CHECK_CAPS          = 1 << 2
216 217 218 219 220
} GstPadLinkCheck;

/**
 * GST_PAD_LINK_CHECK_DEFAULT:
 *
Stefan Kost's avatar
Stefan Kost committed
221
 * The default checks done when linking pads (i.e. the ones used by
222
 * gst_pad_link()).
223 224 225
 *
 * Since: 0.10.30
 */
226
#define GST_PAD_LINK_CHECK_DEFAULT ((GstPadLinkCheck) (GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS))
227

228
/* pad states */
Wim Taymans's avatar
Wim Taymans committed
229 230 231
/**
 * GstPadActivateFunction:
 * @pad: a #GstPad
Wim Taymans's avatar
Wim Taymans committed
232
 * @parent: the parent of @pad
Wim Taymans's avatar
Wim Taymans committed
233 234 235 236 237 238 239 240
 *
 * This function is called when the pad is activated during the element
 * READY to PAUSED state change. By default this function will call the
 * activate function that puts the pad in push mode but elements can
 * override this function to activate the pad in pull mode if they wish.
 *
 * Returns: TRUE if the pad could be activated.
 */
241
typedef gboolean		(*GstPadActivateFunction)	(GstPad *pad, GstObject *parent);
Wim Taymans's avatar
Wim Taymans committed
242 243 244
/**
 * GstPadActivateModeFunction:
 * @pad: a #GstPad
Wim Taymans's avatar
Wim Taymans committed
245
 * @parent: the parent of @pad
246
 * @mode: the requested activation mode of @pad
Wim Taymans's avatar
Wim Taymans committed
247 248
 * @active: activate or deactivate the pad.
 *
249
 * The prototype of the push and pull activate functions.
Wim Taymans's avatar
Wim Taymans committed
250 251 252
 *
 * Returns: TRUE if the pad could be activated or deactivated.
 */
253
typedef gboolean		(*GstPadActivateModeFunction)	(GstPad *pad, GstObject *parent,
254
                                                                 GstPadMode mode, gboolean active);
255

256

Wim Taymans's avatar
Wim Taymans committed
257
/* data passing */
258 259
/**
 * GstPadChainFunction:
260
 * @pad: the sink #GstPad that performed the chain.
261 262 263
 * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
 *          @parent is guaranteed to be not-NULL and remain valid during the
 *          execution of this function.
264
 * @buffer: the #GstBuffer that is chained, not %NULL.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
265
 *
Wim Taymans's avatar
Wim Taymans committed
266
 * A function that will be called on sinkpads when chaining buffers.
267
 * The function typically processes the data contained in the buffer and
268
 * either consumes the data or passes it on to the internally linked pad(s).
269
 *
270 271 272 273
 * The implementer of this function receives a refcount to @buffer and should
 * gst_buffer_unref() when the buffer is no longer needed.
 *
 * When a chain function detects an error in the data stream, it must post an
274
 * error on the bus and return an appropriate #GstFlowReturn value.
275 276
 *
 * Returns: #GST_FLOW_OK for success
277
 */
278 279
typedef GstFlowReturn		(*GstPadChainFunction)		(GstPad *pad, GstObject *parent,
                                                                 GstBuffer *buffer);
280 281 282 283

/**
 * GstPadChainListFunction:
 * @pad: the sink #GstPad that performed the chain.
284 285 286
 * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
 *          @parent is guaranteed to be not-NULL and remain valid during the
 *          execution of this function.
287 288 289 290 291 292 293 294 295 296 297 298 299 300
 * @list: the #GstBufferList that is chained, not %NULL.
 *
 * A function that will be called on sinkpads when chaining buffer lists.
 * The function typically processes the data contained in the buffer list and
 * either consumes the data or passes it on to the internally linked pad(s).
 *
 * The implementer of this function receives a refcount to @list and
 * should gst_buffer_list_unref() when the list is no longer needed.
 *
 * When a chainlist function detects an error in the data stream, it must
 * post an error on the bus and return an appropriate #GstFlowReturn value.
 *
 * Returns: #GST_FLOW_OK for success
 */
301 302
typedef GstFlowReturn		(*GstPadChainListFunction)	(GstPad *pad, GstObject *parent,
                                                                 GstBufferList *list);
303

Wim Taymans's avatar
Wim Taymans committed
304 305
/**
 * GstPadGetRangeFunction:
306
 * @pad: the src #GstPad to perform the getrange on.
307 308 309
 * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
 *          @parent is guaranteed to be not-NULL and remain valid during the
 *          execution of this function.
Wim Taymans's avatar
Wim Taymans committed
310 311
 * @offset: the offset of the range
 * @length: the length of the range
312
 * @buffer: a memory location to hold the result buffer, cannot be NULL.
Wim Taymans's avatar
Wim Taymans committed
313
 *
314 315
 * This function will be called on source pads when a peer element
 * request a buffer at the specified @offset and @length. If this function
316
 * returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The
Wim Taymans's avatar
Wim Taymans committed
317 318
 * contents of @buffer is invalid for any other return value.
 *
319
 * This function is installed on a source pad with
320
 * gst_pad_set_getrange_function() and can only be called on source pads after
321 322 323 324 325
 * they are successfully activated with gst_pad_activate_pull().
 *
 * @offset and @length are always given in byte units. @offset must normally be a value
 * between 0 and the length in bytes of the data available on @pad. The
 * length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a
326
 * #GST_QUERY_SEEKING.
327 328
 *
 * Any @offset larger or equal than the length will make the function return
Wim Taymans's avatar
Wim Taymans committed
329
 * #GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not
330 331
 * contain a valid buffer.
 *
332 333 334
 * The buffer size of @buffer will only be smaller than @length when @offset is
 * near the end of the stream. In all other cases, the size of @buffer must be
 * exactly the requested size.
335
 *
336
 * It is allowed to call this function with a 0 @length and valid @offset, in
337 338 339 340
 * which case @buffer will contain a 0-sized buffer and the function returns
 * #GST_FLOW_OK.
 *
 * When this function is called with a -1 @offset, the sequentially next buffer
341
 * of length @length in the stream is returned.
342 343 344 345 346
 *
 * When this function is called with a -1 @length, a buffer with a default
 * optimal length is returned in @buffer. The length might depend on the value
 * of @offset.
 *
347 348
 * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other
 * return value leaves @buffer undefined.
Wim Taymans's avatar
Wim Taymans committed
349
 */
350 351 352
typedef GstFlowReturn		(*GstPadGetRangeFunction)	(GstPad *pad, GstObject *parent,
                                                                 guint64 offset, guint length,
                                                                 GstBuffer **buffer);
353 354 355 356

/**
 * GstPadEventFunction:
 * @pad: the #GstPad to handle the event.
357 358 359
 * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
 *          @parent is guaranteed to be not-NULL and remain valid during the
 *          execution of this function.
360 361 362 363 364 365
 * @event: the #GstEvent to handle.
 *
 * Function signature to handle an event for the pad.
 *
 * Returns: TRUE if the pad could handle the event.
 */
366 367
typedef gboolean		(*GstPadEventFunction)		(GstPad *pad, GstObject *parent,
                                                                 GstEvent *event);
368

369

370
/* internal links */
371 372 373
/**
 * GstPadIterIntLinkFunction:
 * @pad: The #GstPad to query.
Wim Taymans's avatar
Wim Taymans committed
374 375 376
 * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
 *          @parent is guaranteed to be not-NULL and remain valid during the
 *          execution of this function.
377 378 379 380 381 382 383 384 385 386
 *
 * The signature of the internal pad link iterator function.
 *
 * Returns: a new #GstIterator that will iterate over all pads that are
 * linked to the given pad on the inside of the parent element.
 *
 * the caller must call gst_iterator_free() after usage.
 *
 * Since 0.10.21
 */
Wim Taymans's avatar
Wim Taymans committed
387
typedef GstIterator*           (*GstPadIterIntLinkFunction)    (GstPad *pad, GstObject *parent);
388

Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
389
/* generic query function */
390 391 392
/**
 * GstPadQueryFunction:
 * @pad: the #GstPad to query.
393 394 395
 * @parent: the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT flag is set,
 *          @parent is guaranteed to be not-NULL and remain valid during the
 *          execution of this function.
396
 * @query: the #GstQuery object to execute
397
 *
398
 * The signature of the query function.
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
399
 *
400 401
 * Returns: TRUE if the query could be performed.
 */
402 403
typedef gboolean		(*GstPadQueryFunction)		(GstPad *pad, GstObject *parent,
                                                                 GstQuery *query);
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
404

405

406
/* linking */
407 408 409 410 411 412 413 414 415
/**
 * GstPadLinkFunction
 * @pad: the #GstPad that is linked.
 * @peer: the peer #GstPad of the link
 *
 * Function signature to handle a new link on the pad.
 *
 * Returns: the result of the link with the specified peer.
 */
416
typedef GstPadLinkReturn	(*GstPadLinkFunction)		(GstPad *pad, GstPad *peer);
417 418 419 420 421 422
/**
 * GstPadUnlinkFunction
 * @pad: the #GstPad that is linked.
 *
 * Function signature to handle a unlinking the pad prom its peer.
 */
423
typedef void			(*GstPadUnlinkFunction)		(GstPad *pad);
424

425

426
/* misc */
427
/**
428 429 430
 * GstPadForwardFunction:
 * @pad: the #GstPad that is forwarded.
 * @user_data: the gpointer to optional user data.
431
 *
432 433
 * A forward function is called for all internally linked pads, see
 * gst_pad_forward().
434 435 436
 *
 * Returns: TRUE if the dispatching procedure has to be stopped.
 */
437
typedef gboolean		(*GstPadForwardFunction)	(GstPad *pad, gpointer user_data);
Wim Taymans's avatar
Wim Taymans committed
438

439
/**
440 441 442 443 444 445
 * GstPadProbeType:
 * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type
 * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block
 * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
 * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
 * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
Wim Taymans's avatar
Wim Taymans committed
446 447
 * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
 * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
448 449 450 451
 * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be
 *     explicitly enabled and is not included in the
 *     @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or
 *     @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types.
452 453
 * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries
 * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries
454 455
 * @GST_PAD_PROBE_TYPE_PUSH: probe push
 * @GST_PAD_PROBE_TYPE_PULL: probe pull
456
 *
Wim Taymans's avatar
Wim Taymans committed
457
 * The different probing types that can occur. When either one of
458
 * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a
Wim Taymans's avatar
Wim Taymans committed
459
 * blocking probe.
460 461 462
 */
typedef enum
{
Wim Taymans's avatar
Wim Taymans committed
463
  GST_PAD_PROBE_TYPE_INVALID          = 0,
Wim Taymans's avatar
Wim Taymans committed
464
  /* flags to control blocking */
Wim Taymans's avatar
Wim Taymans committed
465 466
  GST_PAD_PROBE_TYPE_IDLE             = (1 << 0),
  GST_PAD_PROBE_TYPE_BLOCK            = (1 << 1),
Wim Taymans's avatar
Wim Taymans committed
467
  /* flags to select datatypes */
468 469 470 471
  GST_PAD_PROBE_TYPE_BUFFER           = (1 << 4),
  GST_PAD_PROBE_TYPE_BUFFER_LIST      = (1 << 5),
  GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6),
  GST_PAD_PROBE_TYPE_EVENT_UPSTREAM   = (1 << 7),
472 473 474
  GST_PAD_PROBE_TYPE_EVENT_FLUSH      = (1 << 8),
  GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9),
  GST_PAD_PROBE_TYPE_QUERY_UPSTREAM   = (1 << 10),
Wim Taymans's avatar
Wim Taymans committed
475
  /* flags to select scheduling mode */
476
  GST_PAD_PROBE_TYPE_PUSH             = (1 << 12),
477
  GST_PAD_PROBE_TYPE_PULL             = (1 << 13)
478
} GstPadProbeType;
479

Wim Taymans's avatar
Wim Taymans committed
480 481 482 483 484 485 486 487 488 489
#define GST_PAD_PROBE_TYPE_BLOCKING         (GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK)
#define GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM (GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM)
#define GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM   (GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM)
#define GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM  (GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | \
                                             GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM)
#define GST_PAD_PROBE_TYPE_DATA_UPSTREAM    (GST_PAD_PROBE_TYPE_EVENT_UPSTREAM)
#define GST_PAD_PROBE_TYPE_DATA_BOTH        (GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | \
                                             GST_PAD_PROBE_TYPE_DATA_UPSTREAM)
#define GST_PAD_PROBE_TYPE_EVENT_BOTH       (GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | \
                                             GST_PAD_PROBE_TYPE_EVENT_UPSTREAM)
Wim Taymans's avatar
Wim Taymans committed
490 491 492 493
#define GST_PAD_PROBE_TYPE_QUERY_BOTH       (GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | \
                                             GST_PAD_PROBE_TYPE_QUERY_UPSTREAM)
#define GST_PAD_PROBE_TYPE_ALL_BOTH         (GST_PAD_PROBE_TYPE_DATA_BOTH | \
                                             GST_PAD_PROBE_TYPE_QUERY_BOTH)
Wim Taymans's avatar
Wim Taymans committed
494
#define GST_PAD_PROBE_TYPE_SCHEDULING       (GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL)
495 496

/**
497 498
 * GstPadProbeReturn:
 * @GST_PAD_PROBE_OK: normal probe return value
499 500 501 502
 * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that
 *        the data item is not sent downstream. For pull mode, it means that the
 *        data item is not passed upstream. In both cases, this result code
 *        returns #GST_FLOW_OK or %TRUE to the caller.
503 504
 * @GST_PAD_PROBE_REMOVE: remove probe
 * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on
505
 *                         the next item
506
 *
Edward Hervey's avatar
Edward Hervey committed
507
 * Different return values for the #GstPadProbeCallback.
508 509 510
 */
typedef enum
{
511 512 513 514 515
  GST_PAD_PROBE_DROP,
  GST_PAD_PROBE_OK,
  GST_PAD_PROBE_REMOVE,
  GST_PAD_PROBE_PASS,
} GstPadProbeReturn;
516

Wim Taymans's avatar
Wim Taymans committed
517 518 519 520

/**
 * GstPadProbeInfo:
 * @type: the current probe type
Wim Taymans's avatar
Wim Taymans committed
521
 * @id: the id of the probe
Wim Taymans's avatar
Wim Taymans committed
522 523 524 525 526 527
 * @data: type specific data, check the @type field to know the datatype.
 *    This field can be NULL.
 * @offset: offset of pull probe, this field is valid when @type contains
 *    #GST_PAD_PROBE_TYPE_PULL
 * @size: size of pull probe, this field is valid when @type contains
 *    #GST_PAD_PROBE_TYPE_PULL
Wim Taymans's avatar
Wim Taymans committed
528 529 530
 *
 * Info passed in the #GstPadProbeCallback.
 */
Wim Taymans's avatar
Wim Taymans committed
531
struct _GstPadProbeInfo
Wim Taymans's avatar
Wim Taymans committed
532 533
{
  GstPadProbeType type;
Wim Taymans's avatar
Wim Taymans committed
534
  gulong id;
Wim Taymans's avatar
Wim Taymans committed
535
  gpointer data;
Wim Taymans's avatar
Wim Taymans committed
536 537
  guint64 offset;
  guint size;
Wim Taymans's avatar
Wim Taymans committed
538

Wim Taymans's avatar
Wim Taymans committed
539
  /*< private >*/
Wim Taymans's avatar
Wim Taymans committed
540
  gpointer _gst_reserved[GST_PADDING];
Wim Taymans's avatar
Wim Taymans committed
541
};
Wim Taymans's avatar
Wim Taymans committed
542 543

#define GST_PAD_PROBE_INFO_TYPE(d)         ((d)->type)
Wim Taymans's avatar
Wim Taymans committed
544
#define GST_PAD_PROBE_INFO_ID(d)           ((d)->id)
Wim Taymans's avatar
Wim Taymans committed
545 546 547 548 549
#define GST_PAD_PROBE_INFO_DATA(d)         ((d)->data)

#define GST_PAD_PROBE_INFO_BUFFER(d)       GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d))
#define GST_PAD_PROBE_INFO_BUFFER_LIST(d)  GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d))
#define GST_PAD_PROBE_INFO_EVENT(d)        GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d))
550
#define GST_PAD_PROBE_INFO_QUERY(d)        GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d))
Wim Taymans's avatar
Wim Taymans committed
551

Wim Taymans's avatar
Wim Taymans committed
552 553 554
#define GST_PAD_PROBE_INFO_OFFSET(d)       ((d)->offset)
#define GST_PAD_PROBE_INFO_SIZE(d)         ((d)->size)

Stefan Kost's avatar
Stefan Kost committed
555
/**
556
 * GstPadProbeCallback
557
 * @pad: the #GstPad that is blocked
Wim Taymans's avatar
Wim Taymans committed
558
 * @info: #GstPadProbeInfo
Stefan Kost's avatar
Stefan Kost committed
559 560
 * @user_data: the gpointer to optional user data.
 *
561
 * Callback used by gst_pad_add_probe(). Gets called to notify about the current
562
 * blocking type.
Wim Taymans's avatar
Wim Taymans committed
563 564
 *
 * The callback is allowed to modify the data pointer in @info.
Stefan Kost's avatar
Stefan Kost committed
565
 */
Wim Taymans's avatar
Wim Taymans committed
566 567
typedef GstPadProbeReturn   (*GstPadProbeCallback)   (GstPad *pad, GstPadProbeInfo *info,
                                                      gpointer user_data);
568

569 570 571
/**
 * GstPadStickyEventsForeachFunction:
 * @pad: the #GstPad.
Wim Taymans's avatar
Wim Taymans committed
572
 * @event: a sticky #GstEvent.
573 574 575 576
 * @user_data: the #gpointer to optional user data.
 *
 * Callback used by gst_pad_sticky_events_foreach().
 *
Wim Taymans's avatar
Wim Taymans committed
577 578 579 580 581 582 583 584 585
 * When this function returns %TRUE, the next event will be
 * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return.
 *
 * When @event is set to NULL, the item will be removed from the list of sticky events.
 * When @event has been made writable, the new buffer reference can be assigned
 * to @event. This function is responsible for unreffing the old event when
 * removing or modifying.
 *
 * Returns: %TRUE if the iteration should continue
586
 */
Wim Taymans's avatar
Wim Taymans committed
587 588
typedef gboolean  (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event,
                                                        gpointer user_data);
589

590 591
/**
 * GstPadFlags:
592 593 594
 * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked
 * @GST_PAD_FLAG_FLUSHING: is pad refusing buffers
 * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event
595 596
 * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling
 *                       into the pad callbacks.
597
 * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
598 599
 *                            The flag has to be unset manually after
 *                            reconfiguration happened.
Wim Taymans's avatar
Wim Taymans committed
600
 * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events
601
 * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps this means that once the
602
 *                      caps are set on the pad, the caps query function only
603
 *                      returns those caps.
604
 * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward
605 606
 *                      all events and queries to the internally linked pads
 *                      instead of discarding them.
607 608 609
 * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward
 *                      allocation queries to the internally linked pads
 *                      instead of discarding them.
610 611 612 613
 * @GST_PAD_FLAG_LAST: offset to define more flags
 *
 * Pad state flags
 */
614
typedef enum {
615 616 617
  GST_PAD_FLAG_BLOCKED          = (GST_OBJECT_FLAG_LAST << 0),
  GST_PAD_FLAG_FLUSHING         = (GST_OBJECT_FLAG_LAST << 1),
  GST_PAD_FLAG_BLOCKING         = (GST_OBJECT_FLAG_LAST << 2),
618 619 620 621 622 623
  GST_PAD_FLAG_NEED_PARENT      = (GST_OBJECT_FLAG_LAST << 3),
  GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 4),
  GST_PAD_FLAG_PENDING_EVENTS   = (GST_OBJECT_FLAG_LAST << 5),
  GST_PAD_FLAG_FIXED_CAPS       = (GST_OBJECT_FLAG_LAST << 6),
  GST_PAD_FLAG_PROXY_CAPS       = (GST_OBJECT_FLAG_LAST << 7),
  GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 8),
624
  /* padding */
625
  GST_PAD_FLAG_LAST        = (GST_OBJECT_FLAG_LAST << 16)
626
} GstPadFlags;
627

Wim Taymans's avatar
Wim Taymans committed
628 629 630 631 632 633
/**
 * GstPad:
 * @element_private: private data owned by the parent element
 * @padtemplate: padtemplate for this pad
 * @direction: the direction of the pad, cannot change after creating
 *             the pad.
634
 *
Wim Taymans's avatar
Wim Taymans committed
635 636
 * The #GstPad structure. Use the functions to update the variables.
 */
637
struct _GstPad {
Wim Taymans's avatar
Wim Taymans committed
638
  GstObject                      object;
Erik Walthinsen's avatar
Erik Walthinsen committed
639

Wim Taymans's avatar
Wim Taymans committed
640
  /*< public >*/
Wim Taymans's avatar
Wim Taymans committed
641
  gpointer                       element_private;
Erik Walthinsen's avatar
Erik Walthinsen committed
642

Wim Taymans's avatar
Wim Taymans committed
643
  GstPadTemplate                *padtemplate;
644

Wim Taymans's avatar
Wim Taymans committed
645
  GstPadDirection                direction;
646

647
  /*< private >*/
Wim Taymans's avatar
Wim Taymans committed
648
  /* streaming rec_lock */
Wim Taymans's avatar
Wim Taymans committed
649
  GRecMutex		         stream_rec_lock;
Wim Taymans's avatar
Wim Taymans committed
650 651 652
  GstTask			*task;

  /* block cond, mutex is from the object */
Wim Taymans's avatar
Wim Taymans committed
653
  GCond				 block_cond;
654
  GHookList                      probes;
Wim Taymans's avatar
Wim Taymans committed
655

Wim Taymans's avatar
Wim Taymans committed
656
  GstPadMode		         mode;
Wim Taymans's avatar
Wim Taymans committed
657
  GstPadActivateFunction	 activatefunc;
658
  gpointer                       activatedata;
659
  GDestroyNotify                 activatenotify;
660
  GstPadActivateModeFunction	 activatemodefunc;
661
  gpointer                       activatemodedata;
662
  GDestroyNotify                 activatemodenotify;
Erik Walthinsen's avatar
Erik Walthinsen committed
663

664
  /* pad link */
Wim Taymans's avatar
Wim Taymans committed
665
  GstPad			*peer;
666
  GstPadLinkFunction		 linkfunc;
667
  gpointer                       linkdata;
668
  GDestroyNotify                 linknotify;
669
  GstPadUnlinkFunction		 unlinkfunc;
670
  gpointer                       unlinkdata;
671
  GDestroyNotify                 unlinknotify;
Erik Walthinsen's avatar
Erik Walthinsen committed
672

673
  /* data transport functions */
674
  GstPadChainFunction		 chainfunc;
675
  gpointer                       chaindata;
676
  GDestroyNotify                 chainnotify;
Wim Taymans's avatar
Wim Taymans committed
677
  GstPadChainListFunction        chainlistfunc;
678
  gpointer                       chainlistdata;
679
  GDestroyNotify                 chainlistnotify;
680
  GstPadGetRangeFunction	 getrangefunc;
681
  gpointer                       getrangedata;
682
  GDestroyNotify                 getrangenotify;
683
  GstPadEventFunction		 eventfunc;
684
  gpointer                       eventdata;
685
  GDestroyNotify                 eventnotify;
686

687 688 689
  /* pad offset */
  gint64                         offset;

690 691
  /* generic query method */
  GstPadQueryFunction		 queryfunc;
692
  gpointer                       querydata;
693
  GDestroyNotify                 querynotify;
694 695

  /* internal links */
Wim Taymans's avatar
Wim Taymans committed
696
  GstPadIterIntLinkFunction      iterintlinkfunc;
697
  gpointer                       iterintlinkdata;
698
  GDestroyNotify                 iterintlinknotify;
699

700
  /* counts number of probes attached. */
701
  gint				 num_probes;
702
  gint				 num_blocked;
703

Wim Taymans's avatar
Wim Taymans committed
704 705 706
  GstPadPrivate                 *priv;

  gpointer _gst_reserved[GST_PADDING];
Erik Walthinsen's avatar
Erik Walthinsen committed
707 708
};

709 710
struct _GstPadClass {
  GstObjectClass	parent_class;
711 712

  /* signal callbacks */
713 714
  void		(*linked)		(GstPad *pad, GstPad *peer);
  void		(*unlinked)		(GstPad *pad, GstPad *peer);
715 716

  /*< private >*/
717
  gpointer _gst_reserved[GST_PADDING];
Erik Walthinsen's avatar
Erik Walthinsen committed
718 719
};

720 721 722

/***** helper macros *****/
/* GstPad */
723
#define GST_PAD_NAME(pad)		(GST_OBJECT_NAME(pad))
724
#define GST_PAD_PARENT(pad)		(GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad)))
Wim Taymans's avatar
Wim Taymans committed
725
#define GST_PAD_ELEMENT_PRIVATE(pad)    (GST_PAD_CAST(pad)->element_private)
726
#define GST_PAD_PAD_TEMPLATE(pad)	(GST_PAD_CAST(pad)->padtemplate)
727 728
#define GST_PAD_DIRECTION(pad)		(GST_PAD_CAST(pad)->direction)
#define GST_PAD_TASK(pad)		(GST_PAD_CAST(pad)->task)
Wim Taymans's avatar
Wim Taymans committed
729
#define GST_PAD_MODE(pad)	        (GST_PAD_CAST(pad)->mode)
730 731

#define GST_PAD_ACTIVATEFUNC(pad)	(GST_PAD_CAST(pad)->activatefunc)
732
#define GST_PAD_ACTIVATEMODEFUNC(pad)	(GST_PAD_CAST(pad)->activatemodefunc)
733
#define GST_PAD_CHAINFUNC(pad)		(GST_PAD_CAST(pad)->chainfunc)
Wim Taymans's avatar
Wim Taymans committed
734
#define GST_PAD_CHAINLISTFUNC(pad)      (GST_PAD_CAST(pad)->chainlistfunc)
735 736 737
#define GST_PAD_GETRANGEFUNC(pad)	(GST_PAD_CAST(pad)->getrangefunc)
#define GST_PAD_EVENTFUNC(pad)		(GST_PAD_CAST(pad)->eventfunc)
#define GST_PAD_QUERYFUNC(pad)		(GST_PAD_CAST(pad)->queryfunc)
738
#define GST_PAD_ITERINTLINKFUNC(pad)    (GST_PAD_CAST(pad)->iterintlinkfunc)
739 740 741 742 743

#define GST_PAD_PEER(pad)		(GST_PAD_CAST(pad)->peer)
#define GST_PAD_LINKFUNC(pad)		(GST_PAD_CAST(pad)->linkfunc)
#define GST_PAD_UNLINKFUNC(pad)		(GST_PAD_CAST(pad)->unlinkfunc)

744 745 746
#define GST_PAD_IS_SRC(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
#define GST_PAD_IS_SINK(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SINK)

747
#define GST_PAD_IS_LINKED(pad)		(GST_PAD_PEER(pad) != NULL)
748

Wim Taymans's avatar
Wim Taymans committed
749
#define GST_PAD_IS_ACTIVE(pad)          (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE)
Wim Taymans's avatar
Wim Taymans committed
750

751 752
#define GST_PAD_IS_BLOCKED(pad)		(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED))
#define GST_PAD_IS_BLOCKING(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING))
Wim Taymans's avatar
Wim Taymans committed
753

754 755 756
#define GST_PAD_IS_FLUSHING(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING))
#define GST_PAD_SET_FLUSHING(pad)	(GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING))
#define GST_PAD_UNSET_FLUSHING(pad)	(GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING))
Wim Taymans's avatar
Wim Taymans committed
757

758
#define GST_PAD_NEEDS_RECONFIGURE(pad)  (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE))
Wim Taymans's avatar
Wim Taymans committed
759
#define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS))
760 761
#define GST_PAD_IS_FIXED_CAPS(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS))
#define GST_PAD_NEEDS_PARENT(pad)       (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT))
762

763 764 765
#define GST_PAD_IS_PROXY_CAPS(pad)      (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
#define GST_PAD_SET_PROXY_CAPS(pad)     (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS))
#define GST_PAD_UNSET_PROXY_CAPS(pad)   (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS))
766

767 768 769 770
#define GST_PAD_IS_PROXY_ALLOCATION(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
#define GST_PAD_SET_PROXY_ALLOCATION(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))
#define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION))

Wim Taymans's avatar
Wim Taymans committed
771 772 773 774 775 776 777
/**
 * GST_PAD_GET_STREAM_LOCK:
 * @pad: a #GstPad
 *
 * Get the stream lock of @pad. The stream lock is protecting the
 * resources used in the data processing functions of @pad.
 */
778
#define GST_PAD_GET_STREAM_LOCK(pad)    (&(GST_PAD_CAST(pad)->stream_rec_lock))
Wim Taymans's avatar
Wim Taymans committed
779 780 781 782 783 784
/**
 * GST_PAD_STREAM_LOCK:
 * @pad: a #GstPad
 *
 * Lock the stream lock of @pad.
 */
785
#define GST_PAD_STREAM_LOCK(pad)        g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad))
Wim Taymans's avatar
Wim Taymans committed
786 787 788 789 790 791 792
/**
 * GST_PAD_STREAM_TRYLOCK:
 * @pad: a #GstPad
 *
 * Try to Lock the stream lock of the pad, return TRUE if the lock could be
 * taken.
 */
793
#define GST_PAD_STREAM_TRYLOCK(pad)     g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad))
Wim Taymans's avatar
Wim Taymans committed
794 795 796 797 798 799
/**
 * GST_PAD_STREAM_UNLOCK:
 * @pad: a #GstPad
 *
 * Unlock the stream lock of @pad.
 */
800
#define GST_PAD_STREAM_UNLOCK(pad)      g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad))
801

Wim Taymans's avatar
Wim Taymans committed
802
#define GST_PAD_BLOCK_GET_COND(pad)     (&GST_PAD_CAST(pad)->block_cond)
803
#define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
Wim Taymans's avatar
Wim Taymans committed
804
#define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
805
#define GST_PAD_BLOCK_BROADCAST(pad)    (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
Wim Taymans's avatar
Wim Taymans committed
806

807
GType			gst_pad_get_type			(void);
808

809
/* creating pads */
810 811
GstPad*			gst_pad_new				(const gchar *name, GstPadDirection direction);
GstPad*			gst_pad_new_from_template		(GstPadTemplate *templ, const gchar *name);
812 813
GstPad*			gst_pad_new_from_static_template	(GstStaticPadTemplate *templ, const gchar *name);

814

Stefan Kost's avatar
Stefan Kost committed
815 816 817 818
/**
 * gst_pad_get_name:
 * @pad: the pad to get the name from
 *
Wim Taymans's avatar
Wim Taymans committed
819
 * Get a copy of the name of the pad. g_free() after usage.
Stefan Kost's avatar
Stefan Kost committed
820 821 822
 *
 * MT safe.
 */
823
#define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad))
Stefan Kost's avatar
Stefan Kost committed
824 825 826 827
/**
 * gst_pad_get_parent:
 * @pad: the pad to get the parent of
 *
Wim Taymans's avatar
Wim Taymans committed
828
 * Get the parent of @pad. This function increases the refcount
Stefan Kost's avatar
Stefan Kost committed
829
 * of the parent object so you should gst_object_unref() it after usage.
Wim Taymans's avatar
Wim Taymans committed
830
 * Can return NULL if the pad did not have a parent.
Stefan Kost's avatar
Stefan Kost committed
831 832 833
 *
 * MT safe.
 */
Wim Taymans's avatar
Wim Taymans committed
834
#define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad))
835

836
GstPadDirection		gst_pad_get_direction			(GstPad *pad);
Erik Walthinsen's avatar
Erik Walthinsen committed
837

838
gboolean		gst_pad_set_active			(GstPad *pad, gboolean active);
839
gboolean		gst_pad_is_active			(GstPad *pad);
840 841
gboolean		gst_pad_activate_mode			(GstPad *pad, GstPadMode mode,
                                                                 gboolean active);
842

843
gulong                  gst_pad_add_probe                       (GstPad *pad,
844
								 GstPadProbeType mask,
845
								 GstPadProbeCallback callback,
846
                                                                 gpointer user_data,
Wim Taymans's avatar
Wim Taymans committed
847
                                                                 GDestroyNotify destroy_data);
848
void                    gst_pad_remove_probe                    (GstPad *pad, gulong id);
849

Wim Taymans's avatar
Wim Taymans committed
850
gboolean		gst_pad_is_blocked			(GstPad *pad);
851
gboolean		gst_pad_is_blocking			(GstPad *pad);
Erik Walthinsen's avatar
Erik Walthinsen committed
852

853
void                    gst_pad_mark_reconfigure                (GstPad *pad);
854 855
gboolean		gst_pad_check_reconfigure               (GstPad *pad);

856 857
void			gst_pad_set_element_private		(GstPad *pad, gpointer priv);
gpointer		gst_pad_get_element_private		(GstPad *pad);
858

859
GstPadTemplate*		gst_pad_get_pad_template		(GstPad *pad);
Erik Walthinsen's avatar
Erik Walthinsen committed
860

Wim Taymans's avatar
Wim Taymans committed
861 862 863
GstEvent*               gst_pad_get_sticky_event                (GstPad *pad, GstEventType event_type,
                                                                 guint idx);
void                    gst_pad_sticky_events_foreach           (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data);
864

865
/* data passing setup functions */
866 867
void			gst_pad_set_activate_function_full	(GstPad *pad,
                                                                 GstPadActivateFunction activate,
868
                                                                 gpointer user_data,
869 870 871
                                                                 GDestroyNotify notify);
void			gst_pad_set_activatemode_function_full	(GstPad *pad,
                                                                 GstPadActivateModeFunction activatemode,
872
                                                                 gpointer user_data,
873 874 875 876
                                                                 GDestroyNotify notify);
/* data passing functions */
void			gst_pad_set_chain_function_full		(GstPad *pad,
                                                                 GstPadChainFunction chain,
877
                                                                 gpointer user_data,
878 879 880
                                                                 GDestroyNotify notify);
void			gst_pad_set_chain_list_function_full	(GstPad *pad,
                                                                 GstPadChainListFunction chainlist,
881
                                                                 gpointer user_data,
882 883 884
                                                                 GDestroyNotify notify);
void			gst_pad_set_getrange_function_full	(GstPad *pad,
                                                                 GstPadGetRangeFunction get,
885
                                                                 gpointer user_data,
886 887 888
                                                                 GDestroyNotify notify);
void			gst_pad_set_event_function_full		(GstPad *pad,
                                                                 GstPadEventFunction event,