From cf33e0acd01652dc5dc8d6e44a46896dbd001d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 7 Jun 2020 13:42:57 +0300 Subject: [PATCH] audio: Add bindings for audio_buffer_truncate() --- gstreamer-audio/src/functions.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gstreamer-audio/src/functions.rs b/gstreamer-audio/src/functions.rs index aa563d171..7ba16e465 100644 --- a/gstreamer-audio/src/functions.rs +++ b/gstreamer-audio/src/functions.rs @@ -32,6 +32,25 @@ pub fn audio_buffer_clip( } } +#[cfg(any(feature = "v1_16", feature = "dox"))] +pub fn audio_buffer_truncate( + buffer: gst::Buffer, + bpf: u32, + trim: usize, + samples: Option, +) -> gst::Buffer { + skip_assert_initialized!(); + + unsafe { + from_glib_full(gst_audio_sys::gst_audio_buffer_truncate( + buffer.into_ptr(), + bpf as i32, + trim, + samples.unwrap_or(std::usize::MAX), + )) + } +} + pub fn audio_make_raw_caps( formats: &[::AudioFormat], layout: ::AudioLayout,