Commit b4d5c988 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add bindings for GstRTSPContext

This enables most of the signals of GstRTSPClient
parent a00243d5
......@@ -83,6 +83,11 @@ name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "GstRtspServer.RTSPContext"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.ClockTime"
status = "manual"
......
......@@ -52,7 +52,7 @@ unsafe impl Sync for RTSPThreadPool {}
pub trait RTSPThreadPoolExt {
fn get_max_threads(&self) -> i32;
//fn get_thread(&self, type_: RTSPThreadType, ctx: /*Ignored*/&mut RTSPContext) -> /*Ignored*/Option<RTSPThread>;
//fn get_thread(&self, type_: RTSPThreadType, ctx: &RTSPContext) -> /*Ignored*/Option<RTSPThread>;
fn set_max_threads(&self, max_threads: i32);
......@@ -66,7 +66,7 @@ impl<O: IsA<RTSPThreadPool> + IsA<glib::object::Object>> RTSPThreadPoolExt for O
}
}
//fn get_thread(&self, type_: RTSPThreadType, ctx: /*Ignored*/&mut RTSPContext) -> /*Ignored*/Option<RTSPThread> {
//fn get_thread(&self, type_: RTSPThreadType, ctx: &RTSPContext) -> /*Ignored*/Option<RTSPThread> {
// unsafe { TODO: call ffi::gst_rtsp_thread_pool_get_thread() }
//}
......
......@@ -56,12 +56,15 @@ mod r_t_s_p_server;
mod r_t_s_p_address_pool;
mod r_t_s_p_client;
mod r_t_s_p_session_pool;
mod r_t_s_p_context;
pub use r_t_s_p_server::RTSPServerExtManual;
pub use r_t_s_p_address_pool::RTSPAddressPoolExtManual;
pub use r_t_s_p_client::RTSPClientExtManual;
pub use r_t_s_p_session_pool::RTSPSessionPoolExtManual;
pub use r_t_s_p_context::*;
// Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts
pub mod prelude {
......
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use glib;
#[derive(PartialEq, Eq)]
pub struct RTSPContext(*mut ffi::GstRTSPContext);
impl RTSPContext {
pub fn with_current_context<F: FnOnce(&RTSPContext) -> T, T>(func: F) -> Option<T> {
unsafe {
let ptr = ffi::gst_rtsp_context_get_current();
if ptr.is_null() {
return None;
}
let ctx = RTSPContext(ptr);
Some(func(&ctx))
}
}
// TODO: Add various getters for all the contained fields as needed
}
#[doc(hidden)]
impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext {
#[inline]
unsafe fn from_glib_borrow(ptr: *mut ffi::GstRTSPContext) -> Self {
RTSPContext(ptr)
}
}
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