gstreamer-rs/gstreamer-webrtc/src/web_rtc_session_description.rs

32 lines
941 B
Rust
Raw Normal View History

2020-12-15 10:53:31 +00:00
// Take a look at the license at the top of the repository in the LICENSE file.
2018-04-05 18:22:40 +00:00
use std::mem;
use glib::translate::*;
use crate::{WebRTCSDPType, WebRTCSessionDescription};
2018-04-05 18:22:40 +00:00
impl WebRTCSessionDescription {
#[doc(alias = "gst_webrtc_session_description_new")]
pub fn new(type_: WebRTCSDPType, sdp: gst_sdp::SDPMessage) -> WebRTCSessionDescription {
skip_assert_initialized!();
2018-04-05 18:22:40 +00:00
unsafe {
let mut sdp = mem::ManuallyDrop::new(sdp);
from_glib_full(ffi::gst_webrtc_session_description_new(
type_.into_glib(),
2018-04-05 18:22:40 +00:00
sdp.to_glib_none_mut().0,
2020-04-11 18:18:18 +00:00
))
2018-04-05 18:22:40 +00:00
}
}
#[doc(alias = "get_type")]
2021-04-11 19:39:50 +00:00
pub fn type_(&self) -> crate::WebRTCSDPType {
unsafe { from_glib((*self.to_glib_none().0).type_) }
}
#[doc(alias = "get_sdp")]
2021-04-11 19:39:50 +00:00
pub fn sdp(&self) -> gst_sdp::SDPMessage {
unsafe { from_glib_none((*self.to_glib_none().0).sdp) }
}
2018-04-05 18:22:40 +00:00
}