mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-05-20 09:18:28 +00:00
122 lines
3.1 KiB
Rust
122 lines
3.1 KiB
Rust
// 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 glib;
|
|
use glib::object::IsA;
|
|
use glib::translate::*;
|
|
use gst_rtsp_server_sys;
|
|
use RTSPAddress;
|
|
use RTSPAddressFlags;
|
|
|
|
glib_wrapper! {
|
|
pub struct RTSPAddressPool(Object<gst_rtsp_server_sys::GstRTSPAddressPool, gst_rtsp_server_sys::GstRTSPAddressPoolClass, RTSPAddressPoolClass>);
|
|
|
|
match fn {
|
|
get_type => || gst_rtsp_server_sys::gst_rtsp_address_pool_get_type(),
|
|
}
|
|
}
|
|
|
|
impl RTSPAddressPool {
|
|
pub fn new() -> RTSPAddressPool {
|
|
assert_initialized_main_thread!();
|
|
unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_address_pool_new()) }
|
|
}
|
|
}
|
|
|
|
impl Default for RTSPAddressPool {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
unsafe impl Send for RTSPAddressPool {}
|
|
unsafe impl Sync for RTSPAddressPool {}
|
|
|
|
pub const NONE_RTSP_ADDRESS_POOL: Option<&RTSPAddressPool> = None;
|
|
|
|
pub trait RTSPAddressPoolExt: 'static {
|
|
fn acquire_address(
|
|
&self,
|
|
flags: RTSPAddressFlags,
|
|
n_ports: i32,
|
|
) -> Result<RTSPAddress, glib::BoolError>;
|
|
|
|
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,
|
|
) -> Result<RTSPAddress, glib::BoolError> {
|
|
unsafe {
|
|
Option::<_>::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,
|
|
))
|
|
.ok_or_else(|| glib_bool_error!("Failed to acquire address"))
|
|
}
|
|
}
|
|
|
|
fn add_range(
|
|
&self,
|
|
min_address: &str,
|
|
max_address: &str,
|
|
min_port: u16,
|
|
max_port: u16,
|
|
ttl: u8,
|
|
) -> Result<(), glib::error::BoolError> {
|
|
unsafe {
|
|
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"
|
|
)
|
|
}
|
|
}
|
|
|
|
fn clear(&self) {
|
|
unsafe {
|
|
gst_rtsp_server_sys::gst_rtsp_address_pool_clear(self.as_ref().to_glib_none().0);
|
|
}
|
|
}
|
|
|
|
fn dump(&self) {
|
|
unsafe {
|
|
gst_rtsp_server_sys::gst_rtsp_address_pool_dump(self.as_ref().to_glib_none().0);
|
|
}
|
|
}
|
|
|
|
fn has_unicast_addresses(&self) -> bool {
|
|
unsafe {
|
|
from_glib(
|
|
gst_rtsp_server_sys::gst_rtsp_address_pool_has_unicast_addresses(
|
|
self.as_ref().to_glib_none().0,
|
|
),
|
|
)
|
|
}
|
|
}
|
|
}
|