Add VideoOverlay::prepare_window_handle() and got_window_handle()

This commit is contained in:
Sebastian Dröge 2018-09-13 22:53:13 +03:00
parent 20906d41e2
commit c41a8edae7
3 changed files with 13 additions and 5 deletions

View file

@ -59,8 +59,3 @@ status = "generate"
name = "set_render_rectangle"
[object.function.return]
bool_return_is_error = "Failed to set render rectangle"
[[object.function]]
name = "prepare_window_handle"
# to be called by subclasses
ignore = true

View file

@ -39,6 +39,8 @@ pub trait VideoOverlayExt {
fn handle_events(&self, handle_events: bool);
fn prepare_window_handle(&self);
fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), glib::error::BoolError>;
//fn set_window_handle(&self, handle: /*Unimplemented*/Fundamental: UIntPtr);
@ -61,6 +63,12 @@ impl<O: IsA<VideoOverlay>> VideoOverlayExt for O {
}
}
fn prepare_window_handle(&self) {
unsafe {
ffi::gst_video_overlay_prepare_window_handle(self.to_glib_none().0);
}
}
fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_video_overlay_set_render_rectangle(self.to_glib_none().0, x, y, width, height), "Failed to set render rectangle")

View file

@ -14,10 +14,15 @@ use glib::IsA;
pub trait VideoOverlayExtManual {
unsafe fn set_window_handle(&self, handle: uintptr_t);
unsafe fn got_window_handle(&self, handle: uintptr_t);
}
impl<O: IsA<VideoOverlay>> VideoOverlayExtManual for O {
unsafe fn set_window_handle(&self, handle: uintptr_t) {
ffi::gst_video_overlay_set_window_handle(self.to_glib_none().0, handle)
}
unsafe fn got_window_handle(&self, handle: uintptr_t) {
ffi::gst_video_overlay_got_window_handle(self.to_glib_none().0, handle)
}
}