1use glib::{object::IsA, translate::*};
2use gst::prelude::*;
3
4use crate::auto::AudioAggregatorPad;
5
6mod sealed {
7 pub trait Sealed {}
8 impl<T: super::IsA<super::AudioAggregatorPad>> Sealed for T {}
9}
10
11pub trait AudioAggregatorPadExtManual: sealed::Sealed + IsA<AudioAggregatorPad> + 'static {
12 fn audio_info(&self) -> Option<crate::AudioInfo> {
13 unsafe {
14 let ptr: *mut GstAudioAggregatorPad = self.as_ptr() as *mut ffi::GstAudioAggregatorPad;
15 let _guard: ObjectLockGuard<'_, AudioAggregatorPad> = self.as_ref().object_lock();
16
17 let info: &GstAudioInfo = &(*ptr).info;
18
19 if !info.finfo.is_null() && info.channels > 0 && info.rate > 0 && info.bpf > 0 {
20 return None;
21 }
22
23 Some(from_glib_none(ptr:mut_override(
24 ptr:info as *const ffi::GstAudioInfo,
25 )))
26 }
27 }
28}
29
30impl<O: IsA<AudioAggregatorPad>> AudioAggregatorPadExtManual for O {}
31