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 GstPadGetCapsFunction ##### -->
210 Returns the capabilities of the specified pad. By default this function
211 will return the pad template capabilities, but can optionally be overridden.
214 @pad: the #GstPad to get the capabilities of.
215 @Returns: the #GstCaps of the pad.
216 <!-- # Unused Parameters # -->
217 @caps: the peer's #GstCaps, can be used to filter the capabilities.
220 <!-- ##### USER_FUNCTION GstPadEventFunction ##### -->
222 Function signature to handle an event for the pad.
225 @pad: the #GstPad to handle the event.
226 @event: the #GstEvent to handle.
227 @Returns: TRUE if the pad could handle the event.
230 <!-- ##### USER_FUNCTION GstPadLinkFunction ##### -->
232 Function signature to handle a new link on the pad.
235 @pad: the #GstPad that is linked.
236 @caps: the peer's #GstCaps.
237 @Returns: the result of the link with the specified caps.
240 <!-- ##### ENUM GstPadLinkReturn ##### -->
242 The result of a pad link.
245 @GST_PAD_LINK_REFUSED: the link was refused.
246 @GST_PAD_LINK_DELAYED: the link was delayed, probably because the
247 element needs more specific pad capabilitiess.
248 @GST_PAD_LINK_OK: the link succeeded.
249 @GST_PAD_LINK_DONE: the link succeeded,
250 any more attempts are not needed.
252 <!-- ##### USER_FUNCTION GstPadConvertFunction ##### -->
254 The signature of a convert function.
257 @pad: the #GstPad to perform the convert on.
258 @src_format: the source #GstFormat of the conversion.
259 @src_value: the source value of the conversion.
260 @dest_format: a pointer to the destination #GstFormat.
261 @dest_value: a pointer to the destination value.
262 @Returns: TRUE if the conversion could be performed.
265 <!-- ##### USER_FUNCTION GstPadDispatcherFunction ##### -->
267 A dispatcher function is called for all internally linked pads, see
268 gst_pad_dispatcher().
271 @pad: the #GstPad that is dispatched.
272 @data: the gpointer to optional user data.
273 @Returns: TRUE if the dispatching procedure has to be stopped.
276 <!-- ##### USER_FUNCTION GstPadIntLinkFunction ##### -->
278 The signature of the internal pad link function.
281 @pad: The #GstPad to query.
282 @Returns: a newly allocated #GList of pads that are linked to
283 the given pad on the inside of the parent element.
284 The caller must call g_list_free() on it after use.
287 <!-- ##### USER_FUNCTION GstPadQueryFunction ##### -->
289 The signature of the query function.
292 @pad: the #GstPad to query.
293 @type: the #GstPadQueryType.
294 @format: a pointer to the target #GstFormat.
295 @value: a pointer to the target value.
296 @Returns: TRUE if the query could be performed.
299 <!-- ##### USER_FUNCTION GstPadEventMaskFunction ##### -->
301 The signature of the eventmask function.
304 @pad: the #GstPad to query
305 @Returns: an array of event masks
308 <!-- ##### USER_FUNCTION GstPadFormatsFunction ##### -->
310 The signature of the formats function.
313 @pad: a #GstPad to query
314 @Returns: an array of formats
317 <!-- ##### USER_FUNCTION GstPadQueryTypeFunction ##### -->
319 The signature of the query types function.
322 @pad: a #GstPad to query
323 @Returns: an array of query types
326 <!-- ##### MACRO GST_PAD_QUERY_TYPE_FUNCTION ##### -->
328 A convenience macro to construct query type functions
331 @functionname: the name of the function
332 @...: query types, 0 to mark the last element
335 <!-- ##### MACRO GST_PAD_FORMATS_FUNCTION ##### -->
337 Convenience function to define an array of formats that can be used
338 as #GstPadGetFormatsFunction.
341 @functionname: The name of the function
342 @...: comma separated list of formats, 0 to mark the end
345 <!-- ##### MACRO GST_PAD_EVENT_MASK_FUNCTION ##### -->
347 Convenience function to define an array of event masks that can be used
348 as #GstPadGetEventMaskFunction.
351 @functionname: The name of the function
352 @...: comma separated list of event maks, { 0, } to mark the end
355 <!-- ##### ENUM GstPadDirection ##### -->
357 The direction of a pad.
360 @GST_PAD_UNKNOWN: direction is unknown.
361 @GST_PAD_SRC: the pad is a source pad.
362 @GST_PAD_SINK: the pad is a sink pad.
364 <!-- ##### ENUM GstPadFlags ##### -->
369 @GST_PAD_DISABLED: the pad is disabled.
370 @GST_PAD_NEGOTIATING:
371 @GST_PAD_FLAG_LAST: subclasses can use this number to enumerate their flags.
373 <!-- ##### FUNCTION gst_pad_new ##### -->
383 <!-- ##### FUNCTION gst_pad_custom_new ##### -->
394 <!-- ##### FUNCTION gst_pad_custom_new_from_template ##### -->
405 <!-- ##### FUNCTION gst_pad_new_from_template ##### -->
415 <!-- ##### FUNCTION gst_pad_get_direction ##### -->
424 <!-- ##### FUNCTION gst_pad_set_chain_function ##### -->
433 <!-- ##### FUNCTION gst_pad_set_get_function ##### -->
442 <!-- ##### FUNCTION gst_pad_set_link_function ##### -->
451 <!-- ##### FUNCTION gst_pad_set_getcaps_function ##### -->
460 <!-- ##### FUNCTION gst_pad_try_set_caps ##### -->
470 <!-- ##### FUNCTION gst_pad_get_caps ##### -->
479 <!-- ##### FUNCTION gst_pad_check_compatibility ##### -->
489 <!-- ##### FUNCTION gst_pad_set_name ##### -->
498 <!-- ##### FUNCTION gst_pad_get_name ##### -->
507 <!-- ##### FUNCTION gst_pad_set_element_private ##### -->
516 <!-- ##### FUNCTION gst_pad_get_element_private ##### -->
525 <!-- ##### FUNCTION gst_pad_set_parent ##### -->
534 <!-- ##### FUNCTION gst_pad_get_parent ##### -->
543 <!-- ##### FUNCTION gst_pad_get_real_parent ##### -->
552 <!-- ##### FUNCTION gst_pad_add_ghost_pad ##### -->
561 <!-- ##### FUNCTION gst_pad_remove_ghost_pad ##### -->
570 <!-- ##### FUNCTION gst_pad_get_ghost_pad_list ##### -->
579 <!-- ##### FUNCTION gst_pad_get_peer ##### -->
588 <!-- ##### FUNCTION gst_pad_link ##### -->
598 <!-- ##### FUNCTION gst_pad_link_filtered ##### -->
609 <!-- ##### FUNCTION gst_pad_relink_filtered ##### -->
620 <!-- ##### FUNCTION gst_pad_try_relink_filtered ##### -->
631 <!-- ##### FUNCTION gst_pad_unlink ##### -->
640 <!-- ##### FUNCTION gst_pad_can_link ##### -->
650 <!-- ##### FUNCTION gst_pad_can_link_filtered ##### -->
661 <!-- ##### FUNCTION gst_pad_push ##### -->
668 <!-- # Unused Parameters # -->
672 <!-- ##### FUNCTION gst_pad_pull ##### -->
681 <!-- ##### FUNCTION gst_pad_load_and_link ##### -->
690 <!-- ##### FUNCTION gst_pad_proxy_link ##### -->
700 <!-- ##### FUNCTION gst_pad_get_pad_template ##### -->
709 <!-- ##### FUNCTION gst_pad_get_pad_template_caps ##### -->
718 <!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
727 <!-- ##### FUNCTION gst_pad_perform_negotiate ##### -->
737 <!-- ##### FUNCTION gst_ghost_pad_save_thyself ##### -->
747 <!-- ##### FUNCTION gst_pad_select ##### -->
755 <!-- # Unused Parameters # -->
759 <!-- ##### FUNCTION gst_pad_selectv ##### -->
766 <!-- # Unused Parameters # -->
771 <!-- ##### FUNCTION gst_pad_dispatcher ##### -->
782 <!-- ##### FUNCTION gst_pad_send_event ##### -->
792 <!-- ##### FUNCTION gst_pad_event_default ##### -->
802 <!-- ##### FUNCTION gst_pad_set_event_function ##### -->
811 <!-- ##### FUNCTION gst_pad_get_event_masks ##### -->
820 <!-- ##### FUNCTION gst_pad_get_event_masks_default ##### -->
829 <!-- ##### FUNCTION gst_pad_set_event_mask_function ##### -->
838 <!-- ##### FUNCTION gst_pad_set_convert_function ##### -->
847 <!-- ##### FUNCTION gst_pad_convert ##### -->
860 <!-- ##### FUNCTION gst_pad_convert_default ##### -->
873 <!-- ##### FUNCTION gst_pad_get_formats ##### -->
882 <!-- ##### FUNCTION gst_pad_get_formats_default ##### -->
891 <!-- ##### FUNCTION gst_pad_set_formats_function ##### -->
900 <!-- ##### FUNCTION gst_pad_get_internal_links ##### -->
909 <!-- ##### FUNCTION gst_pad_get_internal_links_default ##### -->
918 <!-- ##### FUNCTION gst_pad_set_internal_link_function ##### -->
927 <!-- ##### FUNCTION gst_pad_set_query_function ##### -->
936 <!-- ##### FUNCTION gst_pad_query ##### -->
948 <!-- ##### FUNCTION gst_pad_query_default ##### -->
960 <!-- ##### FUNCTION gst_pad_get_query_types ##### -->
969 <!-- ##### FUNCTION gst_pad_get_query_types_default ##### -->
978 <!-- ##### FUNCTION gst_pad_set_query_type_function ##### -->
987 <!-- ##### MACRO gst_pad_add_probe ##### -->
989 Adds the probe to the given pad
992 @pad: The pad to add the probe to
993 @probe: The probe to add to the pad
996 <!-- ##### MACRO gst_pad_remove_probe ##### -->
998 Remove the probe from the pad
1001 @pad: The pad to remove the probe of
1002 @probe: The probe to remove
1005 <!-- ##### FUNCTION gst_pad_is_active ##### -->
1014 <!-- ##### FUNCTION gst_pad_set_active ##### -->
1023 <!-- ##### FUNCTION gst_pad_get_scheduler ##### -->
1032 <!-- ##### STRUCT GstRealPad ##### -->
1067 <!-- ##### MACRO GST_RPAD_DIRECTION ##### -->
1069 Get the direction of the real pad.
1072 @pad: the realpad to query.
1075 <!-- ##### MACRO GST_RPAD_CAPS ##### -->
1077 Get the caps of the real pad.
1080 @pad: the real pad to query.
1083 <!-- ##### MACRO GST_RPAD_PEER ##### -->
1085 Get the peer element of the real pad.
1088 @pad: the real pad to query.
1091 <!-- ##### MACRO GST_RPAD_CHAINFUNC ##### -->
1093 Get the chain function of the real pad.
1096 @pad: the real pad to query.
1099 <!-- ##### MACRO GST_RPAD_APPFILTER ##### -->
1101 Get the application filter for this pad
1104 @pad: the pad to query
1107 <!-- ##### MACRO GST_RPAD_GETFUNC ##### -->
1109 Get get getfunction of the real pad.
1112 @pad: the real pad to query.
1115 <!-- ##### MACRO GST_RPAD_CHAINHANDLER ##### -->
1117 Get the eventhandler function from the real pad.
1120 @pad: the real pad to query.
1123 <!-- ##### MACRO GST_RPAD_EVENTFUNC ##### -->
1125 Get the event function of this real pad.
1128 @pad: the real pad to query.
1131 <!-- ##### MACRO GST_RPAD_EVENTHANDLER ##### -->
1133 Get the eventhandler function of this real pad.
1136 @pad: the real pad to query.
1139 <!-- ##### MACRO GST_RPAD_GETHANDLER ##### -->
1141 Get the gethandler function of this real pad.
1144 @pad: the real pad to query.
1147 <!-- ##### MACRO GST_RPAD_LINKFUNC ##### -->
1149 Get the link function of the pad
1152 @pad: the pad to query
1155 <!-- ##### MACRO GST_RPAD_GETCAPSFUNC ##### -->
1157 Get the getcaps function of this pad
1160 @pad: the pad to query
1163 <!-- ##### MACRO GST_RPAD_CONVERTFUNC ##### -->
1165 Get the convert function of this pad
1168 @pad: the pad to query
1171 <!-- ##### MACRO GST_RPAD_INTLINKFUNC ##### -->
1173 Get the internal link function of this pad
1176 @pad: the pad to query
1179 <!-- ##### MACRO GST_RPAD_QUERYFUNC ##### -->
1181 Get the query function of this pad
1184 @pad: the pad to query
1187 <!-- ##### MACRO GST_RPAD_EVENTMASKFUNC ##### -->
1189 Get the event mask function of this pad
1192 @pad: the pad to query
1195 <!-- ##### MACRO GST_RPAD_FORMATSFUNC ##### -->
1197 Get the formats function of this pad
1200 @pad: the pad to query
1203 <!-- ##### MACRO GST_RPAD_QUERYTYPEFUNC ##### -->
1205 Get the query types function of this pad
1208 @pad: the pad to query
1211 <!-- ##### MACRO GST_GPAD_REALPAD ##### -->
1213 Get the real pad of this ghost pad.
1216 @pad: the real pad to query.
1219 <!-- ##### STRUCT GstGhostPad ##### -->
1225 <!-- ##### FUNCTION gst_ghost_pad_new ##### -->