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

46 lines
1.4 KiB
Rust
Raw Normal View History

2018-03-15 08:03:01 +00:00
// Copyright (C) 2018 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
2019-03-19 07:58:20 +00:00
use gst_audio_sys;
2018-04-25 08:10:06 +00:00
use AudioStreamAlign;
2018-03-15 08:03:01 +00:00
2018-03-15 08:46:49 +00:00
use glib::translate::*;
2018-04-01 08:30:03 +00:00
use gst;
2018-03-15 08:46:49 +00:00
use std::mem;
2018-03-15 08:03:01 +00:00
impl AudioStreamAlign {
#[cfg(any(feature = "v1_14", feature = "dox"))]
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::uninitialized();
let mut out_duration = mem::uninitialized();
let mut out_sample_position = mem::uninitialized();
2019-03-19 07:58:20 +00:00
let ret = from_glib(gst_audio_sys::gst_audio_stream_align_process(
2018-04-01 08:30:03 +00:00
self.to_glib_none_mut().0,
discont.to_glib(),
timestamp.to_glib(),
n_samples,
&mut out_timestamp,
&mut out_duration,
&mut out_sample_position,
));
(
ret,
from_glib(out_timestamp),
from_glib(out_duration),
out_sample_position,
)
2018-03-15 08:03:01 +00:00
}
}
}