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 > ;
//fn filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPSessionPoolFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession>;
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
}
}
//fn filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPSessionPoolFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession> {
// 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 {
let f : Box_ < Box_ < Fn ( & Self , & RTSPSession ) + Send + Sync + 'static > > = Box_ ::new ( 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 _ ,
2018-02-09 02:30:08 +00:00
transmute ( session_removed_trampoline ::< Self > as usize ) , Box_ ::into_raw ( f ) as * mut _ )
}
}
fn connect_property_max_sessions_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
unsafe {
let f : Box_ < Box_ < Fn ( & Self ) + Send + Sync + 'static > > = Box_ ::new ( 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 _ ,
2018-02-09 02:30:08 +00:00
transmute ( notify_max_sessions_trampoline ::< Self > as usize ) , Box_ ::into_raw ( f ) as * mut _ )
}
}
}
unsafe extern " C " fn session_removed_trampoline < P > ( this : * mut ffi ::GstRTSPSessionPool , object : * mut ffi ::GstRTSPSession , f : glib_ffi ::gpointer )
where P : IsA < RTSPSessionPool > {
let f : & & ( Fn ( & P , & RTSPSession ) + Send + Sync + 'static ) = 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
}
unsafe extern " C " fn notify_max_sessions_trampoline < P > ( this : * mut ffi ::GstRTSPSessionPool , _param_spec : glib_ffi ::gpointer , f : glib_ffi ::gpointer )
where P : IsA < RTSPSessionPool > {
let f : & & ( Fn ( & P ) + Send + Sync + 'static ) = 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
}