2020-12-15 10:53:31 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
|
|
|
|
2018-02-09 02:30:08 +00:00
|
|
|
use std::ptr;
|
|
|
|
|
2023-01-03 18:58:25 +00:00
|
|
|
use glib::{prelude::*, translate::*};
|
|
|
|
|
2024-06-02 08:48:53 +00:00
|
|
|
use crate::{ffi, RTSPAddress, RTSPAddressPool, RTSPAddressPoolResult};
|
2023-01-03 18:58:25 +00:00
|
|
|
|
2024-10-19 15:09:56 +00:00
|
|
|
pub trait RTSPAddressPoolExtManual: IsA<RTSPAddressPool> + 'static {
|
2023-07-05 20:21:43 +00:00
|
|
|
#[doc(alias = "gst_rtsp_address_pool_reserve_address")]
|
2018-02-22 10:18:37 +00:00
|
|
|
fn reserve_address(
|
|
|
|
&self,
|
|
|
|
ip_address: &str,
|
|
|
|
port: u32,
|
|
|
|
n_ports: u32,
|
|
|
|
ttl: u32,
|
|
|
|
) -> Result<RTSPAddress, RTSPAddressPoolResult> {
|
2018-02-09 02:30:08 +00:00
|
|
|
unsafe {
|
|
|
|
let mut address = ptr::null_mut();
|
2020-11-22 10:45:51 +00:00
|
|
|
let ret = from_glib(ffi::gst_rtsp_address_pool_reserve_address(
|
2019-01-16 11:32:58 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
2018-02-22 10:18:37 +00:00
|
|
|
ip_address.to_glib_none().0,
|
|
|
|
port,
|
|
|
|
n_ports,
|
|
|
|
ttl,
|
|
|
|
&mut address,
|
|
|
|
));
|
2018-02-09 02:30:08 +00:00
|
|
|
match ret {
|
|
|
|
RTSPAddressPoolResult::Ok => Ok(from_glib_full(address)),
|
2018-02-22 10:18:37 +00:00
|
|
|
_ => Err(ret),
|
2018-02-09 02:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-05 20:21:43 +00:00
|
|
|
|
|
|
|
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {}
|