From b182882c7e5811335757eced43e11b86a5ec25a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 18 Dec 2019 15:41:11 +0200 Subject: [PATCH] gstreamer-audio: Generate bindings for AudioBaseSrc and AudioSrc --- Gir_GstAudio.toml | 3 + gstreamer-audio/src/auto/audio_base_src.rs | 362 +++++++++++++++++++++ gstreamer-audio/src/auto/audio_src.rs | 24 ++ gstreamer-audio/src/auto/mod.rs | 8 + gstreamer-audio/src/auto/versions.txt | 2 +- 5 files changed, 398 insertions(+), 1 deletion(-) create mode 100644 gstreamer-audio/src/auto/audio_base_src.rs create mode 100644 gstreamer-audio/src/auto/audio_src.rs diff --git a/Gir_GstAudio.toml b/Gir_GstAudio.toml index 5efca0ca2..321c9e3ad 100644 --- a/Gir_GstAudio.toml +++ b/Gir_GstAudio.toml @@ -26,7 +26,9 @@ generate = [ "GstAudio.StreamVolume", "GstAudio.StreamVolumeFormat", "GstAudio.AudioSink", + "GstAudio.AudioSrc", "GstAudio.AudioBaseSink", + "GstAudio.AudioBaseSrc", "GstAudio.AudioRingBufferFormatType", ] @@ -39,6 +41,7 @@ manual = [ "Gst.TagList", "Gst.TagMergeMode", "GstBase.BaseSink", + "GstBase.BaseSrc", "GstAudio.AudioInfo", "GstAudio.AudioFormatInfo", ] diff --git a/gstreamer-audio/src/auto/audio_base_src.rs b/gstreamer-audio/src/auto/audio_base_src.rs new file mode 100644 index 000000000..89bdcf811 --- /dev/null +++ b/gstreamer-audio/src/auto/audio_base_src.rs @@ -0,0 +1,362 @@ +// 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 glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::Value; +use glib_sys; +use gobject_sys; +use gst; +use gst_audio_sys; +use gst_base; +use std::boxed::Box as Box_; +use std::mem::transmute; + +glib_wrapper! { + pub struct AudioBaseSrc(Object) @extends gst_base::BaseSrc, gst::Element, gst::Object; + + match fn { + get_type => || gst_audio_sys::gst_audio_base_src_get_type(), + } +} + +unsafe impl Send for AudioBaseSrc {} +unsafe impl Sync for AudioBaseSrc {} + +pub const NONE_AUDIO_BASE_SRC: Option<&AudioBaseSrc> = None; + +pub trait AudioBaseSrcExt: 'static { + //fn create_ringbuffer(&self) -> /*Ignored*/Option; + + fn get_provide_clock(&self) -> bool; + + //fn get_slave_method(&self) -> /*Ignored*/AudioBaseSrcSlaveMethod; + + fn set_provide_clock(&self, provide: bool); + + //fn set_slave_method(&self, method: /*Ignored*/AudioBaseSrcSlaveMethod); + + fn get_property_actual_buffer_time(&self) -> i64; + + fn get_property_actual_latency_time(&self) -> i64; + + fn get_property_buffer_time(&self) -> i64; + + fn set_property_buffer_time(&self, buffer_time: i64); + + fn get_property_latency_time(&self) -> i64; + + fn set_property_latency_time(&self, latency_time: i64); + + fn connect_property_actual_buffer_time_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_actual_latency_time_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_buffer_time_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_latency_time_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_provide_clock_notify( + &self, + f: F, + ) -> SignalHandlerId; + + fn connect_property_slave_method_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> AudioBaseSrcExt for O { + //fn create_ringbuffer(&self) -> /*Ignored*/Option { + // unsafe { TODO: call gst_audio_sys:gst_audio_base_src_create_ringbuffer() } + //} + + fn get_provide_clock(&self) -> bool { + unsafe { + from_glib(gst_audio_sys::gst_audio_base_src_get_provide_clock( + self.as_ref().to_glib_none().0, + )) + } + } + + //fn get_slave_method(&self) -> /*Ignored*/AudioBaseSrcSlaveMethod { + // unsafe { TODO: call gst_audio_sys:gst_audio_base_src_get_slave_method() } + //} + + fn set_provide_clock(&self, provide: bool) { + unsafe { + gst_audio_sys::gst_audio_base_src_set_provide_clock( + self.as_ref().to_glib_none().0, + provide.to_glib(), + ); + } + } + + //fn set_slave_method(&self, method: /*Ignored*/AudioBaseSrcSlaveMethod) { + // unsafe { TODO: call gst_audio_sys:gst_audio_base_src_set_slave_method() } + //} + + fn get_property_actual_buffer_time(&self) -> i64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"actual-buffer-time\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `actual-buffer-time` getter") + .unwrap() + } + } + + fn get_property_actual_latency_time(&self) -> i64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"actual-latency-time\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `actual-latency-time` getter") + .unwrap() + } + } + + fn get_property_buffer_time(&self) -> i64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"buffer-time\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `buffer-time` getter") + .unwrap() + } + } + + fn set_property_buffer_time(&self, buffer_time: i64) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"buffer-time\0".as_ptr() as *const _, + Value::from(&buffer_time).to_glib_none().0, + ); + } + } + + fn get_property_latency_time(&self) -> i64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_sys::g_object_get_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"latency-time\0".as_ptr() as *const _, + value.to_glib_none_mut().0, + ); + value + .get() + .expect("Return Value for property `latency-time` getter") + .unwrap() + } + } + + fn set_property_latency_time(&self, latency_time: i64) { + unsafe { + gobject_sys::g_object_set_property( + self.to_glib_none().0 as *mut gobject_sys::GObject, + b"latency-time\0".as_ptr() as *const _, + Value::from(&latency_time).to_glib_none().0, + ); + } + } + + fn connect_property_actual_buffer_time_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_actual_buffer_time_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_audio_sys::GstAudioBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&AudioBaseSrc::from_glib_borrow(this).unsafe_cast()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::actual-buffer-time\0".as_ptr() as *const _, + Some(transmute( + notify_actual_buffer_time_trampoline:: as usize, + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_actual_latency_time_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_actual_latency_time_trampoline< + P, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut gst_audio_sys::GstAudioBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&AudioBaseSrc::from_glib_borrow(this).unsafe_cast()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::actual-latency-time\0".as_ptr() as *const _, + Some(transmute( + notify_actual_latency_time_trampoline:: as usize, + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_buffer_time_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_buffer_time_trampoline( + this: *mut gst_audio_sys::GstAudioBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&AudioBaseSrc::from_glib_borrow(this).unsafe_cast()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::buffer-time\0".as_ptr() as *const _, + Some(transmute(notify_buffer_time_trampoline:: as usize)), + Box_::into_raw(f), + ) + } + } + + fn connect_property_latency_time_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_latency_time_trampoline( + this: *mut gst_audio_sys::GstAudioBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&AudioBaseSrc::from_glib_borrow(this).unsafe_cast()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::latency-time\0".as_ptr() as *const _, + Some(transmute( + notify_latency_time_trampoline:: as usize, + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_provide_clock_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_provide_clock_trampoline( + this: *mut gst_audio_sys::GstAudioBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&AudioBaseSrc::from_glib_borrow(this).unsafe_cast()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::provide-clock\0".as_ptr() as *const _, + Some(transmute( + notify_provide_clock_trampoline:: as usize, + )), + Box_::into_raw(f), + ) + } + } + + fn connect_property_slave_method_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_slave_method_trampoline( + this: *mut gst_audio_sys::GstAudioBaseSrc, + _param_spec: glib_sys::gpointer, + f: glib_sys::gpointer, + ) where + P: IsA, + { + let f: &F = &*(f as *const F); + f(&AudioBaseSrc::from_glib_borrow(this).unsafe_cast()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::slave-method\0".as_ptr() as *const _, + Some(transmute( + notify_slave_method_trampoline:: as usize, + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-audio/src/auto/audio_src.rs b/gstreamer-audio/src/auto/audio_src.rs new file mode 100644 index 000000000..c310acda8 --- /dev/null +++ b/gstreamer-audio/src/auto/audio_src.rs @@ -0,0 +1,24 @@ +// 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 glib::translate::*; +use gst; +use gst_audio_sys; +use gst_base; +use AudioBaseSrc; + +glib_wrapper! { + pub struct AudioSrc(Object) @extends AudioBaseSrc, gst_base::BaseSrc, gst::Element, gst::Object; + + match fn { + get_type => || gst_audio_sys::gst_audio_src_get_type(), + } +} + +impl AudioSrc {} + +unsafe impl Send for AudioSrc {} +unsafe impl Sync for AudioSrc {} + +pub const NONE_AUDIO_SRC: Option<&AudioSrc> = None; diff --git a/gstreamer-audio/src/auto/mod.rs b/gstreamer-audio/src/auto/mod.rs index 63cebc538..bbe36b9c6 100644 --- a/gstreamer-audio/src/auto/mod.rs +++ b/gstreamer-audio/src/auto/mod.rs @@ -6,6 +6,10 @@ mod audio_base_sink; pub use self::audio_base_sink::AudioBaseSinkExt; pub use self::audio_base_sink::{AudioBaseSink, AudioBaseSinkClass, NONE_AUDIO_BASE_SINK}; +mod audio_base_src; +pub use self::audio_base_src::AudioBaseSrcExt; +pub use self::audio_base_src::{AudioBaseSrc, AudioBaseSrcClass, NONE_AUDIO_BASE_SRC}; + mod audio_decoder; pub use self::audio_decoder::AudioDecoderExt; pub use self::audio_decoder::{AudioDecoder, AudioDecoderClass, NONE_AUDIO_DECODER}; @@ -17,6 +21,9 @@ pub use self::audio_encoder::{AudioEncoder, AudioEncoderClass, NONE_AUDIO_ENCODE mod audio_sink; pub use self::audio_sink::{AudioSink, AudioSinkClass, NONE_AUDIO_SINK}; +mod audio_src; +pub use self::audio_src::{AudioSrc, AudioSrcClass, NONE_AUDIO_SRC}; + mod stream_volume; pub use self::stream_volume::StreamVolumeExt; pub use self::stream_volume::{StreamVolume, NONE_STREAM_VOLUME}; @@ -41,6 +48,7 @@ pub use self::flags::AudioPackFlags; #[doc(hidden)] pub mod traits { pub use super::AudioBaseSinkExt; + pub use super::AudioBaseSrcExt; pub use super::AudioDecoderExt; pub use super::AudioEncoderExt; pub use super::StreamVolumeExt; diff --git a/gstreamer-audio/src/auto/versions.txt b/gstreamer-audio/src/auto/versions.txt index 3d85e1914..5dbd87df7 100644 --- a/gstreamer-audio/src/auto/versions.txt +++ b/gstreamer-audio/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 5836573) -from gir-files (https://github.com/gtk-rs/gir-files @ 82d78da) +from gir-files (https://github.com/gtk-rs/gir-files @ 7e30d32)