// This file was generated by gir (https://github.com/gtk-rs/gir) // 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::GString; use glib::object::Cast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib::signal::connect_raw; use glib::translate::*; use glib_ffi; use std::boxed::Box as Box_; 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, Q: IsA>(socket: &P, condition: glib::IOCondition, server: &Q) -> Result<(), glib::error::BoolError> { skip_assert_initialized!(); unsafe { glib_result_from_gboolean!(ffi::gst_rtsp_server_io_func(socket.as_ref().to_glib_none().0, condition.to_glib(), server.as_ref().to_glib_none().0), "Failed to connect the source") } } } impl Default for RTSPServer { fn default() -> Self { Self::new() } } unsafe impl Send for RTSPServer {} unsafe impl Sync for RTSPServer {} pub const NONE_RTSP_SERVER: Option<&RTSPServer> = None; pub trait RTSPServerExt: 'static { //fn client_filter(&self, func: /*Unimplemented*/Fn(&RTSPServer, &RTSPClient) -> /*Ignored*/RTSPFilterResult, user_data: /*Unimplemented*/Option) -> Vec; fn create_socket<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> Result; fn create_source<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> 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: IsA + 'a, Q: Into>>(&self, auth: Q); fn set_backlog(&self, backlog: i32); fn set_mount_points<'a, P: IsA + 'a, Q: Into>>(&self, mounts: Q); fn set_service(&self, service: &str); fn set_session_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); fn set_thread_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q); fn transfer_connection<'a, P: IsA, Q: Into>>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Q) -> Result<(), glib::error::BoolError>; 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> RTSPServerExt for O { //fn client_filter(&self, func: /*Unimplemented*/Fn(&RTSPServer, &RTSPClient) -> /*Ignored*/RTSPFilterResult, user_data: /*Unimplemented*/Option) -> Vec { // unsafe { TODO: call ffi::gst_rtsp_server_client_filter() } //} fn create_socket<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> Result { let cancellable = cancellable.into(); unsafe { let mut error = ptr::null_mut(); let ret = ffi::gst_rtsp_server_create_socket(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } fn create_source<'a, P: IsA + 'a, Q: Into>>(&self, cancellable: Q) -> Result { let cancellable = cancellable.into(); unsafe { let mut error = ptr::null_mut(); let ret = ffi::gst_rtsp_server_create_source(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().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.as_ref().to_glib_none().0)) } } fn get_auth(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_auth(self.as_ref().to_glib_none().0)) } } fn get_backlog(&self) -> i32 { unsafe { ffi::gst_rtsp_server_get_backlog(self.as_ref().to_glib_none().0) } } fn get_bound_port(&self) -> i32 { unsafe { ffi::gst_rtsp_server_get_bound_port(self.as_ref().to_glib_none().0) } } fn get_mount_points(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_mount_points(self.as_ref().to_glib_none().0)) } } fn get_service(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_service(self.as_ref().to_glib_none().0)) } } fn get_session_pool(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_session_pool(self.as_ref().to_glib_none().0)) } } fn get_thread_pool(&self) -> Option { unsafe { from_glib_full(ffi::gst_rtsp_server_get_thread_pool(self.as_ref().to_glib_none().0)) } } fn set_address(&self, address: &str) { unsafe { ffi::gst_rtsp_server_set_address(self.as_ref().to_glib_none().0, address.to_glib_none().0); } } fn set_auth<'a, P: IsA + 'a, Q: Into>>(&self, auth: Q) { let auth = auth.into(); unsafe { ffi::gst_rtsp_server_set_auth(self.as_ref().to_glib_none().0, auth.map(|p| p.as_ref()).to_glib_none().0); } } fn set_backlog(&self, backlog: i32) { unsafe { ffi::gst_rtsp_server_set_backlog(self.as_ref().to_glib_none().0, backlog); } } fn set_mount_points<'a, P: IsA + 'a, Q: Into>>(&self, mounts: Q) { let mounts = mounts.into(); unsafe { ffi::gst_rtsp_server_set_mount_points(self.as_ref().to_glib_none().0, mounts.map(|p| p.as_ref()).to_glib_none().0); } } fn set_service(&self, service: &str) { unsafe { ffi::gst_rtsp_server_set_service(self.as_ref().to_glib_none().0, service.to_glib_none().0); } } fn set_session_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); unsafe { ffi::gst_rtsp_server_set_session_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); } } fn set_thread_pool<'a, P: IsA + 'a, Q: Into>>(&self, pool: Q) { let pool = pool.into(); unsafe { ffi::gst_rtsp_server_set_thread_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0); } } fn transfer_connection<'a, P: IsA, Q: Into>>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Q) -> Result<(), glib::error::BoolError> { let initial_buffer = initial_buffer.into(); unsafe { glib_result_from_gboolean!(ffi::gst_rtsp_server_transfer_connection(self.as_ref().to_glib_none().0, socket.as_ref().to_glib_full(), ip.to_glib_none().0, port, initial_buffer.to_glib_none().0), "Failed to transfer to the connection") } } fn connect_client_connected(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"client-connected\0".as_ptr() as *const _, Some(transmute(client_connected_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_address_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::address\0".as_ptr() as *const _, Some(transmute(notify_address_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_backlog_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::backlog\0".as_ptr() as *const _, Some(transmute(notify_backlog_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_bound_port_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::bound-port\0".as_ptr() as *const _, Some(transmute(notify_bound_port_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_mount_points_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::mount-points\0".as_ptr() as *const _, Some(transmute(notify_mount_points_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_service_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::service\0".as_ptr() as *const _, Some(transmute(notify_service_trampoline:: as usize)), Box_::into_raw(f)) } } fn connect_property_session_pool_notify(&self, f: F) -> SignalHandlerId { unsafe { let f: Box_ = Box_::new(f); connect_raw(self.as_ptr() as *mut _, b"notify::session-pool\0".as_ptr() as *const _, Some(transmute(notify_session_pool_trampoline:: as usize)), Box_::into_raw(f)) } } } unsafe extern "C" fn client_connected_trampoline(this: *mut ffi::GstRTSPServer, object: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer) where P: IsA { let f: &F = transmute(f); f(&RTSPServer::from_glib_borrow(this).unsafe_cast(), &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 { let f: &F = transmute(f); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_backlog_trampoline(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &F = transmute(f); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_bound_port_trampoline(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &F = transmute(f); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_mount_points_trampoline(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &F = transmute(f); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_service_trampoline(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &F = transmute(f); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) } unsafe extern "C" fn notify_session_pool_trampoline(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { let f: &F = transmute(f); f(&RTSPServer::from_glib_borrow(this).unsafe_cast()) }