1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    #[doc(alias = "GstBaseTransform")]
    pub struct BaseTransform(Object<ffi::GstBaseTransform, ffi::GstBaseTransformClass>) @extends gst::Element, gst::Object;

    match fn {
        type_ => || ffi::gst_base_transform_get_type(),
    }
}

impl BaseTransform {
    pub const NONE: Option<&'static BaseTransform> = None;
}

unsafe impl Send for BaseTransform {}
unsafe impl Sync for BaseTransform {}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::BaseTransform>> Sealed for T {}
}

pub trait BaseTransformExt: IsA<BaseTransform> + sealed::Sealed + 'static {
    #[doc(alias = "gst_base_transform_get_buffer_pool")]
    #[doc(alias = "get_buffer_pool")]
    fn buffer_pool(&self) -> Option<gst::BufferPool> {
        unsafe {
            from_glib_full(ffi::gst_base_transform_get_buffer_pool(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gst_base_transform_is_in_place")]
    fn is_in_place(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_base_transform_is_in_place(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gst_base_transform_is_passthrough")]
    fn is_passthrough(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_base_transform_is_passthrough(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "gst_base_transform_reconfigure")]
    fn reconfigure(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_base_transform_reconfigure(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gst_base_transform_reconfigure_sink")]
    fn reconfigure_sink(&self) {
        unsafe {
            ffi::gst_base_transform_reconfigure_sink(self.as_ref().to_glib_none().0);
        }
    }

    #[doc(alias = "gst_base_transform_reconfigure_src")]
    fn reconfigure_src(&self) {
        unsafe {
            ffi::gst_base_transform_reconfigure_src(self.as_ref().to_glib_none().0);
        }
    }

    #[doc(alias = "gst_base_transform_set_gap_aware")]
    fn set_gap_aware(&self, gap_aware: bool) {
        unsafe {
            ffi::gst_base_transform_set_gap_aware(
                self.as_ref().to_glib_none().0,
                gap_aware.into_glib(),
            );
        }
    }

    #[doc(alias = "gst_base_transform_set_in_place")]
    fn set_in_place(&self, in_place: bool) {
        unsafe {
            ffi::gst_base_transform_set_in_place(
                self.as_ref().to_glib_none().0,
                in_place.into_glib(),
            );
        }
    }

    #[doc(alias = "gst_base_transform_set_passthrough")]
    fn set_passthrough(&self, passthrough: bool) {
        unsafe {
            ffi::gst_base_transform_set_passthrough(
                self.as_ref().to_glib_none().0,
                passthrough.into_glib(),
            );
        }
    }

    #[doc(alias = "gst_base_transform_set_prefer_passthrough")]
    fn set_prefer_passthrough(&self, prefer_passthrough: bool) {
        unsafe {
            ffi::gst_base_transform_set_prefer_passthrough(
                self.as_ref().to_glib_none().0,
                prefer_passthrough.into_glib(),
            );
        }
    }

    #[doc(alias = "gst_base_transform_update_qos")]
    fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime) {
        unsafe {
            ffi::gst_base_transform_update_qos(
                self.as_ref().to_glib_none().0,
                proportion,
                diff,
                timestamp.into_glib(),
            );
        }
    }

    #[doc(alias = "gst_base_transform_update_src_caps")]
    fn update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::result_from_gboolean!(
                ffi::gst_base_transform_update_src_caps(
                    self.as_ref().to_glib_none().0,
                    updated_caps.to_glib_none().0
                ),
                "Failed to update src caps"
            )
        }
    }

    fn is_qos(&self) -> bool {
        ObjectExt::property(self.as_ref(), "qos")
    }

    fn set_qos(&self, qos: bool) {
        ObjectExt::set_property(self.as_ref(), "qos", qos)
    }

    #[doc(alias = "qos")]
    fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_qos_trampoline<
            P: IsA<BaseTransform>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseTransform,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(BaseTransform::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::qos\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_qos_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<BaseTransform>> BaseTransformExt for O {}