gstreamer/auto/
ghost_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::{ffi, Object, Pad, ProxyPad};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "GstGhostPad")]
11    pub struct GhostPad(Object<ffi::GstGhostPad, ffi::GstGhostPadClass>) @extends ProxyPad, Pad, Object;
12
13    match fn {
14        type_ => || ffi::gst_ghost_pad_get_type(),
15    }
16}
17
18impl GhostPad {
19    pub const NONE: Option<&'static GhostPad> = None;
20}
21
22unsafe impl Send for GhostPad {}
23unsafe impl Sync for GhostPad {}
24
25pub trait GhostPadExt: IsA<GhostPad> + 'static {
26    #[doc(alias = "gst_ghost_pad_get_target")]
27    #[doc(alias = "get_target")]
28    fn target(&self) -> Option<Pad> {
29        unsafe {
30            from_glib_full(ffi::gst_ghost_pad_get_target(
31                self.as_ref().to_glib_none().0,
32            ))
33        }
34    }
35
36    #[doc(alias = "gst_ghost_pad_set_target")]
37    fn set_target(&self, newtarget: Option<&impl IsA<Pad>>) -> Result<(), glib::error::BoolError> {
38        unsafe {
39            glib::result_from_gboolean!(
40                ffi::gst_ghost_pad_set_target(
41                    self.as_ref().to_glib_none().0,
42                    newtarget.map(|p| p.as_ref()).to_glib_none().0
43                ),
44                "Failed to set target"
45            )
46        }
47    }
48}
49
50impl<O: IsA<GhostPad>> GhostPadExt for O {}