mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
Properly implement gst_rtsp_server::RTSPToken bindings
We can now properly implement miniobject bindings outside the main trait.
This commit is contained in:
parent
2778f9c3fb
commit
1a53983b3b
2 changed files with 14 additions and 31 deletions
|
@ -19,6 +19,7 @@ use std::ffi::CStr;
|
||||||
extern crate glib;
|
extern crate glib;
|
||||||
extern crate glib_sys as glib_ffi;
|
extern crate glib_sys as glib_ffi;
|
||||||
extern crate gobject_sys as gobject_ffi;
|
extern crate gobject_sys as gobject_ffi;
|
||||||
|
#[macro_use]
|
||||||
extern crate gstreamer as gst;
|
extern crate gstreamer as gst;
|
||||||
extern crate gstreamer_net as gst_net;
|
extern crate gstreamer_net as gst_net;
|
||||||
extern crate gstreamer_net_sys as gst_net_ffi;
|
extern crate gstreamer_net_sys as gst_net_ffi;
|
||||||
|
@ -140,5 +141,4 @@ pub mod prelude {
|
||||||
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
pub use rtsp_media_factory::RTSPMediaFactoryExtManual;
|
||||||
pub use rtsp_server::RTSPServerExtManual;
|
pub use rtsp_server::RTSPServerExtManual;
|
||||||
pub use rtsp_session_pool::RTSPSessionPoolExtManual;
|
pub use rtsp_session_pool::RTSPSessionPoolExtManual;
|
||||||
pub use rtsp_token::GstRcRTSPTokenExt;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,22 @@ use ffi;
|
||||||
use glib;
|
use glib;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use glib::value::ToSendValue;
|
use glib::value::ToSendValue;
|
||||||
use glib::StaticType;
|
|
||||||
use gst;
|
use gst;
|
||||||
use gst_ffi;
|
use gst::miniobject::*;
|
||||||
|
|
||||||
use gst::miniobject::{GstRc, MiniObject};
|
use std::fmt;
|
||||||
|
|
||||||
pub trait GstRcRTSPTokenExt<T: MiniObject> {
|
gst_define_mini_object_wrapper!(RTSPToken, RTSPTokenRef, ffi::GstRTSPToken, [Debug,], || {
|
||||||
fn new_empty() -> Self;
|
ffi::gst_rtsp_token_get_type()
|
||||||
fn new(values: &[(&str, &ToSendValue)]) -> Self;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
pub type RTSPToken = GstRc<RTSPTokenRef>;
|
impl RTSPToken {
|
||||||
pub struct RTSPTokenRef(ffi::GstRTSPToken);
|
pub fn new_empty() -> Self {
|
||||||
|
|
||||||
unsafe impl MiniObject for RTSPTokenRef {
|
|
||||||
type GstType = ffi::GstRTSPToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GstRcRTSPTokenExt<RTSPTokenRef> for GstRc<RTSPTokenRef> {
|
|
||||||
fn new_empty() -> Self {
|
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe { from_glib_full(ffi::gst_rtsp_token_new_empty()) }
|
unsafe { from_glib_full(ffi::gst_rtsp_token_new_empty()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(values: &[(&str, &ToSendValue)]) -> Self {
|
pub fn new(values: &[(&str, &ToSendValue)]) -> Self {
|
||||||
let mut token = RTSPToken::new_empty();
|
let mut token = RTSPToken::new_empty();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -77,18 +68,10 @@ impl RTSPTokenRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToOwned for RTSPTokenRef {
|
impl fmt::Debug for RTSPTokenRef {
|
||||||
type Owned = GstRc<RTSPTokenRef>;
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
f.debug_struct("RTSPToken")
|
||||||
fn to_owned(&self) -> GstRc<RTSPTokenRef> {
|
.field("structure", &self.get_structure())
|
||||||
unsafe {
|
.finish()
|
||||||
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()) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue