Add initial, untested version of GstApp bindings

This commit is contained in:
Sebastian Dröge 2017-08-01 13:37:22 +01:00
parent e55c7d4088
commit 99c3c61f59
6 changed files with 902 additions and 0 deletions

42
Gir_GstApp.toml Normal file
View file

@ -0,0 +1,42 @@
[options]
girs_dir = "gir-files"
library = "GstApp"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-app"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
external_libraries = [
"GLib",
"GObject",
]
generate = [
"GstApp.AppSink",
"GstApp.AppSrc",
"GstApp.AppStreamType",
]
manual = [
"GObject.Object",
"Gst.ClockTime",
"Gst.FlowReturn",
"Gst.Format",
]
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Buffer"
status = "manual"
ref_mode = "ref"
[[object]]
name = "Gst.Sample"
status = "manual"
ref_mode = "ref"

View file

@ -0,0 +1,336 @@
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
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 gst;
use gst_ffi;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct AppSink(Object<ffi::GstAppSink>);
match fn {
get_type => || ffi::gst_app_sink_get_type(),
}
}
unsafe impl Send for AppSink {}
unsafe impl Sync for AppSink {}
pub trait AppSinkExt {
#[cfg(feature = "v1_12")]
fn get_buffer_list_support(&self) -> bool;
fn get_caps(&self) -> Option<gst::Caps>;
fn get_drop(&self) -> bool;
fn get_emit_signals(&self) -> bool;
fn get_max_buffers(&self) -> u32;
fn get_wait_on_eos(&self) -> bool;
fn is_eos(&self) -> bool;
fn pull_preroll(&self) -> Option<gst::Sample>;
fn pull_sample(&self) -> Option<gst::Sample>;
#[cfg(feature = "v1_12")]
fn set_buffer_list_support(&self, enable_lists: bool);
//fn set_callbacks<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, callbacks: /*Ignored*/&mut AppSinkCallbacks, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
fn set_caps(&self, caps: &gst::Caps);
fn set_drop(&self, drop: bool);
fn set_emit_signals(&self, emit: bool);
fn set_max_buffers(&self, max: u32);
fn set_wait_on_eos(&self, wait: bool);
#[cfg(feature = "v1_10")]
fn try_pull_preroll(&self, timeout: gst::ClockTime) -> Option<gst::Sample>;
#[cfg(feature = "v1_10")]
fn try_pull_sample(&self, timeout: gst::ClockTime) -> Option<gst::Sample>;
fn get_property_buffer_list(&self) -> bool;
fn set_property_buffer_list(&self, buffer_list: bool);
fn get_property_eos(&self) -> bool;
fn connect_eos<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_new_preroll<F: Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_new_sample<F: Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_pull_preroll<F: Fn(&Self) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_pull_sample<F: Fn(&Self) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64;
#[cfg(feature = "v1_10")]
fn connect_try_pull_preroll<F: Fn(&Self, u64) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64;
#[cfg(feature = "v1_10")]
fn connect_try_pull_sample<F: Fn(&Self, u64) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64;
}
impl<O: IsA<AppSink> + IsA<glib::object::Object>> AppSinkExt for O {
#[cfg(feature = "v1_12")]
fn get_buffer_list_support(&self) -> bool {
unsafe {
from_glib(ffi::gst_app_sink_get_buffer_list_support(self.to_glib_none().0))
}
}
fn get_caps(&self) -> Option<gst::Caps> {
unsafe {
from_glib_full(ffi::gst_app_sink_get_caps(self.to_glib_none().0))
}
}
fn get_drop(&self) -> bool {
unsafe {
from_glib(ffi::gst_app_sink_get_drop(self.to_glib_none().0))
}
}
fn get_emit_signals(&self) -> bool {
unsafe {
from_glib(ffi::gst_app_sink_get_emit_signals(self.to_glib_none().0))
}
}
fn get_max_buffers(&self) -> u32 {
unsafe {
ffi::gst_app_sink_get_max_buffers(self.to_glib_none().0)
}
}
fn get_wait_on_eos(&self) -> bool {
unsafe {
from_glib(ffi::gst_app_sink_get_wait_on_eos(self.to_glib_none().0))
}
}
fn is_eos(&self) -> bool {
unsafe {
from_glib(ffi::gst_app_sink_is_eos(self.to_glib_none().0))
}
}
fn pull_preroll(&self) -> Option<gst::Sample> {
unsafe {
from_glib_full(ffi::gst_app_sink_pull_preroll(self.to_glib_none().0))
}
}
fn pull_sample(&self) -> Option<gst::Sample> {
unsafe {
from_glib_full(ffi::gst_app_sink_pull_sample(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
fn set_buffer_list_support(&self, enable_lists: bool) {
unsafe {
ffi::gst_app_sink_set_buffer_list_support(self.to_glib_none().0, enable_lists.to_glib());
}
}
//fn set_callbacks<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, callbacks: /*Ignored*/&mut AppSinkCallbacks, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::gst_app_sink_set_callbacks() }
//}
fn set_caps(&self, caps: &gst::Caps) {
unsafe {
ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
}
}
fn set_drop(&self, drop: bool) {
unsafe {
ffi::gst_app_sink_set_drop(self.to_glib_none().0, drop.to_glib());
}
}
fn set_emit_signals(&self, emit: bool) {
unsafe {
ffi::gst_app_sink_set_emit_signals(self.to_glib_none().0, emit.to_glib());
}
}
fn set_max_buffers(&self, max: u32) {
unsafe {
ffi::gst_app_sink_set_max_buffers(self.to_glib_none().0, max);
}
}
fn set_wait_on_eos(&self, wait: bool) {
unsafe {
ffi::gst_app_sink_set_wait_on_eos(self.to_glib_none().0, wait.to_glib());
}
}
#[cfg(feature = "v1_10")]
fn try_pull_preroll(&self, timeout: gst::ClockTime) -> Option<gst::Sample> {
unsafe {
from_glib_full(ffi::gst_app_sink_try_pull_preroll(self.to_glib_none().0, timeout))
}
}
#[cfg(feature = "v1_10")]
fn try_pull_sample(&self, timeout: gst::ClockTime) -> Option<gst::Sample> {
unsafe {
from_glib_full(ffi::gst_app_sink_try_pull_sample(self.to_glib_none().0, timeout))
}
}
fn get_property_buffer_list(&self) -> bool {
let mut value = Value::from(&false);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "buffer-list".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_buffer_list(&self, buffer_list: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "buffer-list".to_glib_none().0, Value::from(&buffer_list).to_glib_none().0);
}
}
fn get_property_eos(&self) -> bool {
let mut value = Value::from(&false);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "eos".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn connect_eos<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "eos",
transmute(eos_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_new_preroll<F: Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "new-preroll",
transmute(new_preroll_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_new_sample<F: Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "new-sample",
transmute(new_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_pull_preroll<F: Fn(&Self) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) -> gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "pull-preroll",
transmute(pull_preroll_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_pull_sample<F: Fn(&Self) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) -> gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "pull-sample",
transmute(pull_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
#[cfg(feature = "v1_10")]
fn connect_try_pull_preroll<F: Fn(&Self, u64) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, u64) -> gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "try-pull-preroll",
transmute(try_pull_preroll_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
#[cfg(feature = "v1_10")]
fn connect_try_pull_sample<F: Fn(&Self, u64) -> gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, u64) -> gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "try-pull-sample",
transmute(try_pull_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn eos_trampoline<P>(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer)
where P: IsA<AppSink> {
callback_guard!();
let f: &Box_<Fn(&P) + Send + Sync + 'static> = transmute(f);
f(&AppSink::from_glib_none(this).downcast_unchecked())
}
unsafe extern "C" fn new_preroll_trampoline<P>(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn
where P: IsA<AppSink> {
callback_guard!();
let f: &Box_<Fn(&P) -> gst::FlowReturn + Send + Sync + 'static> = transmute(f);
f(&AppSink::from_glib_none(this).downcast_unchecked()).to_glib()
}
unsafe extern "C" fn new_sample_trampoline<P>(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn
where P: IsA<AppSink> {
callback_guard!();
let f: &Box_<Fn(&P) -> gst::FlowReturn + Send + Sync + 'static> = transmute(f);
f(&AppSink::from_glib_none(this).downcast_unchecked()).to_glib()
}
unsafe extern "C" fn pull_preroll_trampoline<P>(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample
where P: IsA<AppSink> {
callback_guard!();
let f: &Box_<Fn(&P) -> gst::Sample + Send + Sync + 'static> = transmute(f);
f(&AppSink::from_glib_none(this).downcast_unchecked()).to_glib_full()
}
unsafe extern "C" fn pull_sample_trampoline<P>(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample
where P: IsA<AppSink> {
callback_guard!();
let f: &Box_<Fn(&P) -> gst::Sample + Send + Sync + 'static> = transmute(f);
f(&AppSink::from_glib_none(this).downcast_unchecked()).to_glib_full()
}
#[cfg(feature = "v1_10")]
unsafe extern "C" fn try_pull_preroll_trampoline<P>(this: *mut ffi::GstAppSink, timeout: u64, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample
where P: IsA<AppSink> {
callback_guard!();
let f: &Box_<Fn(&P, u64) -> gst::Sample + Send + Sync + 'static> = transmute(f);
f(&AppSink::from_glib_none(this).downcast_unchecked(), timeout).to_glib_full()
}
#[cfg(feature = "v1_10")]
unsafe extern "C" fn try_pull_sample_trampoline<P>(this: *mut ffi::GstAppSink, timeout: u64, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample
where P: IsA<AppSink> {
callback_guard!();
let f: &Box_<Fn(&P, u64) -> gst::Sample + Send + Sync + 'static> = transmute(f);
f(&AppSink::from_glib_none(this).downcast_unchecked(), timeout).to_glib_full()
}

View file

@ -0,0 +1,428 @@
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use AppStreamType;
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 gst;
use gst_ffi;
use libc;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;
glib_wrapper! {
pub struct AppSrc(Object<ffi::GstAppSrc>);
match fn {
get_type => || ffi::gst_app_src_get_type(),
}
}
unsafe impl Send for AppSrc {}
unsafe impl Sync for AppSrc {}
pub trait AppSrcExt {
fn end_of_stream(&self) -> gst::FlowReturn;
fn get_caps(&self) -> Option<gst::Caps>;
fn get_current_level_bytes(&self) -> u64;
#[cfg(feature = "v1_10")]
fn get_duration(&self) -> gst::ClockTime;
fn get_emit_signals(&self) -> bool;
fn get_latency(&self, min: u64, max: u64);
fn get_max_bytes(&self) -> u64;
fn get_size(&self) -> i64;
fn get_stream_type(&self) -> AppStreamType;
fn push_buffer(&self, buffer: &gst::Buffer) -> gst::FlowReturn;
fn push_sample(&self, sample: &gst::Sample) -> gst::FlowReturn;
//fn set_callbacks<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, callbacks: /*Ignored*/&mut AppSrcCallbacks, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
fn set_caps(&self, caps: &gst::Caps);
#[cfg(feature = "v1_10")]
fn set_duration(&self, duration: gst::ClockTime);
fn set_emit_signals(&self, emit: bool);
fn set_latency(&self, min: u64, max: u64);
fn set_max_bytes(&self, max: u64);
fn set_size(&self, size: i64);
fn set_stream_type(&self, type_: AppStreamType);
fn get_property_block(&self) -> bool;
fn set_property_block(&self, block: bool);
fn get_property_current_level_bytes(&self) -> u64;
fn get_property_duration(&self) -> u64;
fn set_property_duration(&self, duration: u64);
fn get_property_format(&self) -> gst::Format;
fn set_property_format(&self, format: gst::Format);
fn get_property_is_live(&self) -> bool;
fn set_property_is_live(&self, is_live: bool);
fn get_property_max_latency(&self) -> i64;
fn set_property_max_latency(&self, max_latency: i64);
fn get_property_min_latency(&self) -> i64;
fn set_property_min_latency(&self, min_latency: i64);
fn get_property_min_percent(&self) -> u32;
fn set_property_min_percent(&self, min_percent: u32);
fn connect_end_of_stream<F: Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_enough_data<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_need_data<F: Fn(&Self, u32) + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_push_buffer<F: Fn(&Self, &gst::Buffer) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_push_sample<F: Fn(&Self, &gst::Sample) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64;
fn connect_seek_data<F: Fn(&Self, u64) -> bool + Send + Sync + 'static>(&self, f: F) -> u64;
}
impl<O: IsA<AppSrc> + IsA<glib::object::Object>> AppSrcExt for O {
fn end_of_stream(&self) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_app_src_end_of_stream(self.to_glib_none().0))
}
}
fn get_caps(&self) -> Option<gst::Caps> {
unsafe {
from_glib_full(ffi::gst_app_src_get_caps(self.to_glib_none().0))
}
}
fn get_current_level_bytes(&self) -> u64 {
unsafe {
ffi::gst_app_src_get_current_level_bytes(self.to_glib_none().0)
}
}
#[cfg(feature = "v1_10")]
fn get_duration(&self) -> gst::ClockTime {
unsafe {
ffi::gst_app_src_get_duration(self.to_glib_none().0)
}
}
fn get_emit_signals(&self) -> bool {
unsafe {
from_glib(ffi::gst_app_src_get_emit_signals(self.to_glib_none().0))
}
}
fn get_latency(&self, min: u64, max: u64) {
unsafe {
ffi::gst_app_src_get_latency(self.to_glib_none().0, min, max);
}
}
fn get_max_bytes(&self) -> u64 {
unsafe {
ffi::gst_app_src_get_max_bytes(self.to_glib_none().0)
}
}
fn get_size(&self) -> i64 {
unsafe {
ffi::gst_app_src_get_size(self.to_glib_none().0)
}
}
fn get_stream_type(&self) -> AppStreamType {
unsafe {
from_glib(ffi::gst_app_src_get_stream_type(self.to_glib_none().0))
}
}
fn push_buffer(&self, buffer: &gst::Buffer) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_app_src_push_buffer(self.to_glib_none().0, buffer.to_glib_full()))
}
}
fn push_sample(&self, sample: &gst::Sample) -> gst::FlowReturn {
unsafe {
from_glib(ffi::gst_app_src_push_sample(self.to_glib_none().0, sample.to_glib_none().0))
}
}
//fn set_callbacks<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, callbacks: /*Ignored*/&mut AppSrcCallbacks, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::gst_app_src_set_callbacks() }
//}
fn set_caps(&self, caps: &gst::Caps) {
unsafe {
ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
}
}
#[cfg(feature = "v1_10")]
fn set_duration(&self, duration: gst::ClockTime) {
unsafe {
ffi::gst_app_src_set_duration(self.to_glib_none().0, duration);
}
}
fn set_emit_signals(&self, emit: bool) {
unsafe {
ffi::gst_app_src_set_emit_signals(self.to_glib_none().0, emit.to_glib());
}
}
fn set_latency(&self, min: u64, max: u64) {
unsafe {
ffi::gst_app_src_set_latency(self.to_glib_none().0, min, max);
}
}
fn set_max_bytes(&self, max: u64) {
unsafe {
ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);
}
}
fn set_size(&self, size: i64) {
unsafe {
ffi::gst_app_src_set_size(self.to_glib_none().0, size);
}
}
fn set_stream_type(&self, type_: AppStreamType) {
unsafe {
ffi::gst_app_src_set_stream_type(self.to_glib_none().0, type_.to_glib());
}
}
fn get_property_block(&self) -> bool {
let mut value = Value::from(&false);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "block".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_block(&self, block: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "block".to_glib_none().0, Value::from(&block).to_glib_none().0);
}
}
fn get_property_current_level_bytes(&self) -> u64 {
let mut value = Value::from(&0u64);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "current-level-bytes".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn get_property_duration(&self) -> u64 {
let mut value = Value::from(&0u64);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "duration".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_duration(&self, duration: u64) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "duration".to_glib_none().0, Value::from(&duration).to_glib_none().0);
}
}
fn get_property_format(&self) -> gst::Format {
let mut value = Value::from(&0);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "format".to_glib_none().0, value.to_glib_none_mut().0);
from_glib(transmute(value.get::<i32>().unwrap()))
}
}
fn set_property_format(&self, format: gst::Format) {
let format = format.to_glib() as i32;
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "format".to_glib_none().0, Value::from(&format).to_glib_none().0);
}
}
fn get_property_is_live(&self) -> bool {
let mut value = Value::from(&false);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-live".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_is_live(&self, is_live: bool) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "is-live".to_glib_none().0, Value::from(&is_live).to_glib_none().0);
}
}
fn get_property_max_latency(&self) -> i64 {
let mut value = Value::from(&0i64);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "max-latency".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_max_latency(&self, max_latency: i64) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "max-latency".to_glib_none().0, Value::from(&max_latency).to_glib_none().0);
}
}
fn get_property_min_latency(&self) -> i64 {
let mut value = Value::from(&0i64);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "min-latency".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_min_latency(&self, min_latency: i64) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "min-latency".to_glib_none().0, Value::from(&min_latency).to_glib_none().0);
}
}
fn get_property_min_percent(&self) -> u32 {
let mut value = Value::from(&0u32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "min-percent".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
fn set_property_min_percent(&self, min_percent: u32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "min-percent".to_glib_none().0, Value::from(&min_percent).to_glib_none().0);
}
}
fn connect_end_of_stream<F: Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) -> gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "end-of-stream",
transmute(end_of_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_enough_data<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "enough-data",
transmute(enough_data_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_need_data<F: Fn(&Self, u32) + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, u32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "need-data",
transmute(need_data_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_push_buffer<F: Fn(&Self, &gst::Buffer) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &gst::Buffer) -> gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "push-buffer",
transmute(push_buffer_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_push_sample<F: Fn(&Self, &gst::Sample) -> gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, &gst::Sample) -> gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "push-sample",
transmute(push_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_seek_data<F: Fn(&Self, u64) -> bool + Send + Sync + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Self, u64) -> bool + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "seek-data",
transmute(seek_data_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn end_of_stream_trampoline<P>(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn
where P: IsA<AppSrc> {
callback_guard!();
let f: &Box_<Fn(&P) -> gst::FlowReturn + Send + Sync + 'static> = transmute(f);
f(&AppSrc::from_glib_none(this).downcast_unchecked()).to_glib()
}
unsafe extern "C" fn enough_data_trampoline<P>(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer)
where P: IsA<AppSrc> {
callback_guard!();
let f: &Box_<Fn(&P) + Send + Sync + 'static> = transmute(f);
f(&AppSrc::from_glib_none(this).downcast_unchecked())
}
unsafe extern "C" fn need_data_trampoline<P>(this: *mut ffi::GstAppSrc, length: libc::c_uint, f: glib_ffi::gpointer)
where P: IsA<AppSrc> {
callback_guard!();
let f: &Box_<Fn(&P, u32) + Send + Sync + 'static> = transmute(f);
f(&AppSrc::from_glib_none(this).downcast_unchecked(), length)
}
unsafe extern "C" fn push_buffer_trampoline<P>(this: *mut ffi::GstAppSrc, buffer: *mut gst_ffi::GstBuffer, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn
where P: IsA<AppSrc> {
callback_guard!();
let f: &Box_<Fn(&P, &gst::Buffer) -> gst::FlowReturn + Send + Sync + 'static> = transmute(f);
f(&AppSrc::from_glib_none(this).downcast_unchecked(), &from_glib_none(buffer)).to_glib()
}
unsafe extern "C" fn push_sample_trampoline<P>(this: *mut ffi::GstAppSrc, sample: *mut gst_ffi::GstSample, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn
where P: IsA<AppSrc> {
callback_guard!();
let f: &Box_<Fn(&P, &gst::Sample) -> gst::FlowReturn + Send + Sync + 'static> = transmute(f);
f(&AppSrc::from_glib_none(this).downcast_unchecked(), &from_glib_none(sample)).to_glib()
}
unsafe extern "C" fn seek_data_trampoline<P>(this: *mut ffi::GstAppSrc, offset: u64, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<AppSrc> {
callback_guard!();
let f: &Box_<Fn(&P, u64) -> bool + Send + Sync + 'static> = transmute(f);
f(&AppSrc::from_glib_none(this).downcast_unchecked(), offset).to_glib()
}

View file

@ -0,0 +1,71 @@
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::Type;
use glib::StaticType;
use glib::value::{Value, SetValue, FromValue, FromValueOptional};
use gobject_ffi;
use glib::translate::*;
use std;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum AppStreamType {
Stream,
Seekable,
RandomAccess,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for AppStreamType {
type GlibType = ffi::GstAppStreamType;
fn to_glib(&self) -> ffi::GstAppStreamType {
match *self {
AppStreamType::Stream => ffi::GST_APP_STREAM_TYPE_STREAM,
AppStreamType::Seekable => ffi::GST_APP_STREAM_TYPE_SEEKABLE,
AppStreamType::RandomAccess => ffi::GST_APP_STREAM_TYPE_RANDOM_ACCESS,
AppStreamType::__Unknown(value) => unsafe{std::mem::transmute(value)}
}
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstAppStreamType> for AppStreamType {
fn from_glib(value: ffi::GstAppStreamType) -> Self {
skip_assert_initialized!();
match value as i32 {
0 => AppStreamType::Stream,
1 => AppStreamType::Seekable,
2 => AppStreamType::RandomAccess,
value => AppStreamType::__Unknown(value),
}
}
}
impl StaticType for AppStreamType {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_app_stream_type_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for AppStreamType {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for AppStreamType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(std::mem::transmute::<i32, ffi::GstAppStreamType>(gobject_ffi::g_value_get_enum(value.to_glib_none().0)))
}
}
impl SetValue for AppStreamType {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32)
}
}

View file

@ -0,0 +1,6 @@
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::translate::*;

View file

@ -0,0 +1,19 @@
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
mod app_sink;
pub use self::app_sink::AppSink;
pub use self::app_sink::AppSinkExt;
mod app_src;
pub use self::app_src::AppSrc;
pub use self::app_src::AppSrcExt;
mod enums;
pub use self::enums::AppStreamType;
#[doc(hidden)]
pub mod traits {
pub use super::AppSinkExt;
pub use super::AppSrcExt;
}