gstreamer_mse/auto/
mse_src.rs1use crate::{ffi, MseSrcReadyState};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "GstMseSrc")]
93 pub struct MseSrc(Object<ffi::GstMseSrc, ffi::GstMseSrcClass>) @extends gst::Element, gst::Object;
94
95 match fn {
96 type_ => || ffi::gst_mse_src_get_type(),
97 }
98}
99
100impl MseSrc {
101 #[doc(alias = "gst_mse_src_get_duration")]
109 #[doc(alias = "get_duration")]
110 pub fn duration(&self) -> Option<gst::ClockTime> {
111 unsafe { from_glib(ffi::gst_mse_src_get_duration(self.to_glib_none().0)) }
112 }
113
114 #[doc(alias = "gst_mse_src_get_n_audio")]
119 #[doc(alias = "get_n_audio")]
120 #[doc(alias = "n-audio")]
121 pub fn n_audio(&self) -> u32 {
122 unsafe { ffi::gst_mse_src_get_n_audio(self.to_glib_none().0) }
123 }
124
125 #[doc(alias = "gst_mse_src_get_n_text")]
130 #[doc(alias = "get_n_text")]
131 #[doc(alias = "n-text")]
132 pub fn n_text(&self) -> u32 {
133 unsafe { ffi::gst_mse_src_get_n_text(self.to_glib_none().0) }
134 }
135
136 #[doc(alias = "gst_mse_src_get_n_video")]
141 #[doc(alias = "get_n_video")]
142 #[doc(alias = "n-video")]
143 pub fn n_video(&self) -> u32 {
144 unsafe { ffi::gst_mse_src_get_n_video(self.to_glib_none().0) }
145 }
146
147 #[doc(alias = "gst_mse_src_get_position")]
155 #[doc(alias = "get_position")]
156 pub fn position(&self) -> Option<gst::ClockTime> {
157 unsafe { from_glib(ffi::gst_mse_src_get_position(self.to_glib_none().0)) }
158 }
159
160 #[doc(alias = "gst_mse_src_get_ready_state")]
171 #[doc(alias = "get_ready_state")]
172 #[doc(alias = "ready-state")]
173 pub fn ready_state(&self) -> MseSrcReadyState {
174 unsafe { from_glib(ffi::gst_mse_src_get_ready_state(self.to_glib_none().0)) }
175 }
176
177 pub fn set_duration(&self, duration: u64) {
181 ObjectExt::set_property(self, "duration", duration)
182 }
183
184 #[doc(alias = "duration")]
185 pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
186 &self,
187 f: F,
188 ) -> SignalHandlerId {
189 unsafe extern "C" fn notify_duration_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
190 this: *mut ffi::GstMseSrc,
191 _param_spec: glib::ffi::gpointer,
192 f: glib::ffi::gpointer,
193 ) {
194 let f: &F = &*(f as *const F);
195 f(&from_glib_borrow(this))
196 }
197 unsafe {
198 let f: Box_<F> = Box_::new(f);
199 connect_raw(
200 self.as_ptr() as *mut _,
201 c"notify::duration".as_ptr() as *const _,
202 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
203 notify_duration_trampoline::<F> as *const (),
204 )),
205 Box_::into_raw(f),
206 )
207 }
208 }
209
210 #[doc(alias = "n-audio")]
211 pub fn connect_n_audio_notify<F: Fn(&Self) + Send + Sync + 'static>(
212 &self,
213 f: F,
214 ) -> SignalHandlerId {
215 unsafe extern "C" fn notify_n_audio_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
216 this: *mut ffi::GstMseSrc,
217 _param_spec: glib::ffi::gpointer,
218 f: glib::ffi::gpointer,
219 ) {
220 let f: &F = &*(f as *const F);
221 f(&from_glib_borrow(this))
222 }
223 unsafe {
224 let f: Box_<F> = Box_::new(f);
225 connect_raw(
226 self.as_ptr() as *mut _,
227 c"notify::n-audio".as_ptr() as *const _,
228 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
229 notify_n_audio_trampoline::<F> as *const (),
230 )),
231 Box_::into_raw(f),
232 )
233 }
234 }
235
236 #[doc(alias = "n-text")]
237 pub fn connect_n_text_notify<F: Fn(&Self) + Send + Sync + 'static>(
238 &self,
239 f: F,
240 ) -> SignalHandlerId {
241 unsafe extern "C" fn notify_n_text_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
242 this: *mut ffi::GstMseSrc,
243 _param_spec: glib::ffi::gpointer,
244 f: glib::ffi::gpointer,
245 ) {
246 let f: &F = &*(f as *const F);
247 f(&from_glib_borrow(this))
248 }
249 unsafe {
250 let f: Box_<F> = Box_::new(f);
251 connect_raw(
252 self.as_ptr() as *mut _,
253 c"notify::n-text".as_ptr() as *const _,
254 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
255 notify_n_text_trampoline::<F> as *const (),
256 )),
257 Box_::into_raw(f),
258 )
259 }
260 }
261
262 #[doc(alias = "n-video")]
263 pub fn connect_n_video_notify<F: Fn(&Self) + Send + Sync + 'static>(
264 &self,
265 f: F,
266 ) -> SignalHandlerId {
267 unsafe extern "C" fn notify_n_video_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
268 this: *mut ffi::GstMseSrc,
269 _param_spec: glib::ffi::gpointer,
270 f: glib::ffi::gpointer,
271 ) {
272 let f: &F = &*(f as *const F);
273 f(&from_glib_borrow(this))
274 }
275 unsafe {
276 let f: Box_<F> = Box_::new(f);
277 connect_raw(
278 self.as_ptr() as *mut _,
279 c"notify::n-video".as_ptr() as *const _,
280 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
281 notify_n_video_trampoline::<F> as *const (),
282 )),
283 Box_::into_raw(f),
284 )
285 }
286 }
287
288 #[doc(alias = "position")]
289 pub fn connect_position_notify<F: Fn(&Self) + Send + Sync + 'static>(
290 &self,
291 f: F,
292 ) -> SignalHandlerId {
293 unsafe extern "C" fn notify_position_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
294 this: *mut ffi::GstMseSrc,
295 _param_spec: glib::ffi::gpointer,
296 f: glib::ffi::gpointer,
297 ) {
298 let f: &F = &*(f as *const F);
299 f(&from_glib_borrow(this))
300 }
301 unsafe {
302 let f: Box_<F> = Box_::new(f);
303 connect_raw(
304 self.as_ptr() as *mut _,
305 c"notify::position".as_ptr() as *const _,
306 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
307 notify_position_trampoline::<F> as *const (),
308 )),
309 Box_::into_raw(f),
310 )
311 }
312 }
313
314 #[doc(alias = "ready-state")]
315 pub fn connect_ready_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
316 &self,
317 f: F,
318 ) -> SignalHandlerId {
319 unsafe extern "C" fn notify_ready_state_trampoline<
320 F: Fn(&MseSrc) + Send + Sync + 'static,
321 >(
322 this: *mut ffi::GstMseSrc,
323 _param_spec: glib::ffi::gpointer,
324 f: glib::ffi::gpointer,
325 ) {
326 let f: &F = &*(f as *const F);
327 f(&from_glib_borrow(this))
328 }
329 unsafe {
330 let f: Box_<F> = Box_::new(f);
331 connect_raw(
332 self.as_ptr() as *mut _,
333 c"notify::ready-state".as_ptr() as *const _,
334 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
335 notify_ready_state_trampoline::<F> as *const (),
336 )),
337 Box_::into_raw(f),
338 )
339 }
340 }
341}
342
343unsafe impl Send for MseSrc {}
344unsafe impl Sync for MseSrc {}