1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 The connection between Elements
7 <!-- ##### SECTION Long_Description ##### -->
9 #GstElement are connected to each other via "pads", which are extremely light-weight generic
10 connections. After two pad are retrieved from an element with gst_element_get_pad(), the pads
11 can be connected with gst_pad_connect().
14 Pads are typically created from a #GstPadTemplate with gst_pad_new_from_template().
17 Pad have #GstCaps attached to it to describe the media type they
18 are capable of dealing with. gst_pad_get_caps() and gst_pad_set_caps() are used to
19 manipulate the caps of the pads.
20 Pads created from a padtemplate cannot set capabilities that are incompatible with
21 the padtemplates capabilities.
24 Pads without padtemplates can be created with gst_pad_new() which takes a direction and
25 a name as an argument.
28 gst_pad_get_parent() will retrieve the #GstElement that owns the pad.
31 GstElements creating a pad will typicilally use the various gst_pad_set_*_function() calls
32 to register callbacks for various events on the pads.
35 GstElements will use gst_pad_push() and gst_pad_pull() to push out or pull a buffer in. The
36 gst_pad_pullregion() function can be used to request for a buffer with a specific offset (in
37 time or in bytes). gst_pad_select() and gst_pad_selectv() are use by plugins to wait on a set
38 of pads for a new #GstBuffer or #GstEvent.
41 To send an event on a pad, use gst_pad_send_event().
44 <!-- ##### SECTION See_Also ##### -->
46 #GstPadTemplate, #GstElement, #GstEvent
49 <!-- ##### MACRO GST_PAD_NAME ##### -->
51 Get the name of the pad.
54 @pad: the pad to query
57 <!-- ##### MACRO GST_PAD_ELEMENT_PRIVATE ##### -->
59 Get the private data set by the element that owns the pad.
62 @pad: the pad to query
65 <!-- ##### MACRO GST_PAD_PARENT ##### -->
67 Get the parent element of this pad.
70 @pad: the pad to query
73 <!-- ##### MACRO GST_PAD_PADTEMPLATE ##### -->
75 Get the padtemplate that was used to create this pad. NULL if no padtemplate
79 @pad: the pad to query
82 <!-- ##### MACRO GST_PAD_REALIZE ##### -->
84 Return the real pad of this pad.
87 @pad: the pad to query
90 <!-- ##### MACRO GST_PAD_DIRECTION ##### -->
92 Get the pad direction.
95 @pad: the pad to query
98 <!-- ##### MACRO GST_PAD_CAPS ##### -->
100 Get the capabilities of a pad.
103 @pad: the pad to query
106 <!-- ##### MACRO GST_PAD_PEER ##### -->
108 Get the peerpad of this pad.
111 @pad: the pad to query
114 <!-- ##### MACRO GST_PAD_CAN_PULL ##### -->
116 Can this pad be used to pull a buffer.
119 @pad: the pad to check
122 <!-- ##### MACRO GST_PAD_IS_SINK ##### -->
124 Check if the pad is a sinkpad.
127 @pad: the pad to query
130 <!-- ##### MACRO GST_PAD_IS_SRC ##### -->
132 Check if the pad is a srcpad.
135 @pad: the pad to query
138 <!-- ##### MACRO GST_PAD_IS_CONNECTED ##### -->
140 Checks if the pad is connected
143 @pad: the pad to query
146 <!-- ##### STRUCT GstPad ##### -->
152 <!-- ##### USER_FUNCTION GstPadChainFunction ##### -->
154 The function that will be called when chaining buffers.
157 @pad: the pad that performed the chain
158 @buf: the buffer that is chained
161 <!-- ##### USER_FUNCTION GstPadGetFunction ##### -->
163 The function that will be called when pulling a buffer.
166 @pad: the pad to get a buffer from
167 @Returns: a #GstBuffer
170 <!-- ##### USER_FUNCTION GstPadGetRegionFunction ##### -->
172 The function that will be called when pulling a region buffer.
173 You can specify which buffer to get using an offset/length pair or
174 a start/stop timecode pair.
177 @pad: the pad to get a buffer from
178 @type: the type of region to get (time or offset based)
179 @offset: the offset of the region to get
180 @len: the length of the region to get
181 @Returns: a #GstBuffer
184 <!-- ##### USER_FUNCTION GstPadBufferPoolFunction ##### -->
186 The function that will be called when a bufferpool is requested
190 @pad: the pad with the bufferpool
191 @Returns: the GstBufferPool associated with this pad.
194 <!-- ##### USER_FUNCTION GstPadGetCapsFunction ##### -->
196 Return the caps of the specified pad. By default this function
197 will return the pad template caps but can optionally be overridden.
200 @pad: The pad to get the caps of
201 @caps: The peer caps, can be used to filter the caps.
202 @Returns: The caps of the pad.
205 <!-- ##### ENUM GstRegionType ##### -->
207 the region types for #gst_pad_pullregion.
211 @GST_REGION_OFFSET_LEN: an offet/length pair
212 @GST_REGION_TIME_LEN: a time start/length pair
214 <!-- ##### USER_FUNCTION GstPadPullRegionFunction ##### -->
216 The function that will be called when pulling a region buffer.
217 You can specify which buffer to get using an offset/length pair or
218 a start/stop timecode pair.
221 @pad: the pad to get a buffer from
222 @type: the type of region to get (time or offset based)
223 @offset: the offset of the region to get
224 @len: the length of the region to get
225 @Returns: a #GstBuffer
228 <!-- ##### USER_FUNCTION GstPadEventFunction ##### -->
230 Function signature to handle an event for the pad.
233 @pad: The pad to handle the event
234 @event: The event to handle
235 @Returns: TRUE if the pad could handle the event.
238 <!-- ##### USER_FUNCTION GstPadConnectFunction ##### -->
240 Function signature to handle a new connection on the pad.
243 @pad: The pad that is connected.
244 @caps: The peer caps.
245 @Returns: the result of the connection with the specified caps.
248 <!-- ##### ENUM GstPadConnectReturn ##### -->
253 @GST_PAD_CONNECT_REFUSED:
254 @GST_PAD_CONNECT_DELAYED:
256 @GST_PAD_CONNECT_DONE:
258 <!-- ##### ENUM GstPadDirection ##### -->
260 The direction this pad is.
263 @GST_PAD_UNKNOWN: direction is unknown
264 @GST_PAD_SRC: this is a source pad
265 @GST_PAD_SINK: this is a sink pad
267 <!-- ##### ENUM GstPadFlags ##### -->
272 @GST_PAD_DISABLED: the pad is disabled
273 @GST_PAD_EOS: the pad is in end of stream state
274 @GST_PAD_FLAG_LAST: subclasses can use this number to enumerate their flags
276 <!-- ##### FUNCTION gst_pad_new ##### -->
286 <!-- ##### MACRO gst_pad_destroy ##### -->
291 @pad: the pad to destroy
294 <!-- ##### FUNCTION gst_pad_new_from_template ##### -->
302 <!-- # Unused Parameters # -->
306 <!-- ##### FUNCTION gst_pad_get_direction ##### -->
315 <!-- ##### FUNCTION gst_pad_set_chain_function ##### -->
324 <!-- ##### FUNCTION gst_pad_set_get_function ##### -->
333 <!-- ##### FUNCTION gst_pad_set_getregion_function ##### -->
342 <!-- ##### FUNCTION gst_pad_set_bufferpool_function ##### -->
351 <!-- ##### FUNCTION gst_pad_set_connect_function ##### -->
360 <!-- ##### FUNCTION gst_pad_set_getcaps_function ##### -->
369 <!-- ##### FUNCTION gst_pad_try_set_caps ##### -->
379 <!-- ##### FUNCTION gst_pad_get_caps ##### -->
388 <!-- ##### FUNCTION gst_pad_check_compatibility ##### -->
398 <!-- ##### FUNCTION gst_pad_set_name ##### -->
407 <!-- ##### FUNCTION gst_pad_get_name ##### -->
416 <!-- ##### FUNCTION gst_pad_set_element_private ##### -->
425 <!-- ##### FUNCTION gst_pad_get_element_private ##### -->
434 <!-- ##### FUNCTION gst_pad_set_parent ##### -->
443 <!-- ##### FUNCTION gst_pad_get_parent ##### -->
452 <!-- ##### FUNCTION gst_pad_get_sched ##### -->
461 <!-- ##### FUNCTION gst_pad_set_sched ##### -->
470 <!-- ##### FUNCTION gst_pad_unset_sched ##### -->
478 <!-- ##### FUNCTION gst_pad_get_real_parent ##### -->
487 <!-- ##### FUNCTION gst_pad_add_ghost_pad ##### -->
496 <!-- ##### FUNCTION gst_pad_remove_ghost_pad ##### -->
505 <!-- ##### FUNCTION gst_pad_get_ghost_pad_list ##### -->
514 <!-- ##### FUNCTION gst_pad_get_peer ##### -->
523 <!-- ##### FUNCTION gst_pad_connect ##### -->
533 <!-- ##### FUNCTION gst_pad_connect_filtered ##### -->
544 <!-- ##### FUNCTION gst_pad_reconnect_filtered ##### -->
553 <!-- # Unused Parameters # -->
557 <!-- ##### FUNCTION gst_pad_try_reconnect_filtered ##### -->
566 <!-- # Unused Parameters # -->
570 <!-- ##### FUNCTION gst_pad_disconnect ##### -->
579 <!-- ##### FUNCTION gst_pad_can_connect ##### -->
589 <!-- ##### FUNCTION gst_pad_can_connect_filtered ##### -->
600 <!-- ##### FUNCTION gst_pad_push ##### -->
607 <!-- # Unused Parameters # -->
611 <!-- ##### FUNCTION gst_pad_pull ##### -->
620 <!-- ##### FUNCTION gst_pad_pullregion ##### -->
630 <!-- # Unused Parameters # -->
634 <!-- ##### FUNCTION gst_pad_get_bufferpool ##### -->
643 <!-- ##### FUNCTION gst_pad_load_and_connect ##### -->
650 <!-- # Unused Parameters # -->
655 <!-- ##### FUNCTION gst_pad_proxy_connect ##### -->
665 <!-- ##### FUNCTION gst_pad_get_padtemplate ##### -->
674 <!-- ##### FUNCTION gst_pad_get_padtemplate_caps ##### -->
683 <!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
692 <!-- ##### FUNCTION gst_pad_recalc_allowed_caps ##### -->
701 <!-- ##### FUNCTION gst_pad_perform_negotiate ##### -->
711 <!-- ##### FUNCTION gst_pad_ghost_save_thyself ##### -->
722 <!-- ##### FUNCTION gst_pad_peek ##### -->
731 <!-- ##### FUNCTION gst_pad_select ##### -->
740 <!-- ##### FUNCTION gst_pad_selectv ##### -->
750 <!-- ##### FUNCTION gst_pad_send_event ##### -->
760 <!-- ##### FUNCTION gst_pad_event_default ##### -->
769 <!-- ##### FUNCTION gst_pad_set_event_function ##### -->
778 <!-- ##### STRUCT GstRealPad ##### -->
808 <!-- ##### MACRO GST_RPAD_LEN ##### -->
810 Get the length of the region that is being pulled.
813 @pad: the real pad to query.
816 <!-- ##### MACRO GST_RPAD_OFFSET ##### -->
818 Get the offset of the region that is being pulled.
821 @pad: the real pad to query.
824 <!-- ##### MACRO GST_RPAD_SCHED ##### -->
826 Get the scheduler of this real pad.
829 @pad: the real pad to query.
832 <!-- ##### MACRO GST_RPAD_REGIONTYPE ##### -->
834 Get the type of the region that is being pulled.
837 @pad: the real pad to query.
840 <!-- ##### MACRO GST_RPAD_DIRECTION ##### -->
842 Get the direction of the real pad.
845 @pad: the realpad to query.
848 <!-- ##### MACRO GST_RPAD_CAPS ##### -->
850 Get the caps of the real pad.
853 @pad: the real pad to query.
856 <!-- ##### MACRO GST_RPAD_PEER ##### -->
858 Get the peer element of the real pad.
861 @pad: the real pad to query.
864 <!-- ##### MACRO GST_RPAD_BUFPEN ##### -->
866 Get the bufpen of the real pad.
869 @pad: the real pad to query.
872 <!-- ##### MACRO GST_RPAD_CHAINFUNC ##### -->
874 Get the chain function of the real pad.
877 @pad: the real pad to query.
880 <!-- ##### MACRO GST_RPAD_FILTER ##### -->
882 Get the filter from the pad
885 @pad: the pad to query
888 <!-- ##### MACRO GST_RPAD_APPFILTER ##### -->
890 Get the application filter for this pad
893 @pad: the pad to query
896 <!-- ##### MACRO GST_RPAD_GETFUNC ##### -->
898 Get get getfunction of the real pad.
901 @pad: the real pad to query.
904 <!-- ##### MACRO GST_RPAD_GETREGIONFUNC ##### -->
906 Get the getregion function of the real pad.
909 @pad: the real pad to query.
912 <!-- ##### MACRO GST_RPAD_PULLREGIONFUNC ##### -->
914 Get the pullregion function of the real pad.
917 @pad: the real pad to query.
920 <!-- ##### MACRO GST_RPAD_BUFFERPOOLFUNC ##### -->
922 Get the bufferpoolfunction from the real pad.
925 @pad: the real pad to query.
928 <!-- ##### MACRO GST_RPAD_CHAINHANDLER ##### -->
930 Get the eventhandler function from the real pad.
933 @pad: the real pad to query.
936 <!-- ##### MACRO GST_RPAD_EVENTFUNC ##### -->
938 Get the event function of this real pad.
941 @pad: the real pad to query.
944 <!-- ##### MACRO GST_RPAD_EVENTHANDLER ##### -->
946 Get the eventhandler function of this real pad.
949 @pad: the real pad to query.
952 <!-- ##### MACRO GST_RPAD_GETHANDLER ##### -->
954 Get the gethandler function of this real pad.
957 @pad: the real pad to query.
960 <!-- ##### MACRO GST_RPAD_CONNECTFUNC ##### -->
962 Get the connect function of the pad
965 @pad: the pad to query
968 <!-- ##### MACRO GST_RPAD_GETCAPSFUNC ##### -->
970 Get the getcaps function of this pad
973 @pad: the pad to query
976 <!-- ##### MACRO GST_GPAD_REALPAD ##### -->
978 Get the real pad of this ghost pad.
981 @pad: the real pad to query.
984 <!-- ##### STRUCT GstGhostPad ##### -->
990 <!-- ##### FUNCTION gst_ghost_pad_new ##### -->