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 RTSPAddress ;
use RTSPAddressFlags ;
use glib ;
use glib ::object ::IsA ;
use glib ::translate ::* ;
2019-03-19 07:40:05 +00:00
use gst_rtsp_server_sys ;
2018-02-09 02:30:08 +00:00
glib_wrapper! {
2019-03-19 07:40:05 +00:00
pub struct RTSPAddressPool ( Object < gst_rtsp_server_sys ::GstRTSPAddressPool , gst_rtsp_server_sys ::GstRTSPAddressPoolClass , RTSPAddressPoolClass > ) ;
2018-02-09 02:30:08 +00:00
match fn {
2019-03-19 07:40:05 +00:00
get_type = > | | gst_rtsp_server_sys ::gst_rtsp_address_pool_get_type ( ) ,
2018-02-09 02:30:08 +00:00
}
}
impl RTSPAddressPool {
pub fn new ( ) -> RTSPAddressPool {
assert_initialized_main_thread! ( ) ;
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_rtsp_server_sys ::gst_rtsp_address_pool_new ( ) )
2018-02-09 02:30:08 +00:00
}
}
}
impl Default for RTSPAddressPool {
fn default ( ) -> Self {
Self ::new ( )
}
}
unsafe impl Send for RTSPAddressPool { }
unsafe impl Sync for RTSPAddressPool { }
2019-01-16 11:32:39 +00:00
pub const NONE_RTSP_ADDRESS_POOL : Option < & RTSPAddressPool > = None ;
2018-12-08 09:05:20 +00:00
pub trait RTSPAddressPoolExt : 'static {
2018-02-09 02:30:08 +00:00
fn acquire_address ( & self , flags : RTSPAddressFlags , n_ports : i32 ) -> Option < RTSPAddress > ;
fn add_range ( & self , min_address : & str , max_address : & str , min_port : u16 , max_port : u16 , ttl : u8 ) -> Result < ( ) , glib ::error ::BoolError > ;
fn clear ( & self ) ;
fn dump ( & self ) ;
fn has_unicast_addresses ( & self ) -> bool ;
}
impl < O : IsA < RTSPAddressPool > > RTSPAddressPoolExt for O {
fn acquire_address ( & self , flags : RTSPAddressFlags , n_ports : i32 ) -> Option < RTSPAddress > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_rtsp_server_sys ::gst_rtsp_address_pool_acquire_address ( self . as_ref ( ) . to_glib_none ( ) . 0 , flags . to_glib ( ) , n_ports ) )
2018-02-09 02:30:08 +00:00
}
}
fn add_range ( & self , min_address : & str , max_address : & str , min_port : u16 , max_port : u16 , ttl : u8 ) -> Result < ( ) , glib ::error ::BoolError > {
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_rtsp_server_sys ::gst_rtsp_address_pool_add_range ( self . as_ref ( ) . to_glib_none ( ) . 0 , min_address . to_glib_none ( ) . 0 , max_address . to_glib_none ( ) . 0 , min_port , max_port , ttl ) , " Failed to add address range " )
2018-02-09 02:30:08 +00:00
}
}
fn clear ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_rtsp_server_sys ::gst_rtsp_address_pool_clear ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2018-02-09 02:30:08 +00:00
}
}
fn dump ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_rtsp_server_sys ::gst_rtsp_address_pool_dump ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2018-02-09 02:30:08 +00:00
}
}
fn has_unicast_addresses ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_rtsp_server_sys ::gst_rtsp_address_pool_has_unicast_addresses ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2018-02-09 02:30:08 +00:00
}
}
}