gstreamer-rs/gstreamer-rtsp-server/src/auto/r_t_s_p_address_pool.rs
Mathieu Duponchelle a00243d529 Add initial libgstsdp, libgstrtsp and libgstrtspserver bindings
Only automatic bindings for now, which is enough to allow
implementing a simple rtsp-server example.

Depends on https://github.com/sdroege/gstreamer-sys/pull/8

Uses a new gir feature proposed at
https://github.com/gtk-rs/gir/pull/539 to make doc regeneration
easier.

Fixes https://github.com/sdroege/gstreamer-rs/pull/80
2018-02-14 18:57:58 +02:00

85 lines
2.3 KiB
Rust

// This file was generated by gir (https://github.com/gtk-rs/gir @ 47eb915)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
use RTSPAddress;
use RTSPAddressFlags;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct RTSPAddressPool(Object<ffi::GstRTSPAddressPool, ffi::GstRTSPAddressPoolClass>);
match fn {
get_type => || ffi::gst_rtsp_address_pool_get_type(),
}
}
impl RTSPAddressPool {
pub fn new() -> RTSPAddressPool {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::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 trait RTSPAddressPoolExt {
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 {
from_glib_full(ffi::gst_rtsp_address_pool_acquire_address(self.to_glib_none().0, flags.to_glib(), n_ports))
}
}
fn add_range(&self, min_address: &str, max_address: &str, min_port: u16, max_port: u16, ttl: u8) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_rtsp_address_pool_add_range(self.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 {
ffi::gst_rtsp_address_pool_clear(self.to_glib_none().0);
}
}
fn dump(&self) {
unsafe {
ffi::gst_rtsp_address_pool_dump(self.to_glib_none().0);
}
}
fn has_unicast_addresses(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_address_pool_has_unicast_addresses(self.to_glib_none().0))
}
}
}