diff --git a/Gir_GstRtspServer.toml b/Gir_GstRtspServer.toml index 45ce5355e..70165319a 100644 --- a/Gir_GstRtspServer.toml +++ b/Gir_GstRtspServer.toml @@ -83,6 +83,11 @@ name = "Gst.Caps" status = "manual" ref_mode = "ref" +[[object]] +name = "GstRtspServer.RTSPContext" +status = "manual" +ref_mode = "ref" + [[object]] name = "Gst.ClockTime" status = "manual" diff --git a/gstreamer-rtsp-server/src/auto/r_t_s_p_client.rs b/gstreamer-rtsp-server/src/auto/r_t_s_p_client.rs index 95d765bfb..2a3bf711e 100644 --- a/gstreamer-rtsp-server/src/auto/r_t_s_p_client.rs +++ b/gstreamer-rtsp-server/src/auto/r_t_s_p_client.rs @@ -3,6 +3,7 @@ // DO NOT EDIT use RTSPAuth; +use RTSPContext; use RTSPMountPoints; use RTSPSession; use RTSPSessionPool; @@ -18,6 +19,10 @@ use glib::signal::connect; use glib::translate::*; use glib_ffi; use gobject_ffi; +#[cfg(any(feature = "v1_12", feature = "dox"))] +use gst_rtsp; +#[cfg(any(feature = "v1_12", feature = "dox"))] +use gst_rtsp_ffi; use std::boxed::Box as Box_; use std::mem; use std::mem::transmute; @@ -84,65 +89,65 @@ pub trait RTSPClientExt { fn set_property_drop_backlog(&self, drop_backlog: bool); - //fn connect_announce_request(&self, f: F) -> SignalHandlerId; + fn connect_announce_request(&self, f: F) -> SignalHandlerId; //fn connect_check_requirements(&self, f: F) -> SignalHandlerId; fn connect_closed(&self, f: F) -> SignalHandlerId; - //fn connect_describe_request(&self, f: F) -> SignalHandlerId; + fn connect_describe_request(&self, f: F) -> SignalHandlerId; - //fn connect_get_parameter_request(&self, f: F) -> SignalHandlerId; + fn connect_get_parameter_request(&self, f: F) -> SignalHandlerId; - //fn connect_handle_response(&self, f: F) -> SignalHandlerId; + fn connect_handle_response(&self, f: F) -> SignalHandlerId; fn connect_new_session(&self, f: F) -> SignalHandlerId; - //fn connect_options_request(&self, f: F) -> SignalHandlerId; + fn connect_options_request(&self, f: F) -> SignalHandlerId; - //fn connect_pause_request(&self, f: F) -> SignalHandlerId; + fn connect_pause_request(&self, f: F) -> SignalHandlerId; - //fn connect_play_request(&self, f: F) -> SignalHandlerId; + fn connect_play_request(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_announce_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_announce_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_describe_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_describe_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_get_parameter_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_get_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_options_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_options_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_pause_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_pause_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_play_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_play_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_record_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_record_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_set_parameter_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_set_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_setup_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_setup_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_teardown_request(&self, f: F) -> SignalHandlerId; + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_teardown_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; - //fn connect_record_request(&self, f: F) -> SignalHandlerId; + fn connect_record_request(&self, f: F) -> SignalHandlerId; //fn connect_send_message(&self, f: F) -> SignalHandlerId; - //fn connect_set_parameter_request(&self, f: F) -> SignalHandlerId; + fn connect_set_parameter_request(&self, f: F) -> SignalHandlerId; - //fn connect_setup_request(&self, f: F) -> SignalHandlerId; + fn connect_setup_request(&self, f: F) -> SignalHandlerId; - //fn connect_teardown_request(&self, f: F) -> SignalHandlerId; + fn connect_teardown_request(&self, f: F) -> SignalHandlerId; fn connect_property_drop_backlog_notify(&self, f: F) -> SignalHandlerId; @@ -252,12 +257,15 @@ impl + IsA> RTSPClientExt for O { } } - //fn connect_announce_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_announce_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "announce-request", + transmute(announce_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } //fn connect_check_requirements(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext // Empty ctype arr: *.CArray TypeId { ns_id: 0, id: 28 } //} @@ -269,17 +277,29 @@ impl + IsA> RTSPClientExt for O { } } - //fn connect_describe_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_describe_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "describe-request", + transmute(describe_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //fn connect_get_parameter_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_get_parameter_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "get-parameter-request", + transmute(get_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //fn connect_handle_response(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_handle_response(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "handle-response", + transmute(handle_response_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } fn connect_new_session(&self, f: F) -> SignalHandlerId { unsafe { @@ -289,87 +309,155 @@ impl + IsA> RTSPClientExt for O { } } - //fn connect_options_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_options_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "options-request", + transmute(options_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //fn connect_pause_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_pause_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pause-request", + transmute(pause_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //fn connect_play_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_play_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "play-request", + transmute(play_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_announce_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_announce_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-announce-request", + transmute(pre_announce_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_describe_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_describe_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-describe-request", + transmute(pre_describe_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_get_parameter_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_get_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-get-parameter-request", + transmute(pre_get_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_options_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_options_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-options-request", + transmute(pre_options_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_pause_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_pause_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-pause-request", + transmute(pre_pause_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_play_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_play_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-play-request", + transmute(pre_play_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_record_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_record_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-record-request", + transmute(pre_record_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_set_parameter_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_set_parameter_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-set-parameter-request", + transmute(pre_set_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_setup_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_setup_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-setup-request", + transmute(pre_setup_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //#[cfg(any(feature = "v1_12", feature = "dox"))] - //fn connect_pre_teardown_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + #[cfg(any(feature = "v1_12", feature = "dox"))] + fn connect_pre_teardown_request gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pre-teardown-request", + transmute(pre_teardown_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //fn connect_record_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_record_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "record-request", + transmute(record_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } //fn connect_send_message(&self, f: F) -> SignalHandlerId { // Ignored message: GstRtsp.RTSPMessage //} - //fn connect_set_parameter_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_set_parameter_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "set-parameter-request", + transmute(set_parameter_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //fn connect_setup_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_setup_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "setup-request", + transmute(setup_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } - //fn connect_teardown_request(&self, f: F) -> SignalHandlerId { - // Ignored ctx: GstRtspServer.RTSPContext - //} + fn connect_teardown_request(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "teardown-request", + transmute(teardown_request_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } fn connect_property_drop_backlog_notify(&self, f: F) -> SignalHandlerId { unsafe { @@ -396,6 +484,13 @@ impl + IsA> RTSPClientExt for O { } } +unsafe extern "C" fn announce_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + unsafe extern "C" fn closed_trampoline

