s_d_p_message.rs 12.7 KB
Newer Older
Sebastian Dröge's avatar
Sebastian Dröge committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
// This file was generated by gir (https://github.com/gtk-rs/gir @ d1e0127)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT

use SDPMedia;
use SDPResult;
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use std::mem;
use std::ptr;

glib_wrapper! {
    pub struct SDPMessage(Boxed<ffi::GstSDPMessage>);

    match fn {
        copy => |ptr| gobject_ffi::g_boxed_copy(ffi::gst_sdp_message_get_type(), ptr as *mut _) as *mut ffi::GstSDPMessage,
        free => |ptr| gobject_ffi::g_boxed_free(ffi::gst_sdp_message_get_type(), ptr as *mut _),
        get_type => || ffi::gst_sdp_message_get_type(),
    }
}

impl SDPMessage {
    pub fn add_attribute<'a, P: Into<Option<&'a str>>>(&mut self, key: &str, value: P) -> SDPResult {
        let value = value.into();
        let value = value.to_glib_none();
        unsafe {
            from_glib(ffi::gst_sdp_message_add_attribute(self.to_glib_none_mut().0, key.to_glib_none().0, value.0))
        }
    }

    pub fn add_bandwidth(&mut self, bwtype: &str, bandwidth: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_add_bandwidth(self.to_glib_none_mut().0, bwtype.to_glib_none().0, bandwidth))
        }
    }

    pub fn add_email(&mut self, email: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_add_email(self.to_glib_none_mut().0, email.to_glib_none().0))
        }
    }

    pub fn add_media(&mut self, media: &mut SDPMedia) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_add_media(self.to_glib_none_mut().0, media.to_glib_none_mut().0))
        }
    }

    pub fn add_phone(&mut self, phone: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_add_phone(self.to_glib_none_mut().0, phone.to_glib_none().0))
        }
    }

    pub fn add_time(&mut self, start: &str, stop: &str, repeat: &[&str]) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_add_time(self.to_glib_none_mut().0, start.to_glib_none().0, stop.to_glib_none().0, repeat.to_glib_none().0))
        }
    }

    pub fn add_zone(&mut self, adj_time: &str, typed_time: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_add_zone(self.to_glib_none_mut().0, adj_time.to_glib_none().0, typed_time.to_glib_none().0))
        }
    }

    pub fn as_text(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gst_sdp_message_as_text(self.to_glib_none().0))
        }
    }

    pub fn attributes_len(&self) -> u32 {
        unsafe {
            ffi::gst_sdp_message_attributes_len(self.to_glib_none().0)
        }
    }

    pub fn attributes_to_caps(&self, caps: &gst::Caps) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_attributes_to_caps(self.to_glib_none().0, caps.to_glib_none().0))
        }
    }

    pub fn bandwidths_len(&self) -> u32 {
        unsafe {
            ffi::gst_sdp_message_bandwidths_len(self.to_glib_none().0)
        }
    }

    pub fn dump(&self) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_dump(self.to_glib_none().0))
        }
    }

    pub fn emails_len(&self) -> u32 {
        unsafe {
            ffi::gst_sdp_message_emails_len(self.to_glib_none().0)
        }
    }

    //pub fn get_attribute(&self, idx: u32) -> /*Ignored*/Option<SDPAttribute> {
    //    unsafe { TODO: call ffi::gst_sdp_message_get_attribute() }
    //}

    pub fn get_attribute_val(&self, key: &str) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_attribute_val(self.to_glib_none().0, key.to_glib_none().0))
        }
    }

    pub fn get_attribute_val_n(&self, key: &str, nth: u32) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_attribute_val_n(self.to_glib_none().0, key.to_glib_none().0, nth))
        }
    }

    //pub fn get_bandwidth(&self, idx: u32) -> /*Ignored*/Option<SDPBandwidth> {
    //    unsafe { TODO: call ffi::gst_sdp_message_get_bandwidth() }
    //}

    //pub fn get_connection(&self) -> /*Ignored*/Option<SDPConnection> {
    //    unsafe { TODO: call ffi::gst_sdp_message_get_connection() }
    //}

    pub fn get_email(&self, idx: u32) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_email(self.to_glib_none().0, idx))
        }
    }

    pub fn get_information(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_information(self.to_glib_none().0))
        }
    }

    //pub fn get_key(&self) -> /*Ignored*/Option<SDPKey> {
    //    unsafe { TODO: call ffi::gst_sdp_message_get_key() }
    //}

    pub fn get_media(&self, idx: u32) -> Option<SDPMedia> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_media(self.to_glib_none().0, idx))
        }
    }

    //pub fn get_origin(&self) -> /*Ignored*/Option<SDPOrigin> {
    //    unsafe { TODO: call ffi::gst_sdp_message_get_origin() }
    //}

    pub fn get_phone(&self, idx: u32) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_phone(self.to_glib_none().0, idx))
        }
    }

    pub fn get_session_name(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_session_name(self.to_glib_none().0))
        }
    }

    //pub fn get_time(&self, idx: u32) -> /*Ignored*/Option<SDPTime> {
    //    unsafe { TODO: call ffi::gst_sdp_message_get_time() }
    //}

    pub fn get_uri(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_uri(self.to_glib_none().0))
        }
    }

    pub fn get_version(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gst_sdp_message_get_version(self.to_glib_none().0))
        }
    }

    //pub fn get_zone(&self, idx: u32) -> /*Ignored*/Option<SDPZone> {
    //    unsafe { TODO: call ffi::gst_sdp_message_get_zone() }
    //}

    pub fn init(&mut self) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_init(self.to_glib_none_mut().0))
        }
    }

    //pub fn insert_attribute(&mut self, idx: i32, attr: /*Ignored*/&mut SDPAttribute) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_insert_attribute() }
    //}

    //pub fn insert_bandwidth(&mut self, idx: i32, bw: /*Ignored*/&mut SDPBandwidth) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_insert_bandwidth() }
    //}

    pub fn insert_email(&mut self, idx: i32, email: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_insert_email(self.to_glib_none_mut().0, idx, email.to_glib_none().0))
        }
    }

    pub fn insert_phone(&mut self, idx: i32, phone: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_insert_phone(self.to_glib_none_mut().0, idx, phone.to_glib_none().0))
        }
    }

    //pub fn insert_time(&mut self, idx: i32, t: /*Ignored*/&mut SDPTime) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_insert_time() }
    //}

    //pub fn insert_zone(&mut self, idx: i32, zone: /*Ignored*/&mut SDPZone) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_insert_zone() }
    //}

    pub fn medias_len(&self) -> u32 {
        unsafe {
            ffi::gst_sdp_message_medias_len(self.to_glib_none().0)
        }
    }

    //#[cfg(any(feature = "v1_8_1", feature = "dox"))]
    //pub fn parse_keymgmt(&self, mikey: /*Ignored*/MIKEYMessage) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_parse_keymgmt() }
    //}

    pub fn phones_len(&self) -> u32 {
        unsafe {
            ffi::gst_sdp_message_phones_len(self.to_glib_none().0)
        }
    }

    pub fn remove_attribute(&mut self, idx: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_remove_attribute(self.to_glib_none_mut().0, idx))
        }
    }

    pub fn remove_bandwidth(&mut self, idx: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_remove_bandwidth(self.to_glib_none_mut().0, idx))
        }
    }

    pub fn remove_email(&mut self, idx: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_remove_email(self.to_glib_none_mut().0, idx))
        }
    }

    pub fn remove_phone(&mut self, idx: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_remove_phone(self.to_glib_none_mut().0, idx))
        }
    }

    pub fn remove_time(&mut self, idx: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_remove_time(self.to_glib_none_mut().0, idx))
        }
    }

    pub fn remove_zone(&mut self, idx: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_remove_zone(self.to_glib_none_mut().0, idx))
        }
    }

    //pub fn replace_attribute(&mut self, idx: u32, attr: /*Ignored*/&mut SDPAttribute) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_replace_attribute() }
    //}

    //pub fn replace_bandwidth(&mut self, idx: u32, bw: /*Ignored*/&mut SDPBandwidth) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_replace_bandwidth() }
    //}

    pub fn replace_email(&mut self, idx: u32, email: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_replace_email(self.to_glib_none_mut().0, idx, email.to_glib_none().0))
        }
    }

    pub fn replace_phone(&mut self, idx: u32, phone: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_replace_phone(self.to_glib_none_mut().0, idx, phone.to_glib_none().0))
        }
    }

    //pub fn replace_time(&mut self, idx: u32, t: /*Ignored*/&mut SDPTime) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_replace_time() }
    //}

    //pub fn replace_zone(&mut self, idx: u32, zone: /*Ignored*/&mut SDPZone) -> SDPResult {
    //    unsafe { TODO: call ffi::gst_sdp_message_replace_zone() }
    //}

    pub fn set_connection(&mut self, nettype: &str, addrtype: &str, address: &str, ttl: u32, addr_number: u32) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_set_connection(self.to_glib_none_mut().0, nettype.to_glib_none().0, addrtype.to_glib_none().0, address.to_glib_none().0, ttl, addr_number))
        }
    }

    pub fn set_information(&mut self, information: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_set_information(self.to_glib_none_mut().0, information.to_glib_none().0))
        }
    }

    pub fn set_key(&mut self, type_: &str, data: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_set_key(self.to_glib_none_mut().0, type_.to_glib_none().0, data.to_glib_none().0))
        }
    }

    pub fn set_origin(&mut self, username: &str, sess_id: &str, sess_version: &str, nettype: &str, addrtype: &str, addr: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_set_origin(self.to_glib_none_mut().0, username.to_glib_none().0, sess_id.to_glib_none().0, sess_version.to_glib_none().0, nettype.to_glib_none().0, addrtype.to_glib_none().0, addr.to_glib_none().0))
        }
    }

    pub fn set_session_name(&mut self, session_name: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_set_session_name(self.to_glib_none_mut().0, session_name.to_glib_none().0))
        }
    }

    pub fn set_uri(&mut self, uri: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_set_uri(self.to_glib_none_mut().0, uri.to_glib_none().0))
        }
    }

    pub fn set_version(&mut self, version: &str) -> SDPResult {
        unsafe {
            from_glib(ffi::gst_sdp_message_set_version(self.to_glib_none_mut().0, version.to_glib_none().0))
        }
    }

    pub fn times_len(&self) -> u32 {
        unsafe {
            ffi::gst_sdp_message_times_len(self.to_glib_none().0)
        }
    }

    pub fn zones_len(&self) -> u32 {
        unsafe {
            ffi::gst_sdp_message_zones_len(self.to_glib_none().0)
        }
    }

    pub fn as_uri(scheme: &str, msg: &SDPMessage) -> Option<String> {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gst_sdp_message_as_uri(scheme.to_glib_none().0, msg.to_glib_none().0))
        }
    }

    pub fn parse_buffer(data: &[u8], msg: &mut SDPMessage) -> SDPResult {
        assert_initialized_main_thread!();
        let size = data.len() as u32;
        unsafe {
            from_glib(ffi::gst_sdp_message_parse_buffer(data.to_glib_none().0, size, msg.to_glib_none_mut().0))
        }
    }

    pub fn parse_uri(uri: &str, msg: &mut SDPMessage) -> SDPResult {
        assert_initialized_main_thread!();
        unsafe {
            from_glib(ffi::gst_sdp_message_parse_uri(uri.to_glib_none().0, msg.to_glib_none_mut().0))
        }
    }
}

unsafe impl Send for SDPMessage {}