audio: Move audio_buffer_clip() to functions module

This commit is contained in:
Sebastian Dröge 2020-06-07 13:39:38 +03:00
parent 30d51f0ca6
commit 78c1fed92d
2 changed files with 20 additions and 19 deletions

View file

@ -1,3 +1,4 @@
// Copyright (C) 2017-2020 Sebastian Dröge <sebastian@centricular.com>
// Copyright (C) 2020 Guillaume Desmottes <guillaume.desmottes@collabora.com> // Copyright (C) 2020 Guillaume Desmottes <guillaume.desmottes@collabora.com>
// //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
@ -7,11 +8,30 @@
// except according to those terms. // except according to those terms.
use glib; use glib;
use glib::translate::{from_glib_full, ToGlibPtr};
use glib::ToSendValue; use glib::ToSendValue;
use gst; use gst;
use std::i32; use std::i32;
pub fn audio_buffer_clip(
buffer: gst::Buffer,
segment: &gst::Segment,
rate: u32,
bpf: u32,
) -> Option<gst::Buffer> {
skip_assert_initialized!();
unsafe {
from_glib_full(gst_audio_sys::gst_audio_buffer_clip(
buffer.into_ptr(),
segment.to_glib_none().0,
rate as i32,
bpf as i32,
))
}
}
pub fn audio_make_raw_caps( pub fn audio_make_raw_caps(
formats: &[::AudioFormat], formats: &[::AudioFormat],
layout: ::AudioLayout, layout: ::AudioLayout,

View file

@ -62,25 +62,6 @@ pub use audio_decoder::AudioDecoderExtManual;
mod audio_encoder; mod audio_encoder;
pub use audio_encoder::AudioEncoderExtManual; pub use audio_encoder::AudioEncoderExtManual;
use glib::translate::{from_glib_full, ToGlibPtr};
pub fn audio_buffer_clip(
buffer: gst::Buffer,
segment: &gst::Segment,
rate: u32,
bpf: u32,
) -> Option<gst::Buffer> {
skip_assert_initialized!();
unsafe {
from_glib_full(gst_audio_sys::gst_audio_buffer_clip(
buffer.into_ptr(),
segment.to_glib_none().0,
rate as i32,
bpf as i32,
))
}
}
// Re-export all the traits in a prelude module, so that applications // Re-export all the traits in a prelude module, so that applications
// can always "use gst::prelude::*" without getting conflicts // can always "use gst::prelude::*" without getting conflicts
pub mod prelude { pub mod prelude {