gstreamer_rtsp_server/rtsp_thread.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::ffi;
4use glib::translate::*;
5
6gst::mini_object_wrapper!(RTSPThread, RTSPThreadRef, ffi::GstRTSPThread, || {
7 ffi::gst_rtsp_thread_get_type()
8});
9
10impl RTSPThread {
11 #[doc(alias = "gst_rtsp_thread_new")]
12 pub fn new(type_: crate::RTSPThreadType) -> Option<Self> {
13 assert_initialized_main_thread!();
14 unsafe { from_glib_full(ffi::gst_rtsp_thread_new(type_.into_glib())) }
15 }
16}
17
18impl RTSPThreadRef {
19 #[doc(alias = "gst_rtsp_thread_reuse")]
20 pub fn reuse(&self) -> bool {
21 unsafe { from_glib(ffi::gst_rtsp_thread_reuse(self.as_mut_ptr())) }
22 }
23
24 #[doc(alias = "gst_rtsp_thread_stop")]
25 pub fn stop(&self) {
26 unsafe {
27 ffi::gst_rtsp_thread_stop(self.as_mut_ptr());
28 }
29 }
30
31 pub fn type_(&self) -> crate::RTSPThreadType {
32 unsafe { from_glib((*self.as_ptr()).type_) }
33 }
34
35 pub fn context(&self) -> glib::MainContext {
36 unsafe { from_glib_none((*self.as_ptr()).context) }
37 }
38
39 pub fn loop_(&self) -> glib::MainLoop {
40 unsafe { from_glib_none((*self.as_ptr()).loop_) }
41 }
42}