gstreamer-rs/gstreamer-base/src/auto/base_src.rs
2019-01-29 16:28:51 +02:00

267 lines
9.3 KiB
Rust

// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect_raw;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
glib_wrapper! {
pub struct BaseSrc(Object<ffi::GstBaseSrc, ffi::GstBaseSrcClass, BaseSrcClass>) @extends gst::Element, gst::Object;
match fn {
get_type => || ffi::gst_base_src_get_type(),
}
}
unsafe impl Send for BaseSrc {}
unsafe impl Sync for BaseSrc {}
pub const NONE_BASE_SRC: Option<&BaseSrc> = None;
pub trait BaseSrcExt: 'static {
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
fn get_blocksize(&self) -> u32;
fn get_buffer_pool(&self) -> Option<gst::BufferPool>;
fn get_do_timestamp(&self) -> bool;
fn is_async(&self) -> bool;
fn is_live(&self) -> bool;
fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool;
fn query_latency(&self) -> Option<(bool, gst::ClockTime, gst::ClockTime)>;
fn set_async(&self, async: bool);
fn set_automatic_eos(&self, automatic_eos: bool);
fn set_blocksize(&self, blocksize: u32);
fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError>;
fn set_do_timestamp(&self, timestamp: bool);
fn set_dynamic_size(&self, dynamic: bool);
fn set_format(&self, format: gst::Format);
fn set_live(&self, live: bool);
fn get_property_num_buffers(&self) -> i32;
fn set_property_num_buffers(&self, num_buffers: i32);
fn get_property_typefind(&self) -> bool;
fn set_property_typefind(&self, typefind: bool);
fn connect_property_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<BaseSrc>> BaseSrcExt for O {
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
// unsafe { TODO: call ffi::gst_base_src_get_allocator() }
//}
fn get_blocksize(&self) -> u32 {
unsafe {
ffi::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0)
}
}
fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
unsafe {
from_glib_full(ffi::gst_base_src_get_buffer_pool(self.as_ref().to_glib_none().0))
}
}
fn get_do_timestamp(&self) -> bool {
unsafe {
from_glib(ffi::gst_base_src_get_do_timestamp(self.as_ref().to_glib_none().0))
}
}
fn is_async(&self) -> bool {
unsafe {
from_glib(ffi::gst_base_src_is_async(self.as_ref().to_glib_none().0))
}
}
fn is_live(&self) -> bool {
unsafe {
from_glib(ffi::gst_base_src_is_live(self.as_ref().to_glib_none().0))
}
}
fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool {
unsafe {
from_glib(ffi::gst_base_src_new_seamless_segment(self.as_ref().to_glib_none().0, start, stop, time))
}
}
fn query_latency(&self) -> Option<(bool, gst::ClockTime, gst::ClockTime)> {
unsafe {
let mut live = mem::uninitialized();
let mut min_latency = mem::uninitialized();
let mut max_latency = mem::uninitialized();
let ret = from_glib(ffi::gst_base_src_query_latency(self.as_ref().to_glib_none().0, &mut live, &mut min_latency, &mut max_latency));
if ret { Some((from_glib(live), from_glib(min_latency), from_glib(max_latency))) } else { None }
}
}
fn set_async(&self, async: bool) {
unsafe {
ffi::gst_base_src_set_async(self.as_ref().to_glib_none().0, async.to_glib());
}
}
fn set_automatic_eos(&self, automatic_eos: bool) {
unsafe {
ffi::gst_base_src_set_automatic_eos(self.as_ref().to_glib_none().0, automatic_eos.to_glib());
}
}
fn set_blocksize(&self, blocksize: u32) {
unsafe {
ffi::gst_base_src_set_blocksize(self.as_ref().to_glib_none().0, blocksize);
}
}
fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError> {
unsafe {
glib_result_from_gboolean!(ffi::gst_base_src_set_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0), "Failed to set caps")
}
}
fn set_do_timestamp(&self, timestamp: bool) {
unsafe {
ffi::gst_base_src_set_do_timestamp(self.as_ref().to_glib_none().0, timestamp.to_glib());
}
}
fn set_dynamic_size(&self, dynamic: bool) {
unsafe {
ffi::gst_base_src_set_dynamic_size(self.as_ref().to_glib_none().0, dynamic.to_glib());
}
}
fn set_format(&self, format: gst::Format) {
unsafe {
ffi::gst_base_src_set_format(self.as_ref().to_glib_none().0, format.to_glib());
}
}
fn set_live(&self, live: bool) {
unsafe {
ffi::gst_base_src_set_live(self.as_ref().to_glib_none().0, live.to_glib());
}
}
fn get_property_num_buffers(&self) -> i32 {
unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"num-buffers\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_property_num_buffers(&self, num_buffers: i32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"num-buffers\0".as_ptr() as *const _, Value::from(&num_buffers).to_glib_none().0);
}
}
fn get_property_typefind(&self) -> bool {
unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"typefind\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap()
}
}
fn set_property_typefind(&self, typefind: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0 as *mut gobject_ffi::GObject, b"typefind\0".as_ptr() as *const _, Value::from(&typefind).to_glib_none().0);
}
}
fn connect_property_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _,
Some(transmute(notify_blocksize_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::do-timestamp\0".as_ptr() as *const _,
Some(transmute(notify_do_timestamp_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::num-buffers\0".as_ptr() as *const _,
Some(transmute(notify_num_buffers_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
fn connect_property_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"notify::typefind\0".as_ptr() as *const _,
Some(transmute(notify_typefind_trampoline::<Self, F> as usize)), Box_::into_raw(f))
}
}
}
unsafe extern "C" fn notify_blocksize_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> {
let f: &F = transmute(f);
f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn notify_do_timestamp_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> {
let f: &F = transmute(f);
f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn notify_num_buffers_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> {
let f: &F = transmute(f);
f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn notify_typefind_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> {
let f: &F = transmute(f);
f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
}