// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127) // from gir-files (https://github.com/gtk-rs/gir-files @ ???) // DO NOT EDIT use Error; use RTSPAuth; use RTSPClient; use RTSPMountPoints; use RTSPSessionPool; use RTSPThreadPool; use ffi; use gio; use glib; use glib::object::Downcast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; use std::ptr; glib_wrapper! { pub struct RTSPServer(Object); match fn { get_type => || ffi::gst_rtsp_server_get_type(), } } impl RTSPServer { pub fn new() -> RTSPServer { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gst_rtsp_server_new()) } } pub fn io_func>(socket: &gio::Socket, condition: glib::IOCondition, server: &P) -> bool { skip_assert_initialized!(); unsafe { from_glib(ffi::gst_rtsp_server_io_func(socket.to_glib_none().0, condition.to_glib(), server.to_glib_none().0)) } } } impl Default for RTSPServer { fn default() -> Self { Self::new() } } unsafe impl Send for RTSPServer {} unsafe impl Sync for RTSPServer {} pub trait RTSPServerExt { //fn client_filter<'a, P: Into>, Q: Into>>(&self, func: P, user_data: Q) -> Vec; fn create_socket<'a, P: Into>>(&self, cancellable: P) -> Result; fn create_source<'a, P: Into>>(&self, cancellable: P) -> Result; fn get_address(&self) -> Option; fn get_auth(&self) -> Option; fn get_backlog(&self) -> i32; fn get_bound_port(&self) -> i32; fn get_mount_points(&self) -> Option; fn get_service(&self) -> Option; fn get_session_pool(&self) -> Option; fn get_thread_pool(&self) -> Option; fn set_address(&self, address: &str); fn set_auth<'a, P: Into>>(&self, auth: P); fn set_backlog(&self, backlog: i32); fn set_mount_points<'a, P: Into>>(&self, mounts: P); fn set_service(&self, service: &str); fn set_session_pool<'a, P: Into>>(&self, pool: P); fn set_thread_pool<'a, P: Into>>(&self, pool: P); fn transfer_connection<'a, P: Into>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool; fn connect_client_connected(&self, f: F) -> SignalHandlerId; fn connect_property_address_notify(&self, f: F) -> SignalHandlerId; fn connect_property_backlog_notify(&self, f: F) -> SignalHandlerId; fn connect_property_bound_port_notify(&self, f: F) -> SignalHandlerId; fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId; fn connect_property_service_notify(&self, f: F) -> SignalHandlerId; fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId; } impl + IsA> RTSPServerExt for O { //fn client_filter<'a, P: Into>, Q: Into>>(&self, func: P, user_data: Q) -> Vec { // unsafe { TODO: call ffi::gst_rtsp_server_client_filter() } //} fn create_socket<'a, P: Into>>(&self, cancellable: P) -> Result { let cancellable = cancellable.into(); let cancellable = cancellable.to_glib_none(); unsafe { let mut error = ptr::null_mut(); let ret = ffi::gst_rtsp_server_create_socket(self.to_glib_none().0, cancellable.0, &mut error); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } fn create_source<'a, P: Into>>(&self, cancellable: P) -> Result { let cancellable = cancellable.into(); let cancellable = cancellable.to_glib_none(); unsafe { let mut error = ptr::null_mut(); let ret = ffi::gst_rtsp_server_create_source(self.to_glib_none().0, cancellable.0, &mut error); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } fn get_address(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_address(self.to_glib_none().0)) } } fn get_auth(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_auth(self.to_glib_none().0)) } } fn get_backlog(&self) -> i32 { unsafe { ffi::gst_rtsp_server_get_backlog(self.to_glib_none().0) } } fn get_bound_port(&self) -> i32 { unsafe { ffi::gst_rtsp_server_get_bound_port(self.to_glib_none().0) } } fn get_mount_points(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_mount_points(self.to_glib_none().0)) } } fn get_service(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_service(self.to_glib_none().0)) } } fn get_session_pool(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_session_pool(self.to_glib_none().0)) } } fn get_thread_pool(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_thread_pool(self.to_glib_none().0)) } } fn set_address(&self, address: &str) { unsafe { ffi::gst_rtsp_server_set_address(self.to_glib_none().0, address.to_glib_none().0); } } fn set_auth<'a, P: Into>>(&self, auth: P) { let auth = auth.into(); let auth = auth.to_glib_none(); unsafe { ffi::gst_rtsp_server_set_auth(self.to_glib_none().0, auth.0); } } fn set_backlog(&self, backlog: i32) { unsafe { ffi::gst_rtsp_server_set_backlog(self.to_glib_none().0, backlog); } } fn set_mount_points<'a, P: Into>>(&self, mounts: P) { let mounts = mounts.into(); let mounts = mounts.to_glib_none(); unsafe { ffi::gst_rtsp_server_set_mount_points(self.to_glib_none().0, mounts.0); } } fn set_service(&self, service: &str) { unsafe { ffi::gst_rtsp_server_set_service(self.to_glib_none().0, service.to_glib_none().0); } } fn set_session_pool<'a, P: Into>>(&self, pool: P) { let pool = pool.into(); let pool = pool.to_glib_none(); unsafe { ffi::gst_rtsp_server_set_session_pool(self.to_glib_none().0, pool.0); } } fn set_thread_pool<'a, P: Into>>(&self, pool: P) { let pool = pool.into(); let pool = pool.to_glib_none(); unsafe { ffi::gst_rtsp_server_set_thread_pool(self.to_glib_none().0, pool.0); } } fn transfer_connection<'a, P: Into>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool { let initial_buffer = initial_buffer.into(); let initial_buffer = initial_buffer.to_glib_none(); unsafe { from_glib(ffi::gst_rtsp_server_transfer_connection(self.to_glib_none().0, socket.to_glib_full(), ip.to_glib_none().0, port, initial_buffer.0)) } } fn connect_client_connected(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "client-connected", transmute(client_connected_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } fn connect_property_address_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "notify::address", transmute(notify_address_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } fn connect_property_backlog_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "notify::backlog", transmute(notify_backlog_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } fn connect_property_bound_port_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "notify::bound-port", transmute(notify_bound_port_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "notify::mount-points", transmute(notify_mount_points_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } fn connect_property_service_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "notify::service", transmute(notify_service_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_> = Box_::new(Box_::new(f)); connect(self.to_glib_none().0, "notify::session-pool", transmute(notify_session_pool_trampoline:: as usize), Box_::into_raw(f) as *mut _) } } } unsafe extern "C" fn client_connected_trampoline

(this: *mut ffi::GstRTSPServer, object: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); let f: &&(Fn(&P, &RTSPClient) + Send + Sync + 'static) = transmute(f); f(&RTSPServer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) } unsafe extern "C" fn notify_address_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) } unsafe extern "C" fn notify_backlog_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) } unsafe extern "C" fn notify_bound_port_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) } unsafe extern "C" fn notify_mount_points_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) } unsafe extern "C" fn notify_service_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) } unsafe extern "C" fn notify_session_pool_trampoline

(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) }