gstreamer-rs/gstreamer-audio/src/audio_aggregator_pad.rs
Bilal Elmoussaoui 4ebec84f5e Adapt to no longer renamed ffi crates
Allows us to set all the crates in the main workspace file, so changing
their versions or branch is much simpler and reduce the amount of noise
in the diff

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1450>
2024-06-02 11:20:55 +02:00

31 lines
859 B
Rust

use glib::translate::*;
use gst::prelude::*;
use crate::{ffi, AudioAggregatorPad};
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::AudioAggregatorPad>> Sealed for T {}
}
pub trait AudioAggregatorPadExtManual: sealed::Sealed + IsA<AudioAggregatorPad> + 'static {
fn audio_info(&self) -> Option<crate::AudioInfo> {
unsafe {
let ptr = self.as_ptr() as *mut ffi::GstAudioAggregatorPad;
let _guard = self.as_ref().object_lock();
let info = &(*ptr).info;
if !info.finfo.is_null() && info.channels > 0 && info.rate > 0 && info.bpf > 0 {
return None;
}
Some(from_glib_none(mut_override(
info as *const ffi::GstAudioInfo,
)))
}
}
}
impl<O: IsA<AudioAggregatorPad>> AudioAggregatorPadExtManual for O {}