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")]
16 pub struct MseSrc(Object<ffi::GstMseSrc, ffi::GstMseSrcClass>) @extends gst::Element, gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_mse_src_get_type(),
20 }
21}
22
23impl MseSrc {
24 #[doc(alias = "gst_mse_src_get_duration")]
25 #[doc(alias = "get_duration")]
26 pub fn duration(&self) -> Option<gst::ClockTime> {
27 unsafe { from_glib(ffi::gst_mse_src_get_duration(self.to_glib_none().0)) }
28 }
29
30 #[doc(alias = "gst_mse_src_get_n_audio")]
31 #[doc(alias = "get_n_audio")]
32 #[doc(alias = "n-audio")]
33 pub fn n_audio(&self) -> u32 {
34 unsafe { ffi::gst_mse_src_get_n_audio(self.to_glib_none().0) }
35 }
36
37 #[doc(alias = "gst_mse_src_get_n_text")]
38 #[doc(alias = "get_n_text")]
39 #[doc(alias = "n-text")]
40 pub fn n_text(&self) -> u32 {
41 unsafe { ffi::gst_mse_src_get_n_text(self.to_glib_none().0) }
42 }
43
44 #[doc(alias = "gst_mse_src_get_n_video")]
45 #[doc(alias = "get_n_video")]
46 #[doc(alias = "n-video")]
47 pub fn n_video(&self) -> u32 {
48 unsafe { ffi::gst_mse_src_get_n_video(self.to_glib_none().0) }
49 }
50
51 #[doc(alias = "gst_mse_src_get_position")]
52 #[doc(alias = "get_position")]
53 pub fn position(&self) -> Option<gst::ClockTime> {
54 unsafe { from_glib(ffi::gst_mse_src_get_position(self.to_glib_none().0)) }
55 }
56
57 #[doc(alias = "gst_mse_src_get_ready_state")]
58 #[doc(alias = "get_ready_state")]
59 #[doc(alias = "ready-state")]
60 pub fn ready_state(&self) -> MseSrcReadyState {
61 unsafe { from_glib(ffi::gst_mse_src_get_ready_state(self.to_glib_none().0)) }
62 }
63
64 pub fn set_duration(&self, duration: u64) {
65 ObjectExt::set_property(self, "duration", duration)
66 }
67
68 #[doc(alias = "duration")]
69 pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
70 &self,
71 f: F,
72 ) -> SignalHandlerId {
73 unsafe extern "C" fn notify_duration_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
74 this: *mut ffi::GstMseSrc,
75 _param_spec: glib::ffi::gpointer,
76 f: glib::ffi::gpointer,
77 ) {
78 unsafe {
79 let f: &F = &*(f as *const F);
80 f(&from_glib_borrow(this))
81 }
82 }
83 unsafe {
84 let f: Box_<F> = Box_::new(f);
85 connect_raw(
86 self.as_ptr() as *mut _,
87 c"notify::duration".as_ptr(),
88 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
89 notify_duration_trampoline::<F> as *const (),
90 )),
91 Box_::into_raw(f),
92 )
93 }
94 }
95
96 #[doc(alias = "n-audio")]
97 pub fn connect_n_audio_notify<F: Fn(&Self) + Send + Sync + 'static>(
98 &self,
99 f: F,
100 ) -> SignalHandlerId {
101 unsafe extern "C" fn notify_n_audio_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
102 this: *mut ffi::GstMseSrc,
103 _param_spec: glib::ffi::gpointer,
104 f: glib::ffi::gpointer,
105 ) {
106 unsafe {
107 let f: &F = &*(f as *const F);
108 f(&from_glib_borrow(this))
109 }
110 }
111 unsafe {
112 let f: Box_<F> = Box_::new(f);
113 connect_raw(
114 self.as_ptr() as *mut _,
115 c"notify::n-audio".as_ptr(),
116 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
117 notify_n_audio_trampoline::<F> as *const (),
118 )),
119 Box_::into_raw(f),
120 )
121 }
122 }
123
124 #[doc(alias = "n-text")]
125 pub fn connect_n_text_notify<F: Fn(&Self) + Send + Sync + 'static>(
126 &self,
127 f: F,
128 ) -> SignalHandlerId {
129 unsafe extern "C" fn notify_n_text_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
130 this: *mut ffi::GstMseSrc,
131 _param_spec: glib::ffi::gpointer,
132 f: glib::ffi::gpointer,
133 ) {
134 unsafe {
135 let f: &F = &*(f as *const F);
136 f(&from_glib_borrow(this))
137 }
138 }
139 unsafe {
140 let f: Box_<F> = Box_::new(f);
141 connect_raw(
142 self.as_ptr() as *mut _,
143 c"notify::n-text".as_ptr(),
144 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
145 notify_n_text_trampoline::<F> as *const (),
146 )),
147 Box_::into_raw(f),
148 )
149 }
150 }
151
152 #[doc(alias = "n-video")]
153 pub fn connect_n_video_notify<F: Fn(&Self) + Send + Sync + 'static>(
154 &self,
155 f: F,
156 ) -> SignalHandlerId {
157 unsafe extern "C" fn notify_n_video_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
158 this: *mut ffi::GstMseSrc,
159 _param_spec: glib::ffi::gpointer,
160 f: glib::ffi::gpointer,
161 ) {
162 unsafe {
163 let f: &F = &*(f as *const F);
164 f(&from_glib_borrow(this))
165 }
166 }
167 unsafe {
168 let f: Box_<F> = Box_::new(f);
169 connect_raw(
170 self.as_ptr() as *mut _,
171 c"notify::n-video".as_ptr(),
172 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
173 notify_n_video_trampoline::<F> as *const (),
174 )),
175 Box_::into_raw(f),
176 )
177 }
178 }
179
180 #[doc(alias = "position")]
181 pub fn connect_position_notify<F: Fn(&Self) + Send + Sync + 'static>(
182 &self,
183 f: F,
184 ) -> SignalHandlerId {
185 unsafe extern "C" fn notify_position_trampoline<F: Fn(&MseSrc) + Send + Sync + 'static>(
186 this: *mut ffi::GstMseSrc,
187 _param_spec: glib::ffi::gpointer,
188 f: glib::ffi::gpointer,
189 ) {
190 unsafe {
191 let f: &F = &*(f as *const F);
192 f(&from_glib_borrow(this))
193 }
194 }
195 unsafe {
196 let f: Box_<F> = Box_::new(f);
197 connect_raw(
198 self.as_ptr() as *mut _,
199 c"notify::position".as_ptr(),
200 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
201 notify_position_trampoline::<F> as *const (),
202 )),
203 Box_::into_raw(f),
204 )
205 }
206 }
207
208 #[doc(alias = "ready-state")]
209 pub fn connect_ready_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
210 &self,
211 f: F,
212 ) -> SignalHandlerId {
213 unsafe extern "C" fn notify_ready_state_trampoline<
214 F: Fn(&MseSrc) + Send + Sync + 'static,
215 >(
216 this: *mut ffi::GstMseSrc,
217 _param_spec: glib::ffi::gpointer,
218 f: glib::ffi::gpointer,
219 ) {
220 unsafe {
221 let f: &F = &*(f as *const F);
222 f(&from_glib_borrow(this))
223 }
224 }
225 unsafe {
226 let f: Box_<F> = Box_::new(f);
227 connect_raw(
228 self.as_ptr() as *mut _,
229 c"notify::ready-state".as_ptr(),
230 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
231 notify_ready_state_trampoline::<F> as *const (),
232 )),
233 Box_::into_raw(f),
234 )
235 }
236 }
237}
238
239unsafe impl Send for MseSrc {}
240unsafe impl Sync for MseSrc {}