1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 The link between Elements
7 <!-- ##### SECTION Long_Description ##### -->
9 A #GstElement is linked to other elements via "pads", which are extremely
10 light-weight generic link points.
11 After two pads are retrieved from an element with gst_element_get_pad(),
12 the pads can be link with gst_pad_link(). (For quick links,
13 you can also use gst_element_link(), which will make the obvious
14 link for you if it's straightforward.)
17 Pads are typically created from a #GstPadTemplate with
18 gst_pad_new_from_template().
21 Pads have #GstCaps attached to it to describe the media type they
22 are capable of dealing with.
23 gst_pad_get_caps() and gst_pad_try_set_caps() are used to
24 manipulate the caps of the pads.
25 Pads created from a pad template cannot set capabilities that are
26 incompatible with the pad template capabilities.
29 Pads without pad templates can be created with gst_pad_new(),
30 which takes a direction and a name as an argument. If the name is NULL,
31 then a guaranteed unique name will be assigned to it.
34 gst_pad_get_parent() will retrieve the #GstElement that owns the pad.
37 A #GstElement creating a pad will typically use the various
38 gst_pad_set_*_function() calls to register callbacks for various events
42 GstElements will use gst_pad_push() and gst_pad_pull() to push out
44 gst_pad_select() and gst_pad_selectv() are used by plugins to wait for the
45 first incoming buffer or event on any of the given set of pads.
48 To send a #GstEvent on a pad, use gst_pad_send_event().
52 Last reviewed on December 13th, 2002 (0.5.0.1)
55 <!-- ##### SECTION See_Also ##### -->
57 #GstPadTemplate, #GstElement, #GstEvent
60 <!-- ##### MACRO GST_PAD_NAME ##### -->
62 Gets the name of the pad.
65 @pad: a #GstPad to get the name of.
66 @Returns: the pad's name.
69 <!-- ##### MACRO GST_PAD_ELEMENT_PRIVATE ##### -->
71 Gets the private data set by the element that owns the pad.
74 @pad: a #GstPad to get the private data of.
75 #Returns: a gpointer to the private data.
78 <!-- ##### MACRO GST_PAD_PARENT ##### -->
80 Gets the parent element of this pad.
83 @pad: a #GstPad to get the parent of.
84 @Returns: the parent #GstElement of this pad.
87 <!-- ##### MACRO GST_PAD_PAD_TEMPLATE ##### -->
89 Gets the pad template that was used to create this pad.
92 @pad: a #GstPad to get the pad template of.
93 #Returns: the #GstPadTemplate used to create the pad, or NULL if none was
97 <!-- ##### MACRO GST_PAD_REALIZE ##### -->
99 Returns the real pad of this pad.
102 @pad: a #GstPad to realize.
103 @Returns: the actual #GstPad.
106 <!-- ##### MACRO GST_PAD_DIRECTION ##### -->
108 Gets the pad's direction.
111 @pad: a #GstPad to get the direction of.
112 @Returns: the #GstPadDirection of the pad.
115 <!-- ##### MACRO GST_PAD_CAPS ##### -->
117 Gets the capabilities of a pad.
120 @pad: a #GstPad to get the capabilities of.
121 @Returns: the #GstCaps of the pad.
124 <!-- ##### MACRO GST_PAD_PEER ##### -->
126 Gets the peer pad of this pad. The peer pad is the pad on to which the parent
127 element is linked through this pad.
130 @pad: a #GstPad to get the peer pad of.
131 @Returns: the peer #GstPad.
134 <!-- ##### MACRO GST_PAD_CAN_PULL ##### -->
136 Checks if buffers can be pulled from this buffer.
139 @pad: a #GstPad to check on if a buffer can be pulled from it.
142 <!-- ##### MACRO GST_PAD_IS_SINK ##### -->
144 Checks if the pad is a sink pad.
147 @pad: a #GstPad to check.
150 <!-- ##### MACRO GST_PAD_IS_SRC ##### -->
152 Checks if the pad is a source pad.
155 @pad: a #GstPad to check.
158 <!-- ##### MACRO GST_PAD_IS_LINKED ##### -->
160 Checks if the pad is linked.
163 @pad: a #GstPad to check.
166 <!-- ##### MACRO GST_PAD_IS_ACTIVE ##### -->
168 Checks if the pad is active.
171 @pad: a #GstPad to check
174 <!-- ##### MACRO GST_PAD_IS_USABLE ##### -->
176 Checks if a pad is usable. A usable pad is both linked and active.
179 @pad: a #GstPad to check
182 <!-- ##### STRUCT GstPad ##### -->
188 <!-- ##### USER_FUNCTION GstPadChainFunction ##### -->
190 A function that will be called when chaining buffers.
193 @pad: the #GstPad that performed the chain.
195 <!-- # Unused Parameters # -->
196 @buf: the #GstBuffer that is chained.
199 <!-- ##### USER_FUNCTION GstPadGetFunction ##### -->
201 A function that will be called when pulling a buffer.
204 @pad: the #GstPad to get a buffer from.
205 @Returns: the #GstBuffer pulled.
208 <!-- ##### USER_FUNCTION GstPadBufferPoolFunction ##### -->
210 A function that will be called when a buffer pool is requested
214 @pad: the #GstPad to which the buffer pool is associated.
215 @Returns: the #GstBufferPool associated with this pad.
218 <!-- ##### USER_FUNCTION GstPadGetCapsFunction ##### -->
220 Returns the capabilities of the specified pad. By default this function
221 will return the pad template capabilities, but can optionally be overridden.
224 @pad: the #GstPad to get the capabilities of.
225 @caps: the peer's #GstCaps, can be used to filter the capabilities.
226 @Returns: the #GstCaps of the pad.
229 <!-- ##### USER_FUNCTION GstPadEventFunction ##### -->
231 Function signature to handle an event for the pad.
234 @pad: the #GstPad to handle the event.
235 @event: the #GstEvent to handle.
236 @Returns: TRUE if the pad could handle the event.
239 <!-- ##### USER_FUNCTION GstPadLinkFunction ##### -->
241 Function signature to handle a new link on the pad.
244 @pad: the #GstPad that is linked.
245 @caps: the peer's #GstCaps.
246 @Returns: the result of the link with the specified caps.
249 <!-- ##### ENUM GstPadLinkReturn ##### -->
251 The result of a pad link.
254 @GST_PAD_LINK_REFUSED: the link was refused.
255 @GST_PAD_LINK_DELAYED: the link was delayed, probably because the
256 element needs more specific pad capabilitiess.
257 @GST_PAD_LINK_OK: the link succeeded.
258 @GST_PAD_LINK_DONE: the link succeeded,
259 any more attempts are not needed.
261 <!-- ##### USER_FUNCTION GstPadConvertFunction ##### -->
263 The signature of a convert function.
266 @pad: the #GstPad to perform the convert on.
267 @src_format: the source #GstFormat of the conversion.
268 @src_value: the source value of the conversion.
269 @dest_format: a pointer to the destination #GstFormat.
270 @dest_value: a pointer to the destination value.
271 @Returns: TRUE if the conversion could be performed.
274 <!-- ##### USER_FUNCTION GstPadDispatcherFunction ##### -->
276 A dispatcher function is called for all internally linked pads, see
277 gst_pad_dispatcher().
280 @pad: the #GstPad that is dispatched.
281 @data: the gpointer to optional user data.
282 @Returns: TRUE if the dispatching procedure has to be stopped.
285 <!-- ##### USER_FUNCTION GstPadIntLinkFunction ##### -->
287 The signature of the internal pad link function.
290 @pad: The #GstPad to query.
291 @Returns: a newly allocated #GList of pads that are linked to
292 the given pad on the inside of the parent element.
293 The caller must call g_list_free() on it after use.
296 <!-- ##### USER_FUNCTION GstPadQueryFunction ##### -->
298 The signature of the query function.
301 @pad: the #GstPad to query.
302 @type: the #GstPadQueryType.
303 @format: a pointer to the target #GstFormat.
304 @value: a pointer to the target value.
305 @Returns: TRUE if the query could be performed.
308 <!-- ##### USER_FUNCTION GstPadEventMaskFunction ##### -->
310 The signature of the eventmask function.
313 @pad: the #GstPad to query
314 @Returns: an array of event masks
317 <!-- ##### USER_FUNCTION GstPadFormatsFunction ##### -->
319 The signature of the formats function.
322 @pad: a #GstPad to query
323 @Returns: an array of formats
326 <!-- ##### USER_FUNCTION GstPadQueryTypeFunction ##### -->
328 The signature of the query types function.
331 @pad: a #GstPad to query
332 @Returns: an array of query types
335 <!-- ##### MACRO GST_PAD_QUERY_TYPE_FUNCTION ##### -->
337 A convenience macro to construct query type functions
340 @functionname: the name of the function
341 @...: query types, 0 to mark the last element
344 <!-- ##### MACRO GST_PAD_FORMATS_FUNCTION ##### -->
346 Convenience function to define an array of formats that can be used
347 as #GstPadGetFormatsFunction.
350 @functionname: The name of the function
351 @...: comma separated list of formats, 0 to mark the end
354 <!-- ##### MACRO GST_PAD_EVENT_MASK_FUNCTION ##### -->
356 Convenience function to define an array of event masks that can be used
357 as #GstPadGetEventMaskFunction.
360 @functionname: The name of the function
361 @...: comma separated list of event maks, { 0, } to mark the end
364 <!-- ##### ENUM GstPadDirection ##### -->
366 The direction of a pad.
369 @GST_PAD_UNKNOWN: direction is unknown.
370 @GST_PAD_SRC: the pad is a source pad.
371 @GST_PAD_SINK: the pad is a sink pad.
373 <!-- ##### ENUM GstPadFlags ##### -->
378 @GST_PAD_DISABLED: the pad is disabled.
379 @GST_PAD_NEGOTIATING:
380 @GST_PAD_FLAG_LAST: subclasses can use this number to enumerate their flags.
382 <!-- ##### FUNCTION gst_pad_new ##### -->
392 <!-- ##### FUNCTION gst_pad_custom_new ##### -->
403 <!-- ##### FUNCTION gst_pad_custom_new_from_template ##### -->
414 <!-- ##### FUNCTION gst_pad_new_from_template ##### -->
424 <!-- ##### FUNCTION gst_pad_get_direction ##### -->
433 <!-- ##### FUNCTION gst_pad_set_chain_function ##### -->
442 <!-- ##### FUNCTION gst_pad_set_get_function ##### -->
451 <!-- ##### FUNCTION gst_pad_set_bufferpool_function ##### -->
460 <!-- ##### FUNCTION gst_pad_set_link_function ##### -->
469 <!-- ##### FUNCTION gst_pad_set_getcaps_function ##### -->
478 <!-- ##### FUNCTION gst_pad_try_set_caps ##### -->
488 <!-- ##### FUNCTION gst_pad_get_caps ##### -->
497 <!-- ##### FUNCTION gst_pad_check_compatibility ##### -->
507 <!-- ##### FUNCTION gst_pad_set_name ##### -->
516 <!-- ##### FUNCTION gst_pad_get_name ##### -->
525 <!-- ##### FUNCTION gst_pad_set_element_private ##### -->
534 <!-- ##### FUNCTION gst_pad_get_element_private ##### -->
543 <!-- ##### FUNCTION gst_pad_set_parent ##### -->
552 <!-- ##### FUNCTION gst_pad_get_parent ##### -->
561 <!-- ##### FUNCTION gst_pad_get_real_parent ##### -->
570 <!-- ##### FUNCTION gst_pad_add_ghost_pad ##### -->
579 <!-- ##### FUNCTION gst_pad_remove_ghost_pad ##### -->
588 <!-- ##### FUNCTION gst_pad_get_ghost_pad_list ##### -->
597 <!-- ##### FUNCTION gst_pad_get_peer ##### -->
606 <!-- ##### FUNCTION gst_pad_link ##### -->
616 <!-- ##### FUNCTION gst_pad_link_filtered ##### -->
627 <!-- ##### FUNCTION gst_pad_relink_filtered ##### -->
638 <!-- ##### FUNCTION gst_pad_try_relink_filtered ##### -->
649 <!-- ##### FUNCTION gst_pad_unlink ##### -->
658 <!-- ##### FUNCTION gst_pad_can_link ##### -->
668 <!-- ##### FUNCTION gst_pad_can_link_filtered ##### -->
679 <!-- ##### FUNCTION gst_pad_push ##### -->
686 <!-- # Unused Parameters # -->
690 <!-- ##### FUNCTION gst_pad_pull ##### -->
699 <!-- ##### FUNCTION gst_pad_get_bufferpool ##### -->
708 <!-- ##### FUNCTION gst_pad_load_and_link ##### -->
717 <!-- ##### FUNCTION gst_pad_proxy_link ##### -->
727 <!-- ##### FUNCTION gst_pad_get_pad_template ##### -->
736 <!-- ##### FUNCTION gst_pad_get_pad_template_caps ##### -->
745 <!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
754 <!-- ##### FUNCTION gst_pad_recalc_allowed_caps ##### -->
763 <!-- ##### FUNCTION gst_pad_perform_negotiate ##### -->
773 <!-- ##### FUNCTION gst_ghost_pad_save_thyself ##### -->
783 <!-- ##### FUNCTION gst_pad_select ##### -->
792 <!-- ##### FUNCTION gst_pad_selectv ##### -->
802 <!-- ##### FUNCTION gst_pad_dispatcher ##### -->
813 <!-- ##### FUNCTION gst_pad_send_event ##### -->
823 <!-- ##### FUNCTION gst_pad_event_default ##### -->
833 <!-- ##### FUNCTION gst_pad_set_event_function ##### -->
842 <!-- ##### FUNCTION gst_pad_get_event_masks ##### -->
851 <!-- ##### FUNCTION gst_pad_get_event_masks_default ##### -->
860 <!-- ##### FUNCTION gst_pad_set_event_mask_function ##### -->
869 <!-- ##### FUNCTION gst_pad_set_convert_function ##### -->
878 <!-- ##### FUNCTION gst_pad_convert ##### -->
891 <!-- ##### FUNCTION gst_pad_convert_default ##### -->
904 <!-- ##### FUNCTION gst_pad_get_formats ##### -->
913 <!-- ##### FUNCTION gst_pad_get_formats_default ##### -->
922 <!-- ##### FUNCTION gst_pad_set_formats_function ##### -->
931 <!-- ##### FUNCTION gst_pad_get_internal_links ##### -->
940 <!-- ##### FUNCTION gst_pad_get_internal_links_default ##### -->
949 <!-- ##### FUNCTION gst_pad_set_internal_link_function ##### -->
958 <!-- ##### FUNCTION gst_pad_set_query_function ##### -->
967 <!-- ##### FUNCTION gst_pad_query ##### -->
979 <!-- ##### FUNCTION gst_pad_query_default ##### -->
991 <!-- ##### FUNCTION gst_pad_get_query_types ##### -->
1000 <!-- ##### FUNCTION gst_pad_get_query_types_default ##### -->
1009 <!-- ##### FUNCTION gst_pad_set_query_type_function ##### -->
1018 <!-- ##### MACRO gst_pad_add_probe ##### -->
1020 Adds the probe to the given pad
1023 @pad: The pad to add the probe to
1024 @probe: The probe to add to the pad
1027 <!-- ##### MACRO gst_pad_remove_probe ##### -->
1029 Remove the probe from the pad
1032 @pad: The pad to remove the probe of
1033 @probe: The probe to remove
1036 <!-- ##### FUNCTION gst_pad_is_active ##### -->
1045 <!-- ##### FUNCTION gst_pad_set_active ##### -->
1054 <!-- ##### FUNCTION gst_pad_get_scheduler ##### -->
1063 <!-- ##### STRUCT GstRealPad ##### -->
1094 <!-- ##### MACRO GST_RPAD_DIRECTION ##### -->
1096 Get the direction of the real pad.
1099 @pad: the realpad to query.
1102 <!-- ##### MACRO GST_RPAD_CAPS ##### -->
1104 Get the caps of the real pad.
1107 @pad: the real pad to query.
1110 <!-- ##### MACRO GST_RPAD_PEER ##### -->
1112 Get the peer element of the real pad.
1115 @pad: the real pad to query.
1118 <!-- ##### MACRO GST_RPAD_CHAINFUNC ##### -->
1120 Get the chain function of the real pad.
1123 @pad: the real pad to query.
1126 <!-- ##### MACRO GST_RPAD_FILTER ##### -->
1128 Get the filter from the pad
1131 @pad: the pad to query
1134 <!-- ##### MACRO GST_RPAD_APPFILTER ##### -->
1136 Get the application filter for this pad
1139 @pad: the pad to query
1142 <!-- ##### MACRO GST_RPAD_GETFUNC ##### -->
1144 Get get getfunction of the real pad.
1147 @pad: the real pad to query.
1150 <!-- ##### MACRO GST_RPAD_BUFFERPOOLFUNC ##### -->
1152 Get the bufferpoolfunction from the real pad.
1155 @pad: the real pad to query.
1158 <!-- ##### MACRO GST_RPAD_CHAINHANDLER ##### -->
1160 Get the eventhandler function from the real pad.
1163 @pad: the real pad to query.
1166 <!-- ##### MACRO GST_RPAD_EVENTFUNC ##### -->
1168 Get the event function of this real pad.
1171 @pad: the real pad to query.
1174 <!-- ##### MACRO GST_RPAD_EVENTHANDLER ##### -->
1176 Get the eventhandler function of this real pad.
1179 @pad: the real pad to query.
1182 <!-- ##### MACRO GST_RPAD_GETHANDLER ##### -->
1184 Get the gethandler function of this real pad.
1187 @pad: the real pad to query.
1190 <!-- ##### MACRO GST_RPAD_LINKFUNC ##### -->
1192 Get the link function of the pad
1195 @pad: the pad to query
1198 <!-- ##### MACRO GST_RPAD_GETCAPSFUNC ##### -->
1200 Get the getcaps function of this pad
1203 @pad: the pad to query
1206 <!-- ##### MACRO GST_RPAD_CONVERTFUNC ##### -->
1208 Get the convert function of this pad
1211 @pad: the pad to query
1214 <!-- ##### MACRO GST_RPAD_INTLINKFUNC ##### -->
1216 Get the internal link function of this pad
1219 @pad: the pad to query
1222 <!-- ##### MACRO GST_RPAD_QUERYFUNC ##### -->
1224 Get the query function of this pad
1227 @pad: the pad to query
1230 <!-- ##### MACRO GST_RPAD_EVENTMASKFUNC ##### -->
1232 Get the event mask function of this pad
1235 @pad: the pad to query
1238 <!-- ##### MACRO GST_RPAD_FORMATSFUNC ##### -->
1240 Get the formats function of this pad
1243 @pad: the pad to query
1246 <!-- ##### MACRO GST_RPAD_QUERYTYPEFUNC ##### -->
1248 Get the query types function of this pad
1251 @pad: the pad to query
1254 <!-- ##### MACRO GST_GPAD_REALPAD ##### -->
1256 Get the real pad of this ghost pad.
1259 @pad: the real pad to query.
1262 <!-- ##### STRUCT GstGhostPad ##### -->
1268 <!-- ##### FUNCTION gst_ghost_pad_new ##### -->