2018-04-23 17:34:22 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
2018-02-09 02:30:08 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
|
|
|
use ffi;
|
2019-01-16 11:32:39 +00:00
|
|
|
use glib::object::Cast;
|
2018-02-09 02:30:08 +00:00
|
|
|
use glib::object::IsA;
|
|
|
|
use glib::signal::SignalHandlerId;
|
2018-12-08 09:05:20 +00:00
|
|
|
use glib::signal::connect_raw;
|
2018-02-09 02:30:08 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use glib_ffi;
|
|
|
|
use std::boxed::Box as Box_;
|
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
glib_wrapper! {
|
2019-01-16 11:32:39 +00:00
|
|
|
pub struct RTSPThreadPool(Object<ffi::GstRTSPThreadPool, ffi::GstRTSPThreadPoolClass, RTSPThreadPoolClass>);
|
2018-02-09 02:30:08 +00:00
|
|
|
|
|
|
|
match fn {
|
|
|
|
get_type => || ffi::gst_rtsp_thread_pool_get_type(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl RTSPThreadPool {
|
|
|
|
pub fn new() -> RTSPThreadPool {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_rtsp_thread_pool_new())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn cleanup() {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_rtsp_thread_pool_cleanup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for RTSPThreadPool {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::new()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for RTSPThreadPool {}
|
|
|
|
unsafe impl Sync for RTSPThreadPool {}
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
pub const NONE_RTSP_THREAD_POOL: Option<&RTSPThreadPool> = None;
|
|
|
|
|
2018-12-08 09:05:20 +00:00
|
|
|
pub trait RTSPThreadPoolExt: 'static {
|
2018-02-09 02:30:08 +00:00
|
|
|
fn get_max_threads(&self) -> i32;
|
|
|
|
|
2018-02-15 15:03:31 +00:00
|
|
|
//fn get_thread(&self, type_: RTSPThreadType, ctx: &RTSPContext) -> /*Ignored*/Option<RTSPThread>;
|
2018-02-09 02:30:08 +00:00
|
|
|
|
|
|
|
fn set_max_threads(&self, max_threads: i32);
|
|
|
|
|
|
|
|
fn connect_property_max_threads_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
|
|
|
|
}
|
|
|
|
|
2018-12-08 09:05:20 +00:00
|
|
|
impl<O: IsA<RTSPThreadPool>> RTSPThreadPoolExt for O {
|
2018-02-09 02:30:08 +00:00
|
|
|
fn get_max_threads(&self) -> i32 {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
ffi::gst_rtsp_thread_pool_get_max_threads(self.as_ref().to_glib_none().0)
|
2018-02-09 02:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-15 15:03:31 +00:00
|
|
|
//fn get_thread(&self, type_: RTSPThreadType, ctx: &RTSPContext) -> /*Ignored*/Option<RTSPThread> {
|
2018-02-09 02:30:08 +00:00
|
|
|
// unsafe { TODO: call ffi::gst_rtsp_thread_pool_get_thread() }
|
|
|
|
//}
|
|
|
|
|
|
|
|
fn set_max_threads(&self, max_threads: i32) {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
ffi::gst_rtsp_thread_pool_set_max_threads(self.as_ref().to_glib_none().0, max_threads);
|
2018-02-09 02:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn connect_property_max_threads_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"notify::max-threads\0".as_ptr() as *const _,
|
2019-01-29 13:53:44 +00:00
|
|
|
Some(transmute(notify_max_threads_trampoline::<Self, F> as usize)), Box_::into_raw(f))
|
2018-02-09 02:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-29 13:53:44 +00:00
|
|
|
unsafe extern "C" fn notify_max_threads_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(this: *mut ffi::GstRTSPThreadPool, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
2018-02-09 02:30:08 +00:00
|
|
|
where P: IsA<RTSPThreadPool> {
|
2019-02-22 09:51:17 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
2019-01-16 11:32:39 +00:00
|
|
|
f(&RTSPThreadPool::from_glib_borrow(this).unsafe_cast())
|
2018-02-09 02:30:08 +00:00
|
|
|
}
|