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