Add VideoOverlay bindings

This commit is contained in:
Sebastian Dröge 2017-08-11 15:03:16 +03:00
parent cb8ca2c00e
commit 4b24ca1823
5 changed files with 106 additions and 0 deletions

View file

@ -45,3 +45,16 @@ name = "Gst.Caps"
status = "manual" status = "manual"
ref_mode = "ref" ref_mode = "ref"
[[object]]
name = "GstVideo.VideoOverlay"
status = "generate"
[[object.function]]
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

@ -1,6 +1,10 @@
// This file was generated by gir (cf27827) from gir-files (???) // This file was generated by gir (cf27827) from gir-files (???)
// DO NOT EDIT // DO NOT EDIT
mod video_overlay;
pub use self::video_overlay::VideoOverlay;
pub use self::video_overlay::VideoOverlayExt;
mod enums; mod enums;
pub use self::enums::VideoColorMatrix; pub use self::enums::VideoColorMatrix;
pub use self::enums::VideoColorPrimaries; pub use self::enums::VideoColorPrimaries;
@ -57,4 +61,5 @@ pub use self::flags::VIDEO_MULTIVIEW_FLAGS_MIXED_MONO;
#[doc(hidden)] #[doc(hidden)]
pub mod traits { pub mod traits {
pub use super::VideoOverlayExt;
} }

View file

@ -0,0 +1,62 @@
// This file was generated by gir (cf27827) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct VideoOverlay(Object<ffi::GstVideoOverlay>);
match fn {
get_type => || ffi::gst_video_overlay_get_type(),
}
}
unsafe impl Send for VideoOverlay {}
unsafe impl Sync for VideoOverlay {}
pub trait VideoOverlayExt {
fn expose(&self);
//fn got_window_handle(&self, handle: /*Unimplemented*/Fundamental: UIntPtr);
fn handle_events(&self, handle_events: bool);
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);
}
impl<O: IsA<VideoOverlay>> VideoOverlayExt for O {
fn expose(&self) {
unsafe {
ffi::gst_video_overlay_expose(self.to_glib_none().0);
}
}
//fn got_window_handle(&self, handle: /*Unimplemented*/Fundamental: UIntPtr) {
// unsafe { TODO: call ffi::gst_video_overlay_got_window_handle() }
//}
fn handle_events(&self, handle_events: bool) {
unsafe {
ffi::gst_video_overlay_handle_events(self.to_glib_none().0, handle_events.to_glib());
}
}
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")
}
}
//fn set_window_handle(&self, handle: /*Unimplemented*/Fundamental: UIntPtr) {
// unsafe { TODO: call ffi::gst_video_overlay_set_window_handle() }
//}
}

View file

@ -15,6 +15,7 @@ extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi; extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_video_sys as ffi; extern crate gstreamer_video_sys as ffi;
extern crate gstreamer as gst; extern crate gstreamer as gst;
#[macro_use]
extern crate glib; extern crate glib;
macro_rules! skip_assert_initialized { macro_rules! skip_assert_initialized {
@ -40,3 +41,5 @@ mod video_info;
pub use video_info::*; pub use video_info::*;
mod video_frame; mod video_frame;
pub use video_frame::VideoFrame; pub use video_frame::VideoFrame;
mod video_overlay;
pub use video_overlay::VideoOverlayExtManual;

View file

@ -0,0 +1,23 @@
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use VideoOverlay;
use libc::uintptr_t;
use glib::IsA;
pub trait VideoOverlayExtManual {
unsafe fn set_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)
}
}