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
30mod sealed {
31    pub trait Sealed {}
32    impl<T: super::IsA<super::BaseParse>> Sealed for T {}
33}
34
35pub trait BaseParseExt: IsA<BaseParse> + sealed::Sealed + 'static {
36    #[doc(alias = "gst_base_parse_add_index_entry")]
37    fn add_index_entry(&self, offset: u64, ts: gst::ClockTime, key: bool, force: bool) -> bool {
38        unsafe {
39            from_glib(ffi::gst_base_parse_add_index_entry(
40                self.as_ref().to_glib_none().0,
41                offset,
42                ts.into_glib(),
43                key.into_glib(),
44                force.into_glib(),
45            ))
46        }
47    }
48
49    #[doc(alias = "gst_base_parse_drain")]
50    fn drain(&self) {
51        unsafe {
52            ffi::gst_base_parse_drain(self.as_ref().to_glib_none().0);
53        }
54    }
55
56    #[doc(alias = "gst_base_parse_merge_tags")]
57    fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) {
58        unsafe {
59            ffi::gst_base_parse_merge_tags(
60                self.as_ref().to_glib_none().0,
61                tags.to_glib_none().0,
62                mode.into_glib(),
63            );
64        }
65    }
66
67    #[doc(alias = "gst_base_parse_set_average_bitrate")]
68    fn set_average_bitrate(&self, bitrate: u32) {
69        unsafe {
70            ffi::gst_base_parse_set_average_bitrate(self.as_ref().to_glib_none().0, bitrate);
71        }
72    }
73
74    #[doc(alias = "gst_base_parse_set_has_timing_info")]
75    fn set_has_timing_info(&self, has_timing: bool) {
76        unsafe {
77            ffi::gst_base_parse_set_has_timing_info(
78                self.as_ref().to_glib_none().0,
79                has_timing.into_glib(),
80            );
81        }
82    }
83
84    #[doc(alias = "gst_base_parse_set_infer_ts")]
85    fn set_infer_ts(&self, infer_ts: bool) {
86        unsafe {
87            ffi::gst_base_parse_set_infer_ts(self.as_ref().to_glib_none().0, infer_ts.into_glib());
88        }
89    }
90
91    #[doc(alias = "gst_base_parse_set_latency")]
92    fn set_latency(
93        &self,
94        min_latency: gst::ClockTime,
95        max_latency: impl Into<Option<gst::ClockTime>>,
96    ) {
97        unsafe {
98            ffi::gst_base_parse_set_latency(
99                self.as_ref().to_glib_none().0,
100                min_latency.into_glib(),
101                max_latency.into().into_glib(),
102            );
103        }
104    }
105
106    #[doc(alias = "gst_base_parse_set_min_frame_size")]
107    fn set_min_frame_size(&self, min_size: u32) {
108        unsafe {
109            ffi::gst_base_parse_set_min_frame_size(self.as_ref().to_glib_none().0, min_size);
110        }
111    }
112
113    #[doc(alias = "gst_base_parse_set_passthrough")]
114    fn set_passthrough(&self, passthrough: bool) {
115        unsafe {
116            ffi::gst_base_parse_set_passthrough(
117                self.as_ref().to_glib_none().0,
118                passthrough.into_glib(),
119            );
120        }
121    }
122
123    #[doc(alias = "gst_base_parse_set_pts_interpolation")]
124    fn set_pts_interpolation(&self, pts_interpolate: bool) {
125        unsafe {
126            ffi::gst_base_parse_set_pts_interpolation(
127                self.as_ref().to_glib_none().0,
128                pts_interpolate.into_glib(),
129            );
130        }
131    }
132
133    #[doc(alias = "gst_base_parse_set_syncable")]
134    fn set_syncable(&self, syncable: bool) {
135        unsafe {
136            ffi::gst_base_parse_set_syncable(self.as_ref().to_glib_none().0, syncable.into_glib());
137        }
138    }
139
140    #[doc(alias = "gst_base_parse_set_ts_at_offset")]
141    fn set_ts_at_offset(&self, offset: usize) {
142        unsafe {
143            ffi::gst_base_parse_set_ts_at_offset(self.as_ref().to_glib_none().0, offset);
144        }
145    }
146
147    #[doc(alias = "disable-passthrough")]
148    fn is_disable_passthrough(&self) -> bool {
149        ObjectExt::property(self.as_ref(), "disable-passthrough")
150    }
151
152    #[doc(alias = "disable-passthrough")]
153    fn set_disable_passthrough(&self, disable_passthrough: bool) {
154        ObjectExt::set_property(self.as_ref(), "disable-passthrough", disable_passthrough)
155    }
156
157    #[doc(alias = "disable-passthrough")]
158    fn connect_disable_passthrough_notify<F: Fn(&Self) + Send + Sync + 'static>(
159        &self,
160        f: F,
161    ) -> SignalHandlerId {
162        unsafe extern "C" fn notify_disable_passthrough_trampoline<
163            P: IsA<BaseParse>,
164            F: Fn(&P) + Send + Sync + 'static,
165        >(
166            this: *mut ffi::GstBaseParse,
167            _param_spec: glib::ffi::gpointer,
168            f: glib::ffi::gpointer,
169        ) {
170            let f: &F = &*(f as *const F);
171            f(BaseParse::from_glib_borrow(this).unsafe_cast_ref())
172        }
173        unsafe {
174            let f: Box_<F> = Box_::new(f);
175            connect_raw(
176                self.as_ptr() as *mut _,
177                b"notify::disable-passthrough\0".as_ptr() as *const _,
178                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
179                    notify_disable_passthrough_trampoline::<Self, F> as *const (),
180                )),
181                Box_::into_raw(f),
182            )
183        }
184    }
185}
186
187impl<O: IsA<BaseParse>> BaseParseExt for O {}