app_src.rs 17.8 KB
Newer Older
1 2
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
3 4 5 6
// DO NOT EDIT

use AppStreamType;
use ffi;
7
use glib::StaticType;
8
use glib::Value;
9
use glib::object::ObjectType;
10
use glib::signal::SignalHandlerId;
11
use glib::signal::connect_raw;
12 13 14 15
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
16
use gst_base;
17 18 19 20 21
use libc;
use std::boxed::Box as Box_;
use std::mem::transmute;

glib_wrapper! {
22
    pub struct AppSrc(Object<ffi::GstAppSrc, ffi::GstAppSrcClass, AppSrcClass>) @extends gst_base::BaseSrc, gst::Element, gst::Object, @implements gst::URIHandler;
23 24 25 26 27 28

    match fn {
        get_type => || ffi::gst_app_src_get_type(),
    }
}

29 30
impl AppSrc {
    pub fn get_caps(&self) -> Option<gst::Caps> {
31 32 33 34 35
        unsafe {
            from_glib_full(ffi::gst_app_src_get_caps(self.to_glib_none().0))
        }
    }

36
    pub fn get_current_level_bytes(&self) -> u64 {
37 38 39 40 41
        unsafe {
            ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0)
        }
    }

Sebastian Dröge's avatar
Sebastian Dröge committed
42
    #[cfg(any(feature = "v1_10", feature = "dox"))]
43
    pub fn get_duration(&self) -> gst::ClockTime {
44
        unsafe {
45
            from_glib(ffi::gst_app_src_get_duration(self.to_glib_none().0))
46 47 48
        }
    }

49
    pub fn get_emit_signals(&self) -> bool {
50 51 52 53 54
        unsafe {
            from_glib(ffi::gst_app_src_get_emit_signals(self.to_glib_none().0))
        }
    }

55
    pub fn get_max_bytes(&self) -> u64 {
56 57 58 59 60
        unsafe {
            ffi::gst_app_src_get_max_bytes(self.to_glib_none().0)
        }
    }

61
    pub fn get_size(&self) -> i64 {
62 63 64 65 66
        unsafe {
            ffi::gst_app_src_get_size(self.to_glib_none().0)
        }
    }

67
    pub fn get_stream_type(&self) -> AppStreamType {
68 69 70 71 72
        unsafe {
            from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0))
        }
    }

73
    //pub fn set_callbacks(&self, callbacks: /*Ignored*/&mut AppSrcCallbacks, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
74 75 76
    //    unsafe { TODO: call ffi::gst_app_src_set_callbacks() }
    //}

77 78
    pub fn set_caps<'a, P: Into<Option<&'a gst::Caps>>>(&self, caps: P) {
        let caps = caps.into();
79
        unsafe {
80
            ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
81 82 83
        }
    }

Sebastian Dröge's avatar
Sebastian Dröge committed
84
    #[cfg(any(feature = "v1_10", feature = "dox"))]
85
    pub fn set_duration(&self, duration: gst::ClockTime) {
86
        unsafe {
87
            ffi::gst_app_src_set_duration(self.to_glib_none().0, duration.to_glib());
88 89 90
        }
    }

91
    pub fn set_emit_signals(&self, emit: bool) {
92 93 94 95 96
        unsafe {
            ffi::gst_app_src_set_emit_signals(self.to_glib_none().0, emit.to_glib());
        }
    }

97
    pub fn set_max_bytes(&self, max: u64) {
98 99 100 101 102
        unsafe {
            ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
        }
    }

103
    pub fn set_size(&self, size: i64) {
104 105 106 107 108
        unsafe {
            ffi::gst_app_src_set_size(self.to_glib_none().0, size);
        }
    }

109
    pub fn set_stream_type(&self, type_: AppStreamType) {
110 111 112 113 114
        unsafe {
            ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.to_glib());
        }
    }

115
    pub fn get_property_block(&self) -> bool {
116
        unsafe {
117
            let mut value = Value::from_type(<bool as StaticType>::static_type());
118
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"block\0".as_ptr() as *const _, value.to_glib_none_mut().0);
119
            value.get().unwrap()
120 121 122
        }
    }

123
    pub fn set_property_block(&self, block: bool) {
124
        unsafe {
125
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"block\0".as_ptr() as *const _, Value::from(&block).to_glib_none().0);
126 127 128
        }
    }

129 130
    pub fn get_property_duration(&self) -> u64 {
        unsafe {
131
            let mut value = Value::from_type(<u64 as StaticType>::static_type());
132
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"duration\0".as_ptr() as *const _, value.to_glib_none_mut().0);
133
            value.get().unwrap()
134 135 136 137 138
        }
    }

    pub fn set_property_duration(&self, duration: u64) {
        unsafe {
139
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"duration\0".as_ptr() as *const _, Value::from(&duration).to_glib_none().0);
140 141 142
        }
    }

