gstreamer-rs/gstreamer-audio/src/audio_aggregator_pad.rs

28 lines
778 B
Rust
Raw Normal View History

use glib::{object::IsA, translate::*};
use gst::prelude::*;
2022-04-01 07:22:23 +00:00
use crate::auto::AudioAggregatorPad;
pub trait AudioAggregatorPadExtManual: 'static {
fn audio_info(&self) -> Option<crate::AudioInfo>;
}
impl<O: IsA<AudioAggregatorPad>> AudioAggregatorPadExtManual for O {
fn audio_info(&self) -> Option<crate::AudioInfo> {
unsafe {
let ptr = self.as_ptr() as *mut ffi::GstAudioAggregatorPad;
let _guard = self.as_ref().object_lock();
2022-04-01 07:22:23 +00:00
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,
)))
}
}
}