From 10999552493af91047e62d4f846d0f71ce66bfb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 22 Nov 2020 12:45:51 +0200 Subject: [PATCH] gstreamer-rtsp-server: Update manual code to 2018 edition --- gstreamer-rtsp-server/Cargo.toml | 30 +- gstreamer-rtsp-server/src/lib.rs | 95 ++-- .../src/rtsp_address_pool.rs | 9 +- gstreamer-rtsp-server/src/rtsp_auth.rs | 19 +- gstreamer-rtsp-server/src/rtsp_client.rs | 6 +- gstreamer-rtsp-server/src/rtsp_context.rs | 15 +- gstreamer-rtsp-server/src/rtsp_media.rs | 15 +- .../src/rtsp_media_factory.rs | 10 +- gstreamer-rtsp-server/src/rtsp_server.rs | 6 +- .../src/rtsp_session_pool.rs | 21 +- gstreamer-rtsp-server/src/rtsp_stream.rs | 8 +- .../src/rtsp_stream_transport.rs | 6 +- gstreamer-rtsp-server/src/rtsp_thread.rs | 26 +- gstreamer-rtsp-server/src/rtsp_token.rs | 27 +- .../src/subclass/rtsp_client.rs | 470 +++++++++--------- .../src/subclass/rtsp_media.rs | 223 ++++----- .../src/subclass/rtsp_media_factory.rs | 118 ++--- .../src/subclass/rtsp_server.rs | 30 +- 18 files changed, 511 insertions(+), 623 deletions(-) diff --git a/gstreamer-rtsp-server/Cargo.toml b/gstreamer-rtsp-server/Cargo.toml index 972fcc63e..7dda24071 100644 --- a/gstreamer-rtsp-server/Cargo.toml +++ b/gstreamer-rtsp-server/Cargo.toml @@ -11,39 +11,33 @@ homepage = "https://gstreamer.freedesktop.org" documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/gstreamer_rtsp_server/" keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"] build = "build.rs" +edition = "2018" [dependencies] bitflags = "1.0" libc = "0.2" once_cell = "1.0" -glib-sys = { git = "https://github.com/gtk-rs/gtk-rs" } -gio-sys = { git = "https://github.com/gtk-rs/gtk-rs" } -gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs" } -gstreamer-sys = { path = "../gstreamer/sys", features = ["v1_8"] } -gstreamer-sdp-sys = { path = "../gstreamer-sdp/sys", features = ["v1_8"] } -gstreamer-rtsp-sys = { path = "../gstreamer-rtsp/sys", features = ["v1_8"] } -gstreamer-rtsp-server-sys = { path = "../gstreamer-rtsp-server/sys", features = ["v1_8"] } -gstreamer-net-sys = { path = "../gstreamer-net/sys", features = ["v1_8"] } +ffi = { package = "gstreamer-rtsp-server-sys", path = "../gstreamer-rtsp-server/sys", features = ["v1_8"] } glib = { git = "https://github.com/gtk-rs/gtk-rs" } gio = { git = "https://github.com/gtk-rs/gtk-rs" } -gstreamer = { path = "../gstreamer" } -gstreamer-sdp = { path = "../gstreamer-sdp" } -gstreamer-rtsp = { path = "../gstreamer-rtsp" } -gstreamer-net = { path = "../gstreamer-net" } +gst = { package = "gstreamer", path = "../gstreamer" } +gst-sdp = { package = "gstreamer-sdp", path = "../gstreamer-sdp" } +gst-rtsp = { package = "gstreamer-rtsp", path = "../gstreamer-rtsp" } +gst-net = { package = "gstreamer-net", path = "../gstreamer-net" } [build-dependencies] gstreamer-rs-lgpl-docs = { path = "../docs", optional = true } [features] default = [] -v1_10 = ["gstreamer/v1_10", "gstreamer-sdp/v1_10", "gstreamer-rtsp/v1_10", "gstreamer-net/v1_10", "gstreamer-rtsp-server-sys/v1_10"] -v1_12 = ["gstreamer/v1_12", "gstreamer-sdp/v1_12", "gstreamer-rtsp/v1_12", "gstreamer-net/v1_12", "gstreamer-rtsp-server-sys/v1_12", "v1_10"] -v1_14 = ["gstreamer/v1_14", "gstreamer-sdp/v1_14", "gstreamer-rtsp/v1_14", "gstreamer-net/v1_14", "gstreamer-rtsp-server-sys/v1_14", "v1_12"] -v1_16 = ["gstreamer/v1_16", "gstreamer-sdp/v1_16", "gstreamer-rtsp/v1_16", "gstreamer-net/v1_16", "gstreamer-rtsp-server-sys/v1_16", "v1_14"] -v1_18 = ["gstreamer/v1_18", "gstreamer-sdp/v1_18", "gstreamer-rtsp/v1_18", "gstreamer-net/v1_18", "gstreamer-rtsp-server-sys/v1_18", "v1_16"] +v1_10 = ["gst/v1_10", "gst-sdp/v1_10", "gst-rtsp/v1_10", "gst-net/v1_10", "ffi/v1_10"] +v1_12 = ["gst/v1_12", "gst-sdp/v1_12", "gst-rtsp/v1_12", "gst-net/v1_12", "ffi/v1_12", "v1_10"] +v1_14 = ["gst/v1_14", "gst-sdp/v1_14", "gst-rtsp/v1_14", "gst-net/v1_14", "ffi/v1_14", "v1_12"] +v1_16 = ["gst/v1_16", "gst-sdp/v1_16", "gst-rtsp/v1_16", "gst-net/v1_16", "ffi/v1_16", "v1_14"] +v1_18 = ["gst/v1_18", "gst-sdp/v1_18", "gst-rtsp/v1_18", "gst-net/v1_18", "ffi/v1_18", "v1_16"] embed-lgpl-docs = ["gstreamer-rs-lgpl-docs"] purge-lgpl-docs = ["gstreamer-rs-lgpl-docs"] -dox = ["v1_18", "gstreamer-rtsp-server-sys/dox", "glib/dox", "gio/dox", "gstreamer/dox", "gstreamer-sdp/dox", "gstreamer-rtsp/dox", "gstreamer-net/dox"] +dox = ["v1_18", "ffi/dox", "glib/dox", "gio/dox", "gst/dox", "gst-sdp/dox", "gst-rtsp/dox", "gst-net/dox"] [package.metadata.docs.rs] features = ["dox", "embed-lgpl-docs"] diff --git a/gstreamer-rtsp-server/src/lib.rs b/gstreamer-rtsp-server/src/lib.rs index 931738590..6b17879b4 100644 --- a/gstreamer-rtsp-server/src/lib.rs +++ b/gstreamer-rtsp-server/src/lib.rs @@ -8,32 +8,11 @@ #![cfg_attr(feature = "dox", feature(doc_cfg))] -#[macro_use] -extern crate bitflags; -extern crate libc; -extern crate once_cell; - -extern crate gio; -extern crate gio_sys as gio_sys; -use std::ffi::CStr; -#[macro_use] -extern crate glib; -extern crate glib_sys; -extern crate gobject_sys; -#[macro_use] -extern crate gstreamer as gst; -extern crate gstreamer_net as gst_net; -extern crate gstreamer_net_sys as gst_net_sys; -extern crate gstreamer_rtsp as gst_rtsp; -extern crate gstreamer_rtsp_server_sys as gst_rtsp_server_sys; -extern crate gstreamer_rtsp_sys as gst_rtsp_sys; -extern crate gstreamer_sdp as gst_sdp; -extern crate gstreamer_sdp_sys as gst_sdp_sys; -extern crate gstreamer_sys as gst_sys; +pub use ffi; macro_rules! assert_initialized_main_thread { () => { - if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE { + if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE { panic!("GStreamer has not been initialized. Call `gst::init` first."); } }; @@ -49,7 +28,7 @@ macro_rules! skip_assert_initialized { #[allow(clippy::type_complexity)] #[allow(clippy::let_and_return)] mod auto; -pub use auto::*; +pub use crate::auto::*; mod rtsp_address_pool; mod rtsp_auth; @@ -66,74 +45,76 @@ mod rtsp_token; pub mod subclass; -pub use rtsp_address_pool::RTSPAddressPoolExtManual; -pub use rtsp_auth::RTSPAuthExtManual; -pub use rtsp_client::RTSPClientExtManual; -pub use rtsp_media::RTSPMediaExtManual; -pub use rtsp_media_factory::RTSPMediaFactoryExtManual; -pub use rtsp_server::RTSPServerExtManual; -pub use rtsp_session_pool::RTSPSessionPoolExtManual; -pub use rtsp_stream::RTSPStreamExtManual; -pub use rtsp_stream_transport::RTSPStreamTransportExtManual; -pub use rtsp_thread::*; +pub use crate::rtsp_address_pool::RTSPAddressPoolExtManual; +pub use crate::rtsp_auth::RTSPAuthExtManual; +pub use crate::rtsp_client::RTSPClientExtManual; +pub use crate::rtsp_media::RTSPMediaExtManual; +pub use crate::rtsp_media_factory::RTSPMediaFactoryExtManual; +pub use crate::rtsp_server::RTSPServerExtManual; +pub use crate::rtsp_session_pool::RTSPSessionPoolExtManual; +pub use crate::rtsp_stream::RTSPStreamExtManual; +pub use crate::rtsp_stream_transport::RTSPStreamTransportExtManual; +pub use crate::rtsp_thread::*; -pub use rtsp_context::*; -pub use rtsp_token::*; +pub use crate::rtsp_context::*; +pub use crate::rtsp_token::*; use once_cell::sync::Lazy; +use std::ffi::CStr; + pub static RTSP_ADDRESS_POOL_ANY_IPV4: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ANY_IPV4) + CStr::from_ptr(ffi::GST_RTSP_ADDRESS_POOL_ANY_IPV4) .to_str() .unwrap() }); pub static RTSP_ADDRESS_POOL_ANY_IPV6: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ANY_IPV6) + CStr::from_ptr(ffi::GST_RTSP_ADDRESS_POOL_ANY_IPV6) .to_str() .unwrap() }); pub static RTSP_AUTH_CHECK_CONNECT: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_CONNECT) + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_CONNECT) .to_str() .unwrap() }); pub static RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS) + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS) .to_str() .unwrap() }); pub static RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT) + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT) .to_str() .unwrap() }); pub static RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS) + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS) .to_str() .unwrap() }); pub static RTSP_AUTH_CHECK_URL: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_AUTH_CHECK_URL) + CStr::from_ptr(ffi::GST_RTSP_AUTH_CHECK_URL) .to_str() .unwrap() }); pub static RTSP_PERM_MEDIA_FACTORY_ACCESS: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_PERM_MEDIA_FACTORY_ACCESS) + CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_ACCESS) .to_str() .unwrap() }); pub static RTSP_PERM_MEDIA_FACTORY_CONSTRUCT: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT) + CStr::from_ptr(ffi::GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT) .to_str() .unwrap() }); pub static RTSP_TOKEN_MEDIA_FACTORY_ROLE: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE) + CStr::from_ptr(ffi::GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE) .to_str() .unwrap() }); pub static RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS: Lazy<&'static str> = Lazy::new(|| unsafe { - CStr::from_ptr(gst_rtsp_server_sys::GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS) + CStr::from_ptr(ffi::GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS) .to_str() .unwrap() }); @@ -144,15 +125,15 @@ pub mod prelude { pub use glib::prelude::*; pub use gst::prelude::*; - pub use auto::traits::*; + pub use crate::auto::traits::*; - pub use rtsp_address_pool::RTSPAddressPoolExtManual; - pub use rtsp_auth::RTSPAuthExtManual; - pub use rtsp_client::RTSPClientExtManual; - pub use rtsp_media::RTSPMediaExtManual; - pub use rtsp_media_factory::RTSPMediaFactoryExtManual; - pub use rtsp_server::RTSPServerExtManual; - pub use rtsp_session_pool::RTSPSessionPoolExtManual; - pub use rtsp_stream::RTSPStreamExtManual; - pub use rtsp_stream_transport::RTSPStreamTransportExtManual; + pub use crate::rtsp_address_pool::RTSPAddressPoolExtManual; + pub use crate::rtsp_auth::RTSPAuthExtManual; + pub use crate::rtsp_client::RTSPClientExtManual; + pub use crate::rtsp_media::RTSPMediaExtManual; + pub use crate::rtsp_media_factory::RTSPMediaFactoryExtManual; + pub use crate::rtsp_server::RTSPServerExtManual; + pub use crate::rtsp_session_pool::RTSPSessionPoolExtManual; + pub use crate::rtsp_stream::RTSPStreamExtManual; + pub use crate::rtsp_stream_transport::RTSPStreamTransportExtManual; } diff --git a/gstreamer-rtsp-server/src/rtsp_address_pool.rs b/gstreamer-rtsp-server/src/rtsp_address_pool.rs index 589ea10f2..bb9f41dc9 100644 --- a/gstreamer-rtsp-server/src/rtsp_address_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_address_pool.rs @@ -1,10 +1,9 @@ +use crate::RTSPAddress; +use crate::RTSPAddressPool; +use crate::RTSPAddressPoolResult; use glib::object::IsA; use glib::translate::*; -use gst_rtsp_server_sys; use std::ptr; -use RTSPAddress; -use RTSPAddressPool; -use RTSPAddressPoolResult; pub trait RTSPAddressPoolExtManual: 'static { fn reserve_address( @@ -26,7 +25,7 @@ impl> RTSPAddressPoolExtManual for O { ) -> Result { unsafe { let mut address = ptr::null_mut(); - let ret = from_glib(gst_rtsp_server_sys::gst_rtsp_address_pool_reserve_address( + let ret = from_glib(ffi::gst_rtsp_address_pool_reserve_address( self.as_ref().to_glib_none().0, ip_address.to_glib_none().0, port, diff --git a/gstreamer-rtsp-server/src/rtsp_auth.rs b/gstreamer-rtsp-server/src/rtsp_auth.rs index 2503e3319..9805e9648 100644 --- a/gstreamer-rtsp-server/src/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/rtsp_auth.rs @@ -3,13 +3,12 @@ use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; -use gst_rtsp_server_sys; use std::boxed::Box as Box_; use std::mem::transmute; -use RTSPAuth; -use RTSPToken; +use crate::RTSPAuth; +use crate::RTSPToken; pub trait RTSPAuthExtManual: 'static { fn set_default_token(&self, token: Option<&mut RTSPToken>); @@ -33,7 +32,7 @@ pub trait RTSPAuthExtManual: 'static { impl> RTSPAuthExtManual for O { fn set_default_token(&self, mut token: Option<&mut RTSPToken>) { unsafe { - gst_rtsp_server_sys::gst_rtsp_auth_set_default_token( + ffi::gst_rtsp_auth_set_default_token( self.as_ref().to_glib_none().0, token.to_glib_none_mut().0, ); @@ -80,12 +79,12 @@ unsafe extern "C" fn accept_certificate_trampoline< + Sync + 'static, >( - this: *mut gst_rtsp_server_sys::GstRTSPAuth, - connection: *mut gio_sys::GTlsConnection, - peer_cert: *mut gio_sys::GTlsCertificate, - errors: gio_sys::GTlsCertificateFlags, - f: glib_sys::gpointer, -) -> glib_sys::gboolean + this: *mut ffi::GstRTSPAuth, + connection: *mut gio::ffi::GTlsConnection, + peer_cert: *mut gio::ffi::GTlsCertificate, + errors: gio::ffi::GTlsCertificateFlags, + f: glib::ffi::gpointer, +) -> glib::ffi::gboolean where P: IsA, { diff --git a/gstreamer-rtsp-server/src/rtsp_client.rs b/gstreamer-rtsp-server/src/rtsp_client.rs index e3effef85..aa63b3fed 100644 --- a/gstreamer-rtsp-server/src/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/rtsp_client.rs @@ -1,9 +1,7 @@ -use glib; +use crate::RTSPClient; use glib::object::IsA; use glib::source::SourceId; use glib::translate::*; -use gst_rtsp_server_sys; -use RTSPClient; pub trait RTSPClientExtManual: 'static { fn attach(&self, context: Option<&glib::MainContext>) -> SourceId; @@ -12,7 +10,7 @@ pub trait RTSPClientExtManual: 'static { impl> RTSPClientExtManual for O { fn attach(&self, context: Option<&glib::MainContext>) -> SourceId { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_client_attach( + from_glib(ffi::gst_rtsp_client_attach( self.as_ref().to_glib_none().0, context.to_glib_none().0, )) diff --git a/gstreamer-rtsp-server/src/rtsp_context.rs b/gstreamer-rtsp-server/src/rtsp_context.rs index a25b64e23..fe0177989 100644 --- a/gstreamer-rtsp-server/src/rtsp_context.rs +++ b/gstreamer-rtsp-server/src/rtsp_context.rs @@ -7,16 +7,15 @@ // except according to those terms. use glib::translate::*; -use gst_rtsp_server_sys; use std::ptr; #[derive(Debug, PartialEq, Eq)] -pub struct RTSPContext(ptr::NonNull); +pub struct RTSPContext(ptr::NonNull); impl RTSPContext { pub fn with_current_context T, T>(func: F) -> Option { unsafe { - let ptr = gst_rtsp_server_sys::gst_rtsp_context_get_current(); + let ptr = ffi::gst_rtsp_context_get_current(); if ptr.is_null() { return None; } @@ -30,23 +29,23 @@ impl RTSPContext { } #[doc(hidden)] -impl FromGlibPtrBorrow<*mut gst_rtsp_server_sys::GstRTSPContext> for RTSPContext { +impl FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext { #[inline] - unsafe fn from_glib_borrow(ptr: *mut gst_rtsp_server_sys::GstRTSPContext) -> Borrowed { + unsafe fn from_glib_borrow(ptr: *mut ffi::GstRTSPContext) -> Borrowed { assert!(!ptr.is_null()); Borrowed::new(RTSPContext(ptr::NonNull::new_unchecked(ptr))) } } #[doc(hidden)] -impl<'a> ToGlibPtr<'a, *mut gst_rtsp_server_sys::GstRTSPContext> for RTSPContext { +impl<'a> ToGlibPtr<'a, *mut ffi::GstRTSPContext> for RTSPContext { type Storage = &'a RTSPContext; - fn to_glib_none(&'a self) -> Stash<'a, *mut gst_rtsp_server_sys::GstRTSPContext, Self> { + fn to_glib_none(&'a self) -> Stash<'a, *mut ffi::GstRTSPContext, Self> { Stash(self.0.as_ptr(), self) } - fn to_glib_full(&self) -> *mut gst_rtsp_server_sys::GstRTSPContext { + fn to_glib_full(&self) -> *mut ffi::GstRTSPContext { unimplemented!() } } diff --git a/gstreamer-rtsp-server/src/rtsp_media.rs b/gstreamer-rtsp-server/src/rtsp_media.rs index 40c15d0e6..57fd6ea00 100644 --- a/gstreamer-rtsp-server/src/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/rtsp_media.rs @@ -1,9 +1,7 @@ use glib::object::IsA; use glib::translate::*; -use gst; -use gst_rtsp_server_sys; -use RTSPMedia; +use crate::RTSPMedia; pub trait RTSPMediaExtManual: 'static { fn take_pipeline>(&self, pipeline: &P); @@ -14,13 +12,10 @@ impl> RTSPMediaExtManual for O { unsafe { let pipeline = pipeline.as_ref().to_glib_full(); // See https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/merge_requests/109 - gobject_sys::g_object_force_floating(pipeline as *mut _); - gst_rtsp_server_sys::gst_rtsp_media_take_pipeline( - self.as_ref().to_glib_none().0, - pipeline, - ); - if gobject_sys::g_object_is_floating(pipeline as *mut _) != glib_sys::GFALSE { - gobject_sys::g_object_ref_sink(pipeline as *mut _); + glib::gobject_ffi::g_object_force_floating(pipeline as *mut _); + ffi::gst_rtsp_media_take_pipeline(self.as_ref().to_glib_none().0, pipeline); + if glib::gobject_ffi::g_object_is_floating(pipeline as *mut _) != glib::ffi::GFALSE { + glib::gobject_ffi::g_object_ref_sink(pipeline as *mut _); } } } diff --git a/gstreamer-rtsp-server/src/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/rtsp_media_factory.rs index f61443a64..5f735dcce 100644 --- a/gstreamer-rtsp-server/src/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/rtsp_media_factory.rs @@ -6,18 +6,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use RTSPMediaFactory; +use crate::RTSPMediaFactory; #[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] use glib::translate::*; use glib::IsA; -#[cfg(any(feature = "v1_14", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] -use gst; -#[cfg(any(feature = "v1_14", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] -use gst_rtsp_server_sys; pub trait RTSPMediaFactoryExtManual: 'static { #[cfg(any(feature = "v1_14", feature = "dox"))] @@ -30,7 +24,7 @@ impl> RTSPMediaFactoryExtManual for O { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] fn add_role_from_structure(&self, structure: &gst::StructureRef) { unsafe { - gst_rtsp_server_sys::gst_rtsp_media_factory_add_role_from_structure( + ffi::gst_rtsp_media_factory_add_role_from_structure( self.as_ref().to_glib_none().0, structure.as_mut_ptr(), ); diff --git a/gstreamer-rtsp-server/src/rtsp_server.rs b/gstreamer-rtsp-server/src/rtsp_server.rs index bdd8f0a9b..b83f3a975 100644 --- a/gstreamer-rtsp-server/src/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/rtsp_server.rs @@ -1,9 +1,7 @@ -use glib; +use crate::RTSPServer; use glib::object::IsA; use glib::source::SourceId; use glib::translate::*; -use gst_rtsp_server_sys; -use RTSPServer; pub trait RTSPServerExtManual: 'static { fn attach(&self, context: Option<&glib::MainContext>) -> SourceId; @@ -12,7 +10,7 @@ pub trait RTSPServerExtManual: 'static { impl> RTSPServerExtManual for O { fn attach(&self, context: Option<&glib::MainContext>) -> SourceId { unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_server_attach( + from_glib(ffi::gst_rtsp_server_attach( self.as_ref().to_glib_none().0, context.to_glib_none().0, )) diff --git a/gstreamer-rtsp-server/src/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/rtsp_session_pool.rs index e8555b080..1dbf64447 100644 --- a/gstreamer-rtsp-server/src/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_session_pool.rs @@ -1,16 +1,13 @@ -use glib; +use crate::RTSPSessionPool; +use glib::ffi::{gboolean, gpointer}; use glib::object::IsA; use glib::source::{Continue, Priority}; use glib::translate::*; -use glib_sys; -use glib_sys::{gboolean, gpointer}; -use gst_rtsp_server_sys; use std::cell::RefCell; use std::mem::transmute; -use RTSPSessionPool; unsafe extern "C" fn trampoline_watch Continue + Send + 'static>( - pool: *mut gst_rtsp_server_sys::GstRTSPSessionPool, + pool: *mut ffi::GstRTSPSessionPool, func: gpointer, ) -> gboolean { let func: &RefCell = &*(func as *const RefCell); @@ -44,22 +41,20 @@ impl> RTSPSessionPoolExtManual for O { { skip_assert_initialized!(); unsafe { - let source = gst_rtsp_server_sys::gst_rtsp_session_pool_create_watch( - self.as_ref().to_glib_none().0, - ); - glib_sys::g_source_set_callback( + let source = ffi::gst_rtsp_session_pool_create_watch(self.as_ref().to_glib_none().0); + glib::ffi::g_source_set_callback( source, Some(transmute::< _, - unsafe extern "C" fn(glib_sys::gpointer) -> i32, + unsafe extern "C" fn(glib::ffi::gpointer) -> i32, >(trampoline_watch:: as *const ())), into_raw_watch(func), Some(destroy_closure_watch::), ); - glib_sys::g_source_set_priority(source, priority.to_glib()); + glib::ffi::g_source_set_priority(source, priority.to_glib()); if let Some(name) = name { - glib_sys::g_source_set_name(source, name.to_glib_none().0); + glib::ffi::g_source_set_name(source, name.to_glib_none().0); } from_glib_full(source) diff --git a/gstreamer-rtsp-server/src/rtsp_stream.rs b/gstreamer-rtsp-server/src/rtsp_stream.rs index f083de38d..5644f5014 100644 --- a/gstreamer-rtsp-server/src/rtsp_stream.rs +++ b/gstreamer-rtsp-server/src/rtsp_stream.rs @@ -1,8 +1,6 @@ +use crate::RTSPStream; use glib::object::IsA; use glib::translate::*; -use gst; -use gst_rtsp_server_sys; -use RTSPStream; pub trait RTSPStreamExtManual: 'static { fn recv_rtcp(&self, buffer: &gst::Buffer) -> Result; @@ -13,7 +11,7 @@ pub trait RTSPStreamExtManual: 'static { impl> RTSPStreamExtManual for O { fn recv_rtcp(&self, buffer: &gst::Buffer) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_recv_rtcp( + from_glib(ffi::gst_rtsp_stream_recv_rtcp( self.as_ref().to_glib_none().0, buffer.to_glib_full(), )) @@ -23,7 +21,7 @@ impl> RTSPStreamExtManual for O { fn recv_rtp(&self, buffer: &gst::Buffer) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_recv_rtp( + from_glib(ffi::gst_rtsp_stream_recv_rtp( self.as_ref().to_glib_none().0, buffer.to_glib_full(), )) diff --git a/gstreamer-rtsp-server/src/rtsp_stream_transport.rs b/gstreamer-rtsp-server/src/rtsp_stream_transport.rs index 1d744a69c..33fe71798 100644 --- a/gstreamer-rtsp-server/src/rtsp_stream_transport.rs +++ b/gstreamer-rtsp-server/src/rtsp_stream_transport.rs @@ -1,8 +1,6 @@ +use crate::RTSPStreamTransport; use glib::object::IsA; use glib::translate::*; -use gst; -use gst_rtsp_server_sys; -use RTSPStreamTransport; pub trait RTSPStreamTransportExtManual: 'static { fn recv_data( @@ -19,7 +17,7 @@ impl> RTSPStreamTransportExtManual for O { buffer: &gst::Buffer, ) -> Result { let ret: gst::FlowReturn = unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_stream_transport_recv_data( + from_glib(ffi::gst_rtsp_stream_transport_recv_data( self.as_ref().to_glib_none().0, channel, buffer.to_glib_full(), diff --git a/gstreamer-rtsp-server/src/rtsp_thread.rs b/gstreamer-rtsp-server/src/rtsp_thread.rs index 4f084c79f..85c6803b0 100644 --- a/gstreamer-rtsp-server/src/rtsp_thread.rs +++ b/gstreamer-rtsp-server/src/rtsp_thread.rs @@ -1,38 +1,28 @@ -use glib; use glib::translate::*; -use gst_rtsp_server_sys; - -gst_define_mini_object_wrapper!( - RTSPThread, - RTSPThreadRef, - gst_rtsp_server_sys::GstRTSPThread, - || gst_rtsp_server_sys::gst_rtsp_thread_get_type() -); +gst::gst_define_mini_object_wrapper!(RTSPThread, RTSPThreadRef, ffi::GstRTSPThread, || { + ffi::gst_rtsp_thread_get_type() +}); impl RTSPThread { - pub fn new(type_: ::RTSPThreadType) -> Option { + pub fn new(type_: crate::RTSPThreadType) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_thread_new(type_.to_glib())) } + unsafe { from_glib_full(ffi::gst_rtsp_thread_new(type_.to_glib())) } } } impl RTSPThreadRef { pub fn reuse(&self) -> bool { - unsafe { - from_glib(gst_rtsp_server_sys::gst_rtsp_thread_reuse( - self.as_mut_ptr(), - )) - } + unsafe { from_glib(ffi::gst_rtsp_thread_reuse(self.as_mut_ptr())) } } pub fn stop(&self) { unsafe { - gst_rtsp_server_sys::gst_rtsp_thread_stop(self.as_mut_ptr()); + ffi::gst_rtsp_thread_stop(self.as_mut_ptr()); } } - pub fn type_(&self) -> ::RTSPThreadType { + pub fn type_(&self) -> crate::RTSPThreadType { unsafe { from_glib((*self.as_ptr()).type_) } } diff --git a/gstreamer-rtsp-server/src/rtsp_token.rs b/gstreamer-rtsp-server/src/rtsp_token.rs index 72521b063..1df088a07 100644 --- a/gstreamer-rtsp-server/src/rtsp_token.rs +++ b/gstreamer-rtsp-server/src/rtsp_token.rs @@ -1,22 +1,16 @@ -use glib; use glib::translate::*; use glib::value::ToSendValue; -use gst; -use gst_rtsp_server_sys; use std::fmt; -gst_define_mini_object_wrapper!( - RTSPToken, - RTSPTokenRef, - gst_rtsp_server_sys::GstRTSPToken, - || gst_rtsp_server_sys::gst_rtsp_token_get_type() -); +gst::gst_define_mini_object_wrapper!(RTSPToken, RTSPTokenRef, ffi::GstRTSPToken, || { + ffi::gst_rtsp_token_get_type() +}); impl RTSPToken { pub fn new_empty() -> Self { assert_initialized_main_thread!(); - unsafe { from_glib_full(gst_rtsp_server_sys::gst_rtsp_token_new_empty()) } + unsafe { from_glib_full(ffi::gst_rtsp_token_new_empty()) } } pub fn new(values: &[(&str, &dyn ToSendValue)]) -> Self { @@ -39,7 +33,7 @@ impl RTSPToken { impl RTSPTokenRef { pub fn get_string(&self, field: &str) -> Option { unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_token_get_string( + from_glib_none(ffi::gst_rtsp_token_get_string( self.as_mut_ptr(), field.to_glib_none().0, )) @@ -47,16 +41,12 @@ impl RTSPTokenRef { } pub fn get_structure(&self) -> Option { - unsafe { - from_glib_none(gst_rtsp_server_sys::gst_rtsp_token_get_structure( - self.as_mut_ptr(), - )) - } + 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(gst_rtsp_server_sys::gst_rtsp_token_is_allowed( + from_glib(ffi::gst_rtsp_token_is_allowed( self.as_mut_ptr(), field.to_glib_none().0, )) @@ -65,8 +55,7 @@ impl RTSPTokenRef { pub fn get_mut_structure(&mut self) -> Option<&mut gst::StructureRef> { unsafe { - let structure = - gst_rtsp_server_sys::gst_rtsp_token_writable_structure(self.as_mut_ptr()); + let structure = ffi::gst_rtsp_token_writable_structure(self.as_mut_ptr()); if structure.is_null() { None } else { diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs index 820716cb2..6a864960b 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs @@ -6,38 +6,40 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use gst_rtsp_server_sys; - use glib::prelude::*; use glib::subclass::prelude::*; use glib::translate::*; use std::mem; -use RTSPClient; +use crate::RTSPClient; pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { - fn create_sdp(&self, client: &Self::Type, media: &::RTSPMedia) -> Option { + fn create_sdp( + &self, + client: &Self::Type, + media: &crate::RTSPMedia, + ) -> Option { self.parent_create_sdp(client, media) } fn configure_client_media( &self, client: &Self::Type, - media: &::RTSPMedia, - stream: &::RTSPStream, - ctx: &::RTSPContext, + media: &crate::RTSPMedia, + stream: &crate::RTSPStream, + ctx: &crate::RTSPContext, ) -> Result<(), gst::LoggableError> { self.parent_configure_client_media(client, media, stream, ctx) } // TODO: configure_client_transport - fn params_set(&self, client: &Self::Type, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult { + fn params_set(&self, client: &Self::Type, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPResult { self.parent_params_set(client, ctx) } - fn params_get(&self, client: &Self::Type, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult { + fn params_get(&self, client: &Self::Type, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPResult { self.parent_params_get(client, ctx) } @@ -53,51 +55,51 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { self.parent_closed(client); } - fn new_session(&self, client: &Self::Type, session: &::RTSPSession) { + fn new_session(&self, client: &Self::Type, session: &crate::RTSPSession) { self.parent_new_session(client, session); } - fn options_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn options_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_options_request(client, ctx); } - fn describe_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn describe_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_describe_request(client, ctx); } - fn setup_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn setup_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_setup_request(client, ctx); } - fn play_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn play_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_play_request(client, ctx); } - fn pause_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn pause_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_pause_request(client, ctx); } - fn teardown_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn teardown_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_teardown_request(client, ctx); } - fn set_parameter_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn set_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_set_parameter_request(client, ctx); } - fn get_parameter_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn get_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_get_parameter_request(client, ctx); } - fn announce_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_announce_request(client, ctx); } - fn record_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn record_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_record_request(client, ctx); } - fn handle_response(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn handle_response(&self, client: &Self::Type, ctx: &crate::RTSPContext) { self.parent_handle_response(client, ctx); } @@ -107,8 +109,8 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn handle_sdp( &self, client: &Self::Type, - ctx: &::RTSPContext, - media: &::RTSPMedia, + ctx: &crate::RTSPContext, + media: &crate::RTSPMedia, sdp: &gst_sdp::SDPMessageRef, ) -> Result<(), gst::LoggableError> { self.parent_handle_sdp(client, ctx, media, sdp) @@ -117,7 +119,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn check_requirements( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, arr: &[String], ) -> Option { self.parent_check_requirements(client, ctx, arr) @@ -126,7 +128,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_options_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_options_request(client, ctx) } @@ -134,7 +136,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_describe_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_describe_request(client, ctx) } @@ -142,7 +144,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_setup_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_setup_request(client, ctx) } @@ -150,7 +152,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_play_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_play_request(client, ctx) } @@ -158,7 +160,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_pause_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_pause_request(client, ctx) } @@ -166,7 +168,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_teardown_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_teardown_request(client, ctx) } @@ -174,7 +176,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_set_parameter_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_set_parameter_request(client, ctx) } @@ -182,7 +184,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_get_parameter_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_get_parameter_request(client, ctx) } @@ -190,7 +192,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_announce_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_announce_request(client, ctx) } @@ -198,7 +200,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn pre_record_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { self.parent_pre_record_request(client, ctx) } @@ -208,22 +210,30 @@ pub trait RTSPClientImplExt: ObjectSubclass { fn parent_create_sdp( &self, client: &Self::Type, - media: &::RTSPMedia, + media: &crate::RTSPMedia, ) -> Option; fn parent_configure_client_media( &self, client: &Self::Type, - media: &::RTSPMedia, - stream: &::RTSPStream, - ctx: &::RTSPContext, + media: &crate::RTSPMedia, + stream: &crate::RTSPStream, + ctx: &crate::RTSPContext, ) -> Result<(), gst::LoggableError>; // TODO: configure_client_transport - fn parent_params_set(&self, client: &Self::Type, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult; + fn parent_params_set( + &self, + client: &Self::Type, + ctx: &crate::RTSPContext, + ) -> gst_rtsp::RTSPResult; - fn parent_params_get(&self, client: &Self::Type, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult; + fn parent_params_get( + &self, + client: &Self::Type, + ctx: &crate::RTSPContext, + ) -> gst_rtsp::RTSPResult; fn parent_make_path_from_uri( &self, @@ -233,29 +243,29 @@ pub trait RTSPClientImplExt: ObjectSubclass { fn parent_closed(&self, client: &Self::Type); - fn parent_new_session(&self, client: &Self::Type, session: &::RTSPSession); + fn parent_new_session(&self, client: &Self::Type, session: &crate::RTSPSession); - fn parent_options_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_options_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_describe_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_describe_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_setup_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_setup_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_play_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_play_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_pause_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_pause_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_teardown_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_teardown_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_set_parameter_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_set_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_get_parameter_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_get_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_announce_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_record_request(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_record_request(&self, client: &Self::Type, ctx: &crate::RTSPContext); - fn parent_handle_response(&self, client: &Self::Type, ctx: &::RTSPContext); + fn parent_handle_response(&self, client: &Self::Type, ctx: &crate::RTSPContext); // TODO: tunnel_http_response // TODO: send_message @@ -263,76 +273,76 @@ pub trait RTSPClientImplExt: ObjectSubclass { fn parent_handle_sdp( &self, client: &Self::Type, - ctx: &::RTSPContext, - media: &::RTSPMedia, + ctx: &crate::RTSPContext, + media: &crate::RTSPMedia, sdp: &gst_sdp::SDPMessageRef, ) -> Result<(), gst::LoggableError>; fn parent_check_requirements( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, arr: &[String], ) -> Option; fn parent_pre_options_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_describe_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_setup_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_play_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_pause_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_teardown_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_set_parameter_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_get_parameter_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_announce_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; fn parent_pre_record_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode; } @@ -340,12 +350,11 @@ impl RTSPClientImplExt for T { fn parent_create_sdp( &self, client: &Self::Type, - media: &::RTSPMedia, + media: &crate::RTSPMedia, ) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .create_sdp .expect("No `create_rtpbin` virtual method implementation in parent class"); @@ -360,19 +369,18 @@ impl RTSPClientImplExt for T { fn parent_configure_client_media( &self, client: &Self::Type, - media: &::RTSPMedia, - stream: &::RTSPStream, - ctx: &::RTSPContext, + media: &crate::RTSPMedia, + stream: &crate::RTSPStream, + ctx: &crate::RTSPContext, ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class).configure_client_media.expect( "No `configure_client_media` virtual method implementation in parent class", ); - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f( client.unsafe_cast_ref::().to_glib_none().0, media.to_glib_none().0, @@ -387,11 +395,14 @@ impl RTSPClientImplExt for T { // TODO: configure_client_transport - fn parent_params_set(&self, client: &Self::Type, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult { + fn parent_params_set( + &self, + client: &Self::Type, + ctx: &crate::RTSPContext, + ) -> gst_rtsp::RTSPResult { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .params_set .expect("No `params_set` virtual method implementation in parent class"); @@ -403,11 +414,14 @@ impl RTSPClientImplExt for T { } } - fn parent_params_get(&self, client: &Self::Type, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult { + fn parent_params_get( + &self, + client: &Self::Type, + ctx: &crate::RTSPContext, + ) -> gst_rtsp::RTSPResult { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .params_get .expect("No `params_get` virtual method implementation in parent class"); @@ -426,8 +440,7 @@ impl RTSPClientImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .make_path_from_uri .expect("No `make_path_from_uri` virtual method implementation in parent class"); @@ -442,19 +455,17 @@ impl RTSPClientImplExt for T { fn parent_closed(&self, client: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).closed { f(client.unsafe_cast_ref::().to_glib_none().0); } } } - fn parent_new_session(&self, client: &Self::Type, session: &::RTSPSession) { + fn parent_new_session(&self, client: &Self::Type, session: &crate::RTSPSession) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).new_session { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -464,11 +475,10 @@ impl RTSPClientImplExt for T { } } - fn parent_options_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_options_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).options_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -478,11 +488,10 @@ impl RTSPClientImplExt for T { } } - fn parent_describe_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_describe_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).describe_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -492,11 +501,10 @@ impl RTSPClientImplExt for T { } } - fn parent_setup_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_setup_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).setup_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -506,11 +514,10 @@ impl RTSPClientImplExt for T { } } - fn parent_play_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_play_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).play_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -520,11 +527,10 @@ impl RTSPClientImplExt for T { } } - fn parent_pause_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_pause_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pause_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -534,11 +540,10 @@ impl RTSPClientImplExt for T { } } - fn parent_teardown_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_teardown_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).teardown_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -548,11 +553,10 @@ impl RTSPClientImplExt for T { } } - fn parent_set_parameter_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_set_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).set_parameter_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -562,11 +566,10 @@ impl RTSPClientImplExt for T { } } - fn parent_get_parameter_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_get_parameter_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).get_parameter_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -576,11 +579,10 @@ impl RTSPClientImplExt for T { } } - fn parent_announce_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_announce_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).announce_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -590,11 +592,10 @@ impl RTSPClientImplExt for T { } } - fn parent_record_request(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_record_request(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).record_request { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -604,11 +605,10 @@ impl RTSPClientImplExt for T { } } - fn parent_handle_response(&self, client: &Self::Type, ctx: &::RTSPContext) { + fn parent_handle_response(&self, client: &Self::Type, ctx: &crate::RTSPContext) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).handle_response { f( client.unsafe_cast_ref::().to_glib_none().0, @@ -624,19 +624,18 @@ impl RTSPClientImplExt for T { fn parent_handle_sdp( &self, client: &Self::Type, - ctx: &::RTSPContext, - media: &::RTSPMedia, + ctx: &crate::RTSPContext, + media: &crate::RTSPMedia, sdp: &gst_sdp::SDPMessageRef, ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; let f = (*parent_class) .handle_sdp .expect("No `handle_sdp` virtual method implementation in parent class"); - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f( client.unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, @@ -652,13 +651,12 @@ impl RTSPClientImplExt for T { fn parent_check_requirements( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, arr: &[String], ) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).check_requirements { from_glib_full(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -674,12 +672,11 @@ impl RTSPClientImplExt for T { fn parent_pre_options_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_options_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -694,12 +691,11 @@ impl RTSPClientImplExt for T { fn parent_pre_describe_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_describe_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -714,12 +710,11 @@ impl RTSPClientImplExt for T { fn parent_pre_setup_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_setup_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -734,12 +729,11 @@ impl RTSPClientImplExt for T { fn parent_pre_play_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_play_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -754,12 +748,11 @@ impl RTSPClientImplExt for T { fn parent_pre_pause_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_pause_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -774,12 +767,11 @@ impl RTSPClientImplExt for T { fn parent_pre_teardown_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_teardown_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -794,12 +786,11 @@ impl RTSPClientImplExt for T { fn parent_pre_set_parameter_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_set_parameter_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -814,12 +805,11 @@ impl RTSPClientImplExt for T { fn parent_pre_get_parameter_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_get_parameter_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -834,12 +824,11 @@ impl RTSPClientImplExt for T { fn parent_pre_announce_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_announce_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -854,12 +843,11 @@ impl RTSPClientImplExt for T { fn parent_pre_record_request( &self, client: &Self::Type, - ctx: &::RTSPContext, + ctx: &crate::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_record_request { from_glib(f( client.unsafe_cast_ref::().to_glib_none().0, @@ -909,9 +897,9 @@ unsafe impl IsSubclassable for RTSPClient { } unsafe extern "C" fn client_create_sdp( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - media: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> *mut gst_sdp_sys::GstSDPMessage { + ptr: *mut ffi::GstRTSPClient, + media: *mut ffi::GstRTSPMedia, +) -> *mut gst_sdp::ffi::GstSDPMessage { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -924,11 +912,11 @@ unsafe extern "C" fn client_create_sdp( } unsafe extern "C" fn client_configure_client_media( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - media: *mut gst_rtsp_server_sys::GstRTSPMedia, - stream: *mut gst_rtsp_server_sys::GstRTSPStream, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPClient, + media: *mut ffi::GstRTSPMedia, + stream: *mut ffi::GstRTSPStream, + ctx: *mut ffi::GstRTSPContext, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -939,18 +927,18 @@ unsafe extern "C" fn client_configure_client_media( &from_glib_borrow(stream), &from_glib_borrow(ctx), ) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } unsafe extern "C" fn client_params_set( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPResult { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPResult { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -960,9 +948,9 @@ unsafe extern "C" fn client_params_set( } unsafe extern "C" fn client_params_get( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPResult { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPResult { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -972,8 +960,8 @@ unsafe extern "C" fn client_params_get( } unsafe extern "C" fn client_make_path_from_uri( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - url: *const gst_rtsp_sys::GstRTSPUrl, + ptr: *mut ffi::GstRTSPClient, + url: *const gst_rtsp::ffi::GstRTSPUrl, ) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -983,9 +971,7 @@ unsafe extern "C" fn client_make_path_from_uri( .to_glib_full() } -unsafe extern "C" fn client_closed( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, -) { +unsafe extern "C" fn client_closed(ptr: *mut ffi::GstRTSPClient) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -994,8 +980,8 @@ unsafe extern "C" fn client_closed( } unsafe extern "C" fn client_new_session( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - session: *mut gst_rtsp_server_sys::GstRTSPSession, + ptr: *mut ffi::GstRTSPClient, + session: *mut ffi::GstRTSPSession, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1005,8 +991,8 @@ unsafe extern "C" fn client_new_session( } unsafe extern "C" fn client_options_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1016,8 +1002,8 @@ unsafe extern "C" fn client_options_request( } unsafe extern "C" fn client_describe_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1027,8 +1013,8 @@ unsafe extern "C" fn client_describe_request( } unsafe extern "C" fn client_setup_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1038,8 +1024,8 @@ unsafe extern "C" fn client_setup_request( } unsafe extern "C" fn client_play_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1049,8 +1035,8 @@ unsafe extern "C" fn client_play_request( } unsafe extern "C" fn client_pause_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1060,8 +1046,8 @@ unsafe extern "C" fn client_pause_request( } unsafe extern "C" fn client_teardown_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1071,8 +1057,8 @@ unsafe extern "C" fn client_teardown_request( } unsafe extern "C" fn client_set_parameter_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1082,8 +1068,8 @@ unsafe extern "C" fn client_set_parameter_request( } unsafe extern "C" fn client_get_parameter_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1093,8 +1079,8 @@ unsafe extern "C" fn client_get_parameter_request( } unsafe extern "C" fn client_announce_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1104,8 +1090,8 @@ unsafe extern "C" fn client_announce_request( } unsafe extern "C" fn client_record_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1115,8 +1101,8 @@ unsafe extern "C" fn client_record_request( } unsafe extern "C" fn client_handle_response( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -1126,11 +1112,11 @@ unsafe extern "C" fn client_handle_response( } unsafe extern "C" fn client_handle_sdp( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, - media: *mut gst_rtsp_server_sys::GstRTSPMedia, - sdp: *mut gst_sdp_sys::GstSDPMessage, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, + media: *mut ffi::GstRTSPMedia, + sdp: *mut gst_sdp::ffi::GstSDPMessage, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1141,17 +1127,17 @@ unsafe extern "C" fn client_handle_sdp( &from_glib_borrow(media), &*(sdp as *mut _), ) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } unsafe extern "C" fn client_check_requirements( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, arr: *mut *mut std::os::raw::c_char, ) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); @@ -1167,9 +1153,9 @@ unsafe extern "C" fn client_check_requirements( } unsafe extern "C" fn client_pre_options_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1179,9 +1165,9 @@ unsafe extern "C" fn client_pre_options_request( } unsafe extern "C" fn client_pre_describe_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1191,9 +1177,9 @@ unsafe extern "C" fn client_pre_describe_request( } unsafe extern "C" fn client_pre_setup_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1203,9 +1189,9 @@ unsafe extern "C" fn client_pre_setup_request( } unsafe extern "C" fn client_pre_play_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1215,9 +1201,9 @@ unsafe extern "C" fn client_pre_play_request( } unsafe extern "C" fn client_pre_pause_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1227,9 +1213,9 @@ unsafe extern "C" fn client_pre_pause_request( } unsafe extern "C" fn client_pre_teardown_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1239,9 +1225,9 @@ unsafe extern "C" fn client_pre_teardown_request( } unsafe extern "C" fn client_pre_set_parameter_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1251,9 +1237,9 @@ unsafe extern "C" fn client_pre_set_parameter_request( } unsafe extern "C" fn client_pre_get_parameter_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1263,9 +1249,9 @@ unsafe extern "C" fn client_pre_get_parameter_request( } unsafe extern "C" fn client_pre_announce_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1275,9 +1261,9 @@ unsafe extern "C" fn client_pre_announce_request( } unsafe extern "C" fn client_pre_record_request( - ptr: *mut gst_rtsp_server_sys::GstRTSPClient, - ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode { + ptr: *mut ffi::GstRTSPClient, + ctx: *mut ffi::GstRTSPContext, +) -> gst_rtsp::ffi::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs index 179d717dd..5a11488ff 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs @@ -6,19 +6,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use gst_rtsp_server_sys; - use glib::prelude::*; use glib::subclass::prelude::*; use glib::translate::*; use std::ptr; -use RTSPMedia; -use RTSPThread; +use crate::RTSPMedia; +use crate::RTSPThread; #[derive(Debug)] -pub struct SDPInfo(ptr::NonNull); +pub struct SDPInfo(ptr::NonNull); impl SDPInfo { pub fn is_ipv6(&self) -> bool { @@ -85,11 +83,11 @@ pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync { self.parent_setup_sdp(media, sdp, info) } - fn new_stream(&self, media: &Self::Type, stream: &::RTSPStream) { + fn new_stream(&self, media: &Self::Type, stream: &crate::RTSPStream) { self.parent_new_stream(media, stream); } - fn removed_stream(&self, media: &Self::Type, stream: &::RTSPStream) { + fn removed_stream(&self, media: &Self::Type, stream: &crate::RTSPStream) { self.parent_removed_stream(media, stream); } @@ -144,8 +142,8 @@ pub trait RTSPMediaImplExt: ObjectSubclass { sdp: &mut gst_sdp::SDPMessageRef, info: &SDPInfo, ) -> Result<(), gst::LoggableError>; - fn parent_new_stream(&self, media: &Self::Type, stream: &::RTSPStream); - fn parent_removed_stream(&self, media: &Self::Type, stream: &::RTSPStream); + fn parent_new_stream(&self, media: &Self::Type, stream: &crate::RTSPStream); + fn parent_removed_stream(&self, media: &Self::Type, stream: &crate::RTSPStream); fn parent_prepared(&self, media: &Self::Type); fn parent_unprepared(&self, media: &Self::Type); fn parent_target_state(&self, media: &Self::Type, state: gst::State); @@ -161,8 +159,7 @@ impl RTSPMediaImplExt for T { fn parent_handle_message(&self, media: &Self::Type, message: &gst::MessageRef) -> bool { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).handle_message { from_glib(f( media.unsafe_cast_ref::().to_glib_none().0, @@ -181,10 +178,9 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).prepare { - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f( media.unsafe_cast_ref::().to_glib_none().0, thread.to_glib_none().0 @@ -201,10 +197,9 @@ impl RTSPMediaImplExt for T { fn parent_unprepare(&self, media: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepare { - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f(media.unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Parent function `unprepare` failed" @@ -218,10 +213,9 @@ impl RTSPMediaImplExt for T { fn parent_suspend(&self, media: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).suspend { - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f(media.unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Parent function `suspend` failed" @@ -235,10 +229,9 @@ impl RTSPMediaImplExt for T { fn parent_unsuspend(&self, media: &Self::Type) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unsuspend { - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f(media.unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Parent function `unsuspend` failed" @@ -256,14 +249,13 @@ impl RTSPMediaImplExt for T { use std::mem; let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).query_position { let mut position = mem::MaybeUninit::uninit(); if f( media.unsafe_cast_ref::().to_glib_none().0, position.as_mut_ptr(), - ) == glib_sys::GFALSE + ) == glib::ffi::GFALSE { None } else { @@ -280,14 +272,13 @@ impl RTSPMediaImplExt for T { use std::mem; let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).query_stop { let mut stop = mem::MaybeUninit::uninit(); if f( media.unsafe_cast_ref::().to_glib_none().0, stop.as_mut_ptr(), - ) == glib_sys::GFALSE + ) == glib::ffi::GFALSE { None } else { @@ -302,8 +293,7 @@ impl RTSPMediaImplExt for T { fn parent_create_rtpbin(&self, media: &Self::Type) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; let f = (*parent_class) .create_rtpbin .expect("No `create_rtpbin` virtual method implementation in parent class"); @@ -319,15 +309,14 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).setup_rtpbin { let ptr = rtpbin.to_glib_none().0; // The C code assumes to pass a floating reference around so let's make sure we do - gobject_sys::g_object_force_floating(ptr as *mut _); + glib::gobject_ffi::g_object_force_floating(ptr as *mut _); - let res = gst_result_from_gboolean!( + let res = gst::gst_result_from_gboolean!( f(media.unsafe_cast_ref::().to_glib_none().0, ptr), gst::CAT_RUST, "Parent function `setup_sdp` failed" @@ -336,8 +325,8 @@ impl RTSPMediaImplExt for T { // If the code didn't accidentally sink it then we have to do that // here now so that we don't have any floating reference on our side // anymore - if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE { - gobject_sys::g_object_ref_sink(ptr as *mut _); + if glib::gobject_ffi::g_object_is_floating(ptr as *mut _) != glib::ffi::GFALSE { + glib::gobject_ffi::g_object_ref_sink(ptr as *mut _); } res @@ -355,16 +344,15 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; let f = (*parent_class) .setup_sdp .expect("No `setup_sdp` virtual method implementation in parent class"); - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f( media.unsafe_cast_ref::().to_glib_none().0, - sdp as *mut _ as *mut gst_sdp_sys::GstSDPMessage, + sdp as *mut _ as *mut gst_sdp::ffi::GstSDPMessage, info.0.as_ptr() ), gst::CAT_RUST, @@ -373,11 +361,10 @@ impl RTSPMediaImplExt for T { } } - fn parent_new_stream(&self, media: &Self::Type, stream: &::RTSPStream) { + fn parent_new_stream(&self, media: &Self::Type, stream: &crate::RTSPStream) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_stream { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -387,11 +374,10 @@ impl RTSPMediaImplExt for T { } } - fn parent_removed_stream(&self, media: &Self::Type, stream: &::RTSPStream) { + fn parent_removed_stream(&self, media: &Self::Type, stream: &crate::RTSPStream) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).removed_stream { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -404,8 +390,7 @@ impl RTSPMediaImplExt for T { fn parent_prepared(&self, media: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).prepared { f(media.unsafe_cast_ref::().to_glib_none().0); } @@ -415,8 +400,7 @@ impl RTSPMediaImplExt for T { fn parent_unprepared(&self, media: &Self::Type) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepared { f(media.unsafe_cast_ref::().to_glib_none().0); } @@ -426,8 +410,7 @@ impl RTSPMediaImplExt for T { fn parent_target_state(&self, media: &Self::Type, state: gst::State) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).target_state { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -440,8 +423,7 @@ impl RTSPMediaImplExt for T { fn parent_new_state(&self, media: &Self::Type, state: gst::State) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_state { f( media.unsafe_cast_ref::().to_glib_none().0, @@ -458,16 +440,15 @@ impl RTSPMediaImplExt for T { ) -> Result<(), gst::LoggableError> { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaClass; let f = (*parent_class) .handle_sdp .expect("No `handle_sdp` virtual method implementation in parent class"); - gst_result_from_gboolean!( + gst::gst_result_from_gboolean!( f( media.unsafe_cast_ref::().to_glib_none().0, - sdp as *const _ as *mut gst_sdp_sys::GstSDPMessage + sdp as *const _ as *mut gst_sdp::ffi::GstSDPMessage ), gst::CAT_RUST, "Parent function `handle_sdp` failed" @@ -500,9 +481,9 @@ unsafe impl IsSubclassable for RTSPMedia { } unsafe extern "C" fn media_handle_message( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - message: *mut gst_sys::GstMessage, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, + message: *mut gst::ffi::GstMessage, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -512,74 +493,74 @@ unsafe extern "C" fn media_handle_message( } unsafe extern "C" fn media_prepare( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - thread: *mut gst_rtsp_server_sys::GstRTSPThread, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, + thread: *mut ffi::GstRTSPThread, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.prepare(wrap.unsafe_cast_ref(), &from_glib_borrow(thread)) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } unsafe extern "C" fn media_unprepare( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.unprepare(wrap.unsafe_cast_ref()) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } unsafe extern "C" fn media_suspend( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.suspend(wrap.unsafe_cast_ref()) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } unsafe extern "C" fn media_unsuspend( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); match imp.unsuspend(wrap.unsafe_cast_ref()) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } unsafe extern "C" fn media_query_position( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, + ptr: *mut ffi::GstRTSPMedia, position: *mut i64, -) -> glib_sys::gboolean { +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -587,16 +568,16 @@ unsafe extern "C" fn media_query_position( match imp.query_position(wrap.unsafe_cast_ref()) { Some(pos) => { *position = pos.to_glib() as i64; - glib_sys::GTRUE + glib::ffi::GTRUE } - None => glib_sys::GFALSE, + None => glib::ffi::GFALSE, } } unsafe extern "C" fn media_query_stop( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, + ptr: *mut ffi::GstRTSPMedia, stop: *mut i64, -) -> glib_sys::gboolean { +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -604,61 +585,61 @@ unsafe extern "C" fn media_query_stop( match imp.query_stop(wrap.unsafe_cast_ref()) { Some(s) => { *stop = s.to_glib() as i64; - glib_sys::GTRUE + glib::ffi::GTRUE } - None => glib_sys::GFALSE, + None => glib::ffi::GFALSE, } } unsafe extern "C" fn media_create_rtpbin( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> *mut gst_sys::GstElement { + ptr: *mut ffi::GstRTSPMedia, +) -> *mut gst::ffi::GstElement { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); - let res: *mut gst_sys::GstElement = imp.create_rtpbin(wrap.unsafe_cast_ref()).to_glib_full(); + let res: *mut gst::ffi::GstElement = imp.create_rtpbin(wrap.unsafe_cast_ref()).to_glib_full(); if !res.is_null() { - gobject_sys::g_object_force_floating(res as *mut _); + glib::gobject_ffi::g_object_force_floating(res as *mut _); } res } unsafe extern "C" fn media_setup_rtpbin( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - rtpbin: *mut gst_sys::GstElement, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, + rtpbin: *mut gst::ffi::GstElement, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); // If the rtpbin was floating before make sure it is not anymore for now so // we don't accidentally take ownership of it somewhere along the line - if gobject_sys::g_object_is_floating(rtpbin as *mut _) != glib_sys::GFALSE { - gobject_sys::g_object_ref_sink(rtpbin as *mut _); + if glib::gobject_ffi::g_object_is_floating(rtpbin as *mut _) != glib::ffi::GFALSE { + glib::gobject_ffi::g_object_ref_sink(rtpbin as *mut _); } let res = match imp.setup_rtpbin(wrap.unsafe_cast_ref(), &from_glib_borrow(rtpbin)) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } }; // Ensure that the rtpbin is still floating afterwards here - gobject_sys::g_object_force_floating(rtpbin as *mut _); + glib::gobject_ffi::g_object_force_floating(rtpbin as *mut _); res } unsafe extern "C" fn media_setup_sdp( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - sdp: *mut gst_sdp_sys::GstSDPMessage, - info: *mut gst_rtsp_server_sys::GstSDPInfo, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, + sdp: *mut gst_sdp::ffi::GstSDPMessage, + info: *mut ffi::GstSDPInfo, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -668,17 +649,17 @@ unsafe extern "C" fn media_setup_sdp( &mut *(sdp as *mut gst_sdp::SDPMessageRef), &SDPInfo(ptr::NonNull::new(info).expect("NULL SDPInfo")), ) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } unsafe extern "C" fn media_new_stream( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - stream: *mut gst_rtsp_server_sys::GstRTSPStream, + ptr: *mut ffi::GstRTSPMedia, + stream: *mut ffi::GstRTSPStream, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -688,8 +669,8 @@ unsafe extern "C" fn media_new_stream( } unsafe extern "C" fn media_removed_stream( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - stream: *mut gst_rtsp_server_sys::GstRTSPStream, + ptr: *mut ffi::GstRTSPMedia, + stream: *mut ffi::GstRTSPStream, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -698,7 +679,7 @@ unsafe extern "C" fn media_removed_stream( imp.removed_stream(wrap.unsafe_cast_ref(), &from_glib_borrow(stream)); } -unsafe extern "C" fn media_prepared(ptr: *mut gst_rtsp_server_sys::GstRTSPMedia) { +unsafe extern "C" fn media_prepared(ptr: *mut ffi::GstRTSPMedia) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -706,9 +687,7 @@ unsafe extern "C" fn media_prepared(ptr: *mut gst_rtsp_server_ imp.prepared(wrap.unsafe_cast_ref()); } -unsafe extern "C" fn media_unprepared( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) { +unsafe extern "C" fn media_unprepared(ptr: *mut ffi::GstRTSPMedia) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -717,8 +696,8 @@ unsafe extern "C" fn media_unprepared( } unsafe extern "C" fn media_target_state( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - state: gst_sys::GstState, + ptr: *mut ffi::GstRTSPMedia, + state: gst::ffi::GstState, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -728,8 +707,8 @@ unsafe extern "C" fn media_target_state( } unsafe extern "C" fn media_new_state( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - state: gst_sys::GstState, + ptr: *mut ffi::GstRTSPMedia, + state: gst::ffi::GstState, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -739,9 +718,9 @@ unsafe extern "C" fn media_new_state( } unsafe extern "C" fn media_handle_sdp( - ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, - sdp: *mut gst_sdp_sys::GstSDPMessage, -) -> glib_sys::gboolean { + ptr: *mut ffi::GstRTSPMedia, + sdp: *mut gst_sdp::ffi::GstSDPMessage, +) -> glib::ffi::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -750,10 +729,10 @@ unsafe extern "C" fn media_handle_sdp( wrap.unsafe_cast_ref(), &*(sdp as *const gst_sdp::SDPMessageRef), ) { - Ok(()) => glib_sys::GTRUE, + Ok(()) => glib::ffi::GTRUE, Err(err) => { err.log_with_object(&*wrap); - glib_sys::GFALSE + glib::ffi::GFALSE } } } diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index 29fc2b2ca..61f89cce0 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -6,15 +6,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use gst_rtsp_server_sys; - use glib::prelude::*; use glib::subclass::prelude::*; use glib::translate::*; -use gst_rtsp; - -use RTSPMediaFactory; +use crate::RTSPMediaFactory; use std::mem::transmute; @@ -31,23 +27,27 @@ pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sy self.parent_create_element(factory, url) } - fn construct(&self, factory: &Self::Type, url: &gst_rtsp::RTSPUrl) -> Option<::RTSPMedia> { + fn construct(&self, factory: &Self::Type, url: &gst_rtsp::RTSPUrl) -> Option { self.parent_construct(factory, url) } - fn create_pipeline(&self, factory: &Self::Type, media: &::RTSPMedia) -> Option { + fn create_pipeline( + &self, + factory: &Self::Type, + media: &crate::RTSPMedia, + ) -> Option { self.parent_create_pipeline(factory, media) } - fn configure(&self, factory: &Self::Type, media: &::RTSPMedia) { + fn configure(&self, factory: &Self::Type, media: &crate::RTSPMedia) { self.parent_configure(factory, media) } - fn media_constructed(&self, factory: &Self::Type, media: &::RTSPMedia) { + fn media_constructed(&self, factory: &Self::Type, media: &crate::RTSPMedia) { self.parent_media_constructed(factory, media) } - fn media_configure(&self, factory: &Self::Type, media: &::RTSPMedia) { + fn media_configure(&self, factory: &Self::Type, media: &crate::RTSPMedia) { self.parent_media_configure(factory, media) } } @@ -69,18 +69,18 @@ pub trait RTSPMediaFactoryImplExt: ObjectSubclass { &self, factory: &Self::Type, url: &gst_rtsp::RTSPUrl, - ) -> Option<::RTSPMedia>; + ) -> Option; fn parent_create_pipeline( &self, factory: &Self::Type, - media: &::RTSPMedia, + media: &crate::RTSPMedia, ) -> Option; - fn parent_configure(&self, factory: &Self::Type, media: &::RTSPMedia); + fn parent_configure(&self, factory: &Self::Type, media: &crate::RTSPMedia); - fn parent_media_constructed(&self, factory: &Self::Type, media: &::RTSPMedia); - fn parent_media_configure(&self, factory: &Self::Type, media: &::RTSPMedia); + fn parent_media_constructed(&self, factory: &Self::Type, media: &crate::RTSPMedia); + fn parent_media_configure(&self, factory: &Self::Type, media: &crate::RTSPMedia); } impl RTSPMediaFactoryImplExt for T { @@ -91,8 +91,8 @@ impl RTSPMediaFactoryImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() - as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; + let parent_class = + data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .gen_key .map(|f| { @@ -115,8 +115,8 @@ impl RTSPMediaFactoryImplExt for T { ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() - as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; + let parent_class = + data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .create_element .map(|f| { @@ -136,11 +136,11 @@ impl RTSPMediaFactoryImplExt for T { &self, factory: &Self::Type, url: &gst_rtsp::RTSPUrl, - ) -> Option<::RTSPMedia> { + ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() - as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; + let parent_class = + data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .construct .map(|f| { @@ -159,12 +159,12 @@ impl RTSPMediaFactoryImplExt for T { fn parent_create_pipeline( &self, factory: &Self::Type, - media: &::RTSPMedia, + media: &crate::RTSPMedia, ) -> Option { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() - as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; + let parent_class = + data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; (*parent_class) .create_pipeline .map(|f| { @@ -174,11 +174,11 @@ impl RTSPMediaFactoryImplExt for T { .to_glib_none() .0, media.to_glib_none().0, - ) as *mut gst_sys::GstPipeline; + ) as *mut gst::ffi::GstPipeline; // See https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/merge_requests/109 - if gobject_sys::g_object_is_floating(ptr as *mut _) != glib_sys::GFALSE { - gobject_sys::g_object_ref_sink(ptr as *mut _); + if glib::gobject_ffi::g_object_is_floating(ptr as *mut _) != glib::ffi::GFALSE { + glib::gobject_ffi::g_object_ref_sink(ptr as *mut _); } from_glib_none(ptr) }) @@ -186,11 +186,11 @@ impl RTSPMediaFactoryImplExt for T { } } - fn parent_configure(&self, factory: &Self::Type, media: &::RTSPMedia) { + fn parent_configure(&self, factory: &Self::Type, media: &crate::RTSPMedia) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() - as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; + let parent_class = + data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).configure { f( factory @@ -203,11 +203,11 @@ impl RTSPMediaFactoryImplExt for T { } } - fn parent_media_constructed(&self, factory: &Self::Type, media: &::RTSPMedia) { + fn parent_media_constructed(&self, factory: &Self::Type, media: &crate::RTSPMedia) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() - as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; + let parent_class = + data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_constructed { f( factory @@ -220,11 +220,11 @@ impl RTSPMediaFactoryImplExt for T { } } - fn parent_media_configure(&self, factory: &Self::Type, media: &::RTSPMedia) { + fn parent_media_configure(&self, factory: &Self::Type, media: &crate::RTSPMedia) { unsafe { let data = T::type_data(); - let parent_class = data.as_ref().get_parent_class() - as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; + let parent_class = + data.as_ref().get_parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_configure { f( factory @@ -252,8 +252,8 @@ unsafe impl IsSubclassable for RTSPMediaFactory { } unsafe extern "C" fn factory_gen_key( - ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, - url: *const gst_rtsp_sys::GstRTSPUrl, + ptr: *mut ffi::GstRTSPMediaFactory, + url: *const gst_rtsp::ffi::GstRTSPUrl, ) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -264,9 +264,9 @@ unsafe extern "C" fn factory_gen_key( } unsafe extern "C" fn factory_create_element( - ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, - url: *const gst_rtsp_sys::GstRTSPUrl, -) -> *mut gst_sys::GstElement { + ptr: *mut ffi::GstRTSPMediaFactory, + url: *const gst_rtsp::ffi::GstRTSPUrl, +) -> *mut gst::ffi::GstElement { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -274,14 +274,14 @@ unsafe extern "C" fn factory_create_element( let element = imp .create_element(wrap.unsafe_cast_ref(), &from_glib_borrow(url)) .to_glib_full(); - gobject_sys::g_object_force_floating(element as *mut _); + glib::gobject_ffi::g_object_force_floating(element as *mut _); element } unsafe extern "C" fn factory_construct( - ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, - url: *const gst_rtsp_sys::GstRTSPUrl, -) -> *mut gst_rtsp_server_sys::GstRTSPMedia { + ptr: *mut ffi::GstRTSPMediaFactory, + url: *const gst_rtsp::ffi::GstRTSPUrl, +) -> *mut ffi::GstRTSPMedia { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -291,9 +291,9 @@ unsafe extern "C" fn factory_construct( } unsafe extern "C" fn factory_create_pipeline( - ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, - media: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> *mut gst_sys::GstElement { + ptr: *mut ffi::GstRTSPMediaFactory, + media: *mut ffi::GstRTSPMedia, +) -> *mut gst::ffi::GstElement { use once_cell::sync::Lazy; static PIPELINE_QUARK: Lazy = @@ -303,17 +303,17 @@ unsafe extern "C" fn factory_create_pipeline( let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); - let pipeline: *mut gst_sys::GstPipeline = imp + let pipeline: *mut gst::ffi::GstPipeline = imp .create_pipeline(wrap.unsafe_cast_ref(), &from_glib_borrow(media)) .to_glib_full(); // FIXME We somehow need to ensure the pipeline actually stays alive... - gobject_sys::g_object_set_qdata_full( + glib::gobject_ffi::g_object_set_qdata_full( media as *mut _, PIPELINE_QUARK.to_glib(), pipeline as *mut _, - Some(transmute::<_, unsafe extern "C" fn(glib_sys::gpointer)>( - gobject_sys::g_object_unref as *const (), + Some(transmute::<_, unsafe extern "C" fn(glib::ffi::gpointer)>( + glib::gobject_ffi::g_object_unref as *const (), )), ); @@ -321,8 +321,8 @@ unsafe extern "C" fn factory_create_pipeline( } unsafe extern "C" fn factory_configure( - ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, - media: *mut gst_rtsp_server_sys::GstRTSPMedia, + ptr: *mut ffi::GstRTSPMediaFactory, + media: *mut ffi::GstRTSPMedia, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -332,8 +332,8 @@ unsafe extern "C" fn factory_configure( } unsafe extern "C" fn factory_media_constructed( - ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, - media: *mut gst_rtsp_server_sys::GstRTSPMedia, + ptr: *mut ffi::GstRTSPMediaFactory, + media: *mut ffi::GstRTSPMedia, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); @@ -343,8 +343,8 @@ unsafe extern "C" fn factory_media_constructed( } unsafe extern "C" fn factory_media_configure( - ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, - media: *mut gst_rtsp_server_sys::GstRTSPMedia, + ptr: *mut ffi::GstRTSPMediaFactory, + media: *mut ffi::GstRTSPMedia, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs index c01b9baf3..a49191c6b 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs @@ -6,36 +6,33 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use gst_rtsp_server_sys; - use glib::prelude::*; use glib::subclass::prelude::*; use glib::translate::*; -use RTSPServer; +use crate::RTSPServer; pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync { - fn create_client(&self, server: &Self::Type) -> Option<::RTSPClient> { + fn create_client(&self, server: &Self::Type) -> Option { self.parent_create_client(server) } - fn client_connected(&self, server: &Self::Type, client: &::RTSPClient) { + fn client_connected(&self, server: &Self::Type, client: &crate::RTSPClient) { self.parent_client_connected(server, client); } } pub trait RTSPServerImplExt: ObjectSubclass { - fn parent_create_client(&self, server: &Self::Type) -> Option<::RTSPClient>; + fn parent_create_client(&self, server: &Self::Type) -> Option; - fn parent_client_connected(&self, server: &Self::Type, client: &::RTSPClient); + fn parent_client_connected(&self, server: &Self::Type, client: &crate::RTSPClient); } impl RTSPServerImplExt for T { - fn parent_create_client(&self, server: &Self::Type) -> Option<::RTSPClient> { + fn parent_create_client(&self, server: &Self::Type) -> Option { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPServerClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPServerClass; let f = (*parent_class) .create_client .expect("No `create_client` virtual method implementation in parent class"); @@ -43,11 +40,10 @@ impl RTSPServerImplExt for T { } } - fn parent_client_connected(&self, server: &Self::Type, client: &::RTSPClient) { + fn parent_client_connected(&self, server: &Self::Type, client: &crate::RTSPClient) { unsafe { let data = T::type_data(); - let parent_class = - data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPServerClass; + let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstRTSPServerClass; if let Some(f) = (*parent_class).client_connected { f( server.unsafe_cast_ref::().to_glib_none().0, @@ -67,8 +63,8 @@ unsafe impl IsSubclassable for RTSPServer { } unsafe extern "C" fn server_create_client( - ptr: *mut gst_rtsp_server_sys::GstRTSPServer, -) -> *mut gst_rtsp_server_sys::GstRTSPClient { + ptr: *mut ffi::GstRTSPServer, +) -> *mut ffi::GstRTSPClient { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -77,8 +73,8 @@ unsafe extern "C" fn server_create_client( } unsafe extern "C" fn server_client_connected( - ptr: *mut gst_rtsp_server_sys::GstRTSPServer, - client: *mut gst_rtsp_server_sys::GstRTSPClient, + ptr: *mut ffi::GstRTSPServer, + client: *mut ffi::GstRTSPClient, ) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl();