From bd817c03d2177fb203dd5d57a55c7e52969e7616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 16 Dec 2017 14:04:36 +0200 Subject: [PATCH] Implement AppSrc get/set_latency() manually These are gst::ClockTime, not u64 --- Gir_GstApp.toml | 10 ++++++++++ gstreamer-app/src/app_src.rs | 17 +++++++++++++++++ gstreamer-app/src/auto/app_src.rs | 15 --------------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Gir_GstApp.toml b/Gir_GstApp.toml index 6df5c2151..6274f8628 100644 --- a/Gir_GstApp.toml +++ b/Gir_GstApp.toml @@ -86,6 +86,16 @@ trait = false # Action signal ignore = true + [[object.function]] + name = "set_latency" + # ClockTime + ignore = true + + [[object.function]] + name = "get_latency" + # ClockTime + ignore = true + [[object.function]] name = "set_caps" [[object.function.parameter]] diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 2a590c3e0..9a8f193b3 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -13,6 +13,7 @@ use gst; use glib::source::CallbackGuard; use glib_ffi::{gboolean, gpointer}; use std::ptr; +use std::mem; pub struct AppSrcCallbacks { need_data: Option>, @@ -149,4 +150,20 @@ impl AppSrc { ); } } + + pub fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { + unsafe { + ffi::gst_app_src_set_latency(self.to_glib_none().0, min.to_glib(), max.to_glib()); + } + } + + + pub fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime) { + unsafe { + let mut min = mem::uninitialized(); + let mut max = mem::uninitialized(); + ffi::gst_app_src_get_latency(self.to_glib_none().0, &mut min, &mut max); + (from_glib(min), from_glib(max)) + } + } } diff --git a/gstreamer-app/src/auto/app_src.rs b/gstreamer-app/src/auto/app_src.rs index 0f8a84683..894f6ba67 100644 --- a/gstreamer-app/src/auto/app_src.rs +++ b/gstreamer-app/src/auto/app_src.rs @@ -65,15 +65,6 @@ impl AppSrc { } } - pub fn get_latency(&self) -> (u64, u64) { - unsafe { - let mut min = mem::uninitialized(); - let mut max = mem::uninitialized(); - ffi::gst_app_src_get_latency(self.to_glib_none().0, &mut min, &mut max); - (min, max) - } - } - pub fn get_max_bytes(&self) -> u64 { unsafe { ffi::gst_app_src_get_max_bytes(self.to_glib_none().0) @@ -123,12 +114,6 @@ impl AppSrc { } } - pub fn set_latency(&self, min: u64, max: u64) { - unsafe { - ffi::gst_app_src_set_latency(self.to_glib_none().0, min, max); - } - } - pub fn set_max_bytes(&self, max: u64) { unsafe { ffi::gst_app_src_set_max_bytes(self.to_glib_none().0, max);