gstreamer/auto/
pad.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{
7    ffi, Buffer, BufferList, Caps, Element, Event, FlowError, FlowSuccess, Object, PadDirection,
8    PadLinkCheck, PadLinkError, PadLinkSuccess, PadMode, PadTemplate, Stream, TaskState,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{connect_raw, SignalHandlerId},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19    /// A [`Element`][crate::Element] is linked to other elements via "pads", which are extremely
20    /// light-weight generic link points.
21    ///
22    /// Pads have a [`PadDirection`][crate::PadDirection], source pads produce data, sink pads consume
23    /// data.
24    ///
25    /// Pads are typically created from a [`PadTemplate`][crate::PadTemplate] with
26    /// [`from_template()`][Self::from_template()] and are then added to a [`Element`][crate::Element]. This usually
27    /// happens when the element is created but it can also happen dynamically based
28    /// on the data that the element is processing or based on the pads that the
29    /// application requests.
30    ///
31    /// Pads without pad templates can be created with [`new()`][Self::new()],
32    /// which takes a direction and a name as an argument. If the name is [`None`],
33    /// then a guaranteed unique name will be assigned to it.
34    ///
35    /// A [`Element`][crate::Element] creating a pad will typically use the various
36    /// gst_pad_set_*_function\() calls to register callbacks for events, queries or
37    /// dataflow on the pads.
38    ///
39    /// `gst_pad_get_parent()` will retrieve the [`Element`][crate::Element] that owns the pad.
40    ///
41    /// After two pads are retrieved from an element by [`ElementExt::static_pad()`][crate::prelude::ElementExt::static_pad()],
42    /// the pads can be linked with [`PadExt::link()`][crate::prelude::PadExt::link()]. (For quick links,
43    /// you can also use [`ElementExtManual::link()`][crate::prelude::ElementExtManual::link()], which will make the obvious
44    /// link for you if it's straightforward.). Pads can be unlinked again with
45    /// [`PadExt::unlink()`][crate::prelude::PadExt::unlink()]. [`PadExt::peer()`][crate::prelude::PadExt::peer()] can be used to check what the pad is
46    /// linked to.
47    ///
48    /// Before dataflow is possible on the pads, they need to be activated with
49    /// [`PadExt::set_active()`][crate::prelude::PadExt::set_active()].
50    ///
51    /// [`PadExtManual::query()`][crate::prelude::PadExtManual::query()] and [`PadExtManual::peer_query()`][crate::prelude::PadExtManual::peer_query()] can be used to query various
52    /// properties of the pad and the stream.
53    ///
54    /// To send a [`Event`][crate::Event] on a pad, use [`PadExtManual::send_event()`][crate::prelude::PadExtManual::send_event()] and
55    /// [`PadExtManual::push_event()`][crate::prelude::PadExtManual::push_event()]. Some events will be sticky on the pad, meaning that
56    /// after they pass on the pad they can be queried later with
57    /// [`PadExtManual::sticky_event()`][crate::prelude::PadExtManual::sticky_event()] and [`PadExtManual::sticky_events_foreach()`][crate::prelude::PadExtManual::sticky_events_foreach()].
58    /// [`PadExt::current_caps()`][crate::prelude::PadExt::current_caps()] and [`PadExt::has_current_caps()`][crate::prelude::PadExt::has_current_caps()] are convenience
59    /// functions to query the current sticky CAPS event on a pad.
60    ///
61    /// GstElements will use [`PadExt::push()`][crate::prelude::PadExt::push()] and [`PadExtManual::pull_range()`][crate::prelude::PadExtManual::pull_range()] to push out
62    /// or pull in a buffer.
63    ///
64    /// The dataflow, events and queries that happen on a pad can be monitored with
65    /// probes that can be installed with [`PadExtManual::add_probe()`][crate::prelude::PadExtManual::add_probe()]. [`PadExt::is_blocked()`][crate::prelude::PadExt::is_blocked()]
66    /// can be used to check if a block probe is installed on the pad.
67    /// [`PadExt::is_blocking()`][crate::prelude::PadExt::is_blocking()] checks if the blocking probe is currently blocking the
68    /// pad. [`PadExtManual::remove_probe()`][crate::prelude::PadExtManual::remove_probe()] is used to remove a previously installed probe
69    /// and unblock blocking probes if any.
70    ///
71    /// Pad have an offset that can be retrieved with [`PadExt::offset()`][crate::prelude::PadExt::offset()]. This
72    /// offset will be applied to the running_time of all data passing over the pad.
73    /// [`PadExt::set_offset()`][crate::prelude::PadExt::set_offset()] can be used to change the offset.
74    ///
75    /// Convenience functions exist to start, pause and stop the task on a pad with
76    /// [`PadExtManual::start_task()`][crate::prelude::PadExtManual::start_task()], [`PadExt::pause_task()`][crate::prelude::PadExt::pause_task()] and [`PadExt::stop_task()`][crate::prelude::PadExt::stop_task()]
77    /// respectively.
78    ///
79    /// ## Properties
80    ///
81    ///
82    /// #### `caps`
83    ///  Readable
84    ///
85    ///
86    /// #### `direction`
87    ///  Readable | Writeable | Construct Only
88    ///
89    ///
90    /// #### `offset`
91    ///  The offset that will be applied to the running time of the pad.
92    ///
93    /// Readable | Writeable
94    ///
95    ///
96    /// #### `template`
97    ///  Readable | Writeable
98    /// <details><summary><h4>Object</h4></summary>
99    ///
100    ///
101    /// #### `name`
102    ///  Readable | Writeable | Construct
103    ///
104    ///
105    /// #### `parent`
106    ///  The parent of the object. Please note, that when changing the 'parent'
107    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::Object#deep-notify]
108    /// signals due to locking issues. In some cases one can use
109    /// [`element-added`][struct@crate::Bin#element-added] or [`element-removed`][struct@crate::Bin#element-removed] signals on the parent to
110    /// achieve a similar effect.
111    ///
112    /// Readable | Writeable
113    /// </details>
114    ///
115    /// ## Signals
116    ///
117    ///
118    /// #### `linked`
119    ///  Signals that a pad has been linked to the peer pad.
120    ///
121    ///
122    ///
123    ///
124    /// #### `unlinked`
125    ///  Signals that a pad has been unlinked from the peer pad.
126    ///
127    ///
128    /// <details><summary><h4>Object</h4></summary>
129    ///
130    ///
131    /// #### `deep-notify`
132    ///  The deep notify signal is used to be notified of property changes. It is
133    /// typically attached to the toplevel bin to receive notifications from all
134    /// the elements contained in that bin.
135    ///
136    /// Detailed
137    /// </details>
138    ///
139    /// # Implements
140    ///
141    /// [`PadExt`][trait@crate::prelude::PadExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`], [`PadExtManual`][trait@crate::prelude::PadExtManual]
142    #[doc(alias = "GstPad")]
143    pub struct Pad(Object<ffi::GstPad, ffi::GstPadClass>) @extends Object;
144
145    match fn {
146        type_ => || ffi::gst_pad_get_type(),
147    }
148}
149
150impl Pad {
151    pub const NONE: Option<&'static Pad> = None;
152}
153
154unsafe impl Send for Pad {}
155unsafe impl Sync for Pad {}
156
157/// Trait containing all [`struct@Pad`] methods.
158///
159/// # Implementors
160///
161/// [`Pad`][struct@crate::Pad], [`ProxyPad`][struct@crate::ProxyPad]
162pub trait PadExt: IsA<Pad> + 'static {
163    /// Activates or deactivates the given pad in `mode` via dispatching to the
164    /// pad's activatemodefunc. For use from within pad activation functions only.
165    ///
166    /// If you don't know what this is, you probably don't want to call it.
167    /// ## `mode`
168    /// the requested activation mode
169    /// ## `active`
170    /// whether or not the pad should be active.
171    ///
172    /// # Returns
173    ///
174    /// [`true`] if the operation was successful.
175    ///
176    /// MT safe.
177    #[doc(alias = "gst_pad_activate_mode")]
178    fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), glib::error::BoolError> {
179        unsafe {
180            glib::result_from_gboolean!(
181                ffi::gst_pad_activate_mode(
182                    self.as_ref().to_glib_none().0,
183                    mode.into_glib(),
184                    active.into_glib()
185                ),
186                "Failed to activate mode pad"
187            )
188        }
189    }
190
191    /// Checks if the source pad and the sink pad are compatible so they can be
192    /// linked.
193    /// ## `sinkpad`
194    /// the sink [`Pad`][crate::Pad].
195    ///
196    /// # Returns
197    ///
198    /// [`true`] if the pads can be linked.
199    #[doc(alias = "gst_pad_can_link")]
200    fn can_link(&self, sinkpad: &impl IsA<Pad>) -> bool {
201        unsafe {
202            from_glib(ffi::gst_pad_can_link(
203                self.as_ref().to_glib_none().0,
204                sinkpad.as_ref().to_glib_none().0,
205            ))
206        }
207    }
208
209    /// Chain a buffer to `self`.
210    ///
211    /// The function returns [`FlowReturn::Flushing`][crate::FlowReturn::Flushing] if the pad was flushing.
212    ///
213    /// If the buffer type is not acceptable for `self` (as negotiated with a
214    /// preceding GST_EVENT_CAPS event), this function returns
215    /// [`FlowReturn::NotNegotiated`][crate::FlowReturn::NotNegotiated].
216    ///
217    /// The function proceeds calling the chain function installed on `self` (see
218    /// `gst_pad_set_chain_function()`) and the return value of that function is
219    /// returned to the caller. [`FlowReturn::NotSupported`][crate::FlowReturn::NotSupported] is returned if `self` has no
220    /// chain function.
221    ///
222    /// In all cases, success or failure, the caller loses its reference to `buffer`
223    /// after calling this function.
224    /// ## `buffer`
225    /// the [`Buffer`][crate::Buffer] to send, return GST_FLOW_ERROR
226    ///  if not.
227    ///
228    /// # Returns
229    ///
230    /// a [`FlowReturn`][crate::FlowReturn] from the pad.
231    ///
232    /// MT safe.
233    #[doc(alias = "gst_pad_chain")]
234    fn chain(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError> {
235        unsafe {
236            try_from_glib(ffi::gst_pad_chain(
237                self.as_ref().to_glib_none().0,
238                buffer.into_glib_ptr(),
239            ))
240        }
241    }
242
243    /// Chain a bufferlist to `self`.
244    ///
245    /// The function returns [`FlowReturn::Flushing`][crate::FlowReturn::Flushing] if the pad was flushing.
246    ///
247    /// If `self` was not negotiated properly with a CAPS event, this function
248    /// returns [`FlowReturn::NotNegotiated`][crate::FlowReturn::NotNegotiated].
249    ///
250    /// The function proceeds calling the chainlist function installed on `self` (see
251    /// `gst_pad_set_chain_list_function()`) and the return value of that function is
252    /// returned to the caller. [`FlowReturn::NotSupported`][crate::FlowReturn::NotSupported] is returned if `self` has no
253    /// chainlist function.
254    ///
255    /// In all cases, success or failure, the caller loses its reference to `list`
256    /// after calling this function.
257    ///
258    /// MT safe.
259    /// ## `list`
260    /// the [`BufferList`][crate::BufferList] to send, return GST_FLOW_ERROR
261    ///  if not.
262    ///
263    /// # Returns
264    ///
265    /// a [`FlowReturn`][crate::FlowReturn] from the pad.
266    #[doc(alias = "gst_pad_chain_list")]
267    fn chain_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError> {
268        unsafe {
269            try_from_glib(ffi::gst_pad_chain_list(
270                self.as_ref().to_glib_none().0,
271                list.into_glib_ptr(),
272            ))
273        }
274    }
275
276    /// Check and clear the [`PadFlags::NEED_RECONFIGURE`][crate::PadFlags::NEED_RECONFIGURE] flag on `self` and return [`true`]
277    /// if the flag was set.
278    ///
279    /// # Returns
280    ///
281    /// [`true`] is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on `self`.
282    #[doc(alias = "gst_pad_check_reconfigure")]
283    fn check_reconfigure(&self) -> bool {
284        unsafe {
285            from_glib(ffi::gst_pad_check_reconfigure(
286                self.as_ref().to_glib_none().0,
287            ))
288        }
289    }
290
291    /// Creates a stream-id for the source [`Pad`][crate::Pad] `self` by combining the
292    /// upstream information with the optional `stream_id` of the stream
293    /// of `self`. `self` must have a parent [`Element`][crate::Element] and which must have zero
294    /// or one sinkpad. `stream_id` can only be [`None`] if the parent element
295    /// of `self` has only a single source pad.
296    ///
297    /// This function generates an unique stream-id by getting the upstream
298    /// stream-start event stream ID and appending `stream_id` to it. If the
299    /// element has no sinkpad it will generate an upstream stream-id by
300    /// doing an URI query on the element and in the worst case just uses
301    /// a random number. Source elements that don't implement the URI
302    /// handler interface should ideally generate a unique, deterministic
303    /// stream-id manually instead.
304    ///
305    /// Since stream IDs are sorted alphabetically, any numbers in the
306    /// stream ID should be printed with a fixed number of characters,
307    /// preceded by 0's, such as by using the format \`03u` instead of \`u`.
308    /// ## `parent`
309    /// Parent [`Element`][crate::Element] of `self`
310    /// ## `stream_id`
311    /// The stream-id
312    ///
313    /// # Returns
314    ///
315    /// A stream-id for `self`. `g_free()` after usage.
316    #[doc(alias = "gst_pad_create_stream_id")]
317    fn create_stream_id(
318        &self,
319        parent: &impl IsA<Element>,
320        stream_id: Option<&str>,
321    ) -> glib::GString {
322        unsafe {
323            from_glib_full(ffi::gst_pad_create_stream_id(
324                self.as_ref().to_glib_none().0,
325                parent.as_ref().to_glib_none().0,
326                stream_id.to_glib_none().0,
327            ))
328        }
329    }
330
331    //#[doc(alias = "gst_pad_create_stream_id_printf")]
332    //fn create_stream_id_printf(&self, parent: &impl IsA<Element>, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> glib::GString {
333    //    unsafe { TODO: call ffi:gst_pad_create_stream_id_printf() }
334    //}
335
336    //#[doc(alias = "gst_pad_create_stream_id_printf_valist")]
337    //fn create_stream_id_printf_valist(&self, parent: &impl IsA<Element>, stream_id: Option<&str>, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> glib::GString {
338    //    unsafe { TODO: call ffi:gst_pad_create_stream_id_printf_valist() }
339    //}
340
341    /// Calls `forward` for all internally linked pads of `self`. This function deals with
342    /// dynamically changing internal pads and will make sure that the `forward`
343    /// function is only called once for each pad.
344    ///
345    /// When `forward` returns [`true`], no further pads will be processed.
346    /// ## `forward`
347    /// a `GstPadForwardFunction`
348    ///
349    /// # Returns
350    ///
351    /// [`true`] if one of the dispatcher functions returned [`true`].
352    #[doc(alias = "gst_pad_forward")]
353    fn forward<P: FnMut(&Pad) -> bool>(&self, forward: P) -> bool {
354        let mut forward_data: P = forward;
355        unsafe extern "C" fn forward_func<P: FnMut(&Pad) -> bool>(
356            pad: *mut ffi::GstPad,
357            user_data: glib::ffi::gpointer,
358        ) -> glib::ffi::gboolean {
359            let pad = from_glib_borrow(pad);
360            let callback = user_data as *mut P;
361            (*callback)(&pad).into_glib()
362        }
363        let forward = Some(forward_func::<P> as _);
364        let super_callback0: &mut P = &mut forward_data;
365        unsafe {
366            from_glib(ffi::gst_pad_forward(
367                self.as_ref().to_glib_none().0,
368                forward,
369                super_callback0 as *mut _ as *mut _,
370            ))
371        }
372    }
373
374    /// Gets the capabilities of the allowed media types that can flow through
375    /// `self` and its peer.
376    ///
377    /// The allowed capabilities is calculated as the intersection of the results of
378    /// calling [`query_caps()`][Self::query_caps()] on `self` and its peer. The caller owns a reference
379    /// on the resulting caps.
380    ///
381    /// # Returns
382    ///
383    /// the allowed [`Caps`][crate::Caps] of the
384    ///  pad link. Unref the caps when you no longer need it. This
385    ///  function returns [`None`] when `self` has no peer.
386    ///
387    /// MT safe.
388    #[doc(alias = "gst_pad_get_allowed_caps")]
389    #[doc(alias = "get_allowed_caps")]
390    fn allowed_caps(&self) -> Option<Caps> {
391        unsafe {
392            from_glib_full(ffi::gst_pad_get_allowed_caps(
393                self.as_ref().to_glib_none().0,
394            ))
395        }
396    }
397
398    /// Gets the capabilities currently configured on `self` with the last
399    /// [`EventType::Caps`][crate::EventType::Caps] event.
400    ///
401    /// # Returns
402    ///
403    /// the current caps of the pad with
404    /// incremented ref-count or [`None`] when pad has no caps. Unref after usage.
405    #[doc(alias = "gst_pad_get_current_caps")]
406    #[doc(alias = "get_current_caps")]
407    fn current_caps(&self) -> Option<Caps> {
408        unsafe {
409            from_glib_full(ffi::gst_pad_get_current_caps(
410                self.as_ref().to_glib_none().0,
411            ))
412        }
413    }
414
415    /// Gets the direction of the pad. The direction of the pad is
416    /// decided at construction time so this function does not take
417    /// the LOCK.
418    ///
419    /// # Returns
420    ///
421    /// the [`PadDirection`][crate::PadDirection] of the pad.
422    ///
423    /// MT safe.
424    #[doc(alias = "gst_pad_get_direction")]
425    #[doc(alias = "get_direction")]
426    fn direction(&self) -> PadDirection {
427        unsafe { from_glib(ffi::gst_pad_get_direction(self.as_ref().to_glib_none().0)) }
428    }
429
430    //#[doc(alias = "gst_pad_get_element_private")]
431    //#[doc(alias = "get_element_private")]
432    //fn element_private(&self) -> /*Unimplemented*/Option<Basic: Pointer> {
433    //    unsafe { TODO: call ffi:gst_pad_get_element_private() }
434    //}
435
436    /// Gets the [`FlowReturn`][crate::FlowReturn] return from the last data passed by this pad.
437    #[doc(alias = "gst_pad_get_last_flow_return")]
438    #[doc(alias = "get_last_flow_return")]
439    fn last_flow_result(&self) -> Result<FlowSuccess, FlowError> {
440        unsafe {
441            try_from_glib(ffi::gst_pad_get_last_flow_return(
442                self.as_ref().to_glib_none().0,
443            ))
444        }
445    }
446
447    /// Get the offset applied to the running time of `self`. `self` has to be a source
448    /// pad.
449    ///
450    /// # Returns
451    ///
452    /// the offset.
453    #[doc(alias = "gst_pad_get_offset")]
454    #[doc(alias = "get_offset")]
455    fn offset(&self) -> i64 {
456        unsafe { ffi::gst_pad_get_offset(self.as_ref().to_glib_none().0) }
457    }
458
459    /// Gets the template for `self`.
460    ///
461    /// # Returns
462    ///
463    /// the [`PadTemplate`][crate::PadTemplate] from which
464    ///  this pad was instantiated, or [`None`] if this pad has no
465    ///  template. Unref after usage.
466    #[doc(alias = "gst_pad_get_pad_template")]
467    #[doc(alias = "get_pad_template")]
468    fn pad_template(&self) -> Option<PadTemplate> {
469        unsafe {
470            from_glib_full(ffi::gst_pad_get_pad_template(
471                self.as_ref().to_glib_none().0,
472            ))
473        }
474    }
475
476    /// Gets the capabilities for `self`'s template.
477    ///
478    /// # Returns
479    ///
480    /// the [`Caps`][crate::Caps] of this pad template.
481    /// Unref after usage.
482    #[doc(alias = "gst_pad_get_pad_template_caps")]
483    #[doc(alias = "get_pad_template_caps")]
484    fn pad_template_caps(&self) -> Caps {
485        unsafe {
486            from_glib_full(ffi::gst_pad_get_pad_template_caps(
487                self.as_ref().to_glib_none().0,
488            ))
489        }
490    }
491
492    /// Gets the parent of `self`, cast to a [`Element`][crate::Element]. If a `self` has no parent or
493    /// its parent is not an element, return [`None`].
494    ///
495    /// # Returns
496    ///
497    /// the parent of the pad. The
498    /// caller has a reference on the parent, so unref when you're finished
499    /// with it.
500    ///
501    /// MT safe.
502    #[doc(alias = "gst_pad_get_parent_element")]
503    #[doc(alias = "get_parent_element")]
504    fn parent_element(&self) -> Option<Element> {
505        unsafe {
506            from_glib_full(ffi::gst_pad_get_parent_element(
507                self.as_ref().to_glib_none().0,
508            ))
509        }
510    }
511
512    /// Gets the peer of `self`. This function refs the peer pad so
513    /// you need to unref it after use.
514    ///
515    /// # Returns
516    ///
517    /// the peer [`Pad`][crate::Pad]. Unref after usage.
518    ///
519    /// MT safe.
520    #[doc(alias = "gst_pad_get_peer")]
521    #[doc(alias = "get_peer")]
522    #[must_use]
523    fn peer(&self) -> Option<Pad> {
524        unsafe { from_glib_full(ffi::gst_pad_get_peer(self.as_ref().to_glib_none().0)) }
525    }
526
527    /// If there is a single internal link of the given pad, this function will
528    /// return it. Otherwise, it will return NULL.
529    ///
530    /// # Returns
531    ///
532    /// a [`Pad`][crate::Pad], or [`None`] if `self` has none
533    /// or more than one internal links. Unref returned pad with
534    /// `gst_object_unref()`.
535    #[cfg(feature = "v1_18")]
536    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
537    #[doc(alias = "gst_pad_get_single_internal_link")]
538    #[doc(alias = "get_single_internal_link")]
539    #[must_use]
540    fn single_internal_link(&self) -> Option<Pad> {
541        unsafe {
542            from_glib_full(ffi::gst_pad_get_single_internal_link(
543                self.as_ref().to_glib_none().0,
544            ))
545        }
546    }
547
548    /// Returns the current [`Stream`][crate::Stream] for the `self`, or [`None`] if none has been
549    /// set yet, i.e. the pad has not received a stream-start event yet.
550    ///
551    /// This is a convenience wrapper around [`PadExtManual::sticky_event()`][crate::prelude::PadExtManual::sticky_event()] and
552    /// `gst_event_parse_stream()`.
553    ///
554    /// # Returns
555    ///
556    /// the current [`Stream`][crate::Stream] for `self`, or [`None`].
557    ///  unref the returned stream when no longer needed.
558    #[doc(alias = "gst_pad_get_stream")]
559    #[doc(alias = "get_stream")]
560    fn stream(&self) -> Option<Stream> {
561        unsafe { from_glib_full(ffi::gst_pad_get_stream(self.as_ref().to_glib_none().0)) }
562    }
563
564    /// Returns the current stream-id for the `self`, or [`None`] if none has been
565    /// set yet, i.e. the pad has not received a stream-start event yet.
566    ///
567    /// This is a convenience wrapper around [`PadExtManual::sticky_event()`][crate::prelude::PadExtManual::sticky_event()] and
568    /// `gst_event_parse_stream_start()`.
569    ///
570    /// The returned stream-id string should be treated as an opaque string, its
571    /// contents should not be interpreted.
572    ///
573    /// # Returns
574    ///
575    /// a newly-allocated copy of the stream-id for
576    ///  `self`, or [`None`]. `g_free()` the returned string when no longer
577    ///  needed.
578    #[doc(alias = "gst_pad_get_stream_id")]
579    #[doc(alias = "get_stream_id")]
580    fn stream_id(&self) -> Option<glib::GString> {
581        unsafe { from_glib_full(ffi::gst_pad_get_stream_id(self.as_ref().to_glib_none().0)) }
582    }
583
584    /// Get `self` task state. If no task is currently
585    /// set, [`TaskState::Stopped`][crate::TaskState::Stopped] is returned.
586    ///
587    /// # Returns
588    ///
589    /// The current state of `self`'s task.
590    #[doc(alias = "gst_pad_get_task_state")]
591    #[doc(alias = "get_task_state")]
592    fn task_state(&self) -> TaskState {
593        unsafe { from_glib(ffi::gst_pad_get_task_state(self.as_ref().to_glib_none().0)) }
594    }
595
596    /// Check if `self` has caps set on it with a [`EventType::Caps`][crate::EventType::Caps] event.
597    ///
598    /// # Returns
599    ///
600    /// [`true`] when `self` has caps associated with it.
601    #[doc(alias = "gst_pad_has_current_caps")]
602    fn has_current_caps(&self) -> bool {
603        unsafe {
604            from_glib(ffi::gst_pad_has_current_caps(
605                self.as_ref().to_glib_none().0,
606            ))
607        }
608    }
609
610    /// Query if a pad is active
611    ///
612    /// # Returns
613    ///
614    /// [`true`] if the pad is active.
615    ///
616    /// MT safe.
617    #[doc(alias = "gst_pad_is_active")]
618    fn is_active(&self) -> bool {
619        unsafe { from_glib(ffi::gst_pad_is_active(self.as_ref().to_glib_none().0)) }
620    }
621
622    /// Checks if the pad is blocked or not. This function returns the
623    /// last requested state of the pad. It is not certain that the pad
624    /// is actually blocking at this point (see [`is_blocking()`][Self::is_blocking()]).
625    ///
626    /// # Returns
627    ///
628    /// [`true`] if the pad is blocked.
629    ///
630    /// MT safe.
631    #[doc(alias = "gst_pad_is_blocked")]
632    fn is_blocked(&self) -> bool {
633        unsafe { from_glib(ffi::gst_pad_is_blocked(self.as_ref().to_glib_none().0)) }
634    }
635
636    /// Checks if the pad is blocking or not. This is a guaranteed state
637    /// of whether the pad is actually blocking on a [`Buffer`][crate::Buffer] or a [`Event`][crate::Event].
638    ///
639    /// # Returns
640    ///
641    /// [`true`] if the pad is blocking.
642    ///
643    /// MT safe.
644    #[doc(alias = "gst_pad_is_blocking")]
645    fn is_blocking(&self) -> bool {
646        unsafe { from_glib(ffi::gst_pad_is_blocking(self.as_ref().to_glib_none().0)) }
647    }
648
649    /// Checks if a `self` is linked to another pad or not.
650    ///
651    /// # Returns
652    ///
653    /// [`true`] if the pad is linked, [`false`] otherwise.
654    ///
655    /// MT safe.
656    #[doc(alias = "gst_pad_is_linked")]
657    fn is_linked(&self) -> bool {
658        unsafe { from_glib(ffi::gst_pad_is_linked(self.as_ref().to_glib_none().0)) }
659    }
660
661    //#[doc(alias = "gst_pad_iterate_internal_links")]
662    //fn iterate_internal_links(&self) -> /*Ignored*/Option<Iterator> {
663    //    unsafe { TODO: call ffi:gst_pad_iterate_internal_links() }
664    //}
665
666    //#[doc(alias = "gst_pad_iterate_internal_links_default")]
667    //fn iterate_internal_links_default(&self, parent: Option<&impl IsA<Object>>) -> /*Ignored*/Option<Iterator> {
668    //    unsafe { TODO: call ffi:gst_pad_iterate_internal_links_default() }
669    //}
670
671    /// Links the source pad and the sink pad.
672    /// ## `sinkpad`
673    /// the sink [`Pad`][crate::Pad] to link.
674    ///
675    /// # Returns
676    ///
677    /// A result code indicating if the connection worked or
678    ///  what went wrong.
679    ///
680    /// MT Safe.
681    #[doc(alias = "gst_pad_link")]
682    fn link(&self, sinkpad: &impl IsA<Pad>) -> Result<PadLinkSuccess, PadLinkError> {
683        unsafe {
684            try_from_glib(ffi::gst_pad_link(
685                self.as_ref().to_glib_none().0,
686                sinkpad.as_ref().to_glib_none().0,
687            ))
688        }
689    }
690
691    /// Links the source pad and the sink pad.
692    ///
693    /// This variant of `gst_pad_link` provides a more granular control on the
694    /// checks being done when linking. While providing some considerable speedups
695    /// the caller of this method must be aware that wrong usage of those flags
696    /// can cause severe issues. Refer to the documentation of [`PadLinkCheck`][crate::PadLinkCheck]
697    /// for more information.
698    ///
699    /// MT Safe.
700    /// ## `sinkpad`
701    /// the sink [`Pad`][crate::Pad] to link.
702    /// ## `flags`
703    /// the checks to validate when linking
704    ///
705    /// # Returns
706    ///
707    /// A result code indicating if the connection worked or
708    ///  what went wrong.
709    #[doc(alias = "gst_pad_link_full")]
710    fn link_full(
711        &self,
712        sinkpad: &impl IsA<Pad>,
713        flags: PadLinkCheck,
714    ) -> Result<PadLinkSuccess, PadLinkError> {
715        unsafe {
716            try_from_glib(ffi::gst_pad_link_full(
717                self.as_ref().to_glib_none().0,
718                sinkpad.as_ref().to_glib_none().0,
719                flags.into_glib(),
720            ))
721        }
722    }
723
724    /// Links `self` to `sink`, creating any [`GhostPad`][crate::GhostPad]'s in between as necessary.
725    ///
726    /// This is a convenience function to save having to create and add intermediate
727    /// [`GhostPad`][crate::GhostPad]'s as required for linking across [`Bin`][crate::Bin] boundaries.
728    ///
729    /// If `self` or `sink` pads don't have parent elements or do not share a common
730    /// ancestor, the link will fail.
731    /// ## `sink`
732    /// a [`Pad`][crate::Pad]
733    ///
734    /// # Returns
735    ///
736    /// whether the link succeeded.
737    #[doc(alias = "gst_pad_link_maybe_ghosting")]
738    fn link_maybe_ghosting(&self, sink: &impl IsA<Pad>) -> Result<(), glib::error::BoolError> {
739        unsafe {
740            glib::result_from_gboolean!(
741                ffi::gst_pad_link_maybe_ghosting(
742                    self.as_ref().to_glib_none().0,
743                    sink.as_ref().to_glib_none().0
744                ),
745                "Failed to link pads, possibly ghosting"
746            )
747        }
748    }
749
750    /// Links `self` to `sink`, creating any [`GhostPad`][crate::GhostPad]'s in between as necessary.
751    ///
752    /// This is a convenience function to save having to create and add intermediate
753    /// [`GhostPad`][crate::GhostPad]'s as required for linking across [`Bin`][crate::Bin] boundaries.
754    ///
755    /// If `self` or `sink` pads don't have parent elements or do not share a common
756    /// ancestor, the link will fail.
757    ///
758    /// Calling [`link_maybe_ghosting_full()`][Self::link_maybe_ghosting_full()] with
759    /// `flags` == [`PadLinkCheck::DEFAULT`][crate::PadLinkCheck::DEFAULT] is the recommended way of linking
760    /// pads with safety checks applied.
761    /// ## `sink`
762    /// a [`Pad`][crate::Pad]
763    /// ## `flags`
764    /// some [`PadLinkCheck`][crate::PadLinkCheck] flags
765    ///
766    /// # Returns
767    ///
768    /// whether the link succeeded.
769    #[doc(alias = "gst_pad_link_maybe_ghosting_full")]
770    fn link_maybe_ghosting_full(
771        &self,
772        sink: &impl IsA<Pad>,
773        flags: PadLinkCheck,
774    ) -> Result<(), glib::error::BoolError> {
775        unsafe {
776            glib::result_from_gboolean!(
777                ffi::gst_pad_link_maybe_ghosting_full(
778                    self.as_ref().to_glib_none().0,
779                    sink.as_ref().to_glib_none().0,
780                    flags.into_glib()
781                ),
782                "Failed to link pads, possibly ghosting"
783            )
784        }
785    }
786
787    /// Mark a pad for needing reconfiguration. The next call to
788    /// [`check_reconfigure()`][Self::check_reconfigure()] will return [`true`] after this call.
789    #[doc(alias = "gst_pad_mark_reconfigure")]
790    fn mark_reconfigure(&self) {
791        unsafe {
792            ffi::gst_pad_mark_reconfigure(self.as_ref().to_glib_none().0);
793        }
794    }
795
796    /// Check the [`PadFlags::NEED_RECONFIGURE`][crate::PadFlags::NEED_RECONFIGURE] flag on `self` and return [`true`]
797    /// if the flag was set.
798    ///
799    /// # Returns
800    ///
801    /// [`true`] is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on `self`.
802    #[doc(alias = "gst_pad_needs_reconfigure")]
803    fn needs_reconfigure(&self) -> bool {
804        unsafe {
805            from_glib(ffi::gst_pad_needs_reconfigure(
806                self.as_ref().to_glib_none().0,
807            ))
808        }
809    }
810
811    /// Pause the task of `self`. This function will also wait until the
812    /// function executed by the task is finished if this function is not
813    /// called from the task function.
814    ///
815    /// # Returns
816    ///
817    /// a [`true`] if the task could be paused or [`false`] when the pad
818    /// has no task.
819    #[doc(alias = "gst_pad_pause_task")]
820    fn pause_task(&self) -> Result<(), glib::error::BoolError> {
821        unsafe {
822            glib::result_from_gboolean!(
823                ffi::gst_pad_pause_task(self.as_ref().to_glib_none().0),
824                "Failed to pause pad task"
825            )
826        }
827    }
828
829    /// Check if the peer of `self` accepts `caps`. If `self` has no peer, this function
830    /// returns [`true`].
831    /// ## `caps`
832    /// a [`Caps`][crate::Caps] to check on the pad
833    ///
834    /// # Returns
835    ///
836    /// [`true`] if the peer of `self` can accept the caps or `self` has no peer.
837    #[doc(alias = "gst_pad_peer_query_accept_caps")]
838    fn peer_query_accept_caps(&self, caps: &Caps) -> bool {
839        unsafe {
840            from_glib(ffi::gst_pad_peer_query_accept_caps(
841                self.as_ref().to_glib_none().0,
842                caps.to_glib_none().0,
843            ))
844        }
845    }
846
847    /// Gets the capabilities of the peer connected to this pad. Similar to
848    /// [`query_caps()`][Self::query_caps()].
849    ///
850    /// When called on srcpads `filter` contains the caps that
851    /// upstream could produce in the order preferred by upstream. When
852    /// called on sinkpads `filter` contains the caps accepted by
853    /// downstream in the preferred order. `filter` might be [`None`] but
854    /// if it is not [`None`] the returned caps will be a subset of `filter`.
855    /// ## `filter`
856    /// a [`Caps`][crate::Caps] filter, or [`None`].
857    ///
858    /// # Returns
859    ///
860    /// the caps of the peer pad with incremented
861    /// ref-count. When there is no peer pad, this function returns `filter` or,
862    /// when `filter` is [`None`], ANY caps.
863    #[doc(alias = "gst_pad_peer_query_caps")]
864    fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps {
865        unsafe {
866            from_glib_full(ffi::gst_pad_peer_query_caps(
867                self.as_ref().to_glib_none().0,
868                filter.to_glib_none().0,
869            ))
870        }
871    }
872
873    /// Pushes a buffer to the peer of `self`.
874    ///
875    /// This function will call installed block probes before triggering any
876    /// installed data probes.
877    ///
878    /// The function proceeds calling [`chain()`][Self::chain()] on the peer pad and returns
879    /// the value from that function. If `self` has no peer, [`FlowReturn::NotLinked`][crate::FlowReturn::NotLinked] will
880    /// be returned.
881    ///
882    /// In all cases, success or failure, the caller loses its reference to `buffer`
883    /// after calling this function.
884    /// ## `buffer`
885    /// the [`Buffer`][crate::Buffer] to push returns GST_FLOW_ERROR
886    ///  if not.
887    ///
888    /// # Returns
889    ///
890    /// a [`FlowReturn`][crate::FlowReturn] from the peer pad.
891    ///
892    /// MT safe.
893    #[doc(alias = "gst_pad_push")]
894    fn push(&self, buffer: Buffer) -> Result<FlowSuccess, FlowError> {
895        unsafe {
896            try_from_glib(ffi::gst_pad_push(
897                self.as_ref().to_glib_none().0,
898                buffer.into_glib_ptr(),
899            ))
900        }
901    }
902
903    /// Pushes a buffer list to the peer of `self`.
904    ///
905    /// This function will call installed block probes before triggering any
906    /// installed data probes.
907    ///
908    /// The function proceeds calling the chain function on the peer pad and returns
909    /// the value from that function. If `self` has no peer, [`FlowReturn::NotLinked`][crate::FlowReturn::NotLinked] will
910    /// be returned. If the peer pad does not have any installed chainlist function
911    /// every group buffer of the list will be merged into a normal [`Buffer`][crate::Buffer] and
912    /// chained via [`chain()`][Self::chain()].
913    ///
914    /// In all cases, success or failure, the caller loses its reference to `list`
915    /// after calling this function.
916    /// ## `list`
917    /// the [`BufferList`][crate::BufferList] to push returns GST_FLOW_ERROR
918    ///  if not.
919    ///
920    /// # Returns
921    ///
922    /// a [`FlowReturn`][crate::FlowReturn] from the peer pad.
923    ///
924    /// MT safe.
925    #[doc(alias = "gst_pad_push_list")]
926    fn push_list(&self, list: BufferList) -> Result<FlowSuccess, FlowError> {
927        unsafe {
928            try_from_glib(ffi::gst_pad_push_list(
929                self.as_ref().to_glib_none().0,
930                list.into_glib_ptr(),
931            ))
932        }
933    }
934
935    /// Check if the given pad accepts the caps.
936    /// ## `caps`
937    /// a [`Caps`][crate::Caps] to check on the pad
938    ///
939    /// # Returns
940    ///
941    /// [`true`] if the pad can accept the caps.
942    #[doc(alias = "gst_pad_query_accept_caps")]
943    fn query_accept_caps(&self, caps: &Caps) -> bool {
944        unsafe {
945            from_glib(ffi::gst_pad_query_accept_caps(
946                self.as_ref().to_glib_none().0,
947                caps.to_glib_none().0,
948            ))
949        }
950    }
951
952    /// Gets the capabilities this pad can produce or consume.
953    /// Note that this method doesn't necessarily return the caps set by sending a
954    /// `gst_event_new_caps()` - use [`current_caps()`][Self::current_caps()] for that instead.
955    /// gst_pad_query_caps returns all possible caps a pad can operate with, using
956    /// the pad's CAPS query function, If the query fails, this function will return
957    /// `filter`, if not [`None`], otherwise ANY.
958    ///
959    /// When called on sinkpads `filter` contains the caps that
960    /// upstream could produce in the order preferred by upstream. When
961    /// called on srcpads `filter` contains the caps accepted by
962    /// downstream in the preferred order. `filter` might be [`None`] but
963    /// if it is not [`None`] the returned caps will be a subset of `filter`.
964    ///
965    /// Note that this function does not return writable [`Caps`][crate::Caps], use
966    /// `gst_caps_make_writable()` before modifying the caps.
967    /// ## `filter`
968    /// suggested [`Caps`][crate::Caps], or [`None`]
969    ///
970    /// # Returns
971    ///
972    /// the caps of the pad with incremented ref-count.
973    #[doc(alias = "gst_pad_query_caps")]
974    fn query_caps(&self, filter: Option<&Caps>) -> Caps {
975        unsafe {
976            from_glib_full(ffi::gst_pad_query_caps(
977                self.as_ref().to_glib_none().0,
978                filter.to_glib_none().0,
979            ))
980        }
981    }
982
983    /// Activates or deactivates the given pad.
984    /// Normally called from within core state change functions.
985    ///
986    /// If `active`, makes sure the pad is active. If it is already active, either in
987    /// push or pull mode, just return. Otherwise dispatches to the pad's activate
988    /// function to perform the actual activation.
989    ///
990    /// If not `active`, calls [`activate_mode()`][Self::activate_mode()] with the pad's current mode
991    /// and a [`false`] argument.
992    /// ## `active`
993    /// whether or not the pad should be active.
994    ///
995    /// # Returns
996    ///
997    /// [`true`] if the operation was successful.
998    ///
999    /// MT safe.
1000    #[doc(alias = "gst_pad_set_active")]
1001    fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
1002        unsafe {
1003            glib::result_from_gboolean!(
1004                ffi::gst_pad_set_active(self.as_ref().to_glib_none().0, active.into_glib()),
1005                "Failed to activate pad"
1006            )
1007        }
1008    }
1009
1010    //#[doc(alias = "gst_pad_set_element_private")]
1011    //fn set_element_private(&self, priv_: /*Unimplemented*/Option<Basic: Pointer>) {
1012    //    unsafe { TODO: call ffi:gst_pad_set_element_private() }
1013    //}
1014
1015    /// Set the offset that will be applied to the running time of `self`. Upon next
1016    /// buffer, every sticky events (notably segment) will be pushed again with
1017    /// their running time adjusted. For that reason this is only reliable on
1018    /// source pads.
1019    /// ## `offset`
1020    /// the offset
1021    #[doc(alias = "gst_pad_set_offset")]
1022    #[doc(alias = "offset")]
1023    fn set_offset(&self, offset: i64) {
1024        unsafe {
1025            ffi::gst_pad_set_offset(self.as_ref().to_glib_none().0, offset);
1026        }
1027    }
1028
1029    /// Stop the task of `self`. This function will also make sure that the
1030    /// function executed by the task will effectively stop if not called
1031    /// from the GstTaskFunction.
1032    ///
1033    /// This function will deadlock if called from the GstTaskFunction of
1034    /// the task. Use [`TaskExt::pause()`][crate::prelude::TaskExt::pause()] instead.
1035    ///
1036    /// Regardless of whether the pad has a task, the stream lock is acquired and
1037    /// released so as to ensure that streaming through this pad has finished.
1038    ///
1039    /// # Returns
1040    ///
1041    /// a [`true`] if the task could be stopped or [`false`] on error.
1042    #[doc(alias = "gst_pad_stop_task")]
1043    fn stop_task(&self) -> Result<(), glib::error::BoolError> {
1044        unsafe {
1045            glib::result_from_gboolean!(
1046                ffi::gst_pad_stop_task(self.as_ref().to_glib_none().0),
1047                "Failed to stop pad task"
1048            )
1049        }
1050    }
1051
1052    /// Store the sticky `event` on `self`
1053    /// ## `event`
1054    /// a [`Event`][crate::Event]
1055    ///
1056    /// # Returns
1057    ///
1058    /// [`FlowReturn::Ok`][crate::FlowReturn::Ok] on success, [`FlowReturn::Flushing`][crate::FlowReturn::Flushing] when the pad
1059    /// was flushing or [`FlowReturn::Eos`][crate::FlowReturn::Eos] when the pad was EOS.
1060    #[doc(alias = "gst_pad_store_sticky_event")]
1061    fn store_sticky_event(&self, event: &Event) -> Result<FlowSuccess, FlowError> {
1062        unsafe {
1063            try_from_glib(ffi::gst_pad_store_sticky_event(
1064                self.as_ref().to_glib_none().0,
1065                event.to_glib_none().0,
1066            ))
1067        }
1068    }
1069
1070    /// Unlinks the source pad from the sink pad. Will emit the [`unlinked`][struct@crate::Pad#unlinked]
1071    /// signal on both pads.
1072    /// ## `sinkpad`
1073    /// the sink [`Pad`][crate::Pad] to unlink.
1074    ///
1075    /// # Returns
1076    ///
1077    /// [`true`] if the pads were unlinked. This function returns [`false`] if
1078    /// the pads were not linked together.
1079    ///
1080    /// MT safe.
1081    #[doc(alias = "gst_pad_unlink")]
1082    fn unlink(&self, sinkpad: &impl IsA<Pad>) -> Result<(), glib::error::BoolError> {
1083        unsafe {
1084            glib::result_from_gboolean!(
1085                ffi::gst_pad_unlink(
1086                    self.as_ref().to_glib_none().0,
1087                    sinkpad.as_ref().to_glib_none().0
1088                ),
1089                "Failed to unlink pad"
1090            )
1091        }
1092    }
1093
1094    /// A helper function you can use that sets the FIXED_CAPS flag
1095    /// This way the default CAPS query will always return the negotiated caps
1096    /// or in case the pad is not negotiated, the padtemplate caps.
1097    ///
1098    /// The negotiated caps are the caps of the last CAPS event that passed on the
1099    /// pad. Use this function on a pad that, once it negotiated to a CAPS, cannot
1100    /// be renegotiated to something else.
1101    #[doc(alias = "gst_pad_use_fixed_caps")]
1102    fn use_fixed_caps(&self) {
1103        unsafe {
1104            ffi::gst_pad_use_fixed_caps(self.as_ref().to_glib_none().0);
1105        }
1106    }
1107
1108    /// Signals that a pad has been linked to the peer pad.
1109    /// ## `peer`
1110    /// the peer pad that has been connected
1111    #[doc(alias = "linked")]
1112    fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1113        unsafe extern "C" fn linked_trampoline<
1114            P: IsA<Pad>,
1115            F: Fn(&P, &Pad) + Send + Sync + 'static,
1116        >(
1117            this: *mut ffi::GstPad,
1118            peer: *mut ffi::GstPad,
1119            f: glib::ffi::gpointer,
1120        ) {
1121            let f: &F = &*(f as *const F);
1122            f(
1123                Pad::from_glib_borrow(this).unsafe_cast_ref(),
1124                &from_glib_borrow(peer),
1125            )
1126        }
1127        unsafe {
1128            let f: Box_<F> = Box_::new(f);
1129            connect_raw(
1130                self.as_ptr() as *mut _,
1131                c"linked".as_ptr() as *const _,
1132                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1133                    linked_trampoline::<Self, F> as *const (),
1134                )),
1135                Box_::into_raw(f),
1136            )
1137        }
1138    }
1139
1140    /// Signals that a pad has been unlinked from the peer pad.
1141    /// ## `peer`
1142    /// the peer pad that has been disconnected
1143    #[doc(alias = "unlinked")]
1144    fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
1145        &self,
1146        f: F,
1147    ) -> SignalHandlerId {
1148        unsafe extern "C" fn unlinked_trampoline<
1149            P: IsA<Pad>,
1150            F: Fn(&P, &Pad) + Send + Sync + 'static,
1151        >(
1152            this: *mut ffi::GstPad,
1153            peer: *mut ffi::GstPad,
1154            f: glib::ffi::gpointer,
1155        ) {
1156            let f: &F = &*(f as *const F);
1157            f(
1158                Pad::from_glib_borrow(this).unsafe_cast_ref(),
1159                &from_glib_borrow(peer),
1160            )
1161        }
1162        unsafe {
1163            let f: Box_<F> = Box_::new(f);
1164            connect_raw(
1165                self.as_ptr() as *mut _,
1166                c"unlinked".as_ptr() as *const _,
1167                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1168                    unlinked_trampoline::<Self, F> as *const (),
1169                )),
1170                Box_::into_raw(f),
1171            )
1172        }
1173    }
1174
1175    #[doc(alias = "caps")]
1176    fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1177        unsafe extern "C" fn notify_caps_trampoline<
1178            P: IsA<Pad>,
1179            F: Fn(&P) + Send + Sync + 'static,
1180        >(
1181            this: *mut ffi::GstPad,
1182            _param_spec: glib::ffi::gpointer,
1183            f: glib::ffi::gpointer,
1184        ) {
1185            let f: &F = &*(f as *const F);
1186            f(Pad::from_glib_borrow(this).unsafe_cast_ref())
1187        }
1188        unsafe {
1189            let f: Box_<F> = Box_::new(f);
1190            connect_raw(
1191                self.as_ptr() as *mut _,
1192                c"notify::caps".as_ptr() as *const _,
1193                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1194                    notify_caps_trampoline::<Self, F> as *const (),
1195                )),
1196                Box_::into_raw(f),
1197            )
1198        }
1199    }
1200
1201    #[doc(alias = "offset")]
1202    fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
1203        unsafe extern "C" fn notify_offset_trampoline<
1204            P: IsA<Pad>,
1205            F: Fn(&P) + Send + Sync + 'static,
1206        >(
1207            this: *mut ffi::GstPad,
1208            _param_spec: glib::ffi::gpointer,
1209            f: glib::ffi::gpointer,
1210        ) {
1211            let f: &F = &*(f as *const F);
1212            f(Pad::from_glib_borrow(this).unsafe_cast_ref())
1213        }
1214        unsafe {
1215            let f: Box_<F> = Box_::new(f);
1216            connect_raw(
1217                self.as_ptr() as *mut _,
1218                c"notify::offset".as_ptr() as *const _,
1219                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1220                    notify_offset_trampoline::<Self, F> as *const (),
1221                )),
1222                Box_::into_raw(f),
1223            )
1224        }
1225    }
1226}
1227
1228impl<O: IsA<Pad>> PadExt for O {}