| 1 | /* GStreamer | 
| 2 |  * 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 | 
| 6 |  * | 
| 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. | 
| 11 |  * | 
| 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. | 
| 16 |  * | 
| 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. | 
| 21 |  */ | 
| 22 |  | 
| 23 |  | 
| 24 | #ifndef __GST_PAD_H__ | 
| 25 | #define __GST_PAD_H__ | 
| 26 |  | 
| 27 | #include <gst/gstconfig.h> | 
| 28 |  | 
| 29 | typedef struct _GstPad GstPad; | 
| 30 | typedef struct _GstPadPrivate GstPadPrivate; | 
| 31 | typedef struct _GstPadClass GstPadClass; | 
| 32 | typedef struct _GstPadProbeInfo GstPadProbeInfo; | 
| 33 |  | 
| 34 | /** | 
| 35 |  * GstPadDirection: | 
| 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. | 
| 39 |  * | 
| 40 |  * The direction of a pad. | 
| 41 |  */ | 
| 42 | typedef enum { | 
| 43 |   GST_PAD_UNKNOWN, | 
| 44 |   GST_PAD_SRC, | 
| 45 |   GST_PAD_SINK | 
| 46 | } GstPadDirection; | 
| 47 |  | 
| 48 | /** | 
| 49 |  * GstPadMode: | 
| 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 | 
| 53 |  * | 
| 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. | 
| 57 |  */ | 
| 58 | typedef enum { | 
| 59 |   GST_PAD_MODE_NONE, | 
| 60 |   GST_PAD_MODE_PUSH, | 
| 61 |   GST_PAD_MODE_PULL | 
| 62 | } GstPadMode; | 
| 63 |  | 
| 64 | #include <glib.h> | 
| 65 |  | 
| 66 | GST_API | 
| 67 | const gchar   * gst_pad_mode_get_name (GstPadMode mode); | 
| 68 |  | 
| 69 | #include <gst/gstobject.h> | 
| 70 | #include <gst/gstbuffer.h> | 
| 71 | #include <gst/gstbufferlist.h> | 
| 72 | #include <gst/gstcaps.h> | 
| 73 | #include <gst/gstpadtemplate.h> | 
| 74 | #include <gst/gstevent.h> | 
| 75 | #include <gst/gstquery.h> | 
| 76 | #include <gst/gsttask.h> | 
| 77 |  | 
| 78 | G_BEGIN_DECLS | 
| 79 |  | 
| 80 | /* | 
| 81 |  * Pad base class | 
| 82 |  */ | 
| 83 | #define GST_TYPE_PAD			(gst_pad_get_type ()) | 
| 84 | #define GST_IS_PAD(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PAD)) | 
| 85 | #define GST_IS_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PAD)) | 
| 86 | #define GST_PAD(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PAD, GstPad)) | 
| 87 | #define GST_PAD_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PAD, GstPadClass)) | 
| 88 | #define GST_PAD_CAST(obj)		((GstPad*)(obj)) | 
| 89 |  | 
| 90 |  | 
| 91 |  | 
| 92 | /** | 
| 93 |  * GstPadLinkReturn: | 
| 94 |  * @GST_PAD_LINK_OK		: link succeeded | 
| 95 |  * @GST_PAD_LINK_WRONG_HIERARCHY: pads have no common grandparent | 
| 96 |  * @GST_PAD_LINK_WAS_LINKED	: pad was already linked | 
| 97 |  * @GST_PAD_LINK_WRONG_DIRECTION: pads have wrong direction | 
| 98 |  * @GST_PAD_LINK_NOFORMAT	: pads do not have common format | 
| 99 |  * @GST_PAD_LINK_NOSCHED	: pads cannot cooperate in scheduling | 
| 100 |  * @GST_PAD_LINK_REFUSED	: refused for some reason | 
| 101 |  * | 
| 102 |  * Result values from gst_pad_link and friends. | 
| 103 |  */ | 
| 104 | typedef enum { | 
| 105 |   GST_PAD_LINK_OK               =  0, | 
| 106 |   GST_PAD_LINK_WRONG_HIERARCHY  = -1, | 
| 107 |   GST_PAD_LINK_WAS_LINKED       = -2, | 
| 108 |   GST_PAD_LINK_WRONG_DIRECTION  = -3, | 
| 109 |   GST_PAD_LINK_NOFORMAT         = -4, | 
| 110 |   GST_PAD_LINK_NOSCHED          = -5, | 
| 111 |   GST_PAD_LINK_REFUSED          = -6 | 
| 112 | } GstPadLinkReturn; | 
| 113 |  | 
| 114 | /** | 
| 115 |  * GST_PAD_LINK_FAILED: | 
| 116 |  * @ret: the #GstPadLinkReturn value | 
| 117 |  * | 
| 118 |  * Macro to test if the given #GstPadLinkReturn value indicates a failed | 
| 119 |  * link step. | 
| 120 |  */ | 
| 121 | #define GST_PAD_LINK_FAILED(ret) ((ret) < GST_PAD_LINK_OK) | 
| 122 |  | 
| 123 | /** | 
| 124 |  * GST_PAD_LINK_SUCCESSFUL: | 
| 125 |  * @ret: the #GstPadLinkReturn value | 
| 126 |  * | 
| 127 |  * Macro to test if the given #GstPadLinkReturn value indicates a successful | 
| 128 |  * link step. | 
| 129 |  */ | 
| 130 | #define GST_PAD_LINK_SUCCESSFUL(ret) ((ret) >= GST_PAD_LINK_OK) | 
| 131 |  | 
| 132 | /** | 
| 133 |  * GstFlowReturn: | 
| 134 |  * @GST_FLOW_OK:		 Data passing was ok. | 
| 135 |  * @GST_FLOW_NOT_LINKED:	 Pad is not linked. | 
| 136 |  * @GST_FLOW_FLUSHING:	         Pad is flushing. | 
| 137 |  * @GST_FLOW_EOS:                Pad is EOS. | 
| 138 |  * @GST_FLOW_NOT_NEGOTIATED:	 Pad is not negotiated. | 
| 139 |  * @GST_FLOW_ERROR:		 Some (fatal) error occurred. Element generating | 
| 140 |  *                               this error should post an error message using | 
| 141 |  *                               GST_ELEMENT_ERROR() with more details. | 
| 142 |  * @GST_FLOW_NOT_SUPPORTED:	 This operation is not supported. | 
| 143 |  * @GST_FLOW_CUSTOM_SUCCESS:	 Elements can use values starting from | 
| 144 |  *                               this (and higher) to define custom success | 
| 145 |  *                               codes. | 
| 146 |  * @GST_FLOW_CUSTOM_SUCCESS_1:	 Pre-defined custom success code (define your | 
| 147 |  *                               custom success code to this to avoid compiler | 
| 148 |  *                               warnings). | 
| 149 |  * @GST_FLOW_CUSTOM_SUCCESS_2:	 Pre-defined custom success code. | 
| 150 |  * @GST_FLOW_CUSTOM_ERROR:	 Elements can use values starting from | 
| 151 |  *                               this (and lower) to define custom error codes. | 
| 152 |  * @GST_FLOW_CUSTOM_ERROR_1:	 Pre-defined custom error code (define your | 
| 153 |  *                               custom error code to this to avoid compiler | 
| 154 |  *                               warnings). | 
| 155 |  * @GST_FLOW_CUSTOM_ERROR_2:	 Pre-defined custom error code. | 
| 156 |  * | 
| 157 |  * The result of passing data to a pad. | 
| 158 |  * | 
| 159 |  * Note that the custom return values should not be exposed outside of the | 
| 160 |  * element scope. | 
| 161 |  */ | 
| 162 | typedef enum { | 
| 163 |   /* custom success starts here */ | 
| 164 |   GST_FLOW_CUSTOM_SUCCESS_2 = 102, | 
| 165 |   GST_FLOW_CUSTOM_SUCCESS_1 = 101, | 
| 166 |   GST_FLOW_CUSTOM_SUCCESS = 100, | 
| 167 |  | 
| 168 |   /* core predefined */ | 
| 169 |   GST_FLOW_OK		  =  0, | 
| 170 |   /* expected failures */ | 
| 171 |   GST_FLOW_NOT_LINKED     = -1, | 
| 172 |   GST_FLOW_FLUSHING       = -2, | 
| 173 |   /* error cases */ | 
| 174 |   GST_FLOW_EOS            = -3, | 
| 175 |   GST_FLOW_NOT_NEGOTIATED = -4, | 
| 176 |   GST_FLOW_ERROR	  = -5, | 
| 177 |   GST_FLOW_NOT_SUPPORTED  = -6, | 
| 178 |  | 
| 179 |   /* custom error starts here */ | 
| 180 |   GST_FLOW_CUSTOM_ERROR   = -100, | 
| 181 |   GST_FLOW_CUSTOM_ERROR_1 = -101, | 
| 182 |   GST_FLOW_CUSTOM_ERROR_2 = -102 | 
| 183 | } GstFlowReturn; | 
| 184 |  | 
| 185 | GST_API | 
| 186 | const gchar *         gst_flow_get_name (GstFlowReturn ret); | 
| 187 |  | 
| 188 | GST_API | 
| 189 | GQuark                gst_flow_to_quark (GstFlowReturn ret); | 
| 190 |  | 
| 191 | GST_API | 
| 192 | const gchar *         gst_pad_link_get_name (GstPadLinkReturn ret); | 
| 193 |  | 
| 194 | /** | 
| 195 |  * GstPadLinkCheck: | 
| 196 |  * @GST_PAD_LINK_CHECK_NOTHING: Don't check hierarchy or caps compatibility. | 
| 197 |  * @GST_PAD_LINK_CHECK_HIERARCHY: Check the pads have same parents/grandparents. | 
| 198 |  *   Could be omitted if it is already known that the two elements that own the | 
| 199 |  *   pads are in the same bin. | 
| 200 |  * @GST_PAD_LINK_CHECK_TEMPLATE_CAPS: Check if the pads are compatible by using | 
| 201 |  *   their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but | 
| 202 |  *   would be unsafe e.g. if one pad has %GST_CAPS_ANY. | 
| 203 |  * @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the | 
| 204 |  *   caps returned by gst_pad_query_caps(). | 
| 205 |  * @GST_PAD_LINK_CHECK_NO_RECONFIGURE: Disables pushing a reconfigure event when pads are | 
| 206 |  *   linked. | 
| 207 |  * @GST_PAD_LINK_CHECK_DEFAULT: The default checks done when linking | 
| 208 |  *   pads (i.e. the ones used by gst_pad_link()). | 
| 209 |  * | 
| 210 |  * The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS | 
| 211 |  * and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are | 
| 212 |  * specified, expensive but safe @GST_PAD_LINK_CHECK_CAPS are performed. | 
| 213 |  * | 
| 214 |  * > Only disable some of the checks if you are 100% certain you know the link | 
| 215 |  * > will not fail because of hierarchy/caps compatibility failures. If uncertain, | 
| 216 |  * > use the default checks (%GST_PAD_LINK_CHECK_DEFAULT) or the regular methods | 
| 217 |  * > for linking the pads. | 
| 218 |  */ | 
| 219 |  | 
| 220 | typedef enum { | 
| 221 |   GST_PAD_LINK_CHECK_NOTHING       = 0, | 
| 222 |   GST_PAD_LINK_CHECK_HIERARCHY     = 1 << 0, | 
| 223 |   GST_PAD_LINK_CHECK_TEMPLATE_CAPS = 1 << 1, | 
| 224 |   GST_PAD_LINK_CHECK_CAPS          = 1 << 2, | 
| 225 |  | 
| 226 |  | 
| 227 |   /* Not really checks, more like flags | 
| 228 |    * Added here to avoid creating a new gst_pad_link_variant */ | 
| 229 |   GST_PAD_LINK_CHECK_NO_RECONFIGURE = 1 << 3, | 
| 230 |  | 
| 231 |   GST_PAD_LINK_CHECK_DEFAULT       = GST_PAD_LINK_CHECK_HIERARCHY | GST_PAD_LINK_CHECK_CAPS | 
| 232 | } GstPadLinkCheck; | 
| 233 |  | 
| 234 | /* pad states */ | 
| 235 | /** | 
| 236 |  * GstPadActivateFunction: | 
| 237 |  * @pad: a #GstPad | 
| 238 |  * @parent: the parent of @pad | 
| 239 |  * | 
| 240 |  * This function is called when the pad is activated during the element | 
| 241 |  * READY to PAUSED state change. By default this function will call the | 
| 242 |  * activate function that puts the pad in push mode but elements can | 
| 243 |  * override this function to activate the pad in pull mode if they wish. | 
| 244 |  * | 
| 245 |  * Returns: %TRUE if the pad could be activated. | 
| 246 |  */ | 
| 247 | typedef gboolean		(*GstPadActivateFunction)	(GstPad *pad, GstObject *parent); | 
| 248 | /** | 
| 249 |  * GstPadActivateModeFunction: | 
| 250 |  * @pad: a #GstPad | 
| 251 |  * @parent: the parent of @pad | 
| 252 |  * @mode: the requested activation mode of @pad | 
| 253 |  * @active: activate or deactivate the pad. | 
| 254 |  * | 
| 255 |  * The prototype of the push and pull activate functions. | 
| 256 |  * | 
| 257 |  * Returns: %TRUE if the pad could be activated or deactivated. | 
| 258 |  */ | 
| 259 | typedef gboolean		(*GstPadActivateModeFunction)	(GstPad *pad, GstObject *parent, | 
| 260 |                                                                  GstPadMode mode, gboolean active); | 
| 261 |  | 
| 262 |  | 
| 263 | /* data passing */ | 
| 264 | /** | 
| 265 |  * GstPadChainFunction: | 
| 266 |  * @pad: the sink #GstPad that performed the chain. | 
| 267 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 268 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 269 |  *          during the execution of this function. | 
| 270 |  * @buffer: (transfer full): the #GstBuffer that is chained, not %NULL. | 
| 271 |  * | 
| 272 |  * A function that will be called on sinkpads when chaining buffers. | 
| 273 |  * The function typically processes the data contained in the buffer and | 
| 274 |  * either consumes the data or passes it on to the internally linked pad(s). | 
| 275 |  * | 
| 276 |  * The implementer of this function receives a refcount to @buffer and should | 
| 277 |  * gst_buffer_unref() when the buffer is no longer needed. | 
| 278 |  * | 
| 279 |  * When a chain function detects an error in the data stream, it must post an | 
| 280 |  * error on the bus and return an appropriate #GstFlowReturn value. | 
| 281 |  * | 
| 282 |  * Returns: #GST_FLOW_OK for success | 
| 283 |  */ | 
| 284 | typedef GstFlowReturn		(*GstPadChainFunction)		(GstPad *pad, GstObject *parent, | 
| 285 |                                                                  GstBuffer *buffer); | 
| 286 |  | 
| 287 | /** | 
| 288 |  * GstPadChainListFunction: | 
| 289 |  * @pad: the sink #GstPad that performed the chain. | 
| 290 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 291 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 292 |  *          during the execution of this function. | 
| 293 |  * @list: (transfer full): the #GstBufferList that is chained, not %NULL. | 
| 294 |  * | 
| 295 |  * A function that will be called on sinkpads when chaining buffer lists. | 
| 296 |  * The function typically processes the data contained in the buffer list and | 
| 297 |  * either consumes the data or passes it on to the internally linked pad(s). | 
| 298 |  * | 
| 299 |  * The implementer of this function receives a refcount to @list and | 
| 300 |  * should gst_buffer_list_unref() when the list is no longer needed. | 
| 301 |  * | 
| 302 |  * When a chainlist function detects an error in the data stream, it must | 
| 303 |  * post an error on the bus and return an appropriate #GstFlowReturn value. | 
| 304 |  * | 
| 305 |  * Returns: #GST_FLOW_OK for success | 
| 306 |  */ | 
| 307 | typedef GstFlowReturn		(*GstPadChainListFunction)	(GstPad *pad, GstObject *parent, | 
| 308 |                                                                  GstBufferList *list); | 
| 309 |  | 
| 310 | /** | 
| 311 |  * GstPadGetRangeFunction: | 
| 312 |  * @pad: the src #GstPad to perform the getrange on. | 
| 313 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 314 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 315 |  *          during the execution of this function. | 
| 316 |  * @offset: the offset of the range | 
| 317 |  * @length: the length of the range | 
| 318 |  * @buffer: a memory location to hold the result buffer, cannot be %NULL. | 
| 319 |  * | 
| 320 |  * This function will be called on source pads when a peer element | 
| 321 |  * request a buffer at the specified @offset and @length. If this function | 
| 322 |  * returns #GST_FLOW_OK, the result buffer will be stored in @buffer. The | 
| 323 |  * contents of @buffer is invalid for any other return value. | 
| 324 |  * | 
| 325 |  * This function is installed on a source pad with | 
| 326 |  * gst_pad_set_getrange_function() and can only be called on source pads after | 
| 327 |  * they are successfully activated with gst_pad_activate_mode() with the | 
| 328 |  * #GST_PAD_MODE_PULL. | 
| 329 |  * | 
| 330 |  * @offset and @length are always given in byte units. @offset must normally be a value | 
| 331 |  * between 0 and the length in bytes of the data available on @pad. The | 
| 332 |  * length (duration in bytes) can be retrieved with a #GST_QUERY_DURATION or with a | 
| 333 |  * #GST_QUERY_SEEKING. | 
| 334 |  * | 
| 335 |  * Any @offset larger or equal than the length will make the function return | 
| 336 |  * #GST_FLOW_EOS, which corresponds to EOS. In this case @buffer does not | 
| 337 |  * contain a valid buffer. | 
| 338 |  * | 
| 339 |  * The buffer size of @buffer will only be smaller than @length when @offset is | 
| 340 |  * near the end of the stream. In all other cases, the size of @buffer must be | 
| 341 |  * exactly the requested size. | 
| 342 |  * | 
| 343 |  * It is allowed to call this function with a 0 @length and valid @offset, in | 
| 344 |  * which case @buffer will contain a 0-sized buffer and the function returns | 
| 345 |  * #GST_FLOW_OK. | 
| 346 |  * | 
| 347 |  * When this function is called with a -1 @offset, the sequentially next buffer | 
| 348 |  * of length @length in the stream is returned. | 
| 349 |  * | 
| 350 |  * When this function is called with a -1 @length, a buffer with a default | 
| 351 |  * optimal length is returned in @buffer. The length might depend on the value | 
| 352 |  * of @offset. | 
| 353 |  * | 
| 354 |  * Returns: #GST_FLOW_OK for success and a valid buffer in @buffer. Any other | 
| 355 |  * return value leaves @buffer undefined. | 
| 356 |  */ | 
| 357 | typedef GstFlowReturn		(*GstPadGetRangeFunction)	(GstPad *pad, GstObject *parent, | 
| 358 |                                                                  guint64 offset, guint length, | 
| 359 |                                                                  GstBuffer **buffer); | 
| 360 |  | 
| 361 | /** | 
| 362 |  * GstPadEventFunction: | 
| 363 |  * @pad: the #GstPad to handle the event. | 
| 364 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 365 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 366 |  *          during the execution of this function. | 
| 367 |  * @event: (transfer full): the #GstEvent to handle. | 
| 368 |  * | 
| 369 |  * Function signature to handle an event for the pad. | 
| 370 |  * | 
| 371 |  * Returns: %TRUE if the pad could handle the event. | 
| 372 |  */ | 
| 373 | typedef gboolean		(*GstPadEventFunction)		(GstPad *pad, GstObject *parent, | 
| 374 |                                                                  GstEvent *event); | 
| 375 |  | 
| 376 | /** | 
| 377 |  * GstPadEventFullFunction: | 
| 378 |  * @pad: the #GstPad to handle the event. | 
| 379 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 380 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 381 |  *          during the execution of this function. | 
| 382 |  * @event: (transfer full): the #GstEvent to handle. | 
| 383 |  * | 
| 384 |  * Function signature to handle an event for the pad. | 
| 385 |  * | 
| 386 |  * This variant is for specific elements that will take into account the | 
| 387 |  * last downstream flow return (from a pad push), in which case they can | 
| 388 |  * return it. | 
| 389 |  * | 
| 390 |  * Returns: %GST_FLOW_OK if the event was handled properly, or any other | 
| 391 |  * #GstFlowReturn dependent on downstream state. | 
| 392 |  * | 
| 393 |  * Since: 1.8 | 
| 394 |  */ | 
| 395 | typedef GstFlowReturn		(*GstPadEventFullFunction)	(GstPad *pad, GstObject *parent, | 
| 396 |                                                                  GstEvent *event); | 
| 397 |  | 
| 398 |  | 
| 399 | /* internal links */ | 
| 400 | /** | 
| 401 |  * GstPadIterIntLinkFunction: | 
| 402 |  * @pad: The #GstPad to query. | 
| 403 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 404 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 405 |  *          during the execution of this function. | 
| 406 |  * | 
| 407 |  * The signature of the internal pad link iterator function. | 
| 408 |  * | 
| 409 |  * Returns: a new #GstIterator that will iterate over all pads that are | 
| 410 |  * linked to the given pad on the inside of the parent element. | 
| 411 |  * | 
| 412 |  * the caller must call gst_iterator_free() after usage. | 
| 413 |  */ | 
| 414 | typedef GstIterator*           (*GstPadIterIntLinkFunction)    (GstPad *pad, GstObject *parent); | 
| 415 |  | 
| 416 | /* generic query function */ | 
| 417 | /** | 
| 418 |  * GstPadQueryFunction: | 
| 419 |  * @pad: the #GstPad to query. | 
| 420 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 421 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 422 |  *          during the execution of this function. | 
| 423 |  * @query: the #GstQuery object to execute | 
| 424 |  * | 
| 425 |  * The signature of the query function. | 
| 426 |  * | 
| 427 |  * Returns: %TRUE if the query could be performed. | 
| 428 |  */ | 
| 429 | typedef gboolean		(*GstPadQueryFunction)		(GstPad *pad, GstObject *parent, | 
| 430 |                                                                  GstQuery *query); | 
| 431 |  | 
| 432 |  | 
| 433 | /* linking */ | 
| 434 | /** | 
| 435 |  * GstPadLinkFunction: | 
| 436 |  * @pad: the #GstPad that is linked. | 
| 437 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 438 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 439 |  *          during the execution of this function. | 
| 440 |  * @peer: the peer #GstPad of the link | 
| 441 |  * | 
| 442 |  * Function signature to handle a new link on the pad. | 
| 443 |  * | 
| 444 |  * Returns: the result of the link with the specified peer. | 
| 445 |  */ | 
| 446 | typedef GstPadLinkReturn	(*GstPadLinkFunction)		(GstPad *pad, GstObject *parent, GstPad *peer); | 
| 447 | /** | 
| 448 |  * GstPadUnlinkFunction: | 
| 449 |  * @pad: the #GstPad that is linked. | 
| 450 |  * @parent: (allow-none): the parent of @pad. If the #GST_PAD_FLAG_NEED_PARENT | 
| 451 |  *          flag is set, @parent is guaranteed to be not-%NULL and remain valid | 
| 452 |  *          during the execution of this function. | 
| 453 |  * | 
| 454 |  * Function signature to handle a unlinking the pad prom its peer. | 
| 455 |  * | 
| 456 |  * The pad's lock is already held when the unlink function is called, so most | 
| 457 |  * pad functions cannot be called from within the callback. | 
| 458 |  */ | 
| 459 | typedef void			(*GstPadUnlinkFunction)		(GstPad *pad, GstObject *parent); | 
| 460 |  | 
| 461 |  | 
| 462 | /* misc */ | 
| 463 | /** | 
| 464 |  * GstPadForwardFunction: | 
| 465 |  * @pad: the #GstPad that is forwarded. | 
| 466 |  * @user_data: the gpointer to optional user data. | 
| 467 |  * | 
| 468 |  * A forward function is called for all internally linked pads, see | 
| 469 |  * gst_pad_forward(). | 
| 470 |  * | 
| 471 |  * Returns: %TRUE if the dispatching procedure has to be stopped. | 
| 472 |  */ | 
| 473 | typedef gboolean		(*GstPadForwardFunction)	(GstPad *pad, gpointer user_data); | 
| 474 |  | 
| 475 | /** | 
| 476 |  * GstPadProbeType: | 
| 477 |  * @GST_PAD_PROBE_TYPE_INVALID: invalid probe type | 
| 478 |  * @GST_PAD_PROBE_TYPE_IDLE: probe idle pads and block while the callback is called | 
| 479 |  * @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads | 
| 480 |  * @GST_PAD_PROBE_TYPE_BUFFER: probe buffers | 
| 481 |  * @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists | 
| 482 |  * @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events | 
| 483 |  * @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events | 
| 484 |  * @GST_PAD_PROBE_TYPE_EVENT_FLUSH: probe flush events. This probe has to be | 
| 485 |  *     explicitly enabled and is not included in the | 
| 486 |  *     @@GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM or | 
| 487 |  *     @@GST_PAD_PROBE_TYPE_EVENT_UPSTREAM probe types. | 
| 488 |  * @GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM: probe downstream queries | 
| 489 |  * @GST_PAD_PROBE_TYPE_QUERY_UPSTREAM: probe upstream queries | 
| 490 |  * @GST_PAD_PROBE_TYPE_PUSH: probe push | 
| 491 |  * @GST_PAD_PROBE_TYPE_PULL: probe pull | 
| 492 |  * @GST_PAD_PROBE_TYPE_BLOCKING: probe and block at the next opportunity, at data flow or when idle | 
| 493 |  * @GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM: probe downstream data (buffers, buffer lists, and events) | 
| 494 |  * @GST_PAD_PROBE_TYPE_DATA_UPSTREAM: probe upstream data (events) | 
| 495 |  * @GST_PAD_PROBE_TYPE_DATA_BOTH: probe upstream and downstream data (buffers, buffer lists, and events) | 
| 496 |  * @GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM: probe and block downstream data (buffers, buffer lists, and events) | 
| 497 |  * @GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM: probe and block upstream data (events) | 
| 498 |  * @GST_PAD_PROBE_TYPE_EVENT_BOTH: probe upstream and downstream events | 
| 499 |  * @GST_PAD_PROBE_TYPE_QUERY_BOTH: probe upstream and downstream queries | 
| 500 |  * @GST_PAD_PROBE_TYPE_ALL_BOTH: probe upstream events and queries and downstream buffers, buffer lists, events and queries | 
| 501 |  * @GST_PAD_PROBE_TYPE_SCHEDULING: probe push and pull | 
| 502 |  * | 
| 503 |  * The different probing types that can occur. When either one of | 
| 504 |  * @GST_PAD_PROBE_TYPE_IDLE or @GST_PAD_PROBE_TYPE_BLOCK is used, the probe will be a | 
| 505 |  * blocking probe. | 
| 506 |  */ | 
| 507 | typedef enum | 
| 508 | { | 
| 509 |   GST_PAD_PROBE_TYPE_INVALID          = 0, | 
| 510 |   /* flags to control blocking */ | 
| 511 |   GST_PAD_PROBE_TYPE_IDLE             = (1 << 0), | 
| 512 |   GST_PAD_PROBE_TYPE_BLOCK            = (1 << 1), | 
| 513 |   /* flags to select datatypes */ | 
| 514 |   GST_PAD_PROBE_TYPE_BUFFER           = (1 << 4), | 
| 515 |   GST_PAD_PROBE_TYPE_BUFFER_LIST      = (1 << 5), | 
| 516 |   GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 6), | 
| 517 |   GST_PAD_PROBE_TYPE_EVENT_UPSTREAM   = (1 << 7), | 
| 518 |   GST_PAD_PROBE_TYPE_EVENT_FLUSH      = (1 << 8), | 
| 519 |   GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM = (1 << 9), | 
| 520 |   GST_PAD_PROBE_TYPE_QUERY_UPSTREAM   = (1 << 10), | 
| 521 |   /* flags to select scheduling mode */ | 
| 522 |   GST_PAD_PROBE_TYPE_PUSH             = (1 << 12), | 
| 523 |   GST_PAD_PROBE_TYPE_PULL             = (1 << 13), | 
| 524 |  | 
| 525 |   /* flag combinations */ | 
| 526 |   GST_PAD_PROBE_TYPE_BLOCKING         = GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK, | 
| 527 |   GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM  = GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, | 
| 528 |   GST_PAD_PROBE_TYPE_DATA_UPSTREAM    = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, | 
| 529 |   GST_PAD_PROBE_TYPE_DATA_BOTH        = GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | GST_PAD_PROBE_TYPE_DATA_UPSTREAM, | 
| 530 |   GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, | 
| 531 |   GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM   = GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM, | 
| 532 |   GST_PAD_PROBE_TYPE_EVENT_BOTH       = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, | 
| 533 |   GST_PAD_PROBE_TYPE_QUERY_BOTH       = GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM | GST_PAD_PROBE_TYPE_QUERY_UPSTREAM, | 
| 534 |   GST_PAD_PROBE_TYPE_ALL_BOTH         = GST_PAD_PROBE_TYPE_DATA_BOTH | GST_PAD_PROBE_TYPE_QUERY_BOTH, | 
| 535 |   GST_PAD_PROBE_TYPE_SCHEDULING       = GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL | 
| 536 | } GstPadProbeType; | 
| 537 |  | 
| 538 |  | 
| 539 | /** | 
| 540 |  * GstPadProbeReturn: | 
| 541 |  * @GST_PAD_PROBE_OK: normal probe return value. This leaves the probe in | 
| 542 |  *        place, and defers decisions about dropping or passing data to other | 
| 543 |  *        probes, if any. If there are no other probes, the default behaviour | 
| 544 |  *        for the probe type applies ('block' for blocking probes, | 
| 545 |  *        and 'pass' for non-blocking probes). | 
| 546 |  * @GST_PAD_PROBE_DROP: drop data in data probes. For push mode this means that | 
| 547 |  *        the data item is not sent downstream. For pull mode, it means that | 
| 548 |  *        the data item is not passed upstream. In both cases, no other probes | 
| 549 |  *        are called for this item and %GST_FLOW_OK or %TRUE is returned to the | 
| 550 |  *        caller. | 
| 551 |  * @GST_PAD_PROBE_REMOVE: remove this probe, passing the data. For blocking probes | 
| 552 |  *        this will cause data flow to unblock, unless there are also other | 
| 553 |  *        blocking probes installed. | 
| 554 |  * @GST_PAD_PROBE_PASS: pass the data item in the block probe and block on the | 
| 555 |  *        next item. Note, that if there are multiple pad probes installed and | 
| 556 |  *        any probe returns PASS, the data will be passed. | 
| 557 |  * @GST_PAD_PROBE_HANDLED: Data has been handled in the probe and will not be | 
| 558 |  *        forwarded further. For events and buffers this is the same behaviour as | 
| 559 |  *        %GST_PAD_PROBE_DROP (except that in this case you need to unref the buffer | 
| 560 |  *        or event yourself). For queries it will also return %TRUE to the caller. | 
| 561 |  *        The probe can also modify the #GstFlowReturn value by using the | 
| 562 |  *        #GST_PAD_PROBE_INFO_FLOW_RETURN() accessor. | 
| 563 |  *        Note that the resulting query must contain valid entries. | 
| 564 |  *        Since: 1.6 | 
| 565 |  * | 
| 566 |  * Different return values for the #GstPadProbeCallback. | 
| 567 |  */ | 
| 568 | typedef enum | 
| 569 | { | 
| 570 |   GST_PAD_PROBE_DROP, | 
| 571 |   GST_PAD_PROBE_OK, | 
| 572 |   GST_PAD_PROBE_REMOVE, | 
| 573 |   GST_PAD_PROBE_PASS, | 
| 574 |   GST_PAD_PROBE_HANDLED | 
| 575 | } GstPadProbeReturn; | 
| 576 |  | 
| 577 |  | 
| 578 | /** | 
| 579 |  * GstPadProbeInfo: | 
| 580 |  * @type: the current probe type | 
| 581 |  * @id: the id of the probe | 
| 582 |  * @data: (allow-none): type specific data, check the @type field to know the | 
| 583 |  *    datatype.  This field can be %NULL. | 
| 584 |  * @offset: offset of pull probe, this field is valid when @type contains | 
| 585 |  *    #GST_PAD_PROBE_TYPE_PULL | 
| 586 |  * @size: size of pull probe, this field is valid when @type contains | 
| 587 |  *    #GST_PAD_PROBE_TYPE_PULL | 
| 588 |  * | 
| 589 |  * Info passed in the #GstPadProbeCallback. | 
| 590 |  */ | 
| 591 | struct _GstPadProbeInfo | 
| 592 | { | 
| 593 |   GstPadProbeType type; | 
| 594 |   gulong id; | 
| 595 |   gpointer data; | 
| 596 |   guint64 offset; | 
| 597 |   guint size; | 
| 598 |  | 
| 599 |   /*< private >*/ | 
| 600 |   union { | 
| 601 |     gpointer _gst_reserved[GST_PADDING]; | 
| 602 |     struct { | 
| 603 |       GstFlowReturn flow_ret; | 
| 604 |     } abi; | 
| 605 |   } ABI; | 
| 606 | }; | 
| 607 |  | 
| 608 | #define GST_PAD_PROBE_INFO_TYPE(d)         ((d)->type) | 
| 609 | #define GST_PAD_PROBE_INFO_ID(d)           ((d)->id) | 
| 610 | #define GST_PAD_PROBE_INFO_DATA(d)         ((d)->data) | 
| 611 | #define GST_PAD_PROBE_INFO_FLOW_RETURN(d)  ((d)->ABI.abi.flow_ret) | 
| 612 |  | 
| 613 | #define GST_PAD_PROBE_INFO_BUFFER(d)       GST_BUFFER_CAST(GST_PAD_PROBE_INFO_DATA(d)) | 
| 614 | #define GST_PAD_PROBE_INFO_BUFFER_LIST(d)  GST_BUFFER_LIST_CAST(GST_PAD_PROBE_INFO_DATA(d)) | 
| 615 | #define GST_PAD_PROBE_INFO_EVENT(d)        GST_EVENT_CAST(GST_PAD_PROBE_INFO_DATA(d)) | 
| 616 | #define GST_PAD_PROBE_INFO_QUERY(d)        GST_QUERY_CAST(GST_PAD_PROBE_INFO_DATA(d)) | 
| 617 |  | 
| 618 | #define GST_PAD_PROBE_INFO_OFFSET(d)       ((d)->offset) | 
| 619 | #define GST_PAD_PROBE_INFO_SIZE(d)         ((d)->size) | 
| 620 |  | 
| 621 | GST_API | 
| 622 | GstEvent*      gst_pad_probe_info_get_event       (GstPadProbeInfo * info); | 
| 623 |  | 
| 624 | GST_API | 
| 625 | GstQuery*      gst_pad_probe_info_get_query       (GstPadProbeInfo * info); | 
| 626 |  | 
| 627 | GST_API | 
| 628 | GstBuffer*     gst_pad_probe_info_get_buffer      (GstPadProbeInfo * info); | 
| 629 |  | 
| 630 | GST_API | 
| 631 | GstBufferList* gst_pad_probe_info_get_buffer_list (GstPadProbeInfo * info); | 
| 632 |  | 
| 633 | /** | 
| 634 |  * GstPadProbeCallback: | 
| 635 |  * @pad: the #GstPad that is blocked | 
| 636 |  * @info: #GstPadProbeInfo | 
| 637 |  * @user_data: the gpointer to optional user data. | 
| 638 |  * | 
| 639 |  * Callback used by gst_pad_add_probe(). Gets called to notify about the current | 
| 640 |  * blocking type. | 
| 641 |  * | 
| 642 |  * The callback is allowed to modify the data pointer in @info. | 
| 643 |  * | 
| 644 |  * Returns: a #GstPadProbeReturn | 
| 645 |  */ | 
| 646 | typedef GstPadProbeReturn   (*GstPadProbeCallback)   (GstPad *pad, GstPadProbeInfo *info, | 
| 647 |                                                       gpointer user_data); | 
| 648 |  | 
| 649 | /** | 
| 650 |  * GstPadStickyEventsForeachFunction: | 
| 651 |  * @pad: the #GstPad. | 
| 652 |  * @event: (allow-none): a sticky #GstEvent. | 
| 653 |  * @user_data: the #gpointer to optional user data. | 
| 654 |  * | 
| 655 |  * Callback used by gst_pad_sticky_events_foreach(). | 
| 656 |  * | 
| 657 |  * When this function returns %TRUE, the next event will be | 
| 658 |  * returned. When %FALSE is returned, gst_pad_sticky_events_foreach() will return. | 
| 659 |  * | 
| 660 |  * When @event is set to %NULL, the item will be removed from the list of sticky events. | 
| 661 |  * @event can be replaced by assigning a new reference to it. | 
| 662 |  * This function is responsible for unreffing the old event when | 
| 663 |  * removing or modifying. | 
| 664 |  * | 
| 665 |  * Returns: %TRUE if the iteration should continue | 
| 666 |  */ | 
| 667 | typedef gboolean  (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent **event, | 
| 668 |                                                         gpointer user_data); | 
| 669 |  | 
| 670 | /** | 
| 671 |  * GstPadFlags: | 
| 672 |  * @GST_PAD_FLAG_BLOCKED: is dataflow on a pad blocked | 
| 673 |  * @GST_PAD_FLAG_FLUSHING: is pad flushing | 
| 674 |  * @GST_PAD_FLAG_EOS: is pad in EOS state | 
| 675 |  * @GST_PAD_FLAG_BLOCKING: is pad currently blocking on a buffer or event | 
| 676 |  * @GST_PAD_FLAG_NEED_PARENT: ensure that there is a parent object before calling | 
| 677 |  *                       into the pad callbacks. | 
| 678 |  * @GST_PAD_FLAG_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated. | 
| 679 |  *                            The flag has to be unset manually after | 
| 680 |  *                            reconfiguration happened. | 
| 681 |  * @GST_PAD_FLAG_PENDING_EVENTS: the pad has pending events | 
| 682 |  * @GST_PAD_FLAG_FIXED_CAPS: the pad is using fixed caps. This means that | 
| 683 |  *     once the caps are set on the pad, the default caps query function | 
| 684 |  *     will only return those caps. | 
| 685 |  * @GST_PAD_FLAG_PROXY_CAPS: the default event and query handler will forward | 
| 686 |  *                      all events and queries to the internally linked pads | 
| 687 |  *                      instead of discarding them. | 
| 688 |  * @GST_PAD_FLAG_PROXY_ALLOCATION: the default query handler will forward | 
| 689 |  *                      allocation queries to the internally linked pads | 
| 690 |  *                      instead of discarding them. | 
| 691 |  * @GST_PAD_FLAG_PROXY_SCHEDULING: the default query handler will forward | 
| 692 |  *                      scheduling queries to the internally linked pads | 
| 693 |  *                      instead of discarding them. | 
| 694 |  * @GST_PAD_FLAG_ACCEPT_INTERSECT: the default accept-caps handler will check | 
| 695 |  *                      it the caps intersect the query-caps result instead | 
| 696 |  *                      of checking for a subset. This is interesting for | 
| 697 |  *                      parsers that can accept incompletely specified caps. | 
| 698 |  * @GST_PAD_FLAG_ACCEPT_TEMPLATE: the default accept-caps handler will use | 
| 699 |  *                      the template pad caps instead of query caps to | 
| 700 |  *                      compare with the accept caps. Use this in combination | 
| 701 |  *                      with %GST_PAD_FLAG_ACCEPT_INTERSECT. (Since: 1.6) | 
| 702 |  * @GST_PAD_FLAG_LAST: offset to define more flags | 
| 703 |  * | 
| 704 |  * Pad state flags | 
| 705 |  */ | 
| 706 | typedef enum { | 
| 707 |   GST_PAD_FLAG_BLOCKED          = (GST_OBJECT_FLAG_LAST << 0), | 
| 708 |   GST_PAD_FLAG_FLUSHING         = (GST_OBJECT_FLAG_LAST << 1), | 
| 709 |   GST_PAD_FLAG_EOS              = (GST_OBJECT_FLAG_LAST << 2), | 
| 710 |   GST_PAD_FLAG_BLOCKING         = (GST_OBJECT_FLAG_LAST << 3), | 
| 711 |   GST_PAD_FLAG_NEED_PARENT      = (GST_OBJECT_FLAG_LAST << 4), | 
| 712 |   GST_PAD_FLAG_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5), | 
| 713 |   GST_PAD_FLAG_PENDING_EVENTS   = (GST_OBJECT_FLAG_LAST << 6), | 
| 714 |   GST_PAD_FLAG_FIXED_CAPS       = (GST_OBJECT_FLAG_LAST << 7), | 
| 715 |   GST_PAD_FLAG_PROXY_CAPS       = (GST_OBJECT_FLAG_LAST << 8), | 
| 716 |   GST_PAD_FLAG_PROXY_ALLOCATION = (GST_OBJECT_FLAG_LAST << 9), | 
| 717 |   GST_PAD_FLAG_PROXY_SCHEDULING = (GST_OBJECT_FLAG_LAST << 10), | 
| 718 |   GST_PAD_FLAG_ACCEPT_INTERSECT = (GST_OBJECT_FLAG_LAST << 11), | 
| 719 |   GST_PAD_FLAG_ACCEPT_TEMPLATE  = (GST_OBJECT_FLAG_LAST << 12), | 
| 720 |   /* padding */ | 
| 721 |   GST_PAD_FLAG_LAST        = (GST_OBJECT_FLAG_LAST << 16) | 
| 722 | } GstPadFlags; | 
| 723 |  | 
| 724 | /** | 
| 725 |  * GstPad: | 
| 726 |  * @element_private: private data owned by the parent element | 
| 727 |  * @padtemplate: padtemplate for this pad | 
| 728 |  * @direction: the direction of the pad, cannot change after creating | 
| 729 |  *             the pad. | 
| 730 |  * | 
| 731 |  * The #GstPad structure. Use the functions to update the variables. | 
| 732 |  */ | 
| 733 | struct _GstPad { | 
| 734 |   GstObject                      object; | 
| 735 |  | 
| 736 |   /*< public >*/ | 
| 737 |   gpointer                       element_private; | 
| 738 |  | 
| 739 |   GstPadTemplate                *padtemplate; | 
| 740 |  | 
| 741 |   GstPadDirection                direction; | 
| 742 |  | 
| 743 |   /*< private >*/ | 
| 744 |   /* streaming rec_lock */ | 
| 745 |   GRecMutex		         stream_rec_lock; | 
| 746 |   GstTask			*task; | 
| 747 |  | 
| 748 |   /* block cond, mutex is from the object */ | 
| 749 |   GCond				 block_cond; | 
| 750 |   GHookList                      probes; | 
| 751 |  | 
| 752 |   GstPadMode		         mode; | 
| 753 |   GstPadActivateFunction	 activatefunc; | 
| 754 |   gpointer                       activatedata; | 
| 755 |   GDestroyNotify                 activatenotify; | 
| 756 |   GstPadActivateModeFunction	 activatemodefunc; | 
| 757 |   gpointer                       activatemodedata; | 
| 758 |   GDestroyNotify                 activatemodenotify; | 
| 759 |  | 
| 760 |   /* pad link */ | 
| 761 |   GstPad			*peer; | 
| 762 |   GstPadLinkFunction		 linkfunc; | 
| 763 |   gpointer                       linkdata; | 
| 764 |   GDestroyNotify                 linknotify; | 
| 765 |   GstPadUnlinkFunction		 unlinkfunc; | 
| 766 |   gpointer                       unlinkdata; | 
| 767 |   GDestroyNotify                 unlinknotify; | 
| 768 |  | 
| 769 |   /* data transport functions */ | 
| 770 |   GstPadChainFunction		 chainfunc; | 
| 771 |   gpointer                       chaindata; | 
| 772 |   GDestroyNotify                 chainnotify; | 
| 773 |   GstPadChainListFunction        chainlistfunc; | 
| 774 |   gpointer                       chainlistdata; | 
| 775 |   GDestroyNotify                 chainlistnotify; | 
| 776 |   GstPadGetRangeFunction	 getrangefunc; | 
| 777 |   gpointer                       getrangedata; | 
| 778 |   GDestroyNotify                 getrangenotify; | 
| 779 |   GstPadEventFunction		 eventfunc; | 
| 780 |   gpointer                       eventdata; | 
| 781 |   GDestroyNotify                 eventnotify; | 
| 782 |  | 
| 783 |   /* pad offset */ | 
| 784 |   gint64                         offset; | 
| 785 |  | 
| 786 |   /* generic query method */ | 
| 787 |   GstPadQueryFunction		 queryfunc; | 
| 788 |   gpointer                       querydata; | 
| 789 |   GDestroyNotify                 querynotify; | 
| 790 |  | 
| 791 |   /* internal links */ | 
| 792 |   GstPadIterIntLinkFunction      iterintlinkfunc; | 
| 793 |   gpointer                       iterintlinkdata; | 
| 794 |   GDestroyNotify                 iterintlinknotify; | 
| 795 |  | 
| 796 |   /* counts number of probes attached. */ | 
| 797 |   gint				 num_probes; | 
| 798 |   gint				 num_blocked; | 
| 799 |  | 
| 800 |   GstPadPrivate                 *priv; | 
| 801 |  | 
| 802 |   union { | 
| 803 |     gpointer _gst_reserved[GST_PADDING]; | 
| 804 |     struct { | 
| 805 |       GstFlowReturn last_flowret; | 
| 806 |       GstPadEventFullFunction eventfullfunc; | 
| 807 |     } abi; | 
| 808 |   } ABI; | 
| 809 | }; | 
| 810 |  | 
| 811 | struct _GstPadClass { | 
| 812 |   GstObjectClass	parent_class; | 
| 813 |  | 
| 814 |   /* signal callbacks */ | 
| 815 |   void		(*linked)		(GstPad *pad, GstPad *peer); | 
| 816 |   void		(*unlinked)		(GstPad *pad, GstPad *peer); | 
| 817 |  | 
| 818 |   /*< private >*/ | 
| 819 |   gpointer _gst_reserved[GST_PADDING]; | 
| 820 | }; | 
| 821 |  | 
| 822 |  | 
| 823 | /***** helper macros *****/ | 
| 824 | /* GstPad */ | 
| 825 |  | 
| 826 | /** | 
| 827 |  * GST_PAD_NAME: | 
| 828 |  * @pad: a #GstPad | 
| 829 |  * | 
| 830 |  * Get name of the given pad. | 
| 831 |  * No locking is performed in this function, use gst_pad_get_name() instead. | 
| 832 |  */ | 
| 833 | #define GST_PAD_NAME(pad)		(GST_OBJECT_NAME(pad)) | 
| 834 | /** | 
| 835 |  * GST_PAD_PARENT: | 
| 836 |  * @pad: a #GstPad | 
| 837 |  * | 
| 838 |  * Get the @pad parent. | 
| 839 |  * No locking is performed in this function, use gst_pad_get_parent() instead. | 
| 840 |  */ | 
| 841 | #define GST_PAD_PARENT(pad)		(GST_ELEMENT_CAST(GST_OBJECT_PARENT(pad))) | 
| 842 | /** | 
| 843 |  * GST_PAD_ELEMENT_PRIVATE: | 
| 844 |  * @pad: a #GstPad | 
| 845 |  * | 
| 846 |  * Get the private data of @pad, which is usually some pad- or stream-specific | 
| 847 |  * structure created by the element and set on the pad when creating it. | 
| 848 |  * No locking is performed in this function. | 
| 849 |  */ | 
| 850 | #define GST_PAD_ELEMENT_PRIVATE(pad)    (GST_PAD_CAST(pad)->element_private) | 
| 851 | /** | 
| 852 |  * GST_PAD_PAD_TEMPLATE: | 
| 853 |  * @pad: a #GstPad | 
| 854 |  * | 
| 855 |  * Get the @pad #GstPadTemplate. It describes the possible media types | 
| 856 |  * a @pad or an element factory can handle. | 
| 857 |  */ | 
| 858 | #define GST_PAD_PAD_TEMPLATE(pad)	(GST_PAD_CAST(pad)->padtemplate) | 
| 859 | /** | 
| 860 |  * GST_PAD_DIRECTION: | 
| 861 |  * @pad: a #GstPad | 
| 862 |  * | 
| 863 |  * Get the #GstPadDirection of the given @pad. Accessor macro, use | 
| 864 |  * gst_pad_get_direction() instead. | 
| 865 |  */ | 
| 866 | #define GST_PAD_DIRECTION(pad)		(GST_PAD_CAST(pad)->direction) | 
| 867 | /** | 
| 868 |  * GST_PAD_TASK: | 
| 869 |  * @pad: a #GstPad | 
| 870 |  * | 
| 871 |  * Get the #GstTask of @pad. Accessor macro used by GStreamer. Use the | 
| 872 |  * gst_pad_start_task(), gst_pad_stop_task() and gst_pad_pause_task() | 
| 873 |  * functions instead. | 
| 874 |  */ | 
| 875 | #define GST_PAD_TASK(pad)		(GST_PAD_CAST(pad)->task) | 
| 876 | /** | 
| 877 |  * GST_PAD_MODE: | 
| 878 |  * @pad: a #GstPad | 
| 879 |  * | 
| 880 |  * Get the #GstPadMode of pad, which will be GST_PAD_MODE_NONE if the pad | 
| 881 |  * has not been activated yet, and otherwise either GST_PAD_MODE_PUSH or | 
| 882 |  * GST_PAD_MODE_PULL depending on which mode the pad was activated in. | 
| 883 |  */ | 
| 884 | #define GST_PAD_MODE(pad)	        (GST_PAD_CAST(pad)->mode) | 
| 885 | /** | 
| 886 |  * GST_PAD_ACTIVATEFUNC: | 
| 887 |  * @pad: a #GstPad | 
| 888 |  * | 
| 889 |  * Get the #GstPadActivateFunction from @pad. | 
| 890 |  */ | 
| 891 | #define GST_PAD_ACTIVATEFUNC(pad)	(GST_PAD_CAST(pad)->activatefunc) | 
| 892 | /** | 
| 893 |  * GST_PAD_ACTIVATEMODEFUNC: | 
| 894 |  * @pad: a #GstPad | 
| 895 |  * | 
| 896 |  * Get the #GstPadActivateModeFunction from the given @pad. | 
| 897 |  */ | 
| 898 | #define GST_PAD_ACTIVATEMODEFUNC(pad)	(GST_PAD_CAST(pad)->activatemodefunc) | 
| 899 | /** | 
| 900 |  * GST_PAD_CHAINFUNC: | 
| 901 |  * @pad: a #GstPad | 
| 902 |  * | 
| 903 |  * Get the #GstPadChainFunction from the given @pad. | 
| 904 |  */ | 
| 905 | #define GST_PAD_CHAINFUNC(pad)		(GST_PAD_CAST(pad)->chainfunc) | 
| 906 | /** | 
| 907 |  * GST_PAD_CHAINLISTFUNC: | 
| 908 |  * @pad: a #GstPad | 
| 909 |  * | 
| 910 |  * Get the #GstPadChainListFunction from the given @pad. | 
| 911 |  */ | 
| 912 | #define GST_PAD_CHAINLISTFUNC(pad)      (GST_PAD_CAST(pad)->chainlistfunc) | 
| 913 | /** | 
| 914 |  * GST_PAD_GETRANGEFUNC: | 
| 915 |  * @pad: a #GstPad | 
| 916 |  * | 
| 917 |  * Get the #GstPadGetRangeFunction from the given @pad. | 
| 918 |  */ | 
| 919 | #define GST_PAD_GETRANGEFUNC(pad)	(GST_PAD_CAST(pad)->getrangefunc) | 
| 920 | /** | 
| 921 |  * GST_PAD_EVENTFUNC: | 
| 922 |  * @pad: a #GstPad | 
| 923 |  * | 
| 924 |  * Get the #GstPadEventFunction from the given @pad, which | 
| 925 |  * is the function that handles events on the pad. You can | 
| 926 |  * use this to set your own event handling function on a pad | 
| 927 |  * after you create it.  If your element derives from a base | 
| 928 |  * class, use the base class's virtual functions instead. | 
| 929 |  */ | 
| 930 | #define GST_PAD_EVENTFUNC(pad)		(GST_PAD_CAST(pad)->eventfunc) | 
| 931 | /** | 
| 932 |  * GST_PAD_EVENTFULLFUNC: | 
| 933 |  * @pad: a #GstPad | 
| 934 |  * | 
| 935 |  * Get the #GstPadEventFullFunction from the given @pad, which | 
| 936 |  * is the function that handles events on the pad. You can | 
| 937 |  * use this to set your own event handling function on a pad | 
| 938 |  * after you create it.  If your element derives from a base | 
| 939 |  * class, use the base class's virtual functions instead. | 
| 940 |  * | 
| 941 |  * Since: 1.8 | 
| 942 |  */ | 
| 943 | #define GST_PAD_EVENTFULLFUNC(pad)	(GST_PAD_CAST(pad)->ABI.abi.eventfullfunc) | 
| 944 | /** | 
| 945 |  * GST_PAD_QUERYFUNC: | 
| 946 |  * @pad: a #GstPad | 
| 947 |  * | 
| 948 |  * Get the #GstPadQueryFunction from @pad, which is the function | 
| 949 |  * that handles queries on the pad. You can  use this to set your | 
| 950 |  * own query handling function on a pad after you create it. If your | 
| 951 |  * element derives from a base class, use the base class's virtual | 
| 952 |  * functions instead. | 
| 953 |  */ | 
| 954 | #define GST_PAD_QUERYFUNC(pad)		(GST_PAD_CAST(pad)->queryfunc) | 
| 955 | /** | 
| 956 |  * GST_PAD_ITERINTLINKFUNC: | 
| 957 |  * @pad: a #GstPad | 
| 958 |  * | 
| 959 |  * Get the #GstPadIterIntLinkFunction from the given @pad. | 
| 960 |  */ | 
| 961 | #define GST_PAD_ITERINTLINKFUNC(pad)    (GST_PAD_CAST(pad)->iterintlinkfunc) | 
| 962 | /** | 
| 963 |  * GST_PAD_PEER: | 
| 964 |  * @pad: a #GstPad | 
| 965 |  * | 
| 966 |  * Return the pad's peer member. This member is a pointer to the linked @pad. | 
| 967 |  * No locking is performed in this function, use gst_pad_get_peer() instead. | 
| 968 |  */ | 
| 969 | #define GST_PAD_PEER(pad)		(GST_PAD_CAST(pad)->peer) | 
| 970 | /** | 
| 971 |  * GST_PAD_LINKFUNC: | 
| 972 |  * @pad: a #GstPad | 
| 973 |  * | 
| 974 |  * Get the #GstPadLinkFunction for the given @pad. | 
| 975 |  */ | 
| 976 | #define GST_PAD_LINKFUNC(pad)		(GST_PAD_CAST(pad)->linkfunc) | 
| 977 | /** | 
| 978 |  * GST_PAD_UNLINKFUNC: | 
| 979 |  * @pad: a #GstPad | 
| 980 |  * | 
| 981 |  * Get the #GstPadUnlinkFunction from the given @pad. | 
| 982 |  */ | 
| 983 | #define GST_PAD_UNLINKFUNC(pad)		(GST_PAD_CAST(pad)->unlinkfunc) | 
| 984 | /** | 
| 985 |  * GST_PAD_IS_SRC: | 
| 986 |  * @pad: a #GstPad | 
| 987 |  * | 
| 988 |  * Returns: %TRUE if the pad is a source pad (i.e. produces data). | 
| 989 |  */ | 
| 990 | #define GST_PAD_IS_SRC(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SRC) | 
| 991 | /** | 
| 992 |  * GST_PAD_IS_SINK: | 
| 993 |  * @pad: a #GstPad | 
| 994 |  * | 
| 995 |  * Returns: %TRUE if the pad is a sink pad (i.e. consumes data). | 
| 996 |  */ | 
| 997 | #define GST_PAD_IS_SINK(pad)		(GST_PAD_DIRECTION(pad) == GST_PAD_SINK) | 
| 998 | /** | 
| 999 |  * GST_PAD_IS_LINKED: | 
| 1000 |  * @pad: a #GstPad | 
| 1001 |  * | 
| 1002 |  * Returns: %TRUE if the pad is linked to another pad. Use gst_pad_is_linked() | 
| 1003 |  * instead. | 
| 1004 |  */ | 
| 1005 | #define GST_PAD_IS_LINKED(pad)		(GST_PAD_PEER(pad) != NULL) | 
| 1006 | /** | 
| 1007 |  * GST_PAD_IS_ACTIVE: | 
| 1008 |  * @pad: a #GstPad | 
| 1009 |  * | 
| 1010 |  * Returns: %TRUE if the pad has been activated. | 
| 1011 |  */ | 
| 1012 | #define GST_PAD_IS_ACTIVE(pad)          (GST_PAD_MODE(pad) != GST_PAD_MODE_NONE) | 
| 1013 | /** | 
| 1014 |  * GST_PAD_IS_BLOCKED: | 
| 1015 |  * @pad: a #GstPad | 
| 1016 |  * | 
| 1017 |  * Check if the dataflow on a @pad is blocked. Use gst_pad_is_blocked() instead. | 
| 1018 |  */ | 
| 1019 | #define GST_PAD_IS_BLOCKED(pad)		(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED)) | 
| 1020 | /** | 
| 1021 |  * GST_PAD_IS_BLOCKING: | 
| 1022 |  * @pad: a #GstPad | 
| 1023 |  * | 
| 1024 |  * Check if the @pad is currently blocking on a buffer or event. Use | 
| 1025 |  * gst_pad_is_blocking() instead. | 
| 1026 |  */ | 
| 1027 | #define GST_PAD_IS_BLOCKING(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING)) | 
| 1028 | /** | 
| 1029 |  * GST_PAD_IS_FLUSHING: | 
| 1030 |  * @pad: a #GstPad | 
| 1031 |  * | 
| 1032 |  * Check if the given @pad is flushing. | 
| 1033 |  */ | 
| 1034 | #define GST_PAD_IS_FLUSHING(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING)) | 
| 1035 | /** | 
| 1036 |  * GST_PAD_SET_FLUSHING: | 
| 1037 |  * @pad: a #GstPad | 
| 1038 |  * | 
| 1039 |  * Set the given @pad to flushing state, which means it will not accept any | 
| 1040 |  * more events, queries or buffers, and return GST_FLOW_FLUSHING if any buffers | 
| 1041 |  * are pushed on it. This usually happens when the pad is shut down or when | 
| 1042 |  * a flushing seek happens. This is used inside GStreamer when flush start/stop | 
| 1043 |  * events pass through pads, or when an element state is changed and pads are | 
| 1044 |  * activated or deactivated. | 
| 1045 |  */ | 
| 1046 | #define GST_PAD_SET_FLUSHING(pad)	(GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_FLUSHING)) | 
| 1047 | /** | 
| 1048 |  * GST_PAD_UNSET_FLUSHING: | 
| 1049 |  * @pad: a #GstPad | 
| 1050 |  * | 
| 1051 |  * Unset the flushing flag. | 
| 1052 |  */ | 
| 1053 | #define GST_PAD_UNSET_FLUSHING(pad)	(GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_FLUSHING)) | 
| 1054 | /** | 
| 1055 |  * GST_PAD_IS_EOS: | 
| 1056 |  * @pad: a #GstPad | 
| 1057 |  * | 
| 1058 |  * Check if the @pad is in EOS state. | 
| 1059 |  */ | 
| 1060 | #define GST_PAD_IS_EOS(pad)	        (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_EOS)) | 
| 1061 | /** | 
| 1062 |  * GST_PAD_NEEDS_RECONFIGURE: | 
| 1063 |  * @pad: a #GstPad | 
| 1064 |  * | 
| 1065 |  * Check if the @pad should be reconfigured/renegotiated. | 
| 1066 |  * The flag has to be unset manually after reconfiguration happened. | 
| 1067 |  * Use gst_pad_needs_reconfigure() or gst_pad_check_reconfigure() instead. | 
| 1068 |  */ | 
| 1069 | #define GST_PAD_NEEDS_RECONFIGURE(pad)  (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_RECONFIGURE)) | 
| 1070 | /** | 
| 1071 |  * GST_PAD_HAS_PENDING_EVENTS: | 
| 1072 |  * @pad: a #GstPad | 
| 1073 |  * | 
| 1074 |  * Check if the given @pad has pending events. This is used internally by | 
| 1075 |  * GStreamer. | 
| 1076 |  */ | 
| 1077 | #define GST_PAD_HAS_PENDING_EVENTS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PENDING_EVENTS)) | 
| 1078 | /** | 
| 1079 |  * GST_PAD_IS_FIXED_CAPS: | 
| 1080 |  * @pad: a #GstPad | 
| 1081 |  * | 
| 1082 |  * Check if the given @pad is using fixed caps, which means that | 
| 1083 |  * once the caps are set on the @pad, the caps query function will | 
| 1084 |  * only return those caps. See gst_pad_use_fixed_caps(). | 
| 1085 |  */ | 
| 1086 | #define GST_PAD_IS_FIXED_CAPS(pad)	(GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FIXED_CAPS)) | 
| 1087 | /** | 
| 1088 |  * GST_PAD_NEEDS_PARENT: | 
| 1089 |  * @pad: a #GstPad | 
| 1090 |  * | 
| 1091 |  * Check if there is a parent object before calling into the @pad callbacks. | 
| 1092 |  * This is used internally by GStreamer. | 
| 1093 |  */ | 
| 1094 | #define GST_PAD_NEEDS_PARENT(pad)       (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_NEED_PARENT)) | 
| 1095 | /** | 
| 1096 |  * GST_PAD_IS_PROXY_CAPS: | 
| 1097 |  * @pad: a #GstPad | 
| 1098 |  * | 
| 1099 |  * Check if the given @pad is set to proxy caps. This means that the default | 
| 1100 |  * event and query handler will forward all events and queries to the | 
| 1101 |  * internally linked @pads instead of discarding them. | 
| 1102 |  */ | 
| 1103 | #define GST_PAD_IS_PROXY_CAPS(pad)      (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_CAPS)) | 
| 1104 | /** | 
| 1105 |  * GST_PAD_SET_PROXY_CAPS: | 
| 1106 |  * @pad: a #GstPad | 
| 1107 |  * | 
| 1108 |  * Set @pad to proxy caps, so that all caps-related events and queries are | 
| 1109 |  * proxied down- or upstream to the other side of the element automatically. | 
| 1110 |  * Set this if the element always outputs data in the exact same format as it | 
| 1111 |  * receives as input. This is just for convenience to avoid implementing some | 
| 1112 |  * standard event and query handling code in an element. | 
| 1113 |  */ | 
| 1114 | #define GST_PAD_SET_PROXY_CAPS(pad)     (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_CAPS)) | 
| 1115 | /** | 
| 1116 |  * GST_PAD_UNSET_PROXY_CAPS: | 
| 1117 |  * @pad: a #GstPad | 
| 1118 |  * | 
| 1119 |  * Unset proxy caps flag. | 
| 1120 |  */ | 
| 1121 | #define GST_PAD_UNSET_PROXY_CAPS(pad)   (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_CAPS)) | 
| 1122 | /** | 
| 1123 |  * GST_PAD_IS_PROXY_ALLOCATION: | 
| 1124 |  * @pad: a #GstPad | 
| 1125 |  * | 
| 1126 |  * Check if the given @pad is set as proxy allocation which means | 
| 1127 |  * that the default query handler will forward allocation queries to the | 
| 1128 |  * internally linked @pads instead of discarding them. | 
| 1129 |  */ | 
| 1130 | #define GST_PAD_IS_PROXY_ALLOCATION(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION)) | 
| 1131 | /** | 
| 1132 |  * GST_PAD_SET_PROXY_ALLOCATION: | 
| 1133 |  * @pad: a #GstPad | 
| 1134 |  * | 
| 1135 |  * Set @pad to proxy allocation queries, which means that the default query | 
| 1136 |  * handler will forward allocation queries to the internally linked @pads | 
| 1137 |  * instead of discarding them. | 
| 1138 |  * Set this if the element always outputs data in the exact same format as it | 
| 1139 |  * receives as input. This is just for convenience to avoid implementing some | 
| 1140 |  * standard query handling code in an element. | 
| 1141 |  */ | 
| 1142 | #define GST_PAD_SET_PROXY_ALLOCATION(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_ALLOCATION)) | 
| 1143 | /** | 
| 1144 |  * GST_PAD_UNSET_PROXY_ALLOCATION: | 
| 1145 |  * @pad: a #GstPad | 
| 1146 |  * | 
| 1147 |  * Unset proxy allocation flag. | 
| 1148 |  */ | 
| 1149 | #define GST_PAD_UNSET_PROXY_ALLOCATION(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_ALLOCATION)) | 
| 1150 | /** | 
| 1151 |  * GST_PAD_IS_PROXY_SCHEDULING: | 
| 1152 |  * @pad: a #GstPad | 
| 1153 |  * | 
| 1154 |  * Check if the given @pad is set to proxy scheduling queries, which means that | 
| 1155 |  * the default query handler will forward scheduling queries to the internally | 
| 1156 |  * linked @pads instead of discarding them. | 
| 1157 |  */ | 
| 1158 | #define GST_PAD_IS_PROXY_SCHEDULING(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING)) | 
| 1159 | /** | 
| 1160 |  * GST_PAD_SET_PROXY_SCHEDULING: | 
| 1161 |  * @pad: a #GstPad | 
| 1162 |  * | 
| 1163 |  * Set @pad to proxy scheduling queries, which means that the default query | 
| 1164 |  * handler will forward scheduling queries to the internally linked @pads | 
| 1165 |  * instead of discarding them. You will usually want to handle scheduling | 
| 1166 |  * queries explicitly if your element supports multiple scheduling modes. | 
| 1167 |  */ | 
| 1168 | #define GST_PAD_SET_PROXY_SCHEDULING(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PROXY_SCHEDULING)) | 
| 1169 | /** | 
| 1170 |  * GST_PAD_UNSET_PROXY_SCHEDULING: | 
| 1171 |  * @pad: a #GstPad | 
| 1172 |  * | 
| 1173 |  * Unset proxy scheduling flag. | 
| 1174 |  */ | 
| 1175 | #define GST_PAD_UNSET_PROXY_SCHEDULING(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_PROXY_SCHEDULING)) | 
| 1176 | /** | 
| 1177 |  * GST_PAD_IS_ACCEPT_INTERSECT: | 
| 1178 |  * @pad: a #GstPad | 
| 1179 |  * | 
| 1180 |  * Check if the pad's accept intersect flag is set. The default accept-caps | 
| 1181 |  * handler will check if the caps intersect the query-caps result instead of | 
| 1182 |  * checking for a subset. This is interesting for parser elements that can | 
| 1183 |  * accept incompletely specified caps. | 
| 1184 |  */ | 
| 1185 | #define GST_PAD_IS_ACCEPT_INTERSECT(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT)) | 
| 1186 | /** | 
| 1187 |  * GST_PAD_SET_ACCEPT_INTERSECT: | 
| 1188 |  * @pad: a #GstPad | 
| 1189 |  * | 
| 1190 |  * Set @pad to by default accept caps by intersecting the result instead of | 
| 1191 |  * checking for a subset. This is interesting for parser elements that can | 
| 1192 |  * accept incompletely specified caps. | 
| 1193 |  */ | 
| 1194 | #define GST_PAD_SET_ACCEPT_INTERSECT(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT)) | 
| 1195 | /** | 
| 1196 |  * GST_PAD_UNSET_ACCEPT_INTERSECT: | 
| 1197 |  * @pad: a #GstPad | 
| 1198 |  * | 
| 1199 |  * Unset accept intersect flag. | 
| 1200 |  */ | 
| 1201 | #define GST_PAD_UNSET_ACCEPT_INTERSECT(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_INTERSECT)) | 
| 1202 | /** | 
| 1203 |  * GST_PAD_IS_ACCEPT_TEMPLATE: | 
| 1204 |  * @pad: a #GstPad | 
| 1205 |  * | 
| 1206 |  * Check if the pad's accept caps operation will use the pad template caps. | 
| 1207 |  * The default accept-caps will do a query caps to get the caps, which might | 
| 1208 |  * be querying downstream causing unnecessary overhead. It is recommended to | 
| 1209 |  * implement a proper accept-caps query handler or to use this flag to prevent | 
| 1210 |  * recursive accept-caps handling. | 
| 1211 |  * | 
| 1212 |  * Since: 1.6 | 
| 1213 |  */ | 
| 1214 | #define GST_PAD_IS_ACCEPT_TEMPLATE(pad)    (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE)) | 
| 1215 | /** | 
| 1216 |  * GST_PAD_SET_ACCEPT_TEMPLATE: | 
| 1217 |  * @pad: a #GstPad | 
| 1218 |  * | 
| 1219 |  * Set @pad to by default use the pad template caps to compare with | 
| 1220 |  * the accept caps instead of using a caps query result. | 
| 1221 |  * | 
| 1222 |  * Since: 1.6 | 
| 1223 |  */ | 
| 1224 | #define GST_PAD_SET_ACCEPT_TEMPLATE(pad)   (GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE)) | 
| 1225 | /** | 
| 1226 |  * GST_PAD_UNSET_ACCEPT_TEMPLATE: | 
| 1227 |  * @pad: a #GstPad | 
| 1228 |  * | 
| 1229 |  * Unset accept template flag. | 
| 1230 |  * | 
| 1231 |  * Since: 1.6 | 
| 1232 |  */ | 
| 1233 | #define GST_PAD_UNSET_ACCEPT_TEMPLATE(pad) (GST_OBJECT_FLAG_UNSET (pad, GST_PAD_FLAG_ACCEPT_TEMPLATE)) | 
| 1234 | /** | 
| 1235 |  * GST_PAD_GET_STREAM_LOCK: | 
| 1236 |  * @pad: a #GstPad | 
| 1237 |  * | 
| 1238 |  * Get the stream lock of @pad. The stream lock is protecting the | 
| 1239 |  * resources used in the data processing functions of @pad. Accessor | 
| 1240 |  * macro, use GST_PAD_STREAM_LOCK() and GST_PAD_STREAM_UNLOCK() instead | 
| 1241 |  * to take/release the pad's stream lock. | 
| 1242 |  */ | 
| 1243 | #define GST_PAD_GET_STREAM_LOCK(pad)    (&(GST_PAD_CAST(pad)->stream_rec_lock)) | 
| 1244 | /** | 
| 1245 |  * GST_PAD_STREAM_LOCK: | 
| 1246 |  * @pad: a #GstPad | 
| 1247 |  * | 
| 1248 |  * Take the pad's stream lock. The stream lock is recursive and will be taken | 
| 1249 |  * when buffers or serialized downstream events are pushed on a pad. | 
| 1250 |  */ | 
| 1251 | #define GST_PAD_STREAM_LOCK(pad)        g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad)) | 
| 1252 | /** | 
| 1253 |  * GST_PAD_STREAM_TRYLOCK: | 
| 1254 |  * @pad: a #GstPad | 
| 1255 |  * | 
| 1256 |  * Try to take the pad's stream lock, and return %TRUE if the lock could be | 
| 1257 |  * taken, and otherwise %FALSE. | 
| 1258 |  */ | 
| 1259 | #define GST_PAD_STREAM_TRYLOCK(pad)     g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad)) | 
| 1260 | /** | 
| 1261 |  * GST_PAD_STREAM_UNLOCK: | 
| 1262 |  * @pad: a #GstPad | 
| 1263 |  * | 
| 1264 |  * Release the pad's stream lock. | 
| 1265 |  */ | 
| 1266 | #define GST_PAD_STREAM_UNLOCK(pad)      g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad)) | 
| 1267 | /** | 
| 1268 |  * GST_PAD_LAST_FLOW_RETURN: | 
| 1269 |  * @pad: a #GstPad | 
| 1270 |  * | 
| 1271 |  * Gets the last flow return on this pad | 
| 1272 |  * | 
| 1273 |  * Since: 1.4 | 
| 1274 |  */ | 
| 1275 | #define GST_PAD_LAST_FLOW_RETURN(pad)   (GST_PAD_CAST(pad)->ABI.abi.last_flowret) | 
| 1276 |  | 
| 1277 | #define GST_PAD_BLOCK_GET_COND(pad)     (&GST_PAD_CAST(pad)->block_cond) | 
| 1278 | #define GST_PAD_BLOCK_WAIT(pad)         (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad))) | 
| 1279 | #define GST_PAD_BLOCK_SIGNAL(pad)       (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad))) | 
| 1280 | #define GST_PAD_BLOCK_BROADCAST(pad)    (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad))) | 
| 1281 |  | 
| 1282 | GST_API | 
| 1283 | GType			gst_pad_get_type			(void); | 
| 1284 |  | 
| 1285 | /* creating pads */ | 
| 1286 |  | 
| 1287 | GST_API | 
| 1288 | GstPad*			gst_pad_new				(const gchar *name, GstPadDirection direction); | 
| 1289 |  | 
| 1290 | GST_API | 
| 1291 | GstPad*			gst_pad_new_from_template		(GstPadTemplate *templ, const gchar *name); | 
| 1292 |  | 
| 1293 | GST_API | 
| 1294 | GstPad*			gst_pad_new_from_static_template	(GstStaticPadTemplate *templ, const gchar *name); | 
| 1295 |  | 
| 1296 |  | 
| 1297 | /** | 
| 1298 |  * gst_pad_get_name: | 
| 1299 |  * @pad: the pad to get the name from | 
| 1300 |  * | 
| 1301 |  * Get a copy of the name of the pad. g_free() after usage. | 
| 1302 |  * | 
| 1303 |  * MT safe. | 
| 1304 |  */ | 
| 1305 | #define gst_pad_get_name(pad) gst_object_get_name (GST_OBJECT_CAST (pad)) | 
| 1306 | /** | 
| 1307 |  * gst_pad_get_parent: | 
| 1308 |  * @pad: the pad to get the parent of | 
| 1309 |  * | 
| 1310 |  * Get the parent of @pad. This function increases the refcount | 
| 1311 |  * of the parent object so you should gst_object_unref() it after usage. | 
| 1312 |  * Can return %NULL if the pad did not have a parent. | 
| 1313 |  * | 
| 1314 |  * MT safe. | 
| 1315 |  * | 
| 1316 |  * Returns: (nullable): the parent | 
| 1317 |  */ | 
| 1318 | #define gst_pad_get_parent(pad) gst_object_get_parent (GST_OBJECT_CAST (pad)) | 
| 1319 |  | 
| 1320 | GST_API | 
| 1321 | GstPadDirection		gst_pad_get_direction			(GstPad *pad); | 
| 1322 |  | 
| 1323 | GST_API | 
| 1324 | gboolean		gst_pad_set_active			(GstPad *pad, gboolean active); | 
| 1325 |  | 
| 1326 | GST_API | 
| 1327 | gboolean		gst_pad_is_active			(GstPad *pad); | 
| 1328 |  | 
| 1329 | GST_API | 
| 1330 | gboolean		gst_pad_activate_mode			(GstPad *pad, GstPadMode mode, | 
| 1331 |                                                                  gboolean active); | 
| 1332 | GST_API | 
| 1333 | gulong                  gst_pad_add_probe                       (GstPad *pad, | 
| 1334 | 								 GstPadProbeType mask, | 
| 1335 | 								 GstPadProbeCallback callback, | 
| 1336 |                                                                  gpointer user_data, | 
| 1337 |                                                                  GDestroyNotify destroy_data); | 
| 1338 | GST_API | 
| 1339 | void                    gst_pad_remove_probe                    (GstPad *pad, gulong id); | 
| 1340 |  | 
| 1341 | GST_API | 
| 1342 | gboolean		gst_pad_is_blocked			(GstPad *pad); | 
| 1343 |  | 
| 1344 | GST_API | 
| 1345 | gboolean		gst_pad_is_blocking			(GstPad *pad); | 
| 1346 |  | 
| 1347 | GST_API | 
| 1348 | void                    gst_pad_mark_reconfigure                (GstPad *pad); | 
| 1349 |  | 
| 1350 | GST_API | 
| 1351 | gboolean		gst_pad_needs_reconfigure               (GstPad *pad); | 
| 1352 |  | 
| 1353 | GST_API | 
| 1354 | gboolean		gst_pad_check_reconfigure               (GstPad *pad); | 
| 1355 |  | 
| 1356 | GST_API | 
| 1357 | void			gst_pad_set_element_private		(GstPad *pad, gpointer priv); | 
| 1358 |  | 
| 1359 | GST_API | 
| 1360 | gpointer		gst_pad_get_element_private		(GstPad *pad); | 
| 1361 |  | 
| 1362 | GST_API | 
| 1363 | GstPadTemplate*		gst_pad_get_pad_template		(GstPad *pad); | 
| 1364 |  | 
| 1365 | GST_API | 
| 1366 | GstFlowReturn           gst_pad_store_sticky_event              (GstPad *pad, GstEvent *event); | 
| 1367 |  | 
| 1368 | GST_API | 
| 1369 | GstEvent*               gst_pad_get_sticky_event                (GstPad *pad, GstEventType event_type, | 
| 1370 |                                                                  guint idx); | 
| 1371 |  | 
| 1372 | GST_API | 
| 1373 | void                    gst_pad_sticky_events_foreach           (GstPad *pad, GstPadStickyEventsForeachFunction foreach_func, gpointer user_data); | 
| 1374 |  | 
| 1375 | /* data passing setup functions */ | 
| 1376 |  | 
| 1377 | GST_API | 
| 1378 | void			gst_pad_set_activate_function_full	(GstPad *pad, | 
| 1379 |                                                                  GstPadActivateFunction activate, | 
| 1380 |                                                                  gpointer user_data, | 
| 1381 |                                                                  GDestroyNotify notify); | 
| 1382 | GST_API | 
| 1383 | void			gst_pad_set_activatemode_function_full	(GstPad *pad, | 
| 1384 |                                                                  GstPadActivateModeFunction activatemode, | 
| 1385 |                                                                  gpointer user_data, | 
| 1386 |                                                                  GDestroyNotify notify); | 
| 1387 | /* data passing functions */ | 
| 1388 |  | 
| 1389 | GST_API | 
| 1390 | void			gst_pad_set_chain_function_full		(GstPad *pad, | 
| 1391 |                                                                  GstPadChainFunction chain, | 
| 1392 |                                                                  gpointer user_data, | 
| 1393 |                                                                  GDestroyNotify notify); | 
| 1394 | GST_API | 
| 1395 | void			gst_pad_set_chain_list_function_full	(GstPad *pad, | 
| 1396 |                                                                  GstPadChainListFunction chainlist, | 
| 1397 |                                                                  gpointer user_data, | 
| 1398 |                                                                  GDestroyNotify notify); | 
| 1399 | GST_API | 
| 1400 | void			gst_pad_set_getrange_function_full	(GstPad *pad, | 
| 1401 |                                                                  GstPadGetRangeFunction get, | 
| 1402 |                                                                  gpointer user_data, | 
| 1403 |                                                                  GDestroyNotify notify); | 
| 1404 | GST_API | 
| 1405 | void			gst_pad_set_event_function_full		(GstPad *pad, | 
| 1406 |                                                                  GstPadEventFunction event, | 
| 1407 |                                                                  gpointer user_data, | 
| 1408 |                                                                  GDestroyNotify notify); | 
| 1409 | GST_API | 
| 1410 | void			gst_pad_set_event_full_function_full	(GstPad *pad, | 
| 1411 |                                                                  GstPadEventFullFunction event, | 
| 1412 |                                                                  gpointer user_data, | 
| 1413 |                                                                  GDestroyNotify notify); | 
| 1414 |  | 
| 1415 | #define gst_pad_set_activate_function(p,f)      gst_pad_set_activate_function_full((p),(f),NULL,NULL) | 
| 1416 | #define gst_pad_set_activatemode_function(p,f)  gst_pad_set_activatemode_function_full((p),(f),NULL,NULL) | 
| 1417 | #define gst_pad_set_chain_function(p,f)         gst_pad_set_chain_function_full((p),(f),NULL,NULL) | 
| 1418 | #define gst_pad_set_chain_list_function(p,f)    gst_pad_set_chain_list_function_full((p),(f),NULL,NULL) | 
| 1419 | #define gst_pad_set_getrange_function(p,f)      gst_pad_set_getrange_function_full((p),(f),NULL,NULL) | 
| 1420 | #define gst_pad_set_event_function(p,f)         gst_pad_set_event_function_full((p),(f),NULL,NULL) | 
| 1421 | #define gst_pad_set_event_full_function(p,f)    gst_pad_set_event_full_function_full((p),(f),NULL,NULL) | 
| 1422 |  | 
| 1423 | /* pad links */ | 
| 1424 |  | 
| 1425 | GST_API | 
| 1426 | void			gst_pad_set_link_function_full		(GstPad *pad, | 
| 1427 |                                                                  GstPadLinkFunction link, | 
| 1428 |                                                                  gpointer user_data, | 
| 1429 |                                                                  GDestroyNotify notify); | 
| 1430 | GST_API | 
| 1431 | void			gst_pad_set_unlink_function_full        (GstPad *pad, | 
| 1432 |                                                                  GstPadUnlinkFunction unlink, | 
| 1433 |                                                                  gpointer user_data, | 
| 1434 |                                                                  GDestroyNotify notify); | 
| 1435 |  | 
| 1436 | #define gst_pad_set_link_function(p,f)          gst_pad_set_link_function_full((p),(f),NULL,NULL) | 
| 1437 | #define gst_pad_set_unlink_function(p,f)        gst_pad_set_unlink_function_full((p),(f),NULL,NULL) | 
| 1438 |  | 
| 1439 | GST_API | 
| 1440 | gboolean                gst_pad_can_link                        (GstPad *srcpad, GstPad *sinkpad); | 
| 1441 |  | 
| 1442 | GST_API | 
| 1443 | GstPadLinkReturn        gst_pad_link				(GstPad *srcpad, GstPad *sinkpad); | 
| 1444 |  | 
| 1445 | GST_API | 
| 1446 | GstPadLinkReturn        gst_pad_link_full			(GstPad *srcpad, GstPad *sinkpad, GstPadLinkCheck flags); | 
| 1447 |  | 
| 1448 | GST_API | 
| 1449 | gboolean		gst_pad_unlink				(GstPad *srcpad, GstPad *sinkpad); | 
| 1450 |  | 
| 1451 | GST_API | 
| 1452 | gboolean		gst_pad_is_linked			(GstPad *pad); | 
| 1453 |  | 
| 1454 | GST_API | 
| 1455 | GstPad*			gst_pad_get_peer			(GstPad *pad); | 
| 1456 |  | 
| 1457 | GST_API | 
| 1458 | GstCaps*                gst_pad_get_pad_template_caps		(GstPad *pad); | 
| 1459 |  | 
| 1460 | /* capsnego function for linked/unlinked pads */ | 
| 1461 |  | 
| 1462 | GST_API | 
| 1463 | GstCaps *		gst_pad_get_current_caps                (GstPad * pad); | 
| 1464 |  | 
| 1465 | GST_API | 
| 1466 | gboolean		gst_pad_has_current_caps                (GstPad * pad); | 
| 1467 |  | 
| 1468 | /* capsnego for linked pads */ | 
| 1469 |  | 
| 1470 | GST_API | 
| 1471 | GstCaps *		gst_pad_get_allowed_caps		(GstPad * pad); | 
| 1472 |  | 
| 1473 | /* pad offsets */ | 
| 1474 |  | 
| 1475 | GST_API | 
| 1476 | gint64                  gst_pad_get_offset                      (GstPad *pad); | 
| 1477 |  | 
| 1478 | GST_API | 
| 1479 | void                    gst_pad_set_offset                      (GstPad *pad, gint64 offset); | 
| 1480 |  | 
| 1481 | /* data passing functions to peer */ | 
| 1482 |  | 
| 1483 | GST_API | 
| 1484 | GstFlowReturn		gst_pad_push				(GstPad *pad, GstBuffer *buffer); | 
| 1485 |  | 
| 1486 | GST_API | 
| 1487 | GstFlowReturn		gst_pad_push_list			(GstPad *pad, GstBufferList *list); | 
| 1488 |  | 
| 1489 | GST_API | 
| 1490 | GstFlowReturn		gst_pad_pull_range			(GstPad *pad, guint64 offset, guint size, | 
| 1491 | 								 GstBuffer **buffer); | 
| 1492 | GST_API | 
| 1493 | gboolean		gst_pad_push_event			(GstPad *pad, GstEvent *event); | 
| 1494 |  | 
| 1495 | GST_API | 
| 1496 | gboolean		gst_pad_event_default			(GstPad *pad, GstObject *parent, | 
| 1497 |                                                                  GstEvent *event); | 
| 1498 | GST_API | 
| 1499 | GstFlowReturn           gst_pad_get_last_flow_return            (GstPad *pad); | 
| 1500 |  | 
| 1501 | /* data passing functions on pad */ | 
| 1502 |  | 
| 1503 | GST_API | 
| 1504 | GstFlowReturn		gst_pad_chain				(GstPad *pad, GstBuffer *buffer); | 
| 1505 |  | 
| 1506 | GST_API | 
| 1507 | GstFlowReturn		gst_pad_chain_list                      (GstPad *pad, GstBufferList *list); | 
| 1508 |  | 
| 1509 | GST_API | 
| 1510 | GstFlowReturn		gst_pad_get_range			(GstPad *pad, guint64 offset, guint size, | 
| 1511 | 								 GstBuffer **buffer); | 
| 1512 | GST_API | 
| 1513 | gboolean		gst_pad_send_event			(GstPad *pad, GstEvent *event); | 
| 1514 |  | 
| 1515 | /* pad tasks */ | 
| 1516 |  | 
| 1517 | GST_API | 
| 1518 | gboolean		gst_pad_start_task			(GstPad *pad, GstTaskFunction func, | 
| 1519 | 								 gpointer user_data, GDestroyNotify notify); | 
| 1520 | GST_API | 
| 1521 | gboolean		gst_pad_pause_task			(GstPad *pad); | 
| 1522 |  | 
| 1523 | GST_API | 
| 1524 | gboolean		gst_pad_stop_task			(GstPad *pad); | 
| 1525 |  | 
| 1526 | GST_API | 
| 1527 | GstTaskState	gst_pad_get_task_state		(GstPad *pad); | 
| 1528 |  | 
| 1529 | /* internal links */ | 
| 1530 |  | 
| 1531 | GST_API | 
| 1532 | void                    gst_pad_set_iterate_internal_links_function_full (GstPad * pad, | 
| 1533 |                                                                  GstPadIterIntLinkFunction iterintlink, | 
| 1534 |                                                                  gpointer user_data, | 
| 1535 |                                                                  GDestroyNotify notify); | 
| 1536 |  | 
| 1537 | GST_API | 
| 1538 | GstIterator *           gst_pad_iterate_internal_links          (GstPad * pad); | 
| 1539 |  | 
| 1540 | GST_API | 
| 1541 | GstIterator *           gst_pad_iterate_internal_links_default  (GstPad * pad, GstObject *parent); | 
| 1542 |  | 
| 1543 | #define gst_pad_set_iterate_internal_links_function(p,f) gst_pad_set_iterate_internal_links_function_full((p),(f),NULL,NULL) | 
| 1544 |  | 
| 1545 | GST_API | 
| 1546 | GstPad *                gst_pad_get_single_internal_link        (GstPad * pad); | 
| 1547 |  | 
| 1548 | /* generic query function */ | 
| 1549 |  | 
| 1550 | GST_API | 
| 1551 | gboolean		gst_pad_query				(GstPad *pad, GstQuery *query); | 
| 1552 |  | 
| 1553 | GST_API | 
| 1554 | gboolean		gst_pad_peer_query			(GstPad *pad, GstQuery *query); | 
| 1555 |  | 
| 1556 | GST_API | 
| 1557 | void			gst_pad_set_query_function_full		(GstPad *pad, GstPadQueryFunction query, | 
| 1558 |                                                                  gpointer user_data, | 
| 1559 |                                                                  GDestroyNotify notify); | 
| 1560 | GST_API | 
| 1561 | gboolean		gst_pad_query_default			(GstPad *pad, GstObject *parent, | 
| 1562 |                                                                  GstQuery *query); | 
| 1563 |  | 
| 1564 | #define gst_pad_set_query_function(p,f)   gst_pad_set_query_function_full((p),(f),NULL,NULL) | 
| 1565 |  | 
| 1566 | /* misc helper functions */ | 
| 1567 |  | 
| 1568 | GST_API | 
| 1569 | gboolean		gst_pad_forward                         (GstPad *pad, GstPadForwardFunction forward, | 
| 1570 | 								 gpointer user_data); | 
| 1571 |  | 
| 1572 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPad, gst_object_unref) | 
| 1573 |  | 
| 1574 | G_END_DECLS | 
| 1575 |  | 
| 1576 | #endif /* __GST_PAD_H__ */ | 
| 1577 |  |