rtsp-server: Add bindings for Onvif-specific client/media/media-factory/server

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/373
This commit is contained in:
Sebastian Dröge 2022-02-18 13:21:10 +02:00
parent 0873db2a41
commit 523abc7b3f
8 changed files with 354 additions and 0 deletions

View file

@ -24,6 +24,9 @@ generate = [
"GstRtspServer.RTSPFilterResult",
"GstRtspServer.RTSPMediaFactoryURI",
"GstRtspServer.RTSPMediaStatus",
"GstRtspServer.RTSPOnvifClient",
"GstRtspServer.RTSPOnvifMedia",
"GstRtspServer.RTSPOnvifServer",
"GstRtspServer.RTSPPublishClockMode",
"GstRtspServer.RTSPSuspendMode",
"GstRtspServer.RTSPThreadPool",
@ -236,6 +239,14 @@ status="generate"
[object.function.return]
nullable_return_is_error = "Failed to make path"
[[object]]
name = "GstRtspServer.RTSPOnvifMediaFactory"
status = "generate"
manual_traits = ["RTSPMediaExtManual"]
[[object.function]]
name = "requires_backchannel"
# on extension trait
manual = true
[[object]]
name = "GstRtspServer.RTSPServer"

View file

@ -24,6 +24,34 @@ pub use self::rtsp_media_factory_uri::RTSPMediaFactoryURI;
mod rtsp_mount_points;
pub use self::rtsp_mount_points::RTSPMountPoints;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
mod rtsp_onvif_client;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use self::rtsp_onvif_client::RTSPOnvifClient;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
mod rtsp_onvif_media;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use self::rtsp_onvif_media::RTSPOnvifMedia;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
mod rtsp_onvif_media_factory;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use self::rtsp_onvif_media_factory::RTSPOnvifMediaFactory;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
mod rtsp_onvif_server;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use self::rtsp_onvif_server::RTSPOnvifServer;
mod rtsp_server;
pub use self::rtsp_server::RTSPServer;
@ -69,6 +97,12 @@ pub mod traits {
pub use super::rtsp_media_factory::RTSPMediaFactoryExt;
pub use super::rtsp_media_factory_uri::RTSPMediaFactoryURIExt;
pub use super::rtsp_mount_points::RTSPMountPointsExt;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use super::rtsp_onvif_media::RTSPOnvifMediaExt;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use super::rtsp_onvif_media_factory::RTSPOnvifMediaFactoryExt;
pub use super::rtsp_server::RTSPServerExt;
pub use super::rtsp_session::RTSPSessionExt;
pub use super::rtsp_session_media::RTSPSessionMediaExt;

View file

@ -0,0 +1,44 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::RTSPClient;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
use glib::object::Cast;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstRTSPOnvifClient")]
pub struct RTSPOnvifClient(Object<ffi::GstRTSPOnvifClient, ffi::GstRTSPOnvifClientClass>) @extends RTSPClient;
match fn {
type_ => || ffi::gst_rtsp_onvif_client_get_type(),
}
}
impl RTSPOnvifClient {
pub const NONE: Option<&'static RTSPOnvifClient> = None;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_rtsp_onvif_client_new")]
pub fn new() -> RTSPOnvifClient {
assert_initialized_main_thread!();
unsafe { RTSPClient::from_glib_full(ffi::gst_rtsp_onvif_client_new()).unsafe_cast() }
}
}
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
impl Default for RTSPOnvifClient {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPOnvifClient {}
unsafe impl Sync for RTSPOnvifClient {}

View file

@ -0,0 +1,61 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::RTSPMedia;
use glib::object::IsA;
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstRTSPOnvifMedia")]
pub struct RTSPOnvifMedia(Object<ffi::GstRTSPOnvifMedia, ffi::GstRTSPOnvifMediaClass>) @extends RTSPMedia;
match fn {
type_ => || ffi::gst_rtsp_onvif_media_get_type(),
}
}
impl RTSPOnvifMedia {
pub const NONE: Option<&'static RTSPOnvifMedia> = None;
}
unsafe impl Send for RTSPOnvifMedia {}
unsafe impl Sync for RTSPOnvifMedia {}
pub trait RTSPOnvifMediaExt: 'static {
#[doc(alias = "gst_rtsp_onvif_media_collect_backchannel")]
fn collect_backchannel(&self) -> bool;
#[doc(alias = "gst_rtsp_onvif_media_get_backchannel_bandwidth")]
#[doc(alias = "get_backchannel_bandwidth")]
fn backchannel_bandwidth(&self) -> u32;
#[doc(alias = "gst_rtsp_onvif_media_set_backchannel_bandwidth")]
fn set_backchannel_bandwidth(&self, bandwidth: u32);
}
impl<O: IsA<RTSPOnvifMedia>> RTSPOnvifMediaExt for O {
fn collect_backchannel(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_onvif_media_collect_backchannel(
self.as_ref().to_glib_none().0,
))
}
}
fn backchannel_bandwidth(&self) -> u32 {
unsafe {
ffi::gst_rtsp_onvif_media_get_backchannel_bandwidth(self.as_ref().to_glib_none().0)
}
}
fn set_backchannel_bandwidth(&self, bandwidth: u32) {
unsafe {
ffi::gst_rtsp_onvif_media_set_backchannel_bandwidth(
self.as_ref().to_glib_none().0,
bandwidth,
);
}
}
}

