forked from mirrors/gstreamer-rs
audio: Add audioaggregator bindings
This commit is contained in:
parent
b7afdd4dd0
commit
e31e2ad9bd
10 changed files with 726 additions and 0 deletions
|
@ -17,6 +17,8 @@ external_libraries = [
|
||||||
]
|
]
|
||||||
|
|
||||||
generate = [
|
generate = [
|
||||||
|
"GstAudio.AudioAggregatorConvertPad",
|
||||||
|
"GstAudio.AudioAggregatorPad",
|
||||||
"GstAudio.AudioBaseSrc",
|
"GstAudio.AudioBaseSrc",
|
||||||
"GstAudio.AudioChannelPosition",
|
"GstAudio.AudioChannelPosition",
|
||||||
"GstAudio.AudioDitherMethod",
|
"GstAudio.AudioDitherMethod",
|
||||||
|
@ -45,6 +47,8 @@ manual = [
|
||||||
"GstAudio.AudioLevelMeta",
|
"GstAudio.AudioLevelMeta",
|
||||||
"GstAudio.AudioMeta",
|
"GstAudio.AudioMeta",
|
||||||
"GstAudio.AudioRingBufferSpec",
|
"GstAudio.AudioRingBufferSpec",
|
||||||
|
"GstBase.Aggregator",
|
||||||
|
"GstBase.AggregatorPad",
|
||||||
"GstBase.BaseSink",
|
"GstBase.BaseSink",
|
||||||
"GstBase.BaseSrc",
|
"GstBase.BaseSrc",
|
||||||
]
|
]
|
||||||
|
@ -70,6 +74,20 @@ name = "Gst.Object"
|
||||||
status = "manual"
|
status = "manual"
|
||||||
trait_name = "GstObjectExt"
|
trait_name = "GstObjectExt"
|
||||||
|
|
||||||
|
[[object]]
|
||||||
|
name = "GstAudio.AudioAggregator"
|
||||||
|
status = "generate"
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "set_sink_caps"
|
||||||
|
# capsref
|
||||||
|
manual = true
|
||||||
|
|
||||||
|
[[object.property]]
|
||||||
|
name = "output-buffer-duration-fraction"
|
||||||
|
# fraction
|
||||||
|
manual = true
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "GstAudio.AudioBaseSink"
|
name = "GstAudio.AudioBaseSink"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
104
gstreamer-audio/src/audio_aggregator.rs
Normal file
104
gstreamer-audio/src/audio_aggregator.rs
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
use crate::auto::AudioAggregator;
|
||||||
|
use crate::auto::AudioAggregatorPad;
|
||||||
|
use glib::object::{Cast, IsA};
|
||||||
|
use glib::signal::{connect_raw, SignalHandlerId};
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
pub trait AudioAggregatorExtManual: 'static {
|
||||||
|
#[doc(alias = "gst_audio_aggregator_set_sink_caps")]
|
||||||
|
fn set_sink_caps(&self, pad: &impl IsA<AudioAggregatorPad>, caps: &gst::CapsRef);
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
|
#[doc(alias = "output-buffer-duration-fraction")]
|
||||||
|
fn output_buffer_duration_fraction(&self) -> gst::Fraction;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
|
#[doc(alias = "output-buffer-duration-fraction")]
|
||||||
|
fn set_output_buffer_duration_fraction(&self, output_buffer_duration_fraction: gst::Fraction);
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
|
#[doc(alias = "output-buffer-duration-fraction")]
|
||||||
|
fn connect_output_buffer_duration_fraction_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
|
||||||
|
fn current_caps(&self) -> Option<gst::Caps>;
|
||||||
|
fn current_audio_info(&self) -> Option<crate::AudioInfo>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<AudioAggregator>> AudioAggregatorExtManual for O {
|
||||||
|
fn set_sink_caps(&self, pad: &impl IsA<AudioAggregatorPad>, caps: &gst::CapsRef) {
|
||||||
|
unsafe {
|
||||||
|
ffi::gst_audio_aggregator_set_sink_caps(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
pad.as_ref().to_glib_none().0,
|
||||||
|
caps.as_mut_ptr(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
|
fn output_buffer_duration_fraction(&self) -> gst::Fraction {
|
||||||
|
glib::ObjectExt::property(self.as_ref(), "output-buffer-duration-fraction")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
|
fn set_output_buffer_duration_fraction(&self, output_buffer_duration_fraction: gst::Fraction) {
|
||||||
|
glib::ObjectExt::set_property(
|
||||||
|
self.as_ref(),
|
||||||
|
"output-buffer-duration-fraction",
|
||||||
|
output_buffer_duration_fraction,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
|
fn connect_output_buffer_duration_fraction_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_output_buffer_duration_fraction_trampoline<
|
||||||
|
P: IsA<AudioAggregator>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregator,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box<F> = Box::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::output-buffer-duration-fraction\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_output_buffer_duration_fraction_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn current_caps(&self) -> Option<gst::Caps> {
|
||||||
|
unsafe {
|
||||||
|
let ptr = self.as_ptr() as *mut ffi::GstAudioAggregator;
|
||||||
|
let _guard = crate::utils::MutexGuard::lock(&(*(ptr as *mut gst::ffi::GstObject)).lock);
|
||||||
|
from_glib_none((*ptr).current_caps)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn current_audio_info(&self) -> Option<crate::AudioInfo> {
|
||||||
|
self.current_caps()
|
||||||
|
.and_then(|caps| crate::AudioInfo::from_caps(&caps).ok())
|
||||||
|
}
|
||||||
|
}
|
64
gstreamer-audio/src/audio_aggregator_convert_pad.rs
Normal file
64
gstreamer-audio/src/audio_aggregator_convert_pad.rs
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
use crate::auto::AudioAggregatorConvertPad;
|
||||||
|
use glib::object::IsA;
|
||||||
|
use glib::signal::{connect_raw, SignalHandlerId};
|
||||||
|
use glib::translate::*;
|
||||||
|
use glib::Cast;
|
||||||
|
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
pub trait AudioAggregatorConvertPadExtManual: 'static {
|
||||||
|
#[doc(alias = "converter-config")]
|
||||||
|
fn converter_config(&self) -> Option<crate::AudioConverterConfig>;
|
||||||
|
|
||||||
|
#[doc(alias = "converter-config")]
|
||||||
|
fn set_converter_config(&self, converter_config: Option<&crate::AudioConverterConfig>);
|
||||||
|
|
||||||
|
#[doc(alias = "converter-config")]
|
||||||
|
fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<AudioAggregatorConvertPad>> AudioAggregatorConvertPadExtManual for O {
|
||||||
|
fn converter_config(&self) -> Option<crate::AudioConverterConfig> {
|
||||||
|
glib::ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config")
|
||||||
|
.map(|c| c.try_into().unwrap())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_converter_config(&self, converter_config: Option<&crate::AudioConverterConfig>) {
|
||||||
|
glib::ObjectExt::set_property(
|
||||||
|
self.as_ref(),
|
||||||
|
"converter-config",
|
||||||
|
converter_config.map(|s| s.as_ref()),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_converter_config_trampoline<
|
||||||
|
P: IsA<AudioAggregatorConvertPad>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregatorConvertPad,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregatorConvertPad::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box<F> = Box::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::converter-config\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_converter_config_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
gstreamer-audio/src/audio_aggregator_pad.rs
Normal file
26
gstreamer-audio/src/audio_aggregator_pad.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
use crate::auto::AudioAggregatorPad;
|
||||||
|
use glib::object::IsA;
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
|
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 = crate::utils::MutexGuard::lock(&(*(ptr as *mut gst::ffi::GstObject)).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,
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
242
gstreamer-audio/src/auto/audio_aggregator.rs
Normal file
242
gstreamer-audio/src/auto/audio_aggregator.rs
Normal file
|
@ -0,0 +1,242 @@
|
||||||
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||||
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||||
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||||
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
use glib::object::Cast;
|
||||||
|
use glib::object::IsA;
|
||||||
|
use glib::signal::connect_raw;
|
||||||
|
use glib::signal::SignalHandlerId;
|
||||||
|
use glib::translate::*;
|
||||||
|
use glib::StaticType;
|
||||||
|
use glib::ToValue;
|
||||||
|
use std::boxed::Box as Box_;
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
#[doc(alias = "GstAudioAggregator")]
|
||||||
|
pub struct AudioAggregator(Object<ffi::GstAudioAggregator, ffi::GstAudioAggregatorClass>) @extends gst_base::Aggregator, gst::Element, gst::Object;
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
type_ => || ffi::gst_audio_aggregator_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AudioAggregator {
|
||||||
|
pub const NONE: Option<&'static AudioAggregator> = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for AudioAggregator {}
|
||||||
|
unsafe impl Sync for AudioAggregator {}
|
||||||
|
|
||||||
|
pub trait AudioAggregatorExt: 'static {
|
||||||
|
#[doc(alias = "alignment-threshold")]
|
||||||
|
fn alignment_threshold(&self) -> u64;
|
||||||
|
|
||||||
|
#[doc(alias = "alignment-threshold")]
|
||||||
|
fn set_alignment_threshold(&self, alignment_threshold: u64);
|
||||||
|
|
||||||
|
#[doc(alias = "discont-wait")]
|
||||||
|
fn discont_wait(&self) -> u64;
|
||||||
|
|
||||||
|
#[doc(alias = "discont-wait")]
|
||||||
|
fn set_discont_wait(&self, discont_wait: u64);
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "ignore-inactive-pads")]
|
||||||
|
fn ignores_inactive_pads(&self) -> bool;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "ignore-inactive-pads")]
|
||||||
|
fn set_ignore_inactive_pads(&self, ignore_inactive_pads: bool);
|
||||||
|
|
||||||
|
#[doc(alias = "output-buffer-duration")]
|
||||||
|
fn output_buffer_duration(&self) -> u64;
|
||||||
|
|
||||||
|
#[doc(alias = "output-buffer-duration")]
|
||||||
|
fn set_output_buffer_duration(&self, output_buffer_duration: u64);
|
||||||
|
|
||||||
|
#[doc(alias = "alignment-threshold")]
|
||||||
|
fn connect_alignment_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
|
||||||
|
#[doc(alias = "discont-wait")]
|
||||||
|
fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "ignore-inactive-pads")]
|
||||||
|
fn connect_ignore_inactive_pads_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
|
||||||
|
#[doc(alias = "output-buffer-duration")]
|
||||||
|
fn connect_output_buffer_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<AudioAggregator>> AudioAggregatorExt for O {
|
||||||
|
fn alignment_threshold(&self) -> u64 {
|
||||||
|
glib::ObjectExt::property(self.as_ref(), "alignment-threshold")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_alignment_threshold(&self, alignment_threshold: u64) {
|
||||||
|
glib::ObjectExt::set_property(self.as_ref(), "alignment-threshold", &alignment_threshold)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn discont_wait(&self) -> u64 {
|
||||||
|
glib::ObjectExt::property(self.as_ref(), "discont-wait")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_discont_wait(&self, discont_wait: u64) {
|
||||||
|
glib::ObjectExt::set_property(self.as_ref(), "discont-wait", &discont_wait)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
fn ignores_inactive_pads(&self) -> bool {
|
||||||
|
glib::ObjectExt::property(self.as_ref(), "ignore-inactive-pads")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
fn set_ignore_inactive_pads(&self, ignore_inactive_pads: bool) {
|
||||||
|
glib::ObjectExt::set_property(self.as_ref(), "ignore-inactive-pads", &ignore_inactive_pads)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn output_buffer_duration(&self) -> u64 {
|
||||||
|
glib::ObjectExt::property(self.as_ref(), "output-buffer-duration")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_output_buffer_duration(&self, output_buffer_duration: u64) {
|
||||||
|
glib::ObjectExt::set_property(
|
||||||
|
self.as_ref(),
|
||||||
|
"output-buffer-duration",
|
||||||
|
&output_buffer_duration,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn connect_alignment_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_alignment_threshold_trampoline<
|
||||||
|
P: IsA<AudioAggregator>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregator,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::alignment-threshold\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_alignment_threshold_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn connect_discont_wait_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_discont_wait_trampoline<
|
||||||
|
P: IsA<AudioAggregator>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregator,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::discont-wait\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_discont_wait_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
fn connect_ignore_inactive_pads_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_ignore_inactive_pads_trampoline<
|
||||||
|
P: IsA<AudioAggregator>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregator,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::ignore-inactive-pads\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_ignore_inactive_pads_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn connect_output_buffer_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_output_buffer_duration_trampoline<
|
||||||
|
P: IsA<AudioAggregator>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregator,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregator::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::output-buffer-duration\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_output_buffer_duration_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
81
gstreamer-audio/src/auto/audio_aggregator_convert_pad.rs
Normal file
81
gstreamer-audio/src/auto/audio_aggregator_convert_pad.rs
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||||
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||||
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||||
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
use crate::AudioAggregatorPad;
|
||||||
|
use glib::object::Cast;
|
||||||
|
use glib::object::IsA;
|
||||||
|
use glib::signal::connect_raw;
|
||||||
|
use glib::signal::SignalHandlerId;
|
||||||
|
use glib::translate::*;
|
||||||
|
use std::boxed::Box as Box_;
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
#[doc(alias = "GstAudioAggregatorConvertPad")]
|
||||||
|
pub struct AudioAggregatorConvertPad(Object<ffi::GstAudioAggregatorConvertPad, ffi::GstAudioAggregatorConvertPadClass>) @extends AudioAggregatorPad, gst_base::AggregatorPad, gst::Object;
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
type_ => || ffi::gst_audio_aggregator_convert_pad_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AudioAggregatorConvertPad {
|
||||||
|
pub const NONE: Option<&'static AudioAggregatorConvertPad> = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for AudioAggregatorConvertPad {}
|
||||||
|
unsafe impl Sync for AudioAggregatorConvertPad {}
|
||||||
|
|
||||||
|
pub trait AudioAggregatorConvertPadExt: 'static {
|
||||||
|
//#[doc(alias = "converter-config")]
|
||||||
|
//fn converter_config(&self) -> /*Ignored*/Option<gst::Structure>;
|
||||||
|
|
||||||
|
//#[doc(alias = "converter-config")]
|
||||||
|
//fn set_converter_config(&self, converter_config: /*Ignored*/Option<&gst::Structure>);
|
||||||
|
|
||||||
|
#[doc(alias = "converter-config")]
|
||||||
|
fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<AudioAggregatorConvertPad>> AudioAggregatorConvertPadExt for O {
|
||||||
|
//fn converter_config(&self) -> /*Ignored*/Option<gst::Structure> {
|
||||||
|
// glib::ObjectExt::property(self.as_ref(), "converter-config")
|
||||||
|
//}
|
||||||
|
|
||||||
|
//fn set_converter_config(&self, converter_config: /*Ignored*/Option<&gst::Structure>) {
|
||||||
|
// glib::ObjectExt::set_property(self.as_ref(),"converter-config", &converter_config)
|
||||||
|
//}
|
||||||
|
|
||||||
|
fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_converter_config_trampoline<
|
||||||
|
P: IsA<AudioAggregatorConvertPad>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregatorConvertPad,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregatorConvertPad::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::converter-config\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_converter_config_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
110
gstreamer-audio/src/auto/audio_aggregator_pad.rs
Normal file
110
gstreamer-audio/src/auto/audio_aggregator_pad.rs
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||||
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||||
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||||
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use glib::object::Cast;
|
||||||
|
use glib::object::IsA;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use glib::signal::connect_raw;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use glib::signal::SignalHandlerId;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use glib::translate::*;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use glib::StaticType;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use glib::ToValue;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use std::boxed::Box as Box_;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
#[doc(alias = "GstAudioAggregatorPad")]
|
||||||
|
pub struct AudioAggregatorPad(Object<ffi::GstAudioAggregatorPad, ffi::GstAudioAggregatorPadClass>) @extends gst_base::AggregatorPad, gst::Object;
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
type_ => || ffi::gst_audio_aggregator_pad_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AudioAggregatorPad {
|
||||||
|
pub const NONE: Option<&'static AudioAggregatorPad> = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for AudioAggregatorPad {}
|
||||||
|
unsafe impl Sync for AudioAggregatorPad {}
|
||||||
|
|
||||||
|
pub trait AudioAggregatorPadExt: 'static {
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "qos-messages")]
|
||||||
|
fn is_qos_messages(&self) -> bool;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "qos-messages")]
|
||||||
|
fn set_qos_messages(&self, qos_messages: bool);
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "qos-messages")]
|
||||||
|
fn connect_qos_messages_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<O: IsA<AudioAggregatorPad>> AudioAggregatorPadExt for O {
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
fn is_qos_messages(&self) -> bool {
|
||||||
|
glib::ObjectExt::property(self.as_ref(), "qos-messages")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
fn set_qos_messages(&self, qos_messages: bool) {
|
||||||
|
glib::ObjectExt::set_property(self.as_ref(), "qos-messages", &qos_messages)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
fn connect_qos_messages_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_qos_messages_trampoline<
|
||||||
|
P: IsA<AudioAggregatorPad>,
|
||||||
|
F: Fn(&P) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstAudioAggregatorPad,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(AudioAggregatorPad::from_glib_borrow(this).unsafe_cast_ref())
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::qos-messages\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_qos_messages_trampoline::<Self, F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,27 @@
|
||||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
mod audio_aggregator;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use self::audio_aggregator::AudioAggregator;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
mod audio_aggregator_convert_pad;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use self::audio_aggregator_convert_pad::AudioAggregatorConvertPad;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
mod audio_aggregator_pad;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use self::audio_aggregator_pad::AudioAggregatorPad;
|
||||||
|
|
||||||
mod audio_base_sink;
|
mod audio_base_sink;
|
||||||
pub use self::audio_base_sink::AudioBaseSink;
|
pub use self::audio_base_sink::AudioBaseSink;
|
||||||
|
|
||||||
|
@ -50,6 +71,15 @@ pub use self::flags::AudioPackFlags;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod traits {
|
pub mod traits {
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use super::audio_aggregator::AudioAggregatorExt;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use super::audio_aggregator_convert_pad::AudioAggregatorConvertPadExt;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use super::audio_aggregator_pad::AudioAggregatorPadExt;
|
||||||
pub use super::audio_base_sink::AudioBaseSinkExt;
|
pub use super::audio_base_sink::AudioBaseSinkExt;
|
||||||
pub use super::audio_base_src::AudioBaseSrcExt;
|
pub use super::audio_base_src::AudioBaseSrcExt;
|
||||||
pub use super::audio_decoder::AudioDecoderExt;
|
pub use super::audio_decoder::AudioDecoderExt;
|
||||||
|
|
|
@ -45,6 +45,15 @@ mod audio_channel_position;
|
||||||
pub use crate::audio_channel_position::*;
|
pub use crate::audio_channel_position::*;
|
||||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
mod audio_aggregator;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
mod audio_aggregator_convert_pad;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
mod audio_aggregator_pad;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
mod audio_stream_align;
|
mod audio_stream_align;
|
||||||
mod functions;
|
mod functions;
|
||||||
pub use crate::functions::*;
|
pub use crate::functions::*;
|
||||||
|
@ -61,6 +70,10 @@ mod audio_encoder;
|
||||||
mod audio_converter;
|
mod audio_converter;
|
||||||
pub use crate::audio_converter::AudioConverterConfig;
|
pub use crate::audio_converter::AudioConverterConfig;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
mod utils;
|
||||||
|
|
||||||
// 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_audio::prelude::*" without getting conflicts
|
// can always "use gst_audio::prelude::*" without getting conflicts
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
|
@ -69,7 +82,17 @@ pub mod prelude {
|
||||||
|
|
||||||
pub use super::audio_decoder::AudioDecoderExtManual;
|
pub use super::audio_decoder::AudioDecoderExtManual;
|
||||||
pub use super::audio_encoder::AudioEncoderExtManual;
|
pub use super::audio_encoder::AudioEncoderExtManual;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use crate::audio_aggregator::AudioAggregatorExtManual;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use crate::audio_aggregator_convert_pad::AudioAggregatorConvertPadExtManual;
|
||||||
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
|
pub use crate::audio_aggregator_pad::AudioAggregatorPadExtManual;
|
||||||
pub use crate::audio_format::AudioFormatIteratorExt;
|
pub use crate::audio_format::AudioFormatIteratorExt;
|
||||||
|
|
||||||
pub use crate::auto::traits::*;
|
pub use crate::auto::traits::*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
28
gstreamer-audio/src/utils.rs
Normal file
28
gstreamer-audio/src/utils.rs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
|
use glib::translate::mut_override;
|
||||||
|
|
||||||
|
#[must_use = "if unused the Mutex will immediately unlock"]
|
||||||
|
#[doc(alias = "GMutex")]
|
||||||
|
pub struct MutexGuard<'a>(&'a glib::ffi::GMutex);
|
||||||
|
|
||||||
|
impl<'a> MutexGuard<'a> {
|
||||||
|
#[allow(clippy::trivially_copy_pass_by_ref)]
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[doc(alias = "g_mutex_lock")]
|
||||||
|
pub fn lock(mutex: &'a glib::ffi::GMutex) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
unsafe {
|
||||||
|
glib::ffi::g_mutex_lock(mut_override(mutex));
|
||||||
|
}
|
||||||
|
MutexGuard(mutex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Drop for MutexGuard<'a> {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
unsafe {
|
||||||
|
glib::ffi::g_mutex_unlock(mut_override(self.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue