From 586fc75ffcade5bb42c5c3d052289cf77975a3ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 18 Feb 2022 13:21:10 +0200 Subject: [PATCH] rtsp-server: Add bindings for Onvif-specific client/media/media-factory/server Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/373 --- gstreamer-rtsp-server/Gir.toml | 11 ++ gstreamer-rtsp-server/src/auto/mod.rs | 34 +++++ .../src/auto/rtsp_onvif_client.rs | 44 ++++++ .../src/auto/rtsp_onvif_media.rs | 61 ++++++++ .../src/auto/rtsp_onvif_media_factory.rs | 135 ++++++++++++++++++ .../src/auto/rtsp_onvif_server.rs | 36 +++++ gstreamer-rtsp-server/src/lib.rs | 6 + .../src/rtsp_onvif_media_factory.rs | 27 ++++ 8 files changed, 354 insertions(+) create mode 100644 gstreamer-rtsp-server/src/auto/rtsp_onvif_client.rs create mode 100644 gstreamer-rtsp-server/src/auto/rtsp_onvif_media.rs create mode 100644 gstreamer-rtsp-server/src/auto/rtsp_onvif_media_factory.rs create mode 100644 gstreamer-rtsp-server/src/auto/rtsp_onvif_server.rs create mode 100644 gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs diff --git a/gstreamer-rtsp-server/Gir.toml b/gstreamer-rtsp-server/Gir.toml index 07ad9cfdf..3f0d85ca8 100644 --- a/gstreamer-rtsp-server/Gir.toml +++ b/gstreamer-rtsp-server/Gir.toml @@ -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" diff --git a/gstreamer-rtsp-server/src/auto/mod.rs b/gstreamer-rtsp-server/src/auto/mod.rs index c8d534a16..764d382f6 100644 --- a/gstreamer-rtsp-server/src/auto/mod.rs +++ b/gstreamer-rtsp-server/src/auto/mod.rs @@ -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; diff --git a/gstreamer-rtsp-server/src/auto/rtsp_onvif_client.rs b/gstreamer-rtsp-server/src/auto/rtsp_onvif_client.rs new file mode 100644 index 000000000..98a31fc5c --- /dev/null +++ b/gstreamer-rtsp-server/src/auto/rtsp_onvif_client.rs @@ -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) @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 {} diff --git a/gstreamer-rtsp-server/src/auto/rtsp_onvif_media.rs b/gstreamer-rtsp-server/src/auto/rtsp_onvif_media.rs new file mode 100644 index 000000000..e8cfa8562 --- /dev/null +++ b/gstreamer-rtsp-server/src/auto/rtsp_onvif_media.rs @@ -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) @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> 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, + ); + } + } +} diff --git a/gstreamer-rtsp-server/src/auto/rtsp_onvif_media_factory.rs b/gstreamer-rtsp-server/src/auto/rtsp_onvif_media_factory.rs new file mode 100644 index 000000000..92810979f --- /dev/null +++ b/gstreamer-rtsp-server/src/auto/rtsp_onvif_media_factory.rs @@ -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) @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; + + #[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> 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 { + 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(), + ); + } + } +} diff --git a/gstreamer-rtsp-server/src/auto/rtsp_onvif_server.rs b/gstreamer-rtsp-server/src/auto/rtsp_onvif_server.rs new file mode 100644 index 000000000..a223bf9a2 --- /dev/null +++ b/gstreamer-rtsp-server/src/auto/rtsp_onvif_server.rs @@ -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) @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 {} diff --git a/gstreamer-rtsp-server/src/lib.rs b/gstreamer-rtsp-server/src/lib.rs index 5198abfb0..050d2ad3a 100644 --- a/gstreamer-rtsp-server/src/lib.rs +++ b/gstreamer-rtsp-server/src/lib.rs @@ -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; } diff --git a/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs b/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs new file mode 100644 index 000000000..89d349542 --- /dev/null +++ b/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs @@ -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> 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::() + .to_glib_none() + .0, + ctx.to_glib_none().0, + )) + } + } +}