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