View file

@ -0,0 +1,135 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::RTSPMediaFactory;
use glib::object::Cast;
use glib::object::IsA;
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstRTSPOnvifMediaFactory")]
pub struct RTSPOnvifMediaFactory(Object<ffi::GstRTSPOnvifMediaFactory, ffi::GstRTSPOnvifMediaFactoryClass>) @extends RTSPMediaFactory;
match fn {
type_ => || ffi::gst_rtsp_onvif_media_factory_get_type(),
}
}
impl RTSPOnvifMediaFactory {
pub const NONE: Option<&'static RTSPOnvifMediaFactory> = None;
#[doc(alias = "gst_rtsp_onvif_media_factory_new")]
pub fn new() -> RTSPOnvifMediaFactory {
assert_initialized_main_thread!();
unsafe {
RTSPMediaFactory::from_glib_full(ffi::gst_rtsp_onvif_media_factory_new()).unsafe_cast()
}
}
}
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
impl Default for RTSPOnvifMediaFactory {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPOnvifMediaFactory {}
unsafe impl Sync for RTSPOnvifMediaFactory {}
pub trait RTSPOnvifMediaFactoryExt: 'static {
#[doc(alias = "gst_rtsp_onvif_media_factory_get_backchannel_bandwidth")]
#[doc(alias = "get_backchannel_bandwidth")]
fn backchannel_bandwidth(&self) -> u32;
#[doc(alias = "gst_rtsp_onvif_media_factory_get_backchannel_launch")]
#[doc(alias = "get_backchannel_launch")]
fn backchannel_launch(&self) -> Option<glib::GString>;
#[doc(alias = "gst_rtsp_onvif_media_factory_has_backchannel_support")]
fn has_backchannel_support(&self) -> bool;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_rtsp_onvif_media_factory_has_replay_support")]
fn has_replay_support(&self) -> bool;
#[doc(alias = "gst_rtsp_onvif_media_factory_set_backchannel_bandwidth")]
fn set_backchannel_bandwidth(&self, bandwidth: u32);
#[doc(alias = "gst_rtsp_onvif_media_factory_set_backchannel_launch")]
fn set_backchannel_launch(&self, launch: &str);
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_rtsp_onvif_media_factory_set_replay_support")]
fn set_replay_support(&self, has_replay_support: bool);
}
impl<O: IsA<RTSPOnvifMediaFactory>> RTSPOnvifMediaFactoryExt for O {
fn backchannel_bandwidth(&self) -> u32 {
unsafe {
ffi::gst_rtsp_onvif_media_factory_get_backchannel_bandwidth(
self.as_ref().to_glib_none().0,
)
}
}
fn backchannel_launch(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::gst_rtsp_onvif_media_factory_get_backchannel_launch(
self.as_ref().to_glib_none().0,
))
}
}
fn has_backchannel_support(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_onvif_media_factory_has_backchannel_support(
self.as_ref().to_glib_none().0,
))
}
}
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
fn has_replay_support(&self) -> bool {
unsafe {
from_glib(ffi::gst_rtsp_onvif_media_factory_has_replay_support(
self.as_ref().to_glib_none().0,
))
}
}
fn set_backchannel_bandwidth(&self, bandwidth: u32) {
unsafe {
ffi::gst_rtsp_onvif_media_factory_set_backchannel_bandwidth(
self.as_ref().to_glib_none().0,
bandwidth,
);
}
}
fn set_backchannel_launch(&self, launch: &str) {
unsafe {
ffi::gst_rtsp_onvif_media_factory_set_backchannel_launch(
self.as_ref().to_glib_none().0,
launch.to_glib_none().0,
);
}
}
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
fn set_replay_support(&self, has_replay_support: bool) {
unsafe {
ffi::gst_rtsp_onvif_media_factory_set_replay_support(
self.as_ref().to_glib_none().0,
has_replay_support.into_glib(),
);
}
}
}