143
    pub fn get_property_format(&self) -> gst::Format {
144
        unsafe {
145
            let mut value = Value::from_type(<gst::Format as StaticType>::static_type());
146
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"format\0".as_ptr() as *const _, value.to_glib_none_mut().0);
147
            value.get().unwrap()
148 149 150
        }
    }

151
    pub fn set_property_format(&self, format: gst::Format) {
152
        unsafe {
153
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"format\0".as_ptr() as *const _, Value::from(&format).to_glib_none().0);
154 155 156
        }
    }

157
    pub fn get_property_is_live(&self) -> bool {
158
        unsafe {
159
            let mut value = Value::from_type(<bool as StaticType>::static_type());
160
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"is-live\0".as_ptr() as *const _, value.to_glib_none_mut().0);
161
            value.get().unwrap()
162 163 164
        }
    }

165
    pub fn set_property_is_live(&self, is_live: bool) {
166
        unsafe {
167
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"is-live\0".as_ptr() as *const _, Value::from(&is_live).to_glib_none().0);
168 169 170
        }
    }

171 172
    pub fn get_property_max_latency(&self) -> i64 {
        unsafe {
173
            let mut value = Value::from_type(<i64 as StaticType>::static_type());
174
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"max-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0);
175
            value.get().unwrap()
176 177 178 179 180
        }
    }

    pub fn set_property_max_latency(&self, max_latency: i64) {
        unsafe {
181
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"max-latency\0".as_ptr() as *const _, Value::from(&max_latency).to_glib_none().0);
182 183 184 185 186
        }
    }

    pub fn get_property_min_latency(&self) -> i64 {
        unsafe {
187
            let mut value = Value::from_type(<i64 as StaticType>::static_type());
188
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0);
189
            value.get().unwrap()
190 191 192 193 194
        }
    }

    pub fn set_property_min_latency(&self, min_latency: i64) {
        unsafe {
195
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-latency\0".as_ptr() as *const _, Value::from(&min_latency).to_glib_none().0);
196 197 198
        }
    }

199
    pub fn get_property_min_percent(&self) -> u32 {
200
        unsafe {
201
            let mut value = Value::from_type(<u32 as StaticType>::static_type());
202
            gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-percent\0".as_ptr() as *const _, value.to_glib_none_mut().0);
203
            value.get().unwrap()
204 205 206
        }
    }

207
    pub fn set_property_min_percent(&self, min_percent: u32) {
208
        unsafe {
209
            gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-percent\0".as_ptr() as *const _, Value::from(&min_percent).to_glib_none().0);
210 211 212
        }
    }

213
    pub fn connect_enough_data<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
214
        unsafe {
215
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
216
            connect_raw(self.as_ptr() as *mut _, b"enough-data\0".as_ptr() as *const _,
217
                transmute(enough_data_trampoline as usize), Box_::into_raw(f) as *mut _)
218 219 220
        }
    }

221
    pub fn connect_need_data<F: Fn(&AppSrc, u32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
222
        unsafe {
223
            let f: Box_<Box_<Fn(&AppSrc, u32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
224
            connect_raw(self.as_ptr() as *mut _, b"need-data\0".as_ptr() as *const _,
225
                transmute(need_data_trampoline as usize), Box_::into_raw(f) as *mut _)
226 227 228
        }
    }

229
    pub fn connect_seek_data<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
230
        unsafe {
231
            let f: Box_<Box_<Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>> = Box_::new(Box_::new(f));
232
            connect_raw(self.as_ptr() as *mut _, b"seek-data\0".as_ptr() as *const _,
233
                transmute(seek_data_trampoline as usize), Box_::into_raw(f) as *mut _)
234 235
        }
    }
236

237
    pub fn connect_property_block_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
