mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-09-27 06:20:05 +00:00
60e8c44abb
Enables subclassing gst_rtsp_server::RTSPAuth and overriding its authenticate/check/generate_authenticate_header methods Also add new methods in RTSPContext to retrieve RTSP request/response, and to get/replace tokens. Additionally, added RTSPMessage with methods to add an authentication header to a request / retrieve authentication parameters from a response. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1359>
26 lines
867 B
Rust
26 lines
867 B
Rust
use crate::{RTSPAuthCredential, RTSPAuthMethod, RTSPAuthParam};
|
|
use ffi::GstRTSPAuthCredential;
|
|
use glib::translate::*;
|
|
|
|
impl RTSPAuthCredential {
|
|
pub fn scheme(&self) -> RTSPAuthMethod {
|
|
let ptr: *mut GstRTSPAuthCredential = self.to_glib_none().0;
|
|
unsafe { from_glib((*ptr).scheme) }
|
|
}
|
|
|
|
pub fn authorization(&self) -> Option<&str> {
|
|
let ptr: *mut GstRTSPAuthCredential = self.to_glib_none().0;
|
|
unsafe {
|
|
if (*ptr).authorization.is_null() {
|
|
None
|
|
} else {
|
|
std::ffi::CStr::from_ptr((*ptr).authorization).to_str().ok()
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn params(&self) -> glib::collections::PtrSlice<RTSPAuthParam> {
|
|
let ptr: *mut GstRTSPAuthCredential = self.to_glib_none().0;
|
|
unsafe { FromGlibPtrContainer::from_glib_none((*ptr).params) }
|
|
}
|
|
}
|