Commit 9448f1cc authored by Mathieu Duponchelle's avatar Mathieu Duponchelle 🐸 Committed by Sebastian Dröge

Manual bindings for RTSPToken

parent a3b294f0
......@@ -91,6 +91,11 @@ name = "GstRtspServer.RTSPContext"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstRtspServer.RTSPToken"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.ClockTime"
status = "manual"
......@@ -237,12 +242,3 @@ status="generate"
name = "set_default_token"
# gir forgets mut
ignore = true
[[object]]
name="GstRtspServer.RTSPToken"
status = "generate"
concurrency = "none"
[[object.function]]
name = "writable_structure"
# mutable ref
ignore = true
......@@ -61,9 +61,6 @@ pub use self::r_t_s_p_thread_pool::RTSPThreadPoolExt;
mod r_t_s_p_address;
pub use self::r_t_s_p_address::RTSPAddress;
mod r_t_s_p_token;
pub use self::r_t_s_p_token::RTSPToken;
mod enums;
pub use self::enums::RTSPAddressPoolResult;
pub use self::enums::RTSPMediaStatus;
......
......@@ -62,10 +62,10 @@ unsafe impl Send for RTSPAuth {}
unsafe impl Sync for RTSPAuth {}
pub trait RTSPAuthExt {
fn add_basic(&self, basic: &str, token: &mut RTSPToken);
fn add_basic(&self, basic: &str, token: &RTSPToken);
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn add_digest(&self, user: &str, pass: &str, token: &mut RTSPToken);
fn add_digest(&self, user: &str, pass: &str, token: &RTSPToken);
fn get_default_token(&self) -> Option<RTSPToken>;
......@@ -96,16 +96,16 @@ pub trait RTSPAuthExt {
}
impl<O: IsA<RTSPAuth> + IsA<glib::object::Object>> RTSPAuthExt for O {
fn add_basic(&self, basic: &str, token: &mut RTSPToken) {
fn add_basic(&self, basic: &str, token: &RTSPToken) {
unsafe {
ffi::gst_rtsp_auth_add_basic(self.to_glib_none().0, basic.to_glib_none().0, token.to_glib_none_mut().0);
ffi::gst_rtsp_auth_add_basic(self.to_glib_none().0, basic.to_glib_none().0, token.to_glib_none().0);
}
}
#[cfg(any(feature = "v1_12", feature = "dox"))]
fn add_digest(&self, user: &str, pass: &str, token: &mut RTSPToken) {
fn add_digest(&self, user: &str, pass: &str, token: &RTSPToken) {
unsafe {
ffi::gst_rtsp_auth_add_digest(self.to_glib_none().0, user.to_glib_none().0, pass.to_glib_none().0, token.to_glib_none_mut().0);
ffi::gst_rtsp_auth_add_digest(self.to_glib_none().0, user.to_glib_none().0, pass.to_glib_none().0, token.to_glib_none().0);
}
}
......
......@@ -99,4 +99,5 @@ pub mod prelude {
pub use r_t_s_p_client::RTSPClientExtManual;
pub use r_t_s_p_session_pool::RTSPSessionPoolExtManual;
pub use r_t_s_p_auth::RTSPAuthExtManual;
pub use r_t_s_p_token::GstRcRTSPTokenExt;
}
use RTSPToken;
use glib::value::ToSendValue;
use gst;
use ffi;
use gst_ffi;
use gst;
use glib;
use glib::StaticType;
use glib::value::ToSendValue;
use glib::translate::*;
impl RTSPToken {
pub fn new(values: &[(&str, &ToSendValue)]) -> RTSPToken {
let mut token = RTSPToken::new_empty();
use gst::miniobject::{MiniObject, GstRc};
pub trait GstRcRTSPTokenExt<T: MiniObject> {
fn new_empty() -> Self;
fn new(values: &[(&str, &ToSendValue)]) -> Self;
}
pub type RTSPToken = GstRc<RTSPTokenRef>;
pub struct RTSPTokenRef(ffi::GstRTSPToken);
unsafe impl MiniObject for RTSPTokenRef {
type GstType = ffi::GstRTSPToken;
}
impl GstRcRTSPTokenExt<RTSPTokenRef> for GstRc<RTSPTokenRef> {
fn new_empty() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_rtsp_token_new_empty()) }
}
fn new(values: &[(&str, &ToSendValue)]) -> Self {
let token = RTSPToken::new_empty();
{
let structure = token.writable_structure().unwrap();
......@@ -18,10 +39,30 @@ impl RTSPToken {
token
}
}
impl RTSPTokenRef {
pub fn get_string(&self, field: &str) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_rtsp_token_get_string(self.as_mut_ptr(), field.to_glib_none().0))
}
}
pub fn get_structure(&self) -> Option<gst::Structure> {
unsafe {
from_glib_none(ffi::gst_rtsp_token_get_structure(self.as_mut_ptr()))
}
}
pub fn is_allowed(&self, field: &str) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_token_is_allowed(self.as_mut_ptr(), field.to_glib_none().0))
}
}
pub fn writable_structure(&mut self) -> Option<&mut gst::StructureRef> {
pub fn writable_structure(&self) -> Option<&mut gst::StructureRef> {
unsafe {
let structure = ffi::gst_rtsp_token_writable_structure(self.to_glib_none_mut().0);
let structure = ffi::gst_rtsp_token_writable_structure(self.as_mut_ptr());
if structure.is_null() {
None
} else {
......@@ -30,3 +71,17 @@ impl RTSPToken {
}
}
}
impl ToOwned for RTSPTokenRef {
type Owned = GstRc<RTSPTokenRef>;
fn to_owned(&self) -> GstRc<RTSPTokenRef> {
unsafe { from_glib_full(gst_ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
}
}
impl StaticType for RTSPTokenRef {
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_rtsp_token_get_type()) }
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment