gstreamer_base/auto/
base_parse.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;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GstBaseParse")]
16    pub struct BaseParse(Object<ffi::GstBaseParse, ffi::GstBaseParseClass>) @extends gst::Element, gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_base_parse_get_type(),
20    }
21}
22
23impl BaseParse {
24    pub const NONE: Option<&'static BaseParse> = None;
25}
26
27unsafe impl Send for BaseParse {}
28unsafe impl Sync for BaseParse {}
29
30pub trait BaseParseExt: IsA<BaseParse> + 'static {
31    #[doc(alias = "gst_base_parse_add_index_entry")]
32    fn add_index_entry(&self, offset: u64, ts: gst::ClockTime, key: bool, force: bool) -> bool {
33        unsafe {
34            from_glib(ffi::gst_base_parse_add_index_entry(
35                self.as_ref().to_glib_none().0,
36                offset,
37                ts.into_glib(),
38                key.into_glib(),
39                force.into_glib(),
40            ))
41        }
42    }
43
44    #[doc(alias = "gst_base_parse_drain")]
45    fn drain(&self) {
46        unsafe {
47            ffi::gst_base_parse_drain(self.as_ref().to_glib_none().0);
48        }
49    }
50
51    #[doc(alias = "gst_base_parse_merge_tags")]
52    fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) {
53        unsafe {
54            ffi::gst_base_parse_merge_tags(
55                self.as_ref().to_glib_none().0,
56                tags.to_glib_none().0,
57                mode.into_glib(),
58            );
59        }
60    }
61
62    #[doc(alias = "gst_base_parse_set_average_bitrate")]
63    fn set_average_bitrate(&self, bitrate: u32) {
64        unsafe {
65            ffi::gst_base_parse_set_average_bitrate(self.as_ref().to_glib_none().0, bitrate);
66        }
67    }
68
69    #[doc(alias = "gst_base_parse_set_has_timing_info")]
70    fn set_has_timing_info(&self, has_timing: bool) {
71        unsafe {
72            ffi::gst_base_parse_set_has_timing_info(
73                self.as_ref().to_glib_none().0,
74                has_timing.into_glib(),
75            );
76        }
77    }
78
79    #[doc(alias = "gst_base_parse_set_infer_ts")]
80    fn set_infer_ts(&self, infer_ts: bool) {
81        unsafe {
82            ffi::gst_base_parse_set_infer_ts(self.as_ref().to_glib_none().0, infer_ts.into_glib());
83        }
84    }
85
86    #[doc(alias = "gst_base_parse_set_latency")]
87    fn set_latency(
88        &self,
89        min_latency: gst::ClockTime,
90        max_latency: impl Into<Option<gst::ClockTime>>,
91    ) {
92        unsafe {
93            ffi::gst_base_parse_set_latency(
94                self.as_ref().to_glib_none().0,
95                min_latency.into_glib(),
96                max_latency.into().into_glib(),
97            );
98        }
99    }
100
101    #[doc(alias = "gst_base_parse_set_min_frame_size")]
102    fn set_min_frame_size(&self, min_size: u32) {
103        unsafe {
104            ffi::gst_base_parse_set_min_frame_size(self.as_ref().to_glib_none().0, min_size);
105        }
106    }
107
108    #[doc(alias = "gst_base_parse_set_passthrough")]
109    fn set_passthrough(&self, passthrough: bool) {
110        unsafe {
111            ffi::gst_base_parse_set_passthrough(
112                self.as_ref().to_glib_none().0,
113                passthrough.into_glib(),
114            );
115        }
116    }
117
118    #[doc(alias = "gst_base_parse_set_pts_interpolation")]
119    fn set_pts_interpolation(&self, pts_interpolate: bool) {
120        unsafe {
121            ffi::gst_base_parse_set_pts_interpolation(
122                self.as_ref().to_glib_none().0,
123                pts_interpolate.into_glib(),
124            );
125        }
126    }
127
128    #[doc(alias = "gst_base_parse_set_syncable")]
129    fn set_syncable(&self, syncable: bool) {
130        unsafe {
131            ffi::gst_base_parse_set_syncable(self.as_ref().to_glib_none().0, syncable.into_glib());
132        }
133    }
134
135    #[doc(alias = "gst_base_parse_set_ts_at_offset")]
136    fn set_ts_at_offset(&self, offset: usize) {
137        unsafe {
138            ffi::gst_base_parse_set_ts_at_offset(self.as_ref().to_glib_none().0, offset);
139        }
140    }
141
142    #[cfg(feature = "v1_28")]
143    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
144    #[doc(alias = "disable-clip")]
145    fn is_disable_clip(&self) -> bool {
146        ObjectExt::property(self.as_ref(), "disable-clip")
147    }
148
149    #[cfg(feature = "v1_28")]
150    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
151    #[doc(alias = "disable-clip")]
152    fn set_disable_clip(&self, disable_clip: bool) {
153        ObjectExt::set_property(self.as_ref(), "disable-clip", disable_clip)
154    }
155
156    #[doc(alias = "disable-passthrough")]
157    fn is_disable_passthrough(&self) -> bool {
158        ObjectExt::property(self.as_ref(), "disable-passthrough")
159    }
160
161    #[doc(alias = "disable-passthrough")]
162    fn set_disable_passthrough(&self, disable_passthrough: bool) {
163        ObjectExt::set_property(self.as_ref(), "disable-passthrough", disable_passthrough)
164    }
165
166    #[cfg(feature = "v1_28")]
167    #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
168    #[doc(alias = "disable-clip")]
169    fn connect_disable_clip_notify<F: Fn(&Self) + Send + Sync + 'static>(
170        &self,
171        f: F,
172    ) -> SignalHandlerId {
173        unsafe extern "C" fn notify_disable_clip_trampoline<
174            P: IsA<BaseParse>,
175            F: Fn(&P) + Send + Sync + 'static,
176        >(
177            this: *mut ffi::GstBaseParse,
178            _param_spec: glib::ffi::gpointer,
179            f: glib::ffi::gpointer,
180        ) {
181            let f: &F = &*(f as *const F);
182            f(BaseParse::from_glib_borrow(this).unsafe_cast_ref())
183        }
184        unsafe {
185            let f: Box_<F> = Box_::new(f);
186            connect_raw(
187                self.as_ptr() as *mut _,
188                c"notify::disable-clip".as_ptr() as *const _,
189                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
190                    notify_disable_clip_trampoline::<Self, F> as *const (),
191                )),
192                Box_::into_raw(f),
193            )
194        }
195    }
196
197    #[doc(alias = "disable-passthrough")]
198    fn connect_disable_passthrough_notify<F: Fn(&Self) + Send + Sync + 'static>(
199        &self,
200        f: F,
201    ) -> SignalHandlerId {
202        unsafe extern "C" fn notify_disable_passthrough_trampoline<
203            P: IsA<BaseParse>,
204            F: Fn(&P) + Send + Sync + 'static,
205        >(
206            this: *mut ffi::GstBaseParse,
207            _param_spec: glib::ffi::gpointer,
208            f: glib::ffi::gpointer,
209        ) {
210            let f: &F = &*(f as *const F);
211            f(BaseParse::from_glib_borrow(this).unsafe_cast_ref())
212        }
213        unsafe {
214            let f: Box_<F> = Box_::new(f);
215            connect_raw(
216                self.as_ptr() as *mut _,
217                c"notify::disable-passthrough".as_ptr() as *const _,
218                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
219                    notify_disable_passthrough_trampoline::<Self, F> as *const (),
220                )),
221                Box_::into_raw(f),
222            )
223        }
224    }
225}
226
227impl<O: IsA<BaseParse>> BaseParseExt for O {}