From 99c3c61f5975a1724858ad4f058b6ae253bdc469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 1 Aug 2017 13:37:22 +0100 Subject: [PATCH] Add initial, untested version of GstApp bindings --- Gir_GstApp.toml | 42 +++ gstreamer-app/src/auto/app_sink.rs | 336 ++++++++++++++++++++++ gstreamer-app/src/auto/app_src.rs | 428 +++++++++++++++++++++++++++++ gstreamer-app/src/auto/enums.rs | 71 +++++ gstreamer-app/src/auto/flags.rs | 6 + gstreamer-app/src/auto/mod.rs | 19 ++ 6 files changed, 902 insertions(+) create mode 100644 Gir_GstApp.toml create mode 100644 gstreamer-app/src/auto/app_sink.rs create mode 100644 gstreamer-app/src/auto/app_src.rs create mode 100644 gstreamer-app/src/auto/enums.rs create mode 100644 gstreamer-app/src/auto/flags.rs create mode 100644 gstreamer-app/src/auto/mod.rs diff --git a/Gir_GstApp.toml b/Gir_GstApp.toml new file mode 100644 index 000000000..f878ab911 --- /dev/null +++ b/Gir_GstApp.toml @@ -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" diff --git a/gstreamer-app/src/auto/app_sink.rs b/gstreamer-app/src/auto/app_sink.rs new file mode 100644 index 000000000..e92636c5e --- /dev/null +++ b/gstreamer-app/src/auto/app_sink.rs @@ -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); + + 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; + + 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; + + fn pull_sample(&self) -> Option; + + #[cfg(feature = "v1_12")] + fn set_buffer_list_support(&self, enable_lists: bool); + + //fn set_callbacks>>(&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; + + #[cfg(feature = "v1_10")] + fn try_pull_sample(&self, timeout: gst::ClockTime) -> Option; + + 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(&self, f: F) -> u64; + + fn connect_new_preroll gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64; + + fn connect_new_sample gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64; + + fn connect_pull_preroll gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64; + + fn connect_pull_sample gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64; + + #[cfg(feature = "v1_10")] + fn connect_try_pull_preroll gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64; + + #[cfg(feature = "v1_10")] + fn connect_try_pull_sample gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64; +} + +impl + IsA> 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 { + 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 { + unsafe { + from_glib_full(ffi::gst_app_sink_pull_preroll(self.to_glib_none().0)) + } + } + + fn pull_sample(&self) -> Option { + 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>>(&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 { + 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 { + 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(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "eos", + transmute(eos_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_new_preroll gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "new-preroll", + transmute(new_preroll_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_new_sample gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "new-sample", + transmute(new_sample_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_pull_preroll gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pull-preroll", + transmute(pull_preroll_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_pull_sample gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "pull-sample", + transmute(pull_sample_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + #[cfg(feature = "v1_10")] + fn connect_try_pull_preroll gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "try-pull-preroll", + transmute(try_pull_preroll_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + #[cfg(feature = "v1_10")] + fn connect_try_pull_sample gst::Sample + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::Sample + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "try-pull-sample", + transmute(try_pull_sample_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn eos_trampoline

(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&AppSink::from_glib_none(this).downcast_unchecked()) +} + +unsafe extern "C" fn new_preroll_trampoline

(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn +where P: IsA { + callback_guard!(); + let f: &Box_ gst::FlowReturn + Send + Sync + 'static> = transmute(f); + f(&AppSink::from_glib_none(this).downcast_unchecked()).to_glib() +} + +unsafe extern "C" fn new_sample_trampoline

(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn +where P: IsA { + callback_guard!(); + let f: &Box_ gst::FlowReturn + Send + Sync + 'static> = transmute(f); + f(&AppSink::from_glib_none(this).downcast_unchecked()).to_glib() +} + +unsafe extern "C" fn pull_preroll_trampoline

(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample +where P: IsA { + callback_guard!(); + let f: &Box_ 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

(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample +where P: IsA { + callback_guard!(); + let f: &Box_ 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

(this: *mut ffi::GstAppSink, timeout: u64, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample +where P: IsA { + callback_guard!(); + let f: &Box_ 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

(this: *mut ffi::GstAppSink, timeout: u64, f: glib_ffi::gpointer) -> *mut gst_ffi::GstSample +where P: IsA { + callback_guard!(); + let f: &Box_ gst::Sample + Send + Sync + 'static> = transmute(f); + f(&AppSink::from_glib_none(this).downcast_unchecked(), timeout).to_glib_full() +} diff --git a/gstreamer-app/src/auto/app_src.rs b/gstreamer-app/src/auto/app_src.rs new file mode 100644 index 000000000..6019ab742 --- /dev/null +++ b/gstreamer-app/src/auto/app_src.rs @@ -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); + + 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; + + 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>>(&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 gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64; + + fn connect_enough_data(&self, f: F) -> u64; + + fn connect_need_data(&self, f: F) -> u64; + + fn connect_push_buffer gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64; + + fn connect_push_sample gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64; + + fn connect_seek_data bool + Send + Sync + 'static>(&self, f: F) -> u64; +} + +impl + IsA> 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 { + 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>>(&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::().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 gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "end-of-stream", + transmute(end_of_stream_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_enough_data(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "enough-data", + transmute(enough_data_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_need_data(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "need-data", + transmute(need_data_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_push_buffer gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "push-buffer", + transmute(push_buffer_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_push_sample gst::FlowReturn + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ gst::FlowReturn + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "push-sample", + transmute(push_sample_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_seek_data bool + Send + Sync + 'static>(&self, f: F) -> u64 { + unsafe { + let f: Box_ bool + Send + Sync + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "seek-data", + transmute(seek_data_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn end_of_stream_trampoline

(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn +where P: IsA { + callback_guard!(); + let f: &Box_ gst::FlowReturn + Send + Sync + 'static> = transmute(f); + f(&AppSrc::from_glib_none(this).downcast_unchecked()).to_glib() +} + +unsafe extern "C" fn enough_data_trampoline

(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&AppSrc::from_glib_none(this).downcast_unchecked()) +} + +unsafe extern "C" fn need_data_trampoline

(this: *mut ffi::GstAppSrc, length: libc::c_uint, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&AppSrc::from_glib_none(this).downcast_unchecked(), length) +} + +unsafe extern "C" fn push_buffer_trampoline

(this: *mut ffi::GstAppSrc, buffer: *mut gst_ffi::GstBuffer, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn +where P: IsA { + callback_guard!(); + let f: &Box_ 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

(this: *mut ffi::GstAppSrc, sample: *mut gst_ffi::GstSample, f: glib_ffi::gpointer) -> gst_ffi::GstFlowReturn +where P: IsA { + callback_guard!(); + let f: &Box_ 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

(this: *mut ffi::GstAppSrc, offset: u64, f: glib_ffi::gpointer) -> glib_ffi::gboolean +where P: IsA { + callback_guard!(); + let f: &Box_ bool + Send + Sync + 'static> = transmute(f); + f(&AppSrc::from_glib_none(this).downcast_unchecked(), offset).to_glib() +} diff --git a/gstreamer-app/src/auto/enums.rs b/gstreamer-app/src/auto/enums.rs new file mode 100644 index 000000000..231e512c0 --- /dev/null +++ b/gstreamer-app/src/auto/enums.rs @@ -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 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 { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for AppStreamType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(std::mem::transmute::(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) + } +} + diff --git a/gstreamer-app/src/auto/flags.rs b/gstreamer-app/src/auto/flags.rs new file mode 100644 index 000000000..0d24c0bba --- /dev/null +++ b/gstreamer-app/src/auto/flags.rs @@ -0,0 +1,6 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use ffi; +use glib::translate::*; + diff --git a/gstreamer-app/src/auto/mod.rs b/gstreamer-app/src/auto/mod.rs new file mode 100644 index 000000000..0b382b0ef --- /dev/null +++ b/gstreamer-app/src/auto/mod.rs @@ -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; +}