Commit fb73d1bc authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Get rid of GstSDPResult enum

parent 19b69870
......@@ -28,7 +28,6 @@ generate = [
"GstSdp.MIKEYSecSRTP",
"GstSdp.MIKEYTSType",
"GstSdp.MIKEYType",
"GstSdp.SDPResult",
]
manual = [
......
......@@ -494,36 +494,3 @@ impl FromGlib<ffi::GstMIKEYType> for MIKEYType {
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum SDPResult {
Ok,
Einval,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for SDPResult {
type GlibType = ffi::GstSDPResult;
fn to_glib(&self) -> ffi::GstSDPResult {
match *self {
SDPResult::Ok => ffi::GST_SDP_OK,
SDPResult::Einval => ffi::GST_SDP_EINVAL,
SDPResult::__Unknown(value) => value
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstSDPResult> for SDPResult {
fn from_glib(value: ffi::GstSDPResult) -> Self {
skip_assert_initialized!();
match value {
0 => SDPResult::Ok,
-1 => SDPResult::Einval,
value => SDPResult::__Unknown(value),
}
}
}
......@@ -21,7 +21,6 @@ pub use self::enums::MIKEYSecProto;
pub use self::enums::MIKEYSecSRTP;
pub use self::enums::MIKEYTSType;
pub use self::enums::MIKEYType;
pub use self::enums::SDPResult;
#[doc(hidden)]
pub mod traits {
......
......@@ -12,8 +12,6 @@ use std::mem;
use ffi;
use glib::translate::*;
use auto::SDPResult;
#[repr(C)]
pub struct SDPAttribute(pub(crate) ffi::GstSDPAttribute);
......@@ -22,13 +20,10 @@ impl SDPAttribute {
assert_initialized_main_thread!();
unsafe {
let mut attr = mem::zeroed();
let result = from_glib(ffi::gst_sdp_attribute_set(
&mut attr,
key.to_glib_none().0,
value.to_glib_none().0,
));
let result =
ffi::gst_sdp_attribute_set(&mut attr, key.to_glib_none().0, value.to_glib_none().0);
match result {
SDPResult::Ok => Ok(SDPAttribute(attr)),
ffi::GST_SDP_OK => Ok(SDPAttribute(attr)),
_ => Err(()),
}
}
......
......@@ -12,8 +12,6 @@ use std::mem;
use ffi;
use glib::translate::*;
use auto::SDPResult;
#[repr(C)]
pub struct SDPBandwidth(pub(crate) ffi::GstSDPBandwidth);
......@@ -22,13 +20,9 @@ impl SDPBandwidth {
assert_initialized_main_thread!();
unsafe {
let mut bw = mem::zeroed();
let result = from_glib(ffi::gst_sdp_bandwidth_set(
&mut bw,
bwtype.to_glib_none().0,
bandwidth,
));
let result = ffi::gst_sdp_bandwidth_set(&mut bw, bwtype.to_glib_none().0, bandwidth);
match result {
SDPResult::Ok => Ok(SDPBandwidth(bw)),
ffi::GST_SDP_OK => Ok(SDPBandwidth(bw)),
_ => Err(()),
}
}
......
......@@ -12,8 +12,6 @@ use std::mem;
use ffi;
use glib::translate::*;
use auto::SDPResult;
#[repr(C)]
pub struct SDPConnection(pub(crate) ffi::GstSDPConnection);
......@@ -28,16 +26,16 @@ impl SDPConnection {
assert_initialized_main_thread!();
unsafe {
let mut conn = mem::zeroed();
let result = from_glib(ffi::gst_sdp_connection_set(
let result = ffi::gst_sdp_connection_set(
&mut conn,
nettype.to_glib_none().0,
addrtype.to_glib_none().0,
address.to_glib_none().0,
ttl,
addr_number,
));
);
match result {
SDPResult::Ok => Ok(SDPConnection(conn)),
ffi::GST_SDP_OK => Ok(SDPConnection(conn)),
_ => Err(()),
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -13,8 +13,6 @@ use std::os::raw::c_char;
use ffi;
use glib::translate::*;
use auto::SDPResult;
#[repr(C)]
pub struct SDPTime(pub(crate) ffi::GstSDPTime);
......@@ -23,14 +21,14 @@ impl SDPTime {
assert_initialized_main_thread!();
unsafe {
let mut time = mem::zeroed();
let result = from_glib(ffi::gst_sdp_time_set(
let result = ffi::gst_sdp_time_set(
&mut time,
start.to_glib_none().0,
stop.to_glib_none().0,
repeat.to_glib_none().0,
));
);
match result {
SDPResult::Ok => Ok(SDPTime(time)),
ffi::GST_SDP_OK => Ok(SDPTime(time)),
_ => Err(()),
}
}
......
......@@ -12,8 +12,6 @@ use std::mem;
use ffi;
use glib::translate::*;
use auto::SDPResult;
#[repr(C)]
pub struct SDPZone(pub(crate) ffi::GstSDPZone);
......@@ -22,13 +20,13 @@ impl SDPZone {
assert_initialized_main_thread!();
unsafe {
let mut zone = mem::zeroed();
let result = from_glib(ffi::gst_sdp_zone_set(
let result = ffi::gst_sdp_zone_set(
&mut zone,
time.to_glib_none().0,
typed_time.to_glib_none().0,
));
);
match result {
SDPResult::Ok => Ok(SDPZone(zone)),
ffi::GST_SDP_OK => Ok(SDPZone(zone)),
_ => Err(()),
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment