pad.rs 29.4 KB
Newer Older
1
// This file was generated by gir (a4dcfea) from gir-files (???)
Sebastian Dröge's avatar
Sebastian Dröge committed
2 3
// DO NOT EDIT

Sebastian Dröge's avatar
Sebastian Dröge committed
4
use Caps;
Sebastian Dröge's avatar
Sebastian Dröge committed
5 6 7 8 9
use Element;
use FlowReturn;
use Format;
use Object;
use PadDirection;
10
use PadLinkReturn;
Sebastian Dröge's avatar
Sebastian Dröge committed
11
use PadTemplate;
12 13
#[cfg(feature = "v1_10")]
use Stream;
Sebastian Dröge's avatar
Sebastian Dröge committed
14 15 16 17 18 19 20 21 22 23 24 25 26
use ffi;
use glib;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use libc;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
27
use std::ptr;
Sebastian Dröge's avatar
Sebastian Dröge committed
28 29 30 31 32 33 34 35 36 37 38

glib_wrapper! {
    pub struct Pad(Object<ffi::GstPad>): Object;

    match fn {
        get_type => || ffi::gst_pad_get_type(),
    }
}

impl Pad {
    pub fn new<'a, P: Into<Option<&'a str>>>(name: P, direction: PadDirection) -> Pad {
39
        assert_initialized_main_thread!();
Sebastian Dröge's avatar
Sebastian Dröge committed
40 41 42 43 44 45 46 47 48 49 50 51
        let name = name.into();
        let name = name.to_glib_none();
        unsafe {
            from_glib_none(ffi::gst_pad_new(name.0, direction.to_glib()))
        }
    }

    //pub fn new_from_static_template(templ: /*Ignored*/&mut StaticPadTemplate, name: &str) -> Pad {
    //    unsafe { TODO: call ffi::gst_pad_new_from_static_template() }
    //}