238 239
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
240
            connect_raw(self.as_ptr() as *mut _, b"notify::block\0".as_ptr() as *const _,
241 242 243 244
                transmute(notify_block_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

245
    pub fn connect_property_caps_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
246 247
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
248
            connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _,
249 250 251 252
                transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

253
    pub fn connect_property_current_level_bytes_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
254 255
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
256
            connect_raw(self.as_ptr() as *mut _, b"notify::current-level-bytes\0".as_ptr() as *const _,
257 258 259 260
                transmute(notify_current_level_bytes_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

261
    pub fn connect_property_duration_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
262 263
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
264
            connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
265 266 267 268
                transmute(notify_duration_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

269
    pub fn connect_property_emit_signals_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
270 271
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
272
            connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _,
273 274 275 276
                transmute(notify_emit_signals_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

277
    pub fn connect_property_format_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
278 279
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
280
            connect_raw(self.as_ptr() as *mut _, b"notify::format\0".as_ptr() as *const _,
281 282 283 284
                transmute(notify_format_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

285
    pub fn connect_property_is_live_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
286 287
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
288
            connect_raw(self.as_ptr() as *mut _, b"notify::is-live\0".as_ptr() as *const _,
289 290 291 292
                transmute(notify_is_live_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

293
    pub fn connect_property_max_bytes_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
294 295
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
296
            connect_raw(self.as_ptr() as *mut _, b"notify::max-bytes\0".as_ptr() as *const _,
297 298 299 300
                transmute(notify_max_bytes_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

301
    pub fn connect_property_max_latency_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
302 303
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
304
            connect_raw(self.as_ptr() as *mut _, b"notify::max-latency\0".as_ptr() as *const _,
305 306 307 308
                transmute(notify_max_latency_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

309
    pub fn connect_property_min_latency_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
310 311
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
312
            connect_raw(self.as_ptr() as *mut _, b"notify::min-latency\0".as_ptr() as *const _,
313 314 315 316
                transmute(notify_min_latency_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

317
    pub fn connect_property_min_percent_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
318 319
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
320
            connect_raw(self.as_ptr() as *mut _, b"notify::min-percent\0".as_ptr() as *const _,
321 322 323 324
                transmute(notify_min_percent_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

325
    pub fn connect_property_size_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
326 327
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
328
            connect_raw(self.as_ptr() as *mut _, b"notify::size\0".as_ptr() as *const _,
329 330 331 332
                transmute(notify_size_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

333
    pub fn connect_property_stream_type_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
334 335
        unsafe {
            let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
336
            connect_raw(self.as_ptr() as *mut _, b"notify::stream-type\0".as_ptr() as *const _,
337 338 339
                transmute(notify_stream_type_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }
340 341
}

342 343 344 345
unsafe impl Send for AppSrc {}
unsafe impl Sync for AppSrc {}

unsafe extern "C" fn enough_data_trampoline(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer) {
346
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
347
    f(&from_glib_borrow(this))
348 349
}

350
unsafe extern "C" fn need_data_trampoline(this: *mut ffi::GstAppSrc, length: libc::c_uint, f: glib_ffi::gpointer) {
351
    let f: &&(Fn(&AppSrc, u32) + Send + Sync + 'static) = transmute(f);
352
    f(&from_glib_borrow(this), length)
353 354
}

355
unsafe extern "C" fn seek_data_trampoline(this: *mut ffi::GstAppSrc, offset: u64, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
356
    let f: &&(Fn(&AppSrc, u64) -> bool + Send + Sync + 'static) = transmute(f);
357
    f(&from_glib_borrow(this), offset).to_glib()
358
}
359 360 361

unsafe extern "C" fn notify_block_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
362
    f(&from_glib_borrow(this))
363 364 365 366
}

unsafe extern "C" fn notify_caps_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
367
    f(&from_glib_borrow(this))
368 369 370 371
}

unsafe extern "C" fn notify_current_level_bytes_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
372
    f(&from_glib_borrow(this))
373 374 375 376
}

unsafe extern "C" fn notify_duration_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
377
    f(&from_glib_borrow(this))
378 379 380 381
}

unsafe extern "C" fn notify_emit_signals_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
382
    f(&from_glib_borrow(this))
383 384 385 386
}

unsafe extern "C" fn notify_format_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
387
    f(&from_glib_borrow(this))
388 389 390 391
}

unsafe extern "C" fn notify_is_live_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
392
    f(&from_glib_borrow(this))
393 394 395 396
}

unsafe extern "C" fn notify_max_bytes_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
397
    f(&from_glib_borrow(this))
398 399 400 401
}

unsafe extern "C" fn notify_max_latency_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
402
    f(&from_glib_borrow(this))
403 404 405 406
}

unsafe extern "C" fn notify_min_latency_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
407
    f(&from_glib_borrow(this))
408 409 410 411
}

unsafe extern "C" fn notify_min_percent_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
412
    f(&from_glib_borrow(this))
413 414 415 416
}

unsafe extern "C" fn notify_size_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
417
    f(&from_glib_borrow(this))
418 419 420 421
}

unsafe extern "C" fn notify_stream_type_trampoline(this: *mut ffi::GstAppSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
    let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
422
    f(&from_glib_borrow(this))
423
}