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 RTSPSession ;
use ffi ;
use glib ;
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 RTSPSessionPool ( Object < ffi ::GstRTSPSessionPool , ffi ::GstRTSPSessionPoolClass , RTSPSessionPoolClass > ) ;
2018-02-09 02:30:08 +00:00
match fn {
get_type = > | | ffi ::gst_rtsp_session_pool_get_type ( ) ,
}
}
impl RTSPSessionPool {
pub fn new ( ) -> RTSPSessionPool {
assert_initialized_main_thread! ( ) ;
unsafe {
from_glib_full ( ffi ::gst_rtsp_session_pool_new ( ) )
}
}
}
impl Default for RTSPSessionPool {
fn default ( ) -> Self {
Self ::new ( )
}
}
unsafe impl Send for RTSPSessionPool { }
unsafe impl Sync for RTSPSessionPool { }
2019-01-16 11:32:39 +00:00
pub const NONE_RTSP_SESSION_POOL : Option < & RTSPSessionPool > = None ;
2018-12-08 09:05:20 +00:00
pub trait RTSPSessionPoolExt : 'static {
2018-02-09 02:30:08 +00:00
fn cleanup ( & self ) -> u32 ;
fn create ( & self ) -> Option < RTSPSession > ;
2019-01-29 13:53:44 +00:00
//fn filter(&self, func: /*Unimplemented*/Fn(&RTSPSessionPool, &RTSPSession) -> /*Ignored*/RTSPFilterResult, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Vec<RTSPSession>;
2018-02-09 02:30:08 +00:00
fn find ( & self , sessionid : & str ) -> Option < RTSPSession > ;
fn get_max_sessions ( & self ) -> u32 ;
fn get_n_sessions ( & self ) -> u32 ;
2019-01-16 11:32:39 +00:00
fn remove < P : IsA < RTSPSession > > ( & self , sess : & P ) -> Result < ( ) , glib ::error ::BoolError > ;
2018-02-09 02:30:08 +00:00
fn set_max_sessions ( & self , max : u32 ) ;
fn connect_session_removed < F : Fn ( & Self , & RTSPSession ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId ;
fn connect_property_max_sessions_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId ;
}
2018-12-08 09:05:20 +00:00
impl < O : IsA < RTSPSessionPool > > RTSPSessionPoolExt for O {
2018-02-09 02:30:08 +00:00
fn cleanup ( & self ) -> u32 {
unsafe {
2019-01-16 11:32:39 +00:00
ffi ::gst_rtsp_session_pool_cleanup ( self . as_ref ( ) . to_glib_none ( ) . 0 )
2018-02-09 02:30:08 +00:00
}
}
fn create ( & self ) -> Option < RTSPSession > {
unsafe {
2019-01-16 11:32:39 +00:00
from_glib_full ( ffi ::gst_rtsp_session_pool_create ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2018-02-09 02:30:08 +00:00
}
}
2019-01-29 13:53:44 +00:00
//fn filter(&self, func: /*Unimplemented*/Fn(&RTSPSessionPool, &RTSPSession) -> /*Ignored*/RTSPFilterResult, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Vec<RTSPSession> {
2018-02-09 02:30:08 +00:00
// unsafe { TODO: call ffi::gst_rtsp_session_pool_filter() }
//}
fn find ( & self , sessionid : & str ) -> Option < RTSPSession > {
unsafe {
2019-01-16 11:32:39 +00:00
from_glib_full ( ffi ::gst_rtsp_session_pool_find ( self . as_ref ( ) . to_glib_none ( ) . 0 , sessionid . to_glib_none ( ) . 0 ) )
2018-02-09 02:30:08 +00:00
}
}
fn get_max_sessions ( & self ) -> u32 {
unsafe {
2019-01-16 11:32:39 +00:00
ffi ::gst_rtsp_session_pool_get_max_sessions ( self . as_ref ( ) . to_glib_none ( ) . 0 )
2018-02-09 02:30:08 +00:00
}
}
fn get_n_sessions ( & self ) -> u32 {
unsafe {
2019-01-16 11:32:39 +00:00
ffi ::gst_rtsp_session_pool_get_n_sessions ( self . as_ref ( ) . to_glib_none ( ) . 0 )
2018-02-09 02:30:08 +00:00
}
}
2019-01-16 11:32:39 +00:00
fn remove < P : IsA < RTSPSession > > ( & self , sess : & P ) -> Result < ( ) , glib ::error ::BoolError > {
2018-02-09 02:30:08 +00:00
unsafe {
2019-01-16 11:32:39 +00:00
glib_result_from_gboolean! ( ffi ::gst_rtsp_session_pool_remove ( self . as_ref ( ) . to_glib_none ( ) . 0 , sess . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to remove session from pool " )
2018-02-09 02:30:08 +00:00
}
}
fn set_max_sessions ( & self , max : u32 ) {
unsafe {
2019-01-16 11:32:39 +00:00
ffi ::gst_rtsp_session_pool_set_max_sessions ( self . as_ref ( ) . to_glib_none ( ) . 0 , max ) ;
2018-02-09 02:30:08 +00:00
}
}
fn connect_session_removed < F : Fn ( & Self , & RTSPSession ) + 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 " session-removed \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( session_removed_trampoline ::< Self , F > as usize ) ) , Box_ ::into_raw ( f ) )
2018-02-09 02:30:08 +00:00
}
}
fn connect_property_max_sessions_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-sessions \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( notify_max_sessions_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 session_removed_trampoline < P , F : Fn ( & P , & RTSPSession ) + Send + Sync + 'static > ( this : * mut ffi ::GstRTSPSessionPool , object : * mut ffi ::GstRTSPSession , f : glib_ffi ::gpointer )
2018-02-09 02:30:08 +00:00
where P : IsA < RTSPSessionPool > {
2019-01-29 13:53:44 +00:00
let f : & F = transmute ( f ) ;
2019-01-16 11:32:39 +00:00
f ( & RTSPSessionPool ::from_glib_borrow ( this ) . unsafe_cast ( ) , & from_glib_borrow ( object ) )
2018-02-09 02:30:08 +00:00
}
2019-01-29 13:53:44 +00:00
unsafe extern " C " fn notify_max_sessions_trampoline < P , F : Fn ( & P ) + Send + Sync + 'static > ( this : * mut ffi ::GstRTSPSessionPool , _param_spec : glib_ffi ::gpointer , f : glib_ffi ::gpointer )
2018-02-09 02:30:08 +00:00
where P : IsA < RTSPSessionPool > {
2019-01-29 13:53:44 +00:00
let f : & F = transmute ( f ) ;
2019-01-16 11:32:39 +00:00
f ( & RTSPSessionPool ::from_glib_borrow ( this ) . unsafe_cast ( ) )
2018-02-09 02:30:08 +00:00
}