    pub fn new_from_template<'a, P: Into<Option<&'a str>>>(templ: &PadTemplate, name: P) -> Pad {
52
        skip_assert_initialized!();
Sebastian Dröge's avatar
Sebastian Dröge committed
53 54 55 56 57 58 59
        let name = name.into();
        let name = name.to_glib_none();
        unsafe {
            from_glib_none(ffi::gst_pad_new_from_template(templ.to_glib_none().0, name.0))
        }
    }

60
    pub fn link_get_name(ret: PadLinkReturn) -> Option<String> {
61
        assert_initialized_main_thread!();
62 63 64 65
        unsafe {
            from_glib_none(ffi::gst_pad_link_get_name(ret.to_glib()))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
66 67
}

68 69 70
unsafe impl Send for Pad {}
unsafe impl Sync for Pad {}

Sebastian Dröge's avatar
Sebastian Dröge committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
pub trait PadExt {
    //fn activate_mode(&self, mode: /*Ignored*/PadMode, active: bool) -> bool;

    //fn add_probe<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, mask: /*Ignored*/PadProbeType, callback: /*Unknown conversion*//*Unimplemented*/PadProbeCallback, user_data: P, destroy_data: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> libc::c_ulong;

    fn can_link<P: IsA<Pad>>(&self, sinkpad: &P) -> bool;

    //fn chain(&self, buffer: /*Ignored*/&mut Buffer) -> FlowReturn;

    //fn chain_list(&self, list: /*Ignored*/&mut BufferList) -> FlowReturn;

    fn check_reconfigure(&self) -> bool;

    fn create_stream_id<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q) -> Option<String>;

    //fn create_stream_id_printf<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<String>;

    //fn create_stream_id_printf_valist<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<String>;

    //fn event_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, event: /*Ignored*/&mut Event) -> bool;

    //fn forward<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, forward: /*Unknown conversion*//*Unimplemented*/PadForwardFunction, user_data: P) -> bool;

Sebastian Dröge's avatar
Sebastian Dröge committed
94
    fn get_allowed_caps(&self) -> Option<Caps>;
Sebastian Dröge's avatar
Sebastian Dröge committed
95

Sebastian Dröge's avatar
Sebastian Dröge committed
96
    fn get_current_caps(&self) -> Option<Caps>;
Sebastian Dröge's avatar
Sebastian Dröge committed
97 98 99 100 101 102 103 104 105 106 107

    fn get_direction(&self) -> PadDirection;

    //fn get_element_private(&self) -> /*Unimplemented*/Option<Fundamental: Pointer>;

    fn get_last_flow_return(&self) -> FlowReturn;

    fn get_offset(&self) -> i64;

    fn get_pad_template(&self) -> Option<PadTemplate>;

Sebastian Dröge's avatar
Sebastian Dröge committed
108
    fn get_pad_template_caps(&self) -> Option<Caps>;
Sebastian Dröge's avatar
Sebastian Dröge committed
109 110 111 112 113 114 115 116 117

    fn get_parent_element(&self) -> Option<Element>;

    fn get_peer(&self) -> Option<Pad>;

    //fn get_range(&self, offset: u64, size: u32, buffer: /*Ignored*/Buffer) -> FlowReturn;

    //fn get_sticky_event(&self, event_type: /*Ignored*/EventType, idx: u32) -> /*Ignored*/Option<Event>;

118 119
    #[cfg(feature = "v1_10")]
    fn get_stream(&self) -> Option<Stream>;
Sebastian Dröge's avatar
Sebastian Dröge committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139

    fn get_stream_id(&self) -> Option<String>;

    //#[cfg(feature = "v1_12")]
    //fn get_task_state(&self) -> /*Ignored*/TaskState;

    fn has_current_caps(&self) -> bool;

    fn is_active(&self) -> bool;

    fn is_blocked(&self) -> bool;

    fn is_blocking(&self) -> bool;

    fn is_linked(&self) -> bool;

    //fn iterate_internal_links(&self) -> /*Ignored*/Option<Iterator>;

    //fn iterate_internal_links_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q) -> /*Ignored*/Option<Iterator>;

140
    fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> PadLinkReturn;
Sebastian Dröge's avatar
Sebastian Dröge committed
141

142
    //fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: /*Ignored*/PadLinkCheck) -> PadLinkReturn;
Sebastian Dröge's avatar
Sebastian Dröge committed
143 144

    #[cfg(feature = "v1_10")]
145
    fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError>;
Sebastian Dröge's avatar
Sebastian Dröge committed
146 147 148 149 150 151 152 153

    //#[cfg(feature = "v1_10")]
    //fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: /*Ignored*/PadLinkCheck) -> bool;

    fn mark_reconfigure(&self);

    fn needs_reconfigure(&self) -> bool;

154
    fn pause_task(&self) -> Result<(), glib::error::BoolError>;
Sebastian Dröge's avatar
Sebastian Dröge committed
155 156 157

    //fn peer_query(&self, query: /*Ignored*/&mut Query) -> bool;

Sebastian Dröge's avatar
Sebastian Dröge committed
158
    fn peer_query_accept_caps(&self, caps: &Caps) -> bool;
Sebastian Dröge's avatar
Sebastian Dröge committed
159

Sebastian Dröge's avatar
Sebastian Dröge committed
160
    fn peer_query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps>;
Sebastian Dröge's avatar
Sebastian Dröge committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181

    fn peer_query_convert(&self, src_format: Format, src_val: i64, dest_format: Format) -> Option<i64>;

    fn peer_query_duration(&self, format: Format) -> Option<i64>;

    fn peer_query_position(&self, format: Format) -> Option<i64>;

    //fn proxy_query_accept_caps(&self, query: /*Ignored*/&mut Query) -> bool;

    //fn proxy_query_caps(&self, query: /*Ignored*/&mut Query) -> bool;

    //fn pull_range(&self, offset: u64, size: u32, buffer: /*Ignored*/Buffer) -> FlowReturn;

    //fn push(&self, buffer: /*Ignored*/&mut Buffer) -> FlowReturn;

    //fn push_event(&self, event: /*Ignored*/&mut Event) -> bool;

    //fn push_list(&self, list: /*Ignored*/&mut BufferList) -> FlowReturn;

    //fn query(&self, query: /*Ignored*/&mut Query) -> bool;

Sebastian Dröge's avatar
Sebastian Dröge committed
182
    fn query_accept_caps(&self, caps: &Caps) -> bool;
Sebastian Dröge's avatar
Sebastian Dröge committed
183

Sebastian Dröge's avatar
Sebastian Dröge committed
184
    fn query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps>;
Sebastian Dröge's avatar
Sebastian Dröge committed
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201

    fn query_convert(&self, src_format: Format, src_val: i64, dest_format: Format) -> Option<i64>;

    //fn query_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, query: /*Ignored*/&mut Query) -> bool;

    fn query_duration(&self, format: Format) -> Option<i64>;

    fn query_position(&self, format: Format) -> Option<i64>;

    fn remove_probe(&self, id: libc::c_ulong);

    //fn send_event(&self, event: /*Ignored*/&mut Event) -> bool;

    //fn set_activate_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activate: /*Unknown conversion*//*Unimplemented*/PadActivateFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_activatemode_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activatemode: /*Unknown conversion*//*Unimplemented*/PadActivateModeFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

202
    fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError>;
Sebastian Dröge's avatar
Sebastian Dröge committed
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

    //fn set_chain_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, chain: /*Unknown conversion*//*Unimplemented*/PadChainFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_chain_list_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, chainlist: /*Unknown conversion*//*Unimplemented*/PadChainListFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_element_private<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priv_: P);

    //fn set_event_full_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFullFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_event_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_getrange_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, get: /*Unknown conversion*//*Unimplemented*/PadGetRangeFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_iterate_internal_links_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, iterintlink: /*Unknown conversion*//*Unimplemented*/PadIterIntLinkFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_link_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, link: /*Unknown conversion*//*Unimplemented*/PadLinkFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    fn set_offset(&self, offset: i64);

    //fn set_query_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, query: /*Unknown conversion*//*Unimplemented*/PadQueryFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_unlink_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, unlink: /*Unknown conversion*//*Unimplemented*/PadUnlinkFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn start_task<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/TaskFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> bool;

    //fn sticky_events_foreach<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, foreach_func: /*Unknown conversion*//*Unimplemented*/PadStickyEventsForeachFunction, user_data: P);

230
    fn stop_task(&self) -> Result<(), glib::error::BoolError>;
Sebastian Dröge's avatar
Sebastian Dröge committed
231 232 233

    //fn store_sticky_event(&self, event: /*Ignored*/&mut Event) -> FlowReturn;

234
    fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError>;
Sebastian Dröge's avatar
Sebastian Dröge committed
235 236 237 238 239 240 241

    fn use_fixed_caps(&self);

    fn get_property_template(&self) -> Option<PadTemplate>;

    fn set_property_template(&self, template: Option<&PadTemplate>);

242
    fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(&self, f: F) -> u64;
Sebastian Dröge's avatar
Sebastian Dröge committed
243

244
    fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(&self, f: F) -> u64;
Sebastian Dröge's avatar
Sebastian Dröge committed
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
}

impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
    //fn activate_mode(&self, mode: /*Ignored*/PadMode, active: bool) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_activate_mode() }
    //}

    //fn add_probe<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, mask: /*Ignored*/PadProbeType, callback: /*Unknown conversion*//*Unimplemented*/PadProbeCallback, user_data: P, destroy_data: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> libc::c_ulong {
    //    unsafe { TODO: call ffi::gst_pad_add_probe() }
    //}

    fn can_link<P: IsA<Pad>>(&self, sinkpad: &P) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_can_link(self.to_glib_none().0, sinkpad.to_glib_none().0))
        }
    }

    //fn chain(&self, buffer: /*Ignored*/&mut Buffer) -> FlowReturn {
    //    unsafe { TODO: call ffi::gst_pad_chain() }
    //}

    //fn chain_list(&self, list: /*Ignored*/&mut BufferList) -> FlowReturn {
    //    unsafe { TODO: call ffi::gst_pad_chain_list() }
    //}

    fn check_reconfigure(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_check_reconfigure(self.to_glib_none().0))
        }
    }

    fn create_stream_id<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q) -> Option<String> {
        let stream_id = stream_id.into();
        let stream_id = stream_id.to_glib_none();
        unsafe {
            from_glib_full(ffi::gst_pad_create_stream_id(self.to_glib_none().0, parent.to_glib_none().0, stream_id.0))
        }
    }

    //fn create_stream_id_printf<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<String> {
    //    unsafe { TODO: call ffi::gst_pad_create_stream_id_printf() }
    //}

    //fn create_stream_id_printf_valist<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<String> {
    //    unsafe { TODO: call ffi::gst_pad_create_stream_id_printf_valist() }
    //}

    //fn event_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, event: /*Ignored*/&mut Event) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_event_default() }
    //}

    //fn forward<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, forward: /*Unknown conversion*//*Unimplemented*/PadForwardFunction, user_data: P) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_forward() }
    //}

