2020-12-15 10:53:31 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
|
|
|
|
2020-11-22 10:45:51 +00:00
|
|
|
use crate::RTSPServer;
|
2021-04-26 12:15:53 +00:00
|
|
|
use glib::prelude::*;
|
2018-02-09 02:30:08 +00:00
|
|
|
use glib::source::SourceId;
|
2018-04-01 08:30:03 +00:00
|
|
|
use glib::translate::*;
|
2018-02-09 02:30:08 +00:00
|
|
|
|
2018-12-08 09:22:42 +00:00
|
|
|
pub trait RTSPServerExtManual: 'static {
|
2021-02-04 19:53:13 +00:00
|
|
|
fn attach(
|
|
|
|
&self,
|
|
|
|
context: Option<&glib::MainContext>,
|
|
|
|
) -> Result<SourceId, glib::error::BoolError>;
|
2018-02-09 02:30:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {
|
2021-02-04 19:53:13 +00:00
|
|
|
fn attach(
|
|
|
|
&self,
|
|
|
|
context: Option<&glib::MainContext>,
|
|
|
|
) -> Result<SourceId, glib::error::BoolError> {
|
2018-02-09 02:30:08 +00:00
|
|
|
unsafe {
|
2021-02-04 19:53:13 +00:00
|
|
|
match ffi::gst_rtsp_server_attach(
|
2019-01-16 11:32:58 +00:00
|
|
|
self.as_ref().to_glib_none().0,
|
|
|
|
context.to_glib_none().0,
|
2021-02-04 19:53:13 +00:00
|
|
|
) {
|
|
|
|
0 => Err(glib::bool_error!(
|
|
|
|
"Failed to attach main context to RTSP server"
|
|
|
|
)),
|
|
|
|
id => Ok(from_glib(id)),
|
|
|
|
}
|
2018-02-09 02:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|