(this: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); @@ -403,6 +498,27 @@ where P: IsA { f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) } +unsafe extern "C" fn describe_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +unsafe extern "C" fn get_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +unsafe extern "C" fn handle_response_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + unsafe extern "C" fn new_session_trampoline

(this: *mut ffi::GstRTSPClient, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); @@ -410,6 +526,135 @@ where P: IsA { f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) } +unsafe extern "C" fn options_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +unsafe extern "C" fn pause_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +unsafe extern "C" fn play_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_announce_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_describe_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_get_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_options_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_pause_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_play_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_record_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_set_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_setup_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +#[cfg(any(feature = "v1_12", feature = "dox"))] +unsafe extern "C" fn pre_teardown_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() +} + +unsafe extern "C" fn record_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +unsafe extern "C" fn set_parameter_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +unsafe extern "C" fn setup_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + +unsafe extern "C" fn teardown_request_trampoline

(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); + f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) +} + unsafe extern "C" fn notify_drop_backlog_trampoline

(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) where P: IsA { callback_guard!(); diff --git a/gstreamer-rtsp-server/src/auto/r_t_s_p_thread_pool.rs b/gstreamer-rtsp-server/src/auto/r_t_s_p_thread_pool.rs index 3163aef1c..ed619152a 100644 --- a/gstreamer-rtsp-server/src/auto/r_t_s_p_thread_pool.rs +++ b/gstreamer-rtsp-server/src/auto/r_t_s_p_thread_pool.rs @@ -52,7 +52,7 @@ unsafe impl Sync for RTSPThreadPool {} pub trait RTSPThreadPoolExt { fn get_max_threads(&self) -> i32; - //fn get_thread(&self, type_: RTSPThreadType, ctx: /*Ignored*/&mut RTSPContext) -> /*Ignored*/Option; + //fn get_thread(&self, type_: RTSPThreadType, ctx: &RTSPContext) -> /*Ignored*/Option; fn set_max_threads(&self, max_threads: i32); @@ -66,7 +66,7 @@ impl + IsA> RTSPThreadPoolExt for O } } - //fn get_thread(&self, type_: RTSPThreadType, ctx: /*Ignored*/&mut RTSPContext) -> /*Ignored*/Option { + //fn get_thread(&self, type_: RTSPThreadType, ctx: &RTSPContext) -> /*Ignored*/Option { // unsafe { TODO: call ffi::gst_rtsp_thread_pool_get_thread() } //} diff --git a/gstreamer-rtsp-server/src/lib.rs b/gstreamer-rtsp-server/src/lib.rs index 7990954dd..19c71b9f7 100644 --- a/gstreamer-rtsp-server/src/lib.rs +++ b/gstreamer-rtsp-server/src/lib.rs @@ -56,12 +56,15 @@ mod r_t_s_p_server; mod r_t_s_p_address_pool; mod r_t_s_p_client; mod r_t_s_p_session_pool; +mod r_t_s_p_context; pub use r_t_s_p_server::RTSPServerExtManual; pub use r_t_s_p_address_pool::RTSPAddressPoolExtManual; pub use r_t_s_p_client::RTSPClientExtManual; pub use r_t_s_p_session_pool::RTSPSessionPoolExtManual; +pub use r_t_s_p_context::*; + // Re-export all the traits in a prelude module, so that applications // can always "use gst::prelude::*" without getting conflicts pub mod prelude { diff --git a/gstreamer-rtsp-server/src/r_t_s_p_context.rs b/gstreamer-rtsp-server/src/r_t_s_p_context.rs new file mode 100644 index 000000000..164e0b63a --- /dev/null +++ b/gstreamer-rtsp-server/src/r_t_s_p_context.rs @@ -0,0 +1,37 @@ +// Copyright (C) 2018 Sebastian Dröge +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ffi; +use glib; + +#[derive(PartialEq, Eq)] +pub struct RTSPContext(*mut ffi::GstRTSPContext); + +impl RTSPContext { + pub fn with_current_context T, T>(func: F) -> Option { + unsafe { + let ptr = ffi::gst_rtsp_context_get_current(); + if ptr.is_null() { + return None; + } + + let ctx = RTSPContext(ptr); + Some(func(&ctx)) + } + } + + // TODO: Add various getters for all the contained fields as needed +} + +#[doc(hidden)] +impl glib::translate::FromGlibPtrBorrow<*mut ffi::GstRTSPContext> for RTSPContext { + #[inline] + unsafe fn from_glib_borrow(ptr: *mut ffi::GstRTSPContext) -> Self { + RTSPContext(ptr) + } +}