Sebastian Dröge's avatar
Sebastian Dröge committed
300 301 302 303 304
    fn get_allowed_caps(&self) -> Option<Caps> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_allowed_caps(self.to_glib_none().0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
305

Sebastian Dröge's avatar
Sebastian Dröge committed
306 307 308 309 310
    fn get_current_caps(&self) -> Option<Caps> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_current_caps(self.to_glib_none().0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
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

    fn get_direction(&self) -> PadDirection {
        unsafe {
            from_glib(ffi::gst_pad_get_direction(self.to_glib_none().0))
        }
    }

    //fn get_element_private(&self) -> /*Unimplemented*/Option<Fundamental: Pointer> {
    //    unsafe { TODO: call ffi::gst_pad_get_element_private() }
    //}

    fn get_last_flow_return(&self) -> FlowReturn {
        unsafe {
            from_glib(ffi::gst_pad_get_last_flow_return(self.to_glib_none().0))
        }
    }

    fn get_offset(&self) -> i64 {
        unsafe {
            ffi::gst_pad_get_offset(self.to_glib_none().0)
        }
    }

    fn get_pad_template(&self) -> Option<PadTemplate> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_pad_template(self.to_glib_none().0))
        }
    }

Sebastian Dröge's avatar
Sebastian Dröge committed
340 341 342 343 344
    fn get_pad_template_caps(&self) -> Option<Caps> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_pad_template_caps(self.to_glib_none().0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365

    fn get_parent_element(&self) -> Option<Element> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_parent_element(self.to_glib_none().0))
        }
    }

    fn get_peer(&self) -> Option<Pad> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_peer(self.to_glib_none().0))
        }
    }

    //fn get_range(&self, offset: u64, size: u32, buffer: /*Ignored*/Buffer) -> FlowReturn {
    //    unsafe { TODO: call ffi::gst_pad_get_range() }
    //}

    //fn get_sticky_event(&self, event_type: /*Ignored*/EventType, idx: u32) -> /*Ignored*/Option<Event> {
    //    unsafe { TODO: call ffi::gst_pad_get_sticky_event() }
    //}

366 367 368 369 370 371
    #[cfg(feature = "v1_10")]
    fn get_stream(&self) -> Option<Stream> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_stream(self.to_glib_none().0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421

    fn get_stream_id(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_stream_id(self.to_glib_none().0))
        }
    }

    //#[cfg(feature = "v1_12")]
    //fn get_task_state(&self) -> /*Ignored*/TaskState {
    //    unsafe { TODO: call ffi::gst_pad_get_task_state() }
    //}

    fn has_current_caps(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_has_current_caps(self.to_glib_none().0))
        }
    }

    fn is_active(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_is_active(self.to_glib_none().0))
        }
    }

    fn is_blocked(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_is_blocked(self.to_glib_none().0))
        }
    }

    fn is_blocking(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_is_blocking(self.to_glib_none().0))
        }
    }

    fn is_linked(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_is_linked(self.to_glib_none().0))
        }
    }

    //fn iterate_internal_links(&self) -> /*Ignored*/Option<Iterator> {
    //    unsafe { TODO: call ffi::gst_pad_iterate_internal_links() }
    //}

    //fn iterate_internal_links_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q) -> /*Ignored*/Option<Iterator> {
    //    unsafe { TODO: call ffi::gst_pad_iterate_internal_links_default() }
    //}

422 423 424 425 426
    fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> PadLinkReturn {
        unsafe {
            from_glib(ffi::gst_pad_link(self.to_glib_none().0, sinkpad.to_glib_none().0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
427

428
    //fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: /*Ignored*/PadLinkCheck) -> PadLinkReturn {
Sebastian Dröge's avatar
Sebastian Dröge committed
429 430 431 432
    //    unsafe { TODO: call ffi::gst_pad_link_full() }
    //}

    #[cfg(feature = "v1_10")]
433
    fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError> {
Sebastian Dröge's avatar
Sebastian Dröge committed
434
        unsafe {
435
            glib::error::BoolError::from_glib(ffi::gst_pad_link_maybe_ghosting(self.to_glib_none().0, sink.to_glib_none().0), "Failed to link pad, possibly ghosting")
Sebastian Dröge's avatar
Sebastian Dröge committed
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
        }
    }

    //#[cfg(feature = "v1_10")]
    //fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: /*Ignored*/PadLinkCheck) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_link_maybe_ghosting_full() }
    //}

    fn mark_reconfigure(&self) {
        unsafe {
            ffi::gst_pad_mark_reconfigure(self.to_glib_none().0);
        }
    }

    fn needs_reconfigure(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_needs_reconfigure(self.to_glib_none().0))
        }
    }

456
    fn pause_task(&self) -> Result<(), glib::error::BoolError> {
Sebastian Dröge's avatar
Sebastian Dröge committed
457
        unsafe {
458
            glib::error::BoolError::from_glib(ffi::gst_pad_pause_task(self.to_glib_none().0), "Failed to pause pad task")
Sebastian Dröge's avatar
Sebastian Dröge committed
459 460 461 462 463 464 465
        }
    }

    //fn peer_query(&self, query: /*Ignored*/&mut Query) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_peer_query() }
    //}

Sebastian Dröge's avatar
Sebastian Dröge committed
466 467 468 469 470
    fn peer_query_accept_caps(&self, caps: &Caps) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_peer_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
471

Sebastian Dröge's avatar
Sebastian Dröge committed
472 473 474 475 476 477 478
    fn peer_query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps> {
        let filter = filter.into();
        let filter = filter.to_glib_none();
        unsafe {
            from_glib_full(ffi::gst_pad_peer_query_caps(self.to_glib_none().0, filter.0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531

    fn peer_query_convert(&self, src_format: Format, src_val: i64, dest_format: Format) -> Option<i64> {
        unsafe {
            let mut dest_val = mem::uninitialized();
            let ret = from_glib(ffi::gst_pad_peer_query_convert(self.to_glib_none().0, src_format.to_glib(), src_val, dest_format.to_glib(), &mut dest_val));
            if ret { Some(dest_val) } else { None }
        }
    }

    fn peer_query_duration(&self, format: Format) -> Option<i64> {
        unsafe {
            let mut duration = mem::uninitialized();
            let ret = from_glib(ffi::gst_pad_peer_query_duration(self.to_glib_none().0, format.to_glib(), &mut duration));
            if ret { Some(duration) } else { None }
        }
    }

    fn peer_query_position(&self, format: Format) -> Option<i64> {
        unsafe {
            let mut cur = mem::uninitialized();
            let ret = from_glib(ffi::gst_pad_peer_query_position(self.to_glib_none().0, format.to_glib(), &mut cur));
            if ret { Some(cur) } else { None }
        }
    }

    //fn proxy_query_accept_caps(&self, query: /*Ignored*/&mut Query) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_proxy_query_accept_caps() }
    //}

    //fn proxy_query_caps(&self, query: /*Ignored*/&mut Query) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_proxy_query_caps() }
    //}

    //fn pull_range(&self, offset: u64, size: u32, buffer: /*Ignored*/Buffer) -> FlowReturn {
    //    unsafe { TODO: call ffi::gst_pad_pull_range() }
    //}

    //fn push(&self, buffer: /*Ignored*/&mut Buffer) -> FlowReturn {
    //    unsafe { TODO: call ffi::gst_pad_push() }
    //}

    //fn push_event(&self, event: /*Ignored*/&mut Event) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_push_event() }
    //}

    //fn push_list(&self, list: /*Ignored*/&mut BufferList) -> FlowReturn {
    //    unsafe { TODO: call ffi::gst_pad_push_list() }
    //}

    //fn query(&self, query: /*Ignored*/&mut Query) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_query() }
    //}

Sebastian Dröge's avatar
Sebastian Dröge committed
532 533 534 535 536
    fn query_accept_caps(&self, caps: &Caps) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
537

Sebastian Dröge's avatar
Sebastian Dröge committed
538 539 540 541 542 543 544
    fn query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps> {
        let filter = filter.into();
        let filter = filter.to_glib_none();
        unsafe {
            from_glib_full(ffi::gst_pad_query_caps(self.to_glib_none().0, filter.0))
        }
    }
Sebastian Dröge's avatar
Sebastian Dröge committed
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591

    fn query_convert(&self, src_format: Format, src_val: i64, dest_format: Format) -> Option<i64> {
        unsafe {
            let mut dest_val = mem::uninitialized();
            let ret = from_glib(ffi::gst_pad_query_convert(self.to_glib_none().0, src_format.to_glib(), src_val, dest_format.to_glib(), &mut dest_val));
            if ret { Some(dest_val) } else { None }
        }
    }

    //fn query_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, query: /*Ignored*/&mut Query) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_query_default() }
    //}

    fn query_duration(&self, format: Format) -> Option<i64> {
        unsafe {
            let mut duration = mem::uninitialized();
            let ret = from_glib(ffi::gst_pad_query_duration(self.to_glib_none().0, format.to_glib(), &mut duration));
            if ret { Some(duration) } else { None }
        }
    }

    fn query_position(&self, format: Format) -> Option<i64> {
        unsafe {
            let mut cur = mem::uninitialized();
            let ret = from_glib(ffi::gst_pad_query_position(self.to_glib_none().0, format.to_glib(), &mut cur));
            if ret { Some(cur) } else { None }
        }
    }

    fn remove_probe(&self, id: libc::c_ulong) {
        unsafe {
            ffi::gst_pad_remove_probe(self.to_glib_none().0, id);
        }
    }

    //fn send_event(&self, event: /*Ignored*/&mut Event) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_send_event() }
    //}

    //fn set_activate_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activate: /*Unknown conversion*//*Unimplemented*/PadActivateFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_activate_function_full() }
    //}

    //fn set_activatemode_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activatemode: /*Unknown conversion*//*Unimplemented*/PadActivateModeFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_activatemode_function_full() }
    //}

592
    fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
Sebastian Dröge's avatar
Sebastian Dröge committed
593
        unsafe {
594
            glib::error::BoolError::from_glib(ffi::gst_pad_set_active(self.to_glib_none().0, active.to_glib()), "Failed to activate pad")
Sebastian Dröge's avatar
Sebastian Dröge committed
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
        }
    }

    //fn set_chain_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, chain: /*Unknown conversion*//*Unimplemented*/PadChainFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_chain_function_full() }
    //}

    //fn set_chain_list_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, chainlist: /*Unknown conversion*//*Unimplemented*/PadChainListFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_chain_list_function_full() }
    //}

    //fn set_element_private<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priv_: P) {
    //    unsafe { TODO: call ffi::gst_pad_set_element_private() }
    //}

    //fn set_event_full_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFullFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_event_full_function_full() }
    //}

    //fn set_event_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_event_function_full() }
    //}

    //fn set_getrange_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, get: /*Unknown conversion*//*Unimplemented*/PadGetRangeFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_getrange_function_full() }
    //}

    //fn set_iterate_internal_links_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, iterintlink: /*Unknown conversion*//*Unimplemented*/PadIterIntLinkFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_iterate_internal_links_function_full() }
    //}

    //fn set_link_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, link: /*Unknown conversion*//*Unimplemented*/PadLinkFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_link_function_full() }
    //}

    fn set_offset(&self, offset: i64) {
        unsafe {
            ffi::gst_pad_set_offset(self.to_glib_none().0, offset);
        }
    }

    //fn set_query_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, query: /*Unknown conversion*//*Unimplemented*/PadQueryFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_query_function_full() }
    //}

    //fn set_unlink_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, unlink: /*Unknown conversion*//*Unimplemented*/PadUnlinkFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_unlink_function_full() }
    //}

    //fn start_task<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/TaskFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_start_task() }
    //}

    //fn sticky_events_foreach<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, foreach_func: /*Unknown conversion*//*Unimplemented*/PadStickyEventsForeachFunction, user_data: P) {
    //    unsafe { TODO: call ffi::gst_pad_sticky_events_foreach() }
    //}

652
    fn stop_task(&self) -> Result<(), glib::error::BoolError> {
Sebastian Dröge's avatar
Sebastian Dröge committed
653
        unsafe {
654
            glib::error::BoolError::from_glib(ffi::gst_pad_stop_task(self.to_glib_none().0), "Failed to stop pad task")
Sebastian Dröge's avatar
Sebastian Dröge committed
655 656 657 658 659 660 661
        }
    }

    //fn store_sticky_event(&self, event: /*Ignored*/&mut Event) -> FlowReturn {
    //    unsafe { TODO: call ffi::gst_pad_store_sticky_event() }
    //}

662
    fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError> {
Sebastian Dröge's avatar
Sebastian Dröge committed
663
        unsafe {
664
            glib::error::BoolError::from_glib(ffi::gst_pad_unlink(self.to_glib_none().0, sinkpad.to_glib_none().0), "Failed to unlink pad")
Sebastian Dröge's avatar
Sebastian Dröge committed
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687
        }
    }

    fn use_fixed_caps(&self) {
        unsafe {
            ffi::gst_pad_use_fixed_caps(self.to_glib_none().0);
        }
    }

    fn get_property_template(&self) -> Option<PadTemplate> {
        let mut value = Value::from(None::<&PadTemplate>);
        unsafe {
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "template".to_glib_none().0, value.to_glib_none_mut().0);
        }
        value.get()
    }

    fn set_property_template(&self, template: Option<&PadTemplate>) {
        unsafe {
            gobject_ffi::g_object_set_property(self.to_glib_none().0, "template".to_glib_none().0, Value::from(template).to_glib_none().0);
        }
    }

688
    fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(&self, f: F) -> u64 {
Sebastian Dröge's avatar
Sebastian Dröge committed
689
        unsafe {
690
            let f: Box_<Box_<Fn(&Self, &Pad) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
Sebastian Dröge's avatar
Sebastian Dröge committed
691 692 693 694 695
            connect(self.to_glib_none().0, "linked",
                transmute(linked_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

696
    fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(&self, f: F) -> u64 {
Sebastian Dröge's avatar
Sebastian Dröge committed
697
        unsafe {
698
            let f: Box_<Box_<Fn(&Self, &Pad) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
Sebastian Dröge's avatar
Sebastian Dröge committed
699 700 701 702 703 704 705 706 707
            connect(self.to_glib_none().0, "unlinked",
                transmute(unlinked_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }
}

unsafe extern "C" fn linked_trampoline<P>(this: *mut ffi::GstPad, peer: *mut ffi::GstPad, f: glib_ffi::gpointer)
where P: IsA<Pad> {
    callback_guard!();
708
    let f: &Box_<Fn(&P, &Pad) + Send + Sync + 'static> = transmute(f);
Sebastian Dröge's avatar
Sebastian Dröge committed
709 710 711 712 713 714
    f(&Pad::from_glib_none(this).downcast_unchecked(), &from_glib_none(peer))
}

unsafe extern "C" fn unlinked_trampoline<P>(this: *mut ffi::GstPad, peer: *mut ffi::GstPad, f: glib_ffi::gpointer)
where P: IsA<Pad> {
    callback_guard!();
715
    let f: &Box_<Fn(&P, &Pad) + Send + Sync + 'static> = transmute(f);
Sebastian Dröge's avatar
Sebastian Dröge committed
716 717
    f(&Pad::from_glib_none(this).downcast_unchecked(), &from_glib_none(peer))
}