View file

@ -0,0 +1,36 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::RTSPServer;
use glib::object::Cast;
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GstRTSPOnvifServer")]
pub struct RTSPOnvifServer(Object<ffi::GstRTSPOnvifServer, ffi::GstRTSPOnvifServerClass>) @extends RTSPServer;
match fn {
type_ => || ffi::gst_rtsp_onvif_server_get_type(),
}
}
impl RTSPOnvifServer {
pub const NONE: Option<&'static RTSPOnvifServer> = None;
#[doc(alias = "gst_rtsp_onvif_server_new")]
pub fn new() -> RTSPOnvifServer {
assert_initialized_main_thread!();
unsafe { RTSPServer::from_glib_full(ffi::gst_rtsp_onvif_server_new()).unsafe_cast() }
}
}
impl Default for RTSPOnvifServer {
fn default() -> Self {
Self::new()
}
}
unsafe impl Send for RTSPOnvifServer {}
unsafe impl Sync for RTSPOnvifServer {}

View file

@ -41,6 +41,9 @@ mod rtsp_client;
mod rtsp_context;
mod rtsp_media;
mod rtsp_media_factory;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
mod rtsp_onvif_media_factory;
mod rtsp_server;
mod rtsp_session_pool;
mod rtsp_thread;
@ -129,6 +132,9 @@ pub mod prelude {
pub use crate::rtsp_client::RTSPClientExtManual;
pub use crate::rtsp_media::RTSPMediaExtManual;
pub use crate::rtsp_media_factory::RTSPMediaFactoryExtManual;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
pub use crate::rtsp_onvif_media_factory::RTSPOnvifMediaFactoryExtManual;
pub use crate::rtsp_server::RTSPServerExtManual;
pub use crate::rtsp_session_pool::RTSPSessionPoolExtManual;
}

View file

@ -0,0 +1,27 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::RTSPContext;
use crate::RTSPOnvifMediaFactory;
use glib::prelude::*;
use glib::translate::*;
pub trait RTSPOnvifMediaFactoryExtManual: 'static {
#[doc(alias = "gst_rtsp_onvif_media_factory_requires_backchannel")]
fn requires_backchannel(&self, ctx: &RTSPContext) -> bool;
}
impl<O: IsA<RTSPOnvifMediaFactory>> RTSPOnvifMediaFactoryExtManual for O {
fn requires_backchannel(&self, ctx: &RTSPContext) -> bool {
skip_assert_initialized!();
unsafe {
from_glib(ffi::gst_rtsp_onvif_media_factory_requires_backchannel(
self.as_ref()
.upcast_ref::<crate::RTSPMediaFactory>()
.to_glib_none()
.0,
ctx.to_glib_none().0,
))
}
}
}