gstreamer-rs/gstreamer-audio/src/audio_stream_align.rs

39 lines
1.2 KiB
Rust
Raw Normal View History

2020-12-15 10:53:31 +00:00
// Take a look at the license at the top of the repository in the LICENSE file.
2018-03-15 08:03:01 +00:00
use crate::AudioStreamAlign;
2018-03-15 08:03:01 +00:00
2018-03-15 08:46:49 +00:00
use glib::translate::*;
use std::mem;
2018-03-15 08:03:01 +00:00
impl AudioStreamAlign {
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
2018-04-01 08:30:03 +00:00
pub fn process(
&mut self,
discont: bool,
timestamp: gst::ClockTime,
n_samples: u32,
) -> (bool, gst::ClockTime, gst::ClockTime, u64) {
2018-03-15 08:03:01 +00:00
unsafe {
let mut out_timestamp = mem::MaybeUninit::uninit();
let mut out_duration = mem::MaybeUninit::uninit();
let mut out_sample_position = mem::MaybeUninit::uninit();
let ret = from_glib(ffi::gst_audio_stream_align_process(
2018-04-01 08:30:03 +00:00
self.to_glib_none_mut().0,
discont.into_glib(),
timestamp.into_glib(),
2018-04-01 08:30:03 +00:00
n_samples,
out_timestamp.as_mut_ptr(),
out_duration.as_mut_ptr(),
out_sample_position.as_mut_ptr(),
2018-04-01 08:30:03 +00:00
));
(
ret,
from_glib(out_timestamp.assume_init()),
from_glib(out_duration.assume_init()),
out_sample_position.assume_init(),
2018-04-01 08:30:03 +00:00
)
2018-03-15 08:03:01 +00:00
}
}
}