mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-02-18 03:55:36 +00:00
sdp: Fix various add/set functions on SDPMessage to not have a return value
These can't possibly fail.
This commit is contained in:
parent
e830de8904
commit
0dcaa072a1
1 changed files with 30 additions and 94 deletions
|
@ -168,56 +168,35 @@ unsafe impl Send for SDPMessageRef {}
|
||||||
unsafe impl Sync for SDPMessageRef {}
|
unsafe impl Sync for SDPMessageRef {}
|
||||||
|
|
||||||
impl SDPMessageRef {
|
impl SDPMessageRef {
|
||||||
pub fn add_attribute<'a, P: Into<Option<&'a str>>>(
|
pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) {
|
||||||
&mut self,
|
unsafe {
|
||||||
key: &str,
|
|
||||||
value: P,
|
|
||||||
) -> Result<(), ()> {
|
|
||||||
let result = unsafe {
|
|
||||||
ffi::gst_sdp_message_add_attribute(
|
ffi::gst_sdp_message_add_attribute(
|
||||||
&mut self.0,
|
&mut self.0,
|
||||||
key.to_glib_none().0,
|
key.to_glib_none().0,
|
||||||
value.into().to_glib_none().0,
|
value.into().to_glib_none().0,
|
||||||
)
|
);
|
||||||
};
|
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_email(&mut self, email: &str) -> Result<(), ()> {
|
pub fn add_email(&mut self, email: &str) {
|
||||||
let result = unsafe { ffi::gst_sdp_message_add_email(&mut self.0, email.to_glib_none().0) };
|
unsafe { ffi::gst_sdp_message_add_email(&mut self.0, email.to_glib_none().0) };
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_media(&mut self, media: SDPMedia) -> Result<(), ()> {
|
pub fn add_media(&mut self, media: SDPMedia) {
|
||||||
let result = unsafe {
|
unsafe {
|
||||||
ffi::gst_sdp_message_add_media(
|
ffi::gst_sdp_message_add_media(
|
||||||
&mut self.0,
|
&mut self.0,
|
||||||
media.to_glib_full() as *mut ffi::GstSDPMedia,
|
media.to_glib_full() as *mut ffi::GstSDPMedia,
|
||||||
)
|
);
|
||||||
};
|
|
||||||
mem::forget(media);
|
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_phone(&mut self, phone: &str) -> Result<(), ()> {
|
pub fn add_phone(&mut self, phone: &str) {
|
||||||
let result = unsafe { ffi::gst_sdp_message_add_phone(&mut self.0, phone.to_glib_none().0) };
|
unsafe { ffi::gst_sdp_message_add_phone(&mut self.0, phone.to_glib_none().0) };
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_time(&mut self, start: &str, stop: &str, repeat: &[&str]) -> Result<(), ()> {
|
pub fn add_time(&mut self, start: &str, stop: &str, repeat: &[&str]) {
|
||||||
let result = unsafe {
|
unsafe {
|
||||||
ffi::gst_sdp_message_add_time(
|
ffi::gst_sdp_message_add_time(
|
||||||
&mut self.0,
|
&mut self.0,
|
||||||
start.to_glib_none().0,
|
start.to_glib_none().0,
|
||||||
|
@ -225,24 +204,16 @@ impl SDPMessageRef {
|
||||||
repeat.to_glib_none().0,
|
repeat.to_glib_none().0,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_zone(&mut self, adj_time: &str, typed_time: &str) -> Result<(), ()> {
|
pub fn add_zone(&mut self, adj_time: &str, typed_time: &str) {
|
||||||
let result = unsafe {
|
unsafe {
|
||||||
ffi::gst_sdp_message_add_zone(
|
ffi::gst_sdp_message_add_zone(
|
||||||
&mut self.0,
|
&mut self.0,
|
||||||
adj_time.to_glib_none().0,
|
adj_time.to_glib_none().0,
|
||||||
typed_time.to_glib_none().0,
|
typed_time.to_glib_none().0,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_text(&self) -> Option<String> {
|
pub fn as_text(&self) -> Option<String> {
|
||||||
|
@ -265,12 +236,8 @@ impl SDPMessageRef {
|
||||||
unsafe { ffi::gst_sdp_message_bandwidths_len(&self.0) }
|
unsafe { ffi::gst_sdp_message_bandwidths_len(&self.0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dump(&self) -> Result<(), ()> {
|
pub fn dump(&self) {
|
||||||
let result = unsafe { ffi::gst_sdp_message_dump(&self.0) };
|
unsafe { ffi::gst_sdp_message_dump(&self.0) };
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn emails_len(&self) -> u32 {
|
pub fn emails_len(&self) -> u32 {
|
||||||
|
@ -776,8 +743,8 @@ impl SDPMessageRef {
|
||||||
address: &str,
|
address: &str,
|
||||||
ttl: u32,
|
ttl: u32,
|
||||||
addr_number: u32,
|
addr_number: u32,
|
||||||
) -> Result<(), ()> {
|
) {
|
||||||
let result = unsafe {
|
unsafe {
|
||||||
ffi::gst_sdp_message_set_connection(
|
ffi::gst_sdp_message_set_connection(
|
||||||
&mut self.0,
|
&mut self.0,
|
||||||
nettype.to_glib_none().0,
|
nettype.to_glib_none().0,
|
||||||
|
@ -787,30 +754,16 @@ impl SDPMessageRef {
|
||||||
addr_number,
|
addr_number,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_information(&mut self, information: &str) -> Result<(), ()> {
|
pub fn set_information(&mut self, information: &str) {
|
||||||
let result = unsafe {
|
unsafe { ffi::gst_sdp_message_set_information(&mut self.0, information.to_glib_none().0) };
|
||||||
ffi::gst_sdp_message_set_information(&mut self.0, information.to_glib_none().0)
|
|
||||||
};
|
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_key(&mut self, type_: &str, data: &str) -> Result<(), ()> {
|
pub fn set_key(&mut self, type_: &str, data: &str) {
|
||||||
let result = unsafe {
|
unsafe {
|
||||||
ffi::gst_sdp_message_set_key(&mut self.0, type_.to_glib_none().0, data.to_glib_none().0)
|
ffi::gst_sdp_message_set_key(&mut self.0, type_.to_glib_none().0, data.to_glib_none().0)
|
||||||
};
|
};
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_origin(
|
pub fn set_origin(
|
||||||
|
@ -821,8 +774,8 @@ impl SDPMessageRef {
|
||||||
nettype: &str,
|
nettype: &str,
|
||||||
addrtype: &str,
|
addrtype: &str,
|
||||||
addr: &str,
|
addr: &str,
|
||||||
) -> Result<(), ()> {
|
) {
|
||||||
let result = unsafe {
|
unsafe {
|
||||||
ffi::gst_sdp_message_set_origin(
|
ffi::gst_sdp_message_set_origin(
|
||||||
&mut self.0,
|
&mut self.0,
|
||||||
username.to_glib_none().0,
|
username.to_glib_none().0,
|
||||||
|
@ -833,37 +786,20 @@ impl SDPMessageRef {
|
||||||
addr.to_glib_none().0,
|
addr.to_glib_none().0,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_session_name(&mut self, session_name: &str) -> Result<(), ()> {
|
pub fn set_session_name(&mut self, session_name: &str) {
|
||||||
let result = unsafe {
|
unsafe {
|
||||||
ffi::gst_sdp_message_set_session_name(&mut self.0, session_name.to_glib_none().0)
|
ffi::gst_sdp_message_set_session_name(&mut self.0, session_name.to_glib_none().0)
|
||||||
};
|
};
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_uri(&mut self, uri: &str) -> Result<(), ()> {
|
pub fn set_uri(&mut self, uri: &str) {
|
||||||
let result = unsafe { ffi::gst_sdp_message_set_uri(&mut self.0, uri.to_glib_none().0) };
|
unsafe { ffi::gst_sdp_message_set_uri(&mut self.0, uri.to_glib_none().0) };
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_version(&mut self, version: &str) -> Result<(), ()> {
|
pub fn set_version(&mut self, version: &str) {
|
||||||
let result =
|
unsafe { ffi::gst_sdp_message_set_version(&mut self.0, version.to_glib_none().0) };
|
||||||
unsafe { ffi::gst_sdp_message_set_version(&mut self.0, version.to_glib_none().0) };
|
|
||||||
match result {
|
|
||||||
ffi::GST_SDP_OK => Ok(()),
|
|
||||||
_ => Err(()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn times_len(&self) -> u32 {
|
pub fn times_len(&self) -> u32 {
|
||||||
|
|
Loading…
Reference in a new issue