mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
gstreamer-rtsp-server: Update manual code to 2018 edition
This commit is contained in:
parent
1e9d3e717c
commit
1099955249
18 changed files with 511 additions and 623 deletions
|
@ -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"]
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {
|
|||
) -> Result<RTSPAddress, RTSPAddressPoolResult> {
|
||||
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,
|
||||
|
|
|
@ -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<O: IsA<RTSPAuth>> 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<RTSPAuth>,
|
||||
{
|
||||
|
|
|
@ -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<O: IsA<RTSPClient>> 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,
|
||||
))
|
||||
|
|
|
@ -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<gst_rtsp_server_sys::GstRTSPContext>);
|
||||
pub struct RTSPContext(ptr::NonNull<ffi::GstRTSPContext>);
|
||||
|
||||
impl RTSPContext {
|
||||
pub fn with_current_context<F: FnOnce(&RTSPContext) -> T, T>(func: F) -> Option<T> {
|
||||
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<Self> {
|
||||
unsafe fn from_glib_borrow(ptr: *mut ffi::GstRTSPContext) -> Borrowed<Self> {
|
||||
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!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<P: IsA<gst::Pipeline>>(&self, pipeline: &P);
|
||||
|
@ -14,13 +12,10 @@ impl<O: IsA<RTSPMedia>> 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 _);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<O: IsA<RTSPMediaFactory>> 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(),
|
||||
);
|
||||
|
|
|
@ -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<O: IsA<RTSPServer>> 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,
|
||||
))
|
||||
|
|
|
@ -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<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(
|
||||
pool: *mut gst_rtsp_server_sys::GstRTSPSessionPool,
|
||||
pool: *mut ffi::GstRTSPSessionPool,
|
||||
func: gpointer,
|
||||
) -> gboolean {
|
||||
let func: &RefCell<F> = &*(func as *const RefCell<F>);
|
||||
|
@ -44,22 +41,20 @@ impl<O: IsA<RTSPSessionPool>> 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::<F> as *const ())),
|
||||
into_raw_watch(func),
|
||||
Some(destroy_closure_watch::<F>),
|
||||
);
|
||||
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)
|
||||
|
|
|
@ -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<gst::FlowSuccess, gst::FlowError>;
|
||||
|
@ -13,7 +11,7 @@ pub trait RTSPStreamExtManual: 'static {
|
|||
impl<O: IsA<RTSPStream>> RTSPStreamExtManual for O {
|
||||
fn recv_rtcp(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
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<O: IsA<RTSPStream>> RTSPStreamExtManual for O {
|
|||
|
||||
fn recv_rtp(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
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(),
|
||||
))
|
||||
|
|
|
@ -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<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExtManual for O {
|
|||
buffer: &gst::Buffer,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
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(),
|
||||
|
|
|
@ -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<Self> {
|
||||
pub fn new(type_: crate::RTSPThreadType) -> Option<Self> {
|
||||
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_) }
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> {
|
||||
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<gst::Structure> {
|
||||
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 {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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<gst_rtsp_server_sys::GstSDPInfo>);
|
||||
pub struct SDPInfo(ptr::NonNull<ffi::GstSDPInfo>);
|
||||
|
||||
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<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
|
@ -181,10 +178,9 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
thread.to_glib_none().0
|
||||
|
@ -201,10 +197,9 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0),
|
||||
gst::CAT_RUST,
|
||||
"Parent function `unprepare` failed"
|
||||
|
@ -218,10 +213,9 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0),
|
||||
gst::CAT_RUST,
|
||||
"Parent function `suspend` failed"
|
||||
|
@ -235,10 +229,9 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0),
|
||||
gst::CAT_RUST,
|
||||
"Parent function `unsuspend` failed"
|
||||
|
@ -256,14 +249,13 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
position.as_mut_ptr(),
|
||||
) == glib_sys::GFALSE
|
||||
) == glib::ffi::GFALSE
|
||||
{
|
||||
None
|
||||
} else {
|
||||
|
@ -280,14 +272,13 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
stop.as_mut_ptr(),
|
||||
) == glib_sys::GFALSE
|
||||
) == glib::ffi::GFALSE
|
||||
{
|
||||
None
|
||||
} else {
|
||||
|
@ -302,8 +293,7 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
|
|||
fn parent_create_rtpbin(&self, media: &Self::Type) -> Option<gst::Element> {
|
||||
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<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0, ptr),
|
||||
gst::CAT_RUST,
|
||||
"Parent function `setup_sdp` failed"
|
||||
|
@ -336,8 +325,8 @@ impl<T: RTSPMediaImpl> 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<T: RTSPMediaImpl> 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::<RTSPMedia>().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<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
|
@ -387,11 +374,10 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
|
@ -404,8 +390,7 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0);
|
||||
}
|
||||
|
@ -415,8 +400,7 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0);
|
||||
}
|
||||
|
@ -426,8 +410,7 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
|
@ -440,8 +423,7 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().to_glib_none().0,
|
||||
|
@ -458,16 +440,15 @@ impl<T: RTSPMediaImpl> 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::<RTSPMedia>().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<T: RTSPMediaImpl> IsSubclassable<T> for RTSPMedia {
|
|||
}
|
||||
|
||||
unsafe extern "C" fn media_handle_message<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = from_glib_borrow(ptr);
|
||||
|
@ -512,74 +493,74 @@ unsafe extern "C" fn media_handle_message<T: RTSPMediaImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn media_prepare<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = 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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = 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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = 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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = 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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = from_glib_borrow(ptr);
|
||||
|
@ -587,16 +568,16 @@ unsafe extern "C" fn media_query_position<T: RTSPMediaImpl>(
|
|||
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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = from_glib_borrow(ptr);
|
||||
|
@ -604,61 +585,61 @@ unsafe extern "C" fn media_query_stop<T: RTSPMediaImpl>(
|
|||
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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = 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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = 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<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = from_glib_borrow(ptr);
|
||||
|
@ -668,17 +649,17 @@ unsafe extern "C" fn media_setup_sdp<T: RTSPMediaImpl>(
|
|||
&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<T: RTSPMediaImpl>(
|
||||
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<T: RTSPMediaImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn media_removed_stream<T: RTSPMediaImpl>(
|
||||
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<T: RTSPMediaImpl>(
|
|||
imp.removed_stream(wrap.unsafe_cast_ref(), &from_glib_borrow(stream));
|
||||
}
|
||||
|
||||
unsafe extern "C" fn media_prepared<T: RTSPMediaImpl>(ptr: *mut gst_rtsp_server_sys::GstRTSPMedia) {
|
||||
unsafe extern "C" fn media_prepared<T: RTSPMediaImpl>(ptr: *mut ffi::GstRTSPMedia) {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let wrap: Borrowed<RTSPMedia> = from_glib_borrow(ptr);
|
||||
|
@ -706,9 +687,7 @@ unsafe extern "C" fn media_prepared<T: RTSPMediaImpl>(ptr: *mut gst_rtsp_server_
|
|||
imp.prepared(wrap.unsafe_cast_ref());
|
||||
}
|
||||
|
||||
unsafe extern "C" fn media_unprepared<T: RTSPMediaImpl>(
|
||||
ptr: *mut gst_rtsp_server_sys::GstRTSPMedia,
|
||||
) {
|
||||
unsafe extern "C" fn media_unprepared<T: RTSPMediaImpl>(ptr: *mut ffi::GstRTSPMedia) {
|
||||
let instance = &*(ptr as *mut T::Instance);
|
||||
let imp = instance.get_impl();
|
||||
let wrap: Borrowed<RTSPMedia> = from_glib_borrow(ptr);
|
||||
|
@ -717,8 +696,8 @@ unsafe extern "C" fn media_unprepared<T: RTSPMediaImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn media_target_state<T: RTSPMediaImpl>(
|
||||
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<T: RTSPMediaImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn media_new_state<T: RTSPMediaImpl>(
|
||||
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<T: RTSPMediaImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn media_handle_sdp<T: RTSPMediaImpl>(
|
||||
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<RTSPMedia> = from_glib_borrow(ptr);
|
||||
|
@ -750,10 +729,10 @@ unsafe extern "C" fn media_handle_sdp<T: RTSPMediaImpl>(
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<crate::RTSPMedia> {
|
||||
self.parent_construct(factory, url)
|
||||
}
|
||||
|
||||
fn create_pipeline(&self, factory: &Self::Type, media: &::RTSPMedia) -> Option<gst::Pipeline> {
|
||||
fn create_pipeline(
|
||||
&self,
|
||||
factory: &Self::Type,
|
||||
media: &crate::RTSPMedia,
|
||||
) -> Option<gst::Pipeline> {
|
||||
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<crate::RTSPMedia>;
|
||||
|
||||
fn parent_create_pipeline(
|
||||
&self,
|
||||
factory: &Self::Type,
|
||||
media: &::RTSPMedia,
|
||||
media: &crate::RTSPMedia,
|
||||
) -> Option<gst::Pipeline>;
|
||||
|
||||
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<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {
|
||||
|
@ -91,8 +91,8 @@ impl<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {
|
|||
) -> Option<glib::GString> {
|
||||
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<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {
|
|||
) -> Option<gst::Element> {
|
||||
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<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {
|
|||
&self,
|
||||
factory: &Self::Type,
|
||||
url: &gst_rtsp::RTSPUrl,
|
||||
) -> Option<::RTSPMedia> {
|
||||
) -> Option<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;
|
||||
(*parent_class)
|
||||
.construct
|
||||
.map(|f| {
|
||||
|
@ -159,12 +159,12 @@ impl<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {
|
|||
fn parent_create_pipeline(
|
||||
&self,
|
||||
factory: &Self::Type,
|
||||
media: &::RTSPMedia,
|
||||
media: &crate::RTSPMedia,
|
||||
) -> Option<gst::Pipeline> {
|
||||
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<T: RTSPMediaFactoryImpl> 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<T: RTSPMediaFactoryImpl> 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<T: RTSPMediaFactoryImpl> 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<T: RTSPMediaFactoryImpl> 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<T: RTSPMediaFactoryImpl> IsSubclassable<T> for RTSPMediaFactory {
|
|||
}
|
||||
|
||||
unsafe extern "C" fn factory_gen_key<T: RTSPMediaFactoryImpl>(
|
||||
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<T: RTSPMediaFactoryImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn factory_create_element<T: RTSPMediaFactoryImpl>(
|
||||
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<RTSPMediaFactory> = from_glib_borrow(ptr);
|
||||
|
@ -274,14 +274,14 @@ unsafe extern "C" fn factory_create_element<T: RTSPMediaFactoryImpl>(
|
|||
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<T: RTSPMediaFactoryImpl>(
|
||||
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<RTSPMediaFactory> = from_glib_borrow(ptr);
|
||||
|
@ -291,9 +291,9 @@ unsafe extern "C" fn factory_construct<T: RTSPMediaFactoryImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn factory_create_pipeline<T: RTSPMediaFactoryImpl>(
|
||||
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<glib::Quark> =
|
||||
|
@ -303,17 +303,17 @@ unsafe extern "C" fn factory_create_pipeline<T: RTSPMediaFactoryImpl>(
|
|||
let imp = instance.get_impl();
|
||||
let wrap: Borrowed<RTSPMediaFactory> = 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<T: RTSPMediaFactoryImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn factory_configure<T: RTSPMediaFactoryImpl>(
|
||||
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<T: RTSPMediaFactoryImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn factory_media_constructed<T: RTSPMediaFactoryImpl>(
|
||||
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<T: RTSPMediaFactoryImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn factory_media_configure<T: RTSPMediaFactoryImpl>(
|
||||
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();
|
||||
|
|
|
@ -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<crate::RTSPClient> {
|
||||
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<crate::RTSPClient>;
|
||||
|
||||
fn parent_client_connected(&self, server: &Self::Type, client: &::RTSPClient);
|
||||
fn parent_client_connected(&self, server: &Self::Type, client: &crate::RTSPClient);
|
||||
}
|
||||
|
||||
impl<T: RTSPServerImpl> RTSPServerImplExt for T {
|
||||
fn parent_create_client(&self, server: &Self::Type) -> Option<::RTSPClient> {
|
||||
fn parent_create_client(&self, server: &Self::Type) -> Option<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;
|
||||
let f = (*parent_class)
|
||||
.create_client
|
||||
.expect("No `create_client` virtual method implementation in parent class");
|
||||
|
@ -43,11 +40,10 @@ impl<T: RTSPServerImpl> 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::<RTSPServer>().to_glib_none().0,
|
||||
|
@ -67,8 +63,8 @@ unsafe impl<T: RTSPServerImpl> IsSubclassable<T> for RTSPServer {
|
|||
}
|
||||
|
||||
unsafe extern "C" fn server_create_client<T: RTSPServerImpl>(
|
||||
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<RTSPServer> = from_glib_borrow(ptr);
|
||||
|
@ -77,8 +73,8 @@ unsafe extern "C" fn server_create_client<T: RTSPServerImpl>(
|
|||
}
|
||||
|
||||
unsafe extern "C" fn server_client_connected<T: RTSPServerImpl>(
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue