Use the correct pad type for the proxy/ghost pad default pad functions

This commit is contained in:
Sebastian Dröge 2017-12-17 11:24:03 +02:00
parent 62058ab1c3
commit ffb5869dd1
4 changed files with 68 additions and 27 deletions

View file

@ -550,6 +550,16 @@ status = "generate"
name = "construct" name = "construct"
ignore = true ignore = true
[[object.function]]
name = "activate_mode_default"
# wrong instance type
ignore = true
[[object.function]]
name = "internal_activate_mode_default"
# wrong instance type
ignore = true
[[object]] [[object]]
name = "Gst.ProxyPad" name = "Gst.ProxyPad"
status = "generate" status = "generate"

View file

@ -4,7 +4,6 @@
use Object; use Object;
use Pad; use Pad;
use PadDirection; use PadDirection;
use PadMode;
use PadTemplate; use PadTemplate;
use ProxyPad; use ProxyPad;
use ffi; use ffi;
@ -43,24 +42,6 @@ impl GhostPad {
Pad::from_glib_none(ffi::gst_ghost_pad_new_no_target_from_template(name.0, templ.to_glib_none().0)).downcast_unchecked() Pad::from_glib_none(ffi::gst_ghost_pad_new_no_target_from_template(name.0, templ.to_glib_none().0)).downcast_unchecked()
} }
} }
pub fn activate_mode_default<'a, P: IsA<Pad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>(pad: &P, parent: R, mode: PadMode, active: bool) -> bool {
skip_assert_initialized!();
let parent = parent.into();
let parent = parent.to_glib_none();
unsafe {
from_glib(ffi::gst_ghost_pad_activate_mode_default(pad.to_glib_none().0, parent.0, mode.to_glib(), active.to_glib()))
}
}
pub fn internal_activate_mode_default<'a, P: IsA<Pad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>(pad: &P, parent: R, mode: PadMode, active: bool) -> bool {
skip_assert_initialized!();
let parent = parent.into();
let parent = parent.to_glib_none();
unsafe {
from_glib(ffi::gst_ghost_pad_internal_activate_mode_default(pad.to_glib_none().0, parent.0, mode.to_glib(), active.to_glib()))
}
}
} }
unsafe impl Send for GhostPad {} unsafe impl Send for GhostPad {}

View file

@ -8,6 +8,8 @@
use Pad; use Pad;
use PadTemplate; use PadTemplate;
use Object;
use PadMode;
use GhostPad; use GhostPad;
use ffi; use ffi;
use glib::object::Downcast; use glib::object::Downcast;
@ -41,4 +43,52 @@ impl GhostPad {
)).map(|o| Downcast::downcast_unchecked(o)) )).map(|o| Downcast::downcast_unchecked(o))
} }
} }
pub fn activate_mode_default<
'a,
P: IsA<GhostPad>,
Q: IsA<Object> + 'a,
R: Into<Option<&'a Q>>,
>(
pad: &P,
parent: R,
mode: PadMode,
active: bool,
) -> bool {
skip_assert_initialized!();
let parent = parent.into();
let parent = parent.to_glib_none();
unsafe {
from_glib(ffi::gst_ghost_pad_activate_mode_default(
pad.to_glib_none().0 as *mut ffi::GstPad,
parent.0,
mode.to_glib(),
active.to_glib(),
))
}
}
pub fn internal_activate_mode_default<
'a,
P: IsA<GhostPad>,
Q: IsA<Object> + 'a,
R: Into<Option<&'a Q>>,
>(
pad: &P,
parent: R,
mode: PadMode,
active: bool,
) -> bool {
skip_assert_initialized!();
let parent = parent.into();
let parent = parent.to_glib_none();
unsafe {
from_glib(ffi::gst_ghost_pad_internal_activate_mode_default(
pad.to_glib_none().0 as *mut ffi::GstPad,
parent.0,
mode.to_glib(),
active.to_glib(),
))
}
}
} }

View file

@ -20,7 +20,7 @@ use glib::translate::{from_glib, from_glib_full, ToGlibPtr};
use ffi; use ffi;
impl ProxyPad { impl ProxyPad {
pub fn chain_default<'a, P: IsA<Pad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>( pub fn chain_default<'a, P: IsA<ProxyPad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>(
pad: &P, pad: &P,
parent: R, parent: R,
buffer: Buffer, buffer: Buffer,
@ -30,14 +30,14 @@ impl ProxyPad {
let parent = parent.to_glib_none(); let parent = parent.to_glib_none();
unsafe { unsafe {
from_glib(ffi::gst_proxy_pad_chain_default( from_glib(ffi::gst_proxy_pad_chain_default(
pad.to_glib_none().0, pad.to_glib_none().0 as *mut ffi::GstPad,
parent.0, parent.0,
buffer.into_ptr(), buffer.into_ptr(),
)) ))
} }
} }
pub fn chain_list_default<'a, P: IsA<Pad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>( pub fn chain_list_default<'a, P: IsA<ProxyPad>, Q: IsA<Object> + 'a, R: Into<Option<&'a Q>>>(
pad: &P, pad: &P,
parent: R, parent: R,
list: BufferList, list: BufferList,
@ -47,14 +47,14 @@ impl ProxyPad {
let parent = parent.to_glib_none(); let parent = parent.to_glib_none();
unsafe { unsafe {
from_glib(ffi::gst_proxy_pad_chain_list_default( from_glib(ffi::gst_proxy_pad_chain_list_default(
pad.to_glib_none().0, pad.to_glib_none().0 as *mut ffi::GstPad,
parent.0, parent.0,
list.into_ptr(), list.into_ptr(),
)) ))
} }
} }
pub fn getrange_default<P: IsA<Pad>, Q: IsA<Object>>( pub fn getrange_default<P: IsA<ProxyPad>, Q: IsA<Object>>(
pad: &P, pad: &P,
parent: &Q, parent: &Q,
offset: u64, offset: u64,
@ -64,7 +64,7 @@ impl ProxyPad {
unsafe { unsafe {
let mut buffer = ptr::null_mut(); let mut buffer = ptr::null_mut();
let ret = from_glib(ffi::gst_proxy_pad_getrange_default( let ret = from_glib(ffi::gst_proxy_pad_getrange_default(
pad.to_glib_none().0, pad.to_glib_none().0 as *mut ffi::GstPad,
parent.to_glib_none().0, parent.to_glib_none().0,
offset, offset,
size, size,
@ -80,7 +80,7 @@ impl ProxyPad {
pub fn iterate_internal_links_default< pub fn iterate_internal_links_default<
'a, 'a,
P: IsA<Pad>, P: IsA<ProxyPad>,
Q: IsA<Object> + 'a, Q: IsA<Object> + 'a,
R: Into<Option<&'a Q>>, R: Into<Option<&'a Q>>,
>( >(
@ -92,7 +92,7 @@ impl ProxyPad {
let parent = parent.to_glib_none(); let parent = parent.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default( from_glib_full(ffi::gst_proxy_pad_iterate_internal_links_default(
pad.to_glib_none().0, pad.to_glib_none().0 as *mut ffi::GstPad,
parent.0, parent.0,
)) ))
} }