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