Seal manual traits

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1292>
This commit is contained in:
Bilal Elmoussaoui 2023-07-05 22:21:43 +02:00 committed by Sebastian Dröge
parent 6a703508bc
commit 8cf099f0ab
99 changed files with 1115 additions and 2471 deletions

View file

@ -10,33 +10,13 @@ use gst::prelude::*;
use crate::auto::{AudioAggregator, AudioAggregatorPad}; use crate::auto::{AudioAggregator, AudioAggregatorPad};
pub trait AudioAggregatorExtManual: 'static { mod sealed {
#[doc(alias = "gst_audio_aggregator_set_sink_caps")] pub trait Sealed {}
fn set_sink_caps(&self, pad: &impl IsA<AudioAggregatorPad>, caps: &gst::CapsRef); impl<T: super::IsA<super::AudioAggregator>> Sealed for T {}
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "output-buffer-duration-fraction")]
fn output_buffer_duration_fraction(&self) -> gst::Fraction;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, 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(feature = "v1_18")]
#[cfg_attr(docsrs, 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 { pub trait AudioAggregatorExtManual: sealed::Sealed + IsA<AudioAggregator> + 'static {
#[doc(alias = "gst_audio_aggregator_set_sink_caps")]
fn set_sink_caps(&self, pad: &impl IsA<AudioAggregatorPad>, caps: &gst::CapsRef) { fn set_sink_caps(&self, pad: &impl IsA<AudioAggregatorPad>, caps: &gst::CapsRef) {
unsafe { unsafe {
ffi::gst_audio_aggregator_set_sink_caps( ffi::gst_audio_aggregator_set_sink_caps(
@ -49,12 +29,14 @@ impl<O: IsA<AudioAggregator>> AudioAggregatorExtManual for O {
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "output-buffer-duration-fraction")]
fn output_buffer_duration_fraction(&self) -> gst::Fraction { fn output_buffer_duration_fraction(&self) -> gst::Fraction {
glib::ObjectExt::property(self.as_ref(), "output-buffer-duration-fraction") glib::ObjectExt::property(self.as_ref(), "output-buffer-duration-fraction")
} }
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "output-buffer-duration-fraction")]
fn set_output_buffer_duration_fraction(&self, output_buffer_duration_fraction: gst::Fraction) { fn set_output_buffer_duration_fraction(&self, output_buffer_duration_fraction: gst::Fraction) {
glib::ObjectExt::set_property( glib::ObjectExt::set_property(
self.as_ref(), self.as_ref(),
@ -65,6 +47,7 @@ impl<O: IsA<AudioAggregator>> AudioAggregatorExtManual for O {
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "output-buffer-duration-fraction")]
fn connect_output_buffer_duration_fraction_notify<F: Fn(&Self) + Send + Sync + 'static>( fn connect_output_buffer_duration_fraction_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self, &self,
f: F, f: F,
@ -106,3 +89,5 @@ impl<O: IsA<AudioAggregator>> AudioAggregatorExtManual for O {
.and_then(|caps| crate::AudioInfo::from_caps(&caps).ok()) .and_then(|caps| crate::AudioInfo::from_caps(&caps).ok())
} }
} }
impl<O: IsA<AudioAggregator>> AudioAggregatorExtManual for O {}

View file

@ -9,26 +9,21 @@ use glib::{
use crate::auto::AudioAggregatorConvertPad; use crate::auto::AudioAggregatorConvertPad;
pub trait AudioAggregatorConvertPadExtManual: 'static { mod sealed {
#[doc(alias = "converter-config")] pub trait Sealed {}
fn converter_config(&self) -> Option<crate::AudioConverterConfig>; impl<T: super::IsA<super::AudioAggregatorConvertPad>> Sealed for T {}
#[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 { pub trait AudioAggregatorConvertPadExtManual:
sealed::Sealed + IsA<AudioAggregatorConvertPad> + 'static
{
#[doc(alias = "converter-config")]
fn converter_config(&self) -> Option<crate::AudioConverterConfig> { fn converter_config(&self) -> Option<crate::AudioConverterConfig> {
glib::ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config") glib::ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config")
.map(|c| c.try_into().unwrap()) .map(|c| c.try_into().unwrap())
} }
#[doc(alias = "converter-config")]
fn set_converter_config(&self, converter_config: Option<&crate::AudioConverterConfig>) { fn set_converter_config(&self, converter_config: Option<&crate::AudioConverterConfig>) {
glib::ObjectExt::set_property( glib::ObjectExt::set_property(
self.as_ref(), self.as_ref(),
@ -37,6 +32,7 @@ impl<O: IsA<AudioAggregatorConvertPad>> AudioAggregatorConvertPadExtManual for O
) )
} }
#[doc(alias = "converter-config")]
fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>( fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self, &self,
f: F, f: F,
@ -65,3 +61,5 @@ impl<O: IsA<AudioAggregatorConvertPad>> AudioAggregatorConvertPadExtManual for O
} }
} }
} }
impl<O: IsA<AudioAggregatorConvertPad>> AudioAggregatorConvertPadExtManual for O {}

View file

@ -3,11 +3,12 @@ use gst::prelude::*;
use crate::auto::AudioAggregatorPad; use crate::auto::AudioAggregatorPad;
pub trait AudioAggregatorPadExtManual: 'static { mod sealed {
fn audio_info(&self) -> Option<crate::AudioInfo>; pub trait Sealed {}
impl<T: super::IsA<super::AudioAggregatorPad>> Sealed for T {}
} }
impl<O: IsA<AudioAggregatorPad>> AudioAggregatorPadExtManual for O { pub trait AudioAggregatorPadExtManual: sealed::Sealed + IsA<AudioAggregatorPad> + 'static {
fn audio_info(&self) -> Option<crate::AudioInfo> { fn audio_info(&self) -> Option<crate::AudioInfo> {
unsafe { unsafe {
let ptr = self.as_ptr() as *mut ffi::GstAudioAggregatorPad; let ptr = self.as_ptr() as *mut ffi::GstAudioAggregatorPad;
@ -25,3 +26,5 @@ impl<O: IsA<AudioAggregatorPad>> AudioAggregatorPadExtManual for O {
} }
} }
} }
impl<O: IsA<AudioAggregatorPad>> AudioAggregatorPadExtManual for O {}

View file

@ -20,36 +20,12 @@ extern "C" {
) -> gst::ffi::GstFlowReturn; ) -> gst::ffi::GstFlowReturn;
} }
pub trait AudioDecoderExtManual: 'static { mod sealed {
fn negotiate(&self) -> Result<(), gst::FlowError>; pub trait Sealed {}
impl<T: super::IsA<super::AudioDecoder>> Sealed for T {}
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
fn set_output_caps(&self, caps: &gst::Caps) -> Result<(), gst::FlowError>;
fn set_output_format(&self, info: &AudioInfo) -> Result<(), gst::FlowError>;
#[doc(alias = "get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
#[allow(clippy::too_many_arguments)]
fn error<T: gst::MessageErrorDomain>(
&self,
weight: i32,
code: T,
message: Option<&str>,
debug: Option<&str>,
file: &str,
function: &str,
line: u32,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn sink_pad(&self) -> &gst::Pad;
fn src_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O { pub trait AudioDecoderExtManual: sealed::Sealed + IsA<AudioDecoder> + 'static {
#[doc(alias = "gst_audio_decoder_negotiate")] #[doc(alias = "gst_audio_decoder_negotiate")]
fn negotiate(&self) -> Result<(), gst::FlowError> { fn negotiate(&self) -> Result<(), gst::FlowError> {
unsafe { unsafe {
@ -96,6 +72,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
} }
} }
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_audio_decoder_get_allocator")] #[doc(alias = "gst_audio_decoder_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) { fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
unsafe { unsafe {
@ -110,6 +87,7 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
} }
} }
#[allow(clippy::too_many_arguments)]
fn error<T: gst::MessageErrorDomain>( fn error<T: gst::MessageErrorDomain>(
&self, &self,
weight: i32, weight: i32,
@ -150,6 +128,8 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
} }
} }
impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {}
#[macro_export] #[macro_export]
macro_rules! audio_decoder_error( macro_rules! audio_decoder_error(
($obj:expr, $weight:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { { ($obj:expr, $weight:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { {

View file

@ -6,26 +6,13 @@ use glib::{prelude::*, translate::*};
use crate::AudioEncoder; use crate::AudioEncoder;
pub trait AudioEncoderExtManual: 'static { mod sealed {
#[doc(alias = "gst_audio_encoder_negotiate")] pub trait Sealed {}
fn negotiate(&self) -> Result<(), gst::FlowError>; impl<T: super::IsA<super::AudioEncoder>> Sealed for T {}
#[doc(alias = "gst_audio_encoder_set_output_format")]
fn set_output_format(&self, caps: &gst::Caps) -> Result<(), gst::FlowError>;
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_audio_encoder_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
#[doc(alias = "gst_audio_encoder_set_headers")]
fn set_headers(&self, headers: impl IntoIterator<Item = gst::Buffer>);
fn sink_pad(&self) -> &gst::Pad;
fn src_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O { pub trait AudioEncoderExtManual: sealed::Sealed + IsA<AudioEncoder> + 'static {
#[doc(alias = "gst_audio_encoder_negotiate")]
fn negotiate(&self) -> Result<(), gst::FlowError> { fn negotiate(&self) -> Result<(), gst::FlowError> {
unsafe { unsafe {
let ret = from_glib(ffi::gst_audio_encoder_negotiate( let ret = from_glib(ffi::gst_audio_encoder_negotiate(
@ -39,6 +26,7 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
} }
} }
#[doc(alias = "gst_audio_encoder_set_output_format")]
fn set_output_format(&self, caps: &gst::Caps) -> Result<(), gst::FlowError> { fn set_output_format(&self, caps: &gst::Caps) -> Result<(), gst::FlowError> {
unsafe { unsafe {
let ret = from_glib(ffi::gst_audio_encoder_set_output_format( let ret = from_glib(ffi::gst_audio_encoder_set_output_format(
@ -53,6 +41,8 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
} }
} }
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_audio_encoder_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) { fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
unsafe { unsafe {
let mut allocator = ptr::null_mut(); let mut allocator = ptr::null_mut();
@ -66,6 +56,7 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
} }
} }
#[doc(alias = "gst_audio_encoder_set_headers")]
fn set_headers(&self, headers: impl IntoIterator<Item = gst::Buffer>) { fn set_headers(&self, headers: impl IntoIterator<Item = gst::Buffer>) {
unsafe { unsafe {
ffi::gst_audio_encoder_set_headers( ffi::gst_audio_encoder_set_headers(
@ -92,3 +83,5 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
} }
} }
} }
impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {}

View file

@ -26,22 +26,12 @@ pub trait AudioAggregatorImpl: AudioAggregatorImplExt + AggregatorImpl {
} }
} }
pub trait AudioAggregatorImplExt: ObjectSubclass { mod sealed {
fn parent_create_output_buffer(&self, num_frames: u32) -> Option<gst::Buffer>; pub trait Sealed {}
impl<T: super::AudioAggregatorImplExt> Sealed for T {}
#[allow(clippy::too_many_arguments)]
fn parent_aggregate_one_buffer(
&self,
pad: &AudioAggregatorPad,
inbuf: &gst::BufferRef,
in_offset: u32,
outbuf: &mut gst::BufferRef,
out_offset: u32,
num_frames: u32,
) -> bool;
} }
impl<T: AudioAggregatorImpl> AudioAggregatorImplExt for T { pub trait AudioAggregatorImplExt: sealed::Sealed + ObjectSubclass {
fn parent_create_output_buffer(&self, num_frames: u32) -> Option<gst::Buffer> { fn parent_create_output_buffer(&self, num_frames: u32) -> Option<gst::Buffer> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -92,6 +82,8 @@ impl<T: AudioAggregatorImpl> AudioAggregatorImplExt for T {
} }
} }
impl<T: AudioAggregatorImpl> AudioAggregatorImplExt for T {}
unsafe impl<T: AudioAggregatorImpl> IsSubclassable<T> for AudioAggregator { unsafe impl<T: AudioAggregatorImpl> IsSubclassable<T> for AudioAggregator {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -24,18 +24,12 @@ pub trait AudioAggregatorPadImpl: AudioAggregatorPadImplExt + AggregatorPadImpl
} }
} }
pub trait AudioAggregatorPadImplExt: ObjectSubclass { mod sealed {
fn parent_update_conversion_info(&self); pub trait Sealed {}
impl<T: super::AudioAggregatorPadImplExt> Sealed for T {}
fn parent_convert_buffer(
&self,
in_info: &crate::AudioInfo,
out_info: &crate::AudioInfo,
buffer: &gst::Buffer,
) -> Option<gst::Buffer>;
} }
impl<T: AudioAggregatorPadImpl> AudioAggregatorPadImplExt for T { pub trait AudioAggregatorPadImplExt: sealed::Sealed + ObjectSubclass {
fn parent_update_conversion_info(&self) { fn parent_update_conversion_info(&self) {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -75,6 +69,8 @@ impl<T: AudioAggregatorPadImpl> AudioAggregatorPadImplExt for T {
} }
} }
impl<T: AudioAggregatorPadImpl> AudioAggregatorPadImplExt for T {}
unsafe impl<T: AudioAggregatorPadImpl> IsSubclassable<T> for AudioAggregatorPad { unsafe impl<T: AudioAggregatorPadImpl> IsSubclassable<T> for AudioAggregatorPad {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -86,52 +86,12 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl {
} }
} }
pub trait AudioDecoderImplExt: ObjectSubclass { mod sealed {
fn parent_open(&self) -> Result<(), gst::ErrorMessage>; pub trait Sealed {}
impl<T: super::AudioDecoderImplExt> Sealed for T {}
fn parent_close(&self) -> Result<(), gst::ErrorMessage>;
fn parent_start(&self) -> Result<(), gst::ErrorMessage>;
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_set_format(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>;
fn parent_parse(&self, adapter: &gst_base::Adapter) -> Result<(u32, u32), gst::FlowError>;
fn parent_handle_frame(
&self,
buffer: Option<&gst::Buffer>,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_pre_push(&self, buffer: gst::Buffer) -> Result<Option<gst::Buffer>, gst::FlowError>;
fn parent_flush(&self, hard: bool);
fn parent_negotiate(&self) -> Result<(), gst::LoggableError>;
fn parent_caps(&self, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, event: gst::Event) -> bool;
fn parent_sink_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_src_event(&self, event: gst::Event) -> bool;
fn parent_src_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_propose_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
} }
impl<T: AudioDecoderImpl> AudioDecoderImplExt for T { pub trait AudioDecoderImplExt: sealed::Sealed + ObjectSubclass {
fn parent_open(&self) -> Result<(), gst::ErrorMessage> { fn parent_open(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -513,6 +473,8 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
} }
} }
impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {}
unsafe impl<T: AudioDecoderImpl> IsSubclassable<T> for AudioDecoder { unsafe impl<T: AudioDecoderImpl> IsSubclassable<T> for AudioDecoder {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -82,50 +82,12 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl {
} }
} }
pub trait AudioEncoderImplExt: ObjectSubclass { mod sealed {
fn parent_open(&self) -> Result<(), gst::ErrorMessage>; pub trait Sealed {}
impl<T: super::AudioEncoderImplExt> Sealed for T {}
fn parent_close(&self) -> Result<(), gst::ErrorMessage>;
fn parent_start(&self) -> Result<(), gst::ErrorMessage>;
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_set_format(&self, info: &AudioInfo) -> Result<(), gst::LoggableError>;
fn parent_handle_frame(
&self,
buffer: Option<&gst::Buffer>,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_pre_push(&self, buffer: gst::Buffer) -> Result<Option<gst::Buffer>, gst::FlowError>;
fn parent_flush(&self);
fn parent_negotiate(&self) -> Result<(), gst::LoggableError>;
fn parent_caps(&self, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, event: gst::Event) -> bool;
fn parent_sink_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_src_event(&self, event: gst::Event) -> bool;
fn parent_src_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_propose_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
} }
impl<T: AudioEncoderImpl> AudioEncoderImplExt for T { pub trait AudioEncoderImplExt: sealed::Sealed + ObjectSubclass {
fn parent_open(&self) -> Result<(), gst::ErrorMessage> { fn parent_open(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -475,6 +437,8 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
} }
} }
impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {}
unsafe impl<T: AudioEncoderImpl> IsSubclassable<T> for AudioEncoder { unsafe impl<T: AudioEncoderImpl> IsSubclassable<T> for AudioEncoder {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -13,11 +13,12 @@ pub trait AudioFilterImpl: AudioFilterImplExt + BaseTransformImpl {
} }
} }
pub trait AudioFilterImplExt: ObjectSubclass { mod sealed {
fn parent_setup(&self, info: &AudioInfo) -> Result<(), gst::LoggableError>; pub trait Sealed {}
impl<T: super::AudioFilterImplExt> Sealed for T {}
} }
impl<T: AudioFilterImpl> AudioFilterImplExt for T { pub trait AudioFilterImplExt: sealed::Sealed + ObjectSubclass {
fn parent_setup(&self, info: &AudioInfo) -> Result<(), gst::LoggableError> { fn parent_setup(&self, info: &AudioInfo) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -39,6 +40,8 @@ impl<T: AudioFilterImpl> AudioFilterImplExt for T {
} }
} }
impl<T: AudioFilterImpl> AudioFilterImplExt for T {}
unsafe impl<T: AudioFilterImpl> IsSubclassable<T> for AudioFilter { unsafe impl<T: AudioFilterImpl> IsSubclassable<T> for AudioFilter {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -37,17 +37,12 @@ pub trait AudioSinkImpl: AudioSinkImplExt + AudioBaseSinkImpl {
} }
} }
pub trait AudioSinkImplExt: ObjectSubclass { mod sealed {
fn parent_close(&self) -> Result<(), LoggableError>; pub trait Sealed {}
fn parent_delay(&self) -> u32; impl<T: super::AudioSinkImplExt> Sealed for T {}
fn parent_open(&self) -> Result<(), LoggableError>;
fn parent_prepare(&self, spec: &mut AudioRingBufferSpec) -> Result<(), LoggableError>;
fn parent_unprepare(&self) -> Result<(), LoggableError>;
fn parent_write(&self, audio_data: &[u8]) -> Result<i32, LoggableError>;
fn parent_reset(&self);
} }
impl<T: AudioSinkImpl> AudioSinkImplExt for T { pub trait AudioSinkImplExt: sealed::Sealed + ObjectSubclass {
fn parent_close(&self) -> Result<(), LoggableError> { fn parent_close(&self) -> Result<(), LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -168,6 +163,8 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
} }
} }
impl<T: AudioSinkImpl> AudioSinkImplExt for T {}
unsafe impl<T: AudioSinkImpl> IsSubclassable<T> for AudioSink { unsafe impl<T: AudioSinkImpl> IsSubclassable<T> for AudioSink {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -39,20 +39,12 @@ pub trait AudioSrcImpl: AudioSrcImplExt + AudioBaseSrcImpl {
} }
} }
pub trait AudioSrcImplExt: ObjectSubclass { mod sealed {
fn parent_close(&self) -> Result<(), LoggableError>; pub trait Sealed {}
fn parent_delay(&self) -> u32; impl<T: super::AudioSrcImplExt> Sealed for T {}
fn parent_open(&self) -> Result<(), LoggableError>;
fn parent_prepare(&self, spec: &mut AudioRingBufferSpec) -> Result<(), LoggableError>;
fn parent_unprepare(&self) -> Result<(), LoggableError>;
fn parent_read(
&self,
audio_data: &mut [u8],
) -> Result<(u32, Option<gst::ClockTime>), LoggableError>;
fn parent_reset(&self);
} }
impl<T: AudioSrcImpl> AudioSrcImplExt for T { pub trait AudioSrcImplExt: sealed::Sealed + ObjectSubclass {
fn parent_close(&self) -> Result<(), LoggableError> { fn parent_close(&self) -> Result<(), LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -178,6 +170,8 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
} }
} }
impl<T: AudioSrcImpl> AudioSrcImplExt for T {}
unsafe impl<T: AudioSrcImpl> IsSubclassable<T> for AudioSrc { unsafe impl<T: AudioSrcImpl> IsSubclassable<T> for AudioSrc {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -17,71 +17,14 @@ use gst::{format::FormattedValue, prelude::*};
use crate::Aggregator; use crate::Aggregator;
use crate::AggregatorPad; use crate::AggregatorPad;
pub trait AggregatorExtManual: 'static { mod sealed {
#[doc(alias = "get_allocator")] pub trait Sealed {}
#[doc(alias = "gst_aggregator_get_allocator")] impl<T: super::IsA<super::Aggregator>> Sealed for T {}
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "min-upstream-latency")]
fn min_upstream_latency(&self) -> gst::ClockTime;
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "min-upstream-latency")]
fn set_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime);
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "min-upstream-latency")]
fn connect_min_upstream_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_aggregator_update_segment")]
fn update_segment<F: gst::format::FormattedValueIntrinsic>(
&self,
segment: &gst::FormattedSegment<F>,
);
fn set_position(&self, position: impl FormattedValue);
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_aggregator_selected_samples")]
fn selected_samples(
&self,
pts: impl Into<Option<gst::ClockTime>>,
dts: impl Into<Option<gst::ClockTime>>,
duration: impl Into<Option<gst::ClockTime>>,
info: Option<&gst::StructureRef>,
);
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn connect_samples_selected<
F: Fn(
&Self,
&gst::Segment,
Option<gst::ClockTime>,
Option<gst::ClockTime>,
Option<gst::ClockTime>,
Option<&gst::StructureRef>,
) + Send
+ 'static,
>(
&self,
f: F,
) -> SignalHandlerId;
fn src_pad(&self) -> &AggregatorPad;
} }
impl<O: IsA<Aggregator>> AggregatorExtManual for O { pub trait AggregatorExtManual: sealed::Sealed + IsA<Aggregator> + 'static {
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_aggregator_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) { fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
unsafe { unsafe {
let mut allocator = ptr::null_mut(); let mut allocator = ptr::null_mut();
@ -97,12 +40,14 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
#[cfg(feature = "v1_16")] #[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "min-upstream-latency")]
fn min_upstream_latency(&self) -> gst::ClockTime { fn min_upstream_latency(&self) -> gst::ClockTime {
self.as_ref().property("min-upstream-latency") self.as_ref().property("min-upstream-latency")
} }
#[cfg(feature = "v1_16")] #[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "min-upstream-latency")]
fn set_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime) { fn set_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime) {
self.as_ref() self.as_ref()
.set_property("min-upstream-latency", min_upstream_latency); .set_property("min-upstream-latency", min_upstream_latency);
@ -110,6 +55,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
#[cfg(feature = "v1_16")] #[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "min-upstream-latency")]
fn connect_min_upstream_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( fn connect_min_upstream_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self, &self,
f: F, f: F,
@ -126,8 +72,10 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
) )
} }
} }
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_aggregator_update_segment")]
fn update_segment<F: gst::format::FormattedValueIntrinsic>( fn update_segment<F: gst::format::FormattedValueIntrinsic>(
&self, &self,
segment: &gst::FormattedSegment<F>, segment: &gst::FormattedSegment<F>,
@ -157,6 +105,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_aggregator_selected_samples")]
fn selected_samples( fn selected_samples(
&self, &self,
pts: impl Into<Option<gst::ClockTime>>, pts: impl Into<Option<gst::ClockTime>>,
@ -177,8 +126,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
} }
} }
#[cfg(feature = "v1_18")] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn connect_samples_selected< fn connect_samples_selected<
F: Fn( F: Fn(
&Self, &Self,
@ -251,6 +199,8 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
} }
} }
impl<O: IsA<Aggregator>> AggregatorExtManual for O {}
#[cfg(feature = "v1_16")] #[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
unsafe extern "C" fn notify_min_upstream_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( unsafe extern "C" fn notify_min_upstream_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(

View file

@ -5,12 +5,13 @@ use gst::prelude::*;
use crate::AggregatorPad; use crate::AggregatorPad;
pub trait AggregatorPadExtManual: 'static { mod sealed {
#[doc(alias = "get_segment")] pub trait Sealed {}
fn segment(&self) -> gst::Segment; impl<T: super::IsA<super::AggregatorPad>> Sealed for T {}
} }
impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O { pub trait AggregatorPadExtManual: sealed::Sealed + IsA<AggregatorPad> + 'static {
#[doc(alias = "get_segment")]
fn segment(&self) -> gst::Segment { fn segment(&self) -> gst::Segment {
unsafe { unsafe {
let ptr: &ffi::GstAggregatorPad = &*(self.as_ptr() as *const _); let ptr: &ffi::GstAggregatorPad = &*(self.as_ptr() as *const _);
@ -19,3 +20,5 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {
} }
} }
} }
impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {}

View file

@ -7,37 +7,13 @@ use gst::format::{FormattedValue, SpecificFormattedValueFullRange};
use crate::{BaseParse, BaseParseFrame}; use crate::{BaseParse, BaseParseFrame};
pub trait BaseParseExtManual: 'static { mod sealed {
#[doc(alias = "get_sink_pad")] pub trait Sealed {}
fn sink_pad(&self) -> &gst::Pad; impl<T: super::IsA<super::BaseParse>> Sealed for T {}
#[doc(alias = "get_src_pad")]
fn src_pad(&self) -> &gst::Pad;
#[doc(alias = "gst_base_parse_set_duration")]
fn set_duration(&self, duration: impl FormattedValue, interval: u32);
#[doc(alias = "gst_base_parse_set_frame_rate")]
fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32);
#[doc(alias = "gst_base_parse_convert_default")]
fn convert_default<U: SpecificFormattedValueFullRange>(
&self,
src_val: impl FormattedValue,
) -> Option<U>;
fn convert_default_generic(
&self,
src_val: impl FormattedValue,
dest_format: gst::Format,
) -> Option<gst::GenericFormattedValue>;
#[doc(alias = "gst_base_parse_finish_frame")]
fn finish_frame(
&self,
frame: BaseParseFrame,
size: u32,
) -> Result<gst::FlowSuccess, gst::FlowError>;
} }
impl<O: IsA<BaseParse>> BaseParseExtManual for O { pub trait BaseParseExtManual: sealed::Sealed + IsA<BaseParse> + 'static {
#[doc(alias = "get_sink_pad")]
fn sink_pad(&self) -> &gst::Pad { fn sink_pad(&self) -> &gst::Pad {
unsafe { unsafe {
let elt = &*(self.as_ptr() as *const ffi::GstBaseParse); let elt = &*(self.as_ptr() as *const ffi::GstBaseParse);
@ -45,6 +21,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
#[doc(alias = "get_src_pad")]
fn src_pad(&self) -> &gst::Pad { fn src_pad(&self) -> &gst::Pad {
unsafe { unsafe {
let elt = &*(self.as_ptr() as *const ffi::GstBaseParse); let elt = &*(self.as_ptr() as *const ffi::GstBaseParse);
@ -52,6 +29,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
#[doc(alias = "gst_base_parse_set_duration")]
fn set_duration(&self, duration: impl FormattedValue, interval: u32) { fn set_duration(&self, duration: impl FormattedValue, interval: u32) {
unsafe { unsafe {
ffi::gst_base_parse_set_duration( ffi::gst_base_parse_set_duration(
@ -63,6 +41,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
#[doc(alias = "gst_base_parse_set_frame_rate")]
fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32) { fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32) {
let (fps_num, fps_den) = fps.into(); let (fps_num, fps_den) = fps.into();
unsafe { unsafe {
@ -76,6 +55,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
#[doc(alias = "gst_base_parse_convert_default")]
fn convert_default<U: SpecificFormattedValueFullRange>( fn convert_default<U: SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl FormattedValue, src_val: impl FormattedValue,
@ -122,6 +102,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
#[doc(alias = "gst_base_parse_finish_frame")]
fn finish_frame( fn finish_frame(
&self, &self,
frame: BaseParseFrame, frame: BaseParseFrame,
@ -136,3 +117,5 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
} }
impl<O: IsA<BaseParse>> BaseParseExtManual for O {}

View file

@ -7,19 +7,13 @@ use gst::prelude::*;
use crate::BaseSink; use crate::BaseSink;
pub trait BaseSinkExtManual: 'static { mod sealed {
#[doc(alias = "get_segment")] pub trait Sealed {}
fn segment(&self) -> gst::Segment; impl<T: super::IsA<super::BaseSink>> Sealed for T {}
#[doc(alias = "gst_base_sink_query_latency")]
fn query_latency(
&self,
) -> Result<(bool, bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError>;
fn sink_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<BaseSink>> BaseSinkExtManual for O { pub trait BaseSinkExtManual: sealed::Sealed + IsA<BaseSink> + 'static {
#[doc(alias = "get_segment")]
fn segment(&self) -> gst::Segment { fn segment(&self) -> gst::Segment {
unsafe { unsafe {
let sink: &ffi::GstBaseSink = &*(self.as_ptr() as *const _); let sink: &ffi::GstBaseSink = &*(self.as_ptr() as *const _);
@ -28,6 +22,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
} }
} }
#[doc(alias = "gst_base_sink_query_latency")]
fn query_latency( fn query_latency(
&self, &self,
) -> Result<(bool, bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError> { ) -> Result<(bool, bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError> {
@ -67,3 +62,5 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
} }
} }
} }
impl<O: IsA<BaseSink>> BaseSinkExtManual for O {}

View file

@ -7,23 +7,14 @@ use gst::prelude::*;
use crate::BaseSrc; use crate::BaseSrc;
pub trait BaseSrcExtManual: 'static { mod sealed {
#[doc(alias = "get_allocator")] pub trait Sealed {}
#[doc(alias = "gst_base_src_get_allocator")] impl<T: super::IsA<super::BaseSrc>> Sealed for T {}
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
#[doc(alias = "get_segment")]
fn segment(&self) -> gst::Segment;
#[doc(alias = "gst_base_src_query_latency")]
fn query_latency(
&self,
) -> Result<(bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError>;
fn src_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<BaseSrc>> BaseSrcExtManual for O { pub trait BaseSrcExtManual: sealed::Sealed + IsA<BaseSrc> + 'static {
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_base_src_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) { fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
unsafe { unsafe {
let mut allocator = ptr::null_mut(); let mut allocator = ptr::null_mut();
@ -37,6 +28,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
} }
} }
#[doc(alias = "get_segment")]
fn segment(&self) -> gst::Segment { fn segment(&self) -> gst::Segment {
unsafe { unsafe {
let src: &ffi::GstBaseSrc = &*(self.as_ptr() as *const _); let src: &ffi::GstBaseSrc = &*(self.as_ptr() as *const _);
@ -45,6 +37,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
} }
} }
#[doc(alias = "gst_base_src_query_latency")]
fn query_latency( fn query_latency(
&self, &self,
) -> Result<(bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError> { ) -> Result<(bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError> {
@ -80,3 +73,5 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
} }
} }
} }
impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {}

View file

@ -7,20 +7,14 @@ use gst::prelude::*;
use crate::BaseTransform; use crate::BaseTransform;
pub trait BaseTransformExtManual: 'static { mod sealed {
#[doc(alias = "get_allocator")] pub trait Sealed {}
#[doc(alias = "gst_base_transform_get_allocator")] impl<T: super::IsA<super::BaseTransform>> Sealed for T {}
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
#[doc(alias = "get_segment")]
fn segment(&self) -> gst::Segment;
fn sink_pad(&self) -> &gst::Pad;
fn src_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<BaseTransform>> BaseTransformExtManual for O { pub trait BaseTransformExtManual: sealed::Sealed + IsA<BaseTransform> + 'static {
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_base_transform_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) { fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
unsafe { unsafe {
let mut allocator = ptr::null_mut(); let mut allocator = ptr::null_mut();
@ -34,6 +28,7 @@ impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
} }
} }
#[doc(alias = "get_segment")]
fn segment(&self) -> gst::Segment { fn segment(&self) -> gst::Segment {
unsafe { unsafe {
let trans: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _); let trans: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _);
@ -56,3 +51,5 @@ impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
} }
} }
} }
impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {}

View file

@ -135,98 +135,12 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
} }
} }
pub trait AggregatorImplExt: ObjectSubclass { mod sealed {
fn parent_flush(&self) -> Result<gst::FlowSuccess, gst::FlowError>; pub trait Sealed {}
impl<T: super::AggregatorImplExt> Sealed for T {}
fn parent_clip(
&self,
aggregator_pad: &AggregatorPad,
buffer: gst::Buffer,
) -> Option<gst::Buffer>;
fn parent_finish_buffer(&self, buffer: gst::Buffer)
-> Result<gst::FlowSuccess, gst::FlowError>;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn parent_finish_buffer_list(
&self,
buffer_list: gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_sink_event(&self, aggregator_pad: &AggregatorPad, event: gst::Event) -> bool;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn parent_sink_event_pre_queue(
&self,
aggregator_pad: &AggregatorPad,
event: gst::Event,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_sink_query(&self, aggregator_pad: &AggregatorPad, query: &mut gst::QueryRef) -> bool;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn parent_sink_query_pre_queue(
&self,
aggregator_pad: &AggregatorPad,
query: &mut gst::QueryRef,
) -> bool;
fn parent_src_event(&self, event: gst::Event) -> bool;
fn parent_src_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_src_activate(
&self,
mode: gst::PadMode,
active: bool,
) -> Result<(), gst::LoggableError>;
fn parent_aggregate(&self, timeout: bool) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_start(&self) -> Result<(), gst::ErrorMessage>;
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_next_time(&self) -> Option<gst::ClockTime>;
fn parent_create_new_pad(
&self,
templ: &gst::PadTemplate,
req_name: Option<&str>,
caps: Option<&gst::Caps>,
) -> Option<AggregatorPad>;
fn parent_update_src_caps(&self, caps: &gst::Caps) -> Result<gst::Caps, gst::FlowError>;
fn parent_fixate_src_caps(&self, caps: gst::Caps) -> gst::Caps;
fn parent_negotiated_src_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>;
fn parent_propose_allocation(
&self,
pad: &AggregatorPad,
decide_query: Option<&gst::query::Allocation>,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn parent_negotiate(&self) -> bool;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn parent_peek_next_sample(&self, pad: &AggregatorPad) -> Option<gst::Sample>;
} }
impl<T: AggregatorImpl> AggregatorImplExt for T { pub trait AggregatorImplExt: sealed::Sealed + ObjectSubclass {
fn parent_flush(&self) -> Result<gst::FlowSuccess, gst::FlowError> { fn parent_flush(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -668,6 +582,8 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
} }
} }
impl<T: AggregatorImpl> AggregatorImplExt for T {}
unsafe impl<T: AggregatorImpl> IsSubclassable<T> for Aggregator { unsafe impl<T: AggregatorImpl> IsSubclassable<T> for Aggregator {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -15,13 +15,12 @@ pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
} }
} }
pub trait AggregatorPadImplExt: ObjectSubclass { mod sealed {
fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError>; pub trait Sealed {}
impl<T: super::AggregatorPadImplExt> Sealed for T {}
fn parent_skip_buffer(&self, aggregator: &Aggregator, buffer: &gst::Buffer) -> bool;
} }
impl<T: AggregatorPadImpl> AggregatorPadImplExt for T { pub trait AggregatorPadImplExt: sealed::Sealed + ObjectSubclass {
fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> { fn parent_flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -61,6 +60,8 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
} }
} }
} }
impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {}
unsafe impl<T: AggregatorPadImpl> IsSubclassable<T> for AggregatorPad { unsafe impl<T: AggregatorPadImpl> IsSubclassable<T> for AggregatorPad {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -36,26 +36,12 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
} }
} }
pub trait BaseParseImplExt: ObjectSubclass { mod sealed {
fn parent_start(&self) -> Result<(), gst::ErrorMessage>; pub trait Sealed {}
impl<T: super::BaseParseImplExt> Sealed for T {}
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_set_sink_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>;
fn parent_handle_frame(
&self,
frame: BaseParseFrame,
) -> Result<(gst::FlowSuccess, u32), gst::FlowError>;
fn parent_convert(
&self,
src_val: impl gst::format::FormattedValue,
dest_format: gst::Format,
) -> Option<gst::GenericFormattedValue>;
} }
impl<T: BaseParseImpl> BaseParseImplExt for T { pub trait BaseParseImplExt: sealed::Sealed + ObjectSubclass {
fn parent_start(&self) -> Result<(), gst::ErrorMessage> { fn parent_start(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -180,6 +166,8 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
} }
} }
impl<T: BaseParseImpl> BaseParseImplExt for T {}
unsafe impl<T: BaseParseImpl> IsSubclassable<T> for BaseParse { unsafe impl<T: BaseParseImpl> IsSubclassable<T> for BaseParse {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -68,46 +68,12 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
} }
} }
pub trait BaseSinkImplExt: ObjectSubclass { mod sealed {
fn parent_start(&self) -> Result<(), gst::ErrorMessage>; pub trait Sealed {}
impl<T: super::BaseSinkImplExt> Sealed for T {}
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_render(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_prepare(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_render_list(
&self,
list: &gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_prepare_list(
&self,
list: &gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_event(&self, event: gst::Event) -> bool;
fn parent_caps(&self, filter: Option<&gst::Caps>) -> Option<gst::Caps>;
fn parent_set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>;
fn parent_fixate(&self, caps: gst::Caps) -> gst::Caps;
fn parent_unlock(&self) -> Result<(), gst::ErrorMessage>;
fn parent_unlock_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_propose_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
} }
impl<T: BaseSinkImpl> BaseSinkImplExt for T { pub trait BaseSinkImplExt: sealed::Sealed + ObjectSubclass {
fn parent_start(&self) -> Result<(), gst::ErrorMessage> { fn parent_start(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -183,50 +149,12 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
fn parent_render_list( fn parent_render_list(
&self, &self,
list: &gst::BufferList, list: &gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError>;
unsafe {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass;
(*parent_class)
.render_list
.map(|f| {
try_from_glib(f(
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
list.to_glib_none().0,
))
})
.unwrap_or_else(|| {
for buffer in list.iter() {
self.render(&from_glib_borrow(buffer.as_ptr()))?;
}
Ok(gst::FlowSuccess::Ok)
})
}
}
fn parent_prepare_list( fn parent_prepare_list(
&self, &self,
list: &gst::BufferList, list: &gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError>;
unsafe {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass;
(*parent_class)
.prepare_list
.map(|f| {
try_from_glib(f(
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
list.to_glib_none().0,
))
})
.unwrap_or_else(|| {
for buffer in list.iter() {
self.prepare(&from_glib_borrow(buffer.as_ptr()))?;
}
Ok(gst::FlowSuccess::Ok)
})
}
}
fn parent_query(&self, query: &mut gst::QueryRef) -> bool { fn parent_query(&self, query: &mut gst::QueryRef) -> bool {
unsafe { unsafe {
@ -376,6 +304,56 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
} }
} }
impl<T: BaseSinkImpl> BaseSinkImplExt for T {
fn parent_render_list(
&self,
list: &gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass;
(*parent_class)
.render_list
.map(|f| {
try_from_glib(f(
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
list.to_glib_none().0,
))
})
.unwrap_or_else(|| {
for buffer in list.iter() {
self.render(&from_glib_borrow(buffer.as_ptr()))?;
}
Ok(gst::FlowSuccess::Ok)
})
}
}
fn parent_prepare_list(
&self,
list: &gst::BufferList,
) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSinkClass;
(*parent_class)
.prepare_list
.map(|f| {
try_from_glib(f(
self.obj().unsafe_cast_ref::<BaseSink>().to_glib_none().0,
list.to_glib_none().0,
))
})
.unwrap_or_else(|| {
for buffer in list.iter() {
self.prepare(&from_glib_borrow(buffer.as_ptr()))?;
}
Ok(gst::FlowSuccess::Ok)
})
}
}
}
unsafe impl<T: BaseSinkImpl> IsSubclassable<T> for BaseSink { unsafe impl<T: BaseSinkImpl> IsSubclassable<T> for BaseSink {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -108,61 +108,12 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
} }
} }
pub trait BaseSrcImplExt: ObjectSubclass { mod sealed {
fn parent_start(&self) -> Result<(), gst::ErrorMessage>; pub trait Sealed {}
impl<T: super::BaseSrcImplExt> Sealed for T {}
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_is_seekable(&self) -> bool;
fn parent_size(&self) -> Option<u64>;
fn parent_times(
&self,
buffer: &gst::BufferRef,
) -> (Option<gst::ClockTime>, Option<gst::ClockTime>);
fn parent_fill(
&self,
offset: u64,
length: u32,
buffer: &mut gst::BufferRef,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_alloc(&self, offset: u64, length: u32) -> Result<gst::Buffer, gst::FlowError>;
fn parent_create(
&self,
offset: u64,
buffer: Option<&mut gst::BufferRef>,
length: u32,
) -> Result<CreateSuccess, gst::FlowError>;
fn parent_do_seek(&self, segment: &mut gst::Segment) -> bool;
fn parent_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_event(&self, event: &gst::Event) -> bool;
fn parent_caps(&self, filter: Option<&gst::Caps>) -> Option<gst::Caps>;
fn parent_negotiate(&self) -> Result<(), gst::LoggableError>;
fn parent_set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>;
fn parent_fixate(&self, caps: gst::Caps) -> gst::Caps;
fn parent_unlock(&self) -> Result<(), gst::ErrorMessage>;
fn parent_unlock_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
} }
impl<T: BaseSrcImpl> BaseSrcImplExt for T { pub trait BaseSrcImplExt: sealed::Sealed + ObjectSubclass {
fn parent_start(&self) -> Result<(), gst::ErrorMessage> { fn parent_start(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -607,6 +558,8 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
} }
} }
impl<T: BaseSrcImpl> BaseSrcImplExt for T {}
unsafe impl<T: BaseSrcImpl> IsSubclassable<T> for BaseSrc { unsafe impl<T: BaseSrcImpl> IsSubclassable<T> for BaseSrc {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -154,117 +154,12 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
} }
} }
pub trait BaseTransformImplExt: ObjectSubclass { mod sealed {
fn parent_start(&self) -> Result<(), gst::ErrorMessage>; pub trait Sealed {}
impl<T: super::BaseTransformImplExt> Sealed for T {}
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_transform_caps(
&self,
direction: gst::PadDirection,
caps: &gst::Caps,
filter: Option<&gst::Caps>,
) -> Option<gst::Caps>;
fn parent_fixate_caps(
&self,
direction: gst::PadDirection,
caps: &gst::Caps,
othercaps: gst::Caps,
) -> gst::Caps;
fn parent_set_caps(
&self,
incaps: &gst::Caps,
outcaps: &gst::Caps,
) -> Result<(), gst::LoggableError>;
fn parent_accept_caps(&self, direction: gst::PadDirection, caps: &gst::Caps) -> bool;
fn parent_query(&self, direction: gst::PadDirection, query: &mut gst::QueryRef) -> bool;
fn parent_transform_size(
&self,
direction: gst::PadDirection,
caps: &gst::Caps,
size: usize,
othercaps: &gst::Caps,
) -> Option<usize>;
fn parent_unit_size(&self, caps: &gst::Caps) -> Option<usize>;
fn parent_sink_event(&self, event: gst::Event) -> bool;
fn parent_src_event(&self, event: gst::Event) -> bool;
fn parent_prepare_output_buffer(
&self,
inbuf: InputBuffer,
) -> Result<PrepareOutputBufferSuccess, gst::FlowError>;
fn parent_transform(
&self,
inbuf: &gst::Buffer,
outbuf: &mut gst::BufferRef,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_transform_ip(
&self,
buf: &mut gst::BufferRef,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_transform_ip_passthrough(
&self,
buf: &gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_propose_allocation(
&self,
decide_query: Option<&gst::query::Allocation>,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
fn parent_copy_metadata(
&self,
inbuf: &gst::BufferRef,
outbuf: &mut gst::BufferRef,
) -> Result<(), gst::LoggableError>;
fn parent_transform_meta<'a>(
&self,
outbuf: &mut gst::BufferRef,
meta: gst::MetaRef<'a, gst::Meta>,
inbuf: &'a gst::BufferRef,
) -> bool;
fn parent_before_transform(&self, inbuf: &gst::BufferRef);
fn parent_submit_input_buffer(
&self,
is_discont: bool,
inbuf: gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_generate_output(&self) -> Result<GenerateOutputSuccess, gst::FlowError>;
fn take_queued_buffer(&self) -> Option<gst::Buffer>
where
Self: ObjectSubclass,
<Self as ObjectSubclass>::ParentType: IsA<BaseTransform>;
#[doc(alias = "get_queued_buffer")]
fn queued_buffer(&self) -> Option<gst::Buffer>
where
Self: ObjectSubclass,
<Self as ObjectSubclass>::ParentType: IsA<BaseTransform>;
} }
impl<T: BaseTransformImpl> BaseTransformImplExt for T { pub trait BaseTransformImplExt: sealed::Sealed + ObjectSubclass {
fn parent_start(&self) -> Result<(), gst::ErrorMessage> { fn parent_start(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -887,6 +782,8 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
} }
} }
impl<T: BaseTransformImpl> BaseTransformImplExt for T {}
unsafe impl<T: BaseTransformImpl> IsSubclassable<T> for BaseTransform { unsafe impl<T: BaseTransformImpl> IsSubclassable<T> for BaseTransform {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -22,18 +22,12 @@ pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl {
} }
} }
pub trait PushSrcImplExt: ObjectSubclass { mod sealed {
fn parent_fill(&self, buffer: &mut gst::BufferRef) -> Result<gst::FlowSuccess, gst::FlowError>; pub trait Sealed {}
impl<T: super::PushSrcImplExt> Sealed for T {}
fn parent_alloc(&self) -> Result<gst::Buffer, gst::FlowError>;
fn parent_create(
&self,
buffer: Option<&mut gst::BufferRef>,
) -> Result<CreateSuccess, gst::FlowError>;
} }
impl<T: PushSrcImpl> PushSrcImplExt for T { pub trait PushSrcImplExt: sealed::Sealed + ObjectSubclass {
fn parent_fill(&self, buffer: &mut gst::BufferRef) -> Result<gst::FlowSuccess, gst::FlowError> { fn parent_fill(&self, buffer: &mut gst::BufferRef) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -186,6 +180,8 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
} }
} }
impl<T: PushSrcImpl> PushSrcImplExt for T {}
unsafe impl<T: PushSrcImpl> IsSubclassable<T> for PushSrc { unsafe impl<T: PushSrcImpl> IsSubclassable<T> for PushSrc {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -1,22 +1,13 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use crate::prelude::*; use crate::{prelude::*, Formatter};
use gst::glib::translate::*; use gst::glib::translate::*;
pub trait FormatterExtManual: 'static { mod sealed {
fn can_load_uri(&self, uri: &str) -> Result<(), glib::Error>; pub trait Sealed {}
#[doc(alias = "ges_formatter_class_register_metas")] impl<T: super::IsA<super::Formatter>> Sealed for T {}
fn register(
type_: glib::types::Type,
name: &str,
description: Option<&str>,
extensions: Option<&str>,
caps: Option<&str>,
version: f64,
rank: gst::Rank,
);
} }
impl<O: IsA<crate::Formatter>> FormatterExtManual for O { pub trait FormatterExtManual: sealed::Sealed + IsA<Formatter> + 'static {
fn can_load_uri(&self, uri: &str) -> Result<(), glib::Error> { fn can_load_uri(&self, uri: &str) -> Result<(), glib::Error> {
unsafe { unsafe {
let klass = self.class_of::<crate::Formatter>().unwrap(); let klass = self.class_of::<crate::Formatter>().unwrap();
@ -71,3 +62,5 @@ impl<O: IsA<crate::Formatter>> FormatterExtManual for O {
} }
} }
} }
impl<O: IsA<Formatter>> FormatterExtManual for O {}

View file

@ -23,24 +23,12 @@ pub trait FormatterImpl: FormatterImplExt + ObjectImpl + Send + Sync {
} }
} }
pub trait FormatterImplExt: ObjectSubclass { mod sealed {
fn parent_can_load_uri(&self, uri: &str) -> Result<(), glib::Error>; pub trait Sealed {}
impl<T: super::FormatterImplExt> Sealed for T {}
fn parent_load_from_uri(
&self,
timeline: &crate::Timeline,
uri: &str,
) -> Result<(), glib::Error>;
fn parent_save_to_uri(
&self,
timeline: &crate::Timeline,
uri: &str,
overwrite: bool,
) -> Result<(), glib::Error>;
} }
impl<T: FormatterImpl> FormatterImplExt for T { pub trait FormatterImplExt: sealed::Sealed + ObjectSubclass {
fn parent_can_load_uri(&self, uri: &str) -> Result<(), glib::Error> { fn parent_can_load_uri(&self, uri: &str) -> Result<(), glib::Error> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -161,6 +149,8 @@ impl<T: FormatterImpl> FormatterImplExt for T {
} }
} }
impl<T: FormatterImpl> FormatterImplExt for T {}
unsafe impl<T: FormatterImpl> IsSubclassable<T> for Formatter { unsafe impl<T: FormatterImpl> IsSubclassable<T> for Formatter {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -45,21 +45,20 @@ impl GLContext {
} }
} }
pub trait GLContextExtManual: 'static { mod sealed {
#[doc(alias = "get_gl_context")] pub trait Sealed {}
#[doc(alias = "gst_gl_context_get_gl_context")] impl<T: super::IsA<super::GLContext>> Sealed for T {}
fn gl_context(&self) -> uintptr_t;
#[doc(alias = "get_proc_address")]
#[doc(alias = "gst_gl_context_get_proc_address")]
fn proc_address(&self, name: &str) -> uintptr_t;
} }
impl<O: IsA<GLContext>> GLContextExtManual for O { pub trait GLContextExtManual: sealed::Sealed + IsA<GLContext> + 'static {
#[doc(alias = "get_gl_context")]
#[doc(alias = "gst_gl_context_get_gl_context")]
fn gl_context(&self) -> uintptr_t { fn gl_context(&self) -> uintptr_t {
unsafe { ffi::gst_gl_context_get_gl_context(self.as_ref().to_glib_none().0) as uintptr_t } unsafe { ffi::gst_gl_context_get_gl_context(self.as_ref().to_glib_none().0) as uintptr_t }
} }
#[doc(alias = "get_proc_address")]
#[doc(alias = "gst_gl_context_get_proc_address")]
fn proc_address(&self, name: &str) -> uintptr_t { fn proc_address(&self, name: &str) -> uintptr_t {
unsafe { unsafe {
ffi::gst_gl_context_get_proc_address( ffi::gst_gl_context_get_proc_address(
@ -69,3 +68,5 @@ impl<O: IsA<GLContext>> GLContextExtManual for O {
} }
} }
} }
impl<O: IsA<GLContext>> GLContextExtManual for O {}

View file

@ -3,20 +3,15 @@ use crate::{GLContext, GLDisplay};
use glib::prelude::*; use glib::prelude::*;
use glib::translate::*; use glib::translate::*;
pub trait GLDisplayExtManual: 'static { mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::GLDisplay>> Sealed for T {}
}
pub trait GLDisplayExtManual: sealed::Sealed + IsA<GLDisplay> + 'static {
#[cfg(feature = "v1_24")] #[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_gl_display_ensure_context")] #[doc(alias = "gst_gl_display_ensure_context")]
fn ensure_context(
&self,
other_context: Option<&impl IsA<GLContext>>,
context: &mut Option<GLContext>,
) -> Result<(), glib::Error>;
}
impl<O: IsA<GLDisplay>> GLDisplayExtManual for O {
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
fn ensure_context( fn ensure_context(
&self, &self,
other_context: Option<&impl IsA<GLContext>>, other_context: Option<&impl IsA<GLContext>>,
@ -43,6 +38,8 @@ impl<O: IsA<GLDisplay>> GLDisplayExtManual for O {
} }
} }
impl<O: IsA<GLDisplay>> GLDisplayExtManual for O {}
impl GLDisplay { impl GLDisplay {
#[doc(alias = "gst_gl_display_get_gl_context_for_thread")] #[doc(alias = "gst_gl_display_get_gl_context_for_thread")]
pub fn get_gl_context_for_current_thread( pub fn get_gl_context_for_current_thread(

View file

@ -19,15 +19,12 @@ pub trait GLBaseFilterImpl: GLBaseFilterImplExt + BaseTransformImpl {
} }
} }
pub trait GLBaseFilterImplExt: ObjectSubclass { mod sealed {
fn parent_gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError>; pub trait Sealed {}
impl<T: super::GLBaseFilterImplExt> Sealed for T {}
fn parent_gl_start(&self) -> Result<(), LoggableError>;
fn parent_gl_stop(&self);
} }
impl<T: GLBaseFilterImpl> GLBaseFilterImplExt for T { pub trait GLBaseFilterImplExt: sealed::Sealed + ObjectSubclass {
fn parent_gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> { fn parent_gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -91,6 +88,8 @@ impl<T: GLBaseFilterImpl> GLBaseFilterImplExt for T {
} }
} }
impl<T: GLBaseFilterImpl> GLBaseFilterImplExt for T {}
unsafe impl<T: GLBaseFilterImpl> IsSubclassable<T> for GLBaseFilter { unsafe impl<T: GLBaseFilterImpl> IsSubclassable<T> for GLBaseFilter {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -21,15 +21,12 @@ pub trait GLBaseSrcImpl: GLBaseSrcImplExt + PushSrcImpl {
} }
} }
pub trait GLBaseSrcImplExt: ObjectSubclass { mod sealed {
fn parent_gl_start(&self) -> Result<(), LoggableError>; pub trait Sealed {}
impl<T: super::GLBaseSrcImplExt> Sealed for T {}
fn parent_gl_stop(&self);
fn parent_fill_gl_memory(&self, memory: &GLMemory) -> Result<(), LoggableError>;
} }
impl<T: GLBaseSrcImpl> GLBaseSrcImplExt for T { pub trait GLBaseSrcImplExt: sealed::Sealed + ObjectSubclass {
fn parent_gl_start(&self) -> Result<(), LoggableError> { fn parent_gl_start(&self) -> Result<(), LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -81,6 +78,8 @@ impl<T: GLBaseSrcImpl> GLBaseSrcImplExt for T {
} }
} }
impl<T: GLBaseSrcImpl> GLBaseSrcImplExt for T {}
unsafe impl<T: GLBaseSrcImpl> IsSubclassable<T> for GLBaseSrc { unsafe impl<T: GLBaseSrcImpl> IsSubclassable<T> for GLBaseSrc {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -46,28 +46,12 @@ pub trait GLFilterImpl: GLFilterImplExt + GLBaseFilterImpl {
} }
} }
pub trait GLFilterImplExt: ObjectSubclass { mod sealed {
fn parent_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError>; pub trait Sealed {}
impl<T: super::GLFilterImplExt> Sealed for T {}
fn parent_filter(&self, input: &Buffer, output: &Buffer) -> Result<(), LoggableError>;
fn parent_filter_texture(
&self,
input: &GLMemory,
output: &GLMemory,
) -> Result<(), LoggableError>;
fn parent_init_fbo(&self) -> Result<(), LoggableError>;
fn parent_transform_internal_caps(
&self,
direction: PadDirection,
caps: &Caps,
filter_caps: Option<&Caps>,
) -> Option<Caps>;
} }
impl<T: GLFilterImpl> GLFilterImplExt for T { pub trait GLFilterImplExt: sealed::Sealed + ObjectSubclass {
fn parent_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> { fn parent_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -179,6 +163,8 @@ impl<T: GLFilterImpl> GLFilterImplExt for T {
} }
} }
impl<T: GLFilterImpl> GLFilterImplExt for T {}
unsafe impl<T: GLFilterImpl> IsSubclassable<T> for GLFilter { unsafe impl<T: GLFilterImpl> IsSubclassable<T> for GLFilter {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -5,22 +5,16 @@ use gst::prelude::*;
use crate::{auto::AudioVisualizer, subclass::AudioVisualizerSetupToken}; use crate::{auto::AudioVisualizer, subclass::AudioVisualizerSetupToken};
pub trait AudioVisualizerExtManual: 'static { mod sealed {
// rustdoc-stripper-ignore-next pub trait Sealed {}
/// Returns the number of samples per frame required before calling the render method impl<T: super::IsA<super::AudioVisualizer>> Sealed for T {}
fn req_spf(&self) -> u32;
// rustdoc-stripper-ignore-next
/// Modify the request of samples per frame required to be present in buffer before calling
/// the render method
fn set_req_spf(&self, spf: u32, token: &AudioVisualizerSetupToken);
fn audio_info(&self) -> gst_audio::AudioInfo;
fn video_info(&self) -> gst_video::VideoInfo;
} }
impl<O: IsA<AudioVisualizer> + ElementExt> AudioVisualizerExtManual for O { pub trait AudioVisualizerExtManual:
sealed::Sealed + IsA<AudioVisualizer> + IsA<gst::Element> + 'static
{
// rustdoc-stripper-ignore-next
/// Returns the number of samples per frame required before calling the render method
fn req_spf(&self) -> u32 { fn req_spf(&self) -> u32 {
let sinkpad = self.static_pad("sink").expect("sink pad presence"); let sinkpad = self.static_pad("sink").expect("sink pad presence");
let _stream_lock = sinkpad.stream_lock(); let _stream_lock = sinkpad.stream_lock();
@ -29,6 +23,9 @@ impl<O: IsA<AudioVisualizer> + ElementExt> AudioVisualizerExtManual for O {
unsafe { (*ptr).req_spf } unsafe { (*ptr).req_spf }
} }
// rustdoc-stripper-ignore-next
/// Modify the request of samples per frame required to be present in buffer before calling
/// the render method
fn set_req_spf(&self, spf: u32, token: &AudioVisualizerSetupToken) { fn set_req_spf(&self, spf: u32, token: &AudioVisualizerSetupToken) {
assert_eq!( assert_eq!(
self.as_ptr() as *mut ffi::GstAudioVisualizer, self.as_ptr() as *mut ffi::GstAudioVisualizer,
@ -70,3 +67,5 @@ impl<O: IsA<AudioVisualizer> + ElementExt> AudioVisualizerExtManual for O {
} }
} }
} }
impl<O: IsA<AudioVisualizer> + IsA<gst::Element>> AudioVisualizerExtManual for O {}

View file

@ -31,12 +31,14 @@ impl Iterator for Iter {
impl std::iter::FusedIterator for Iter {} impl std::iter::FusedIterator for Iter {}
pub trait DiscovererStreamInfoExtManual: 'static { mod sealed {
fn next_iter(&self) -> Iter; pub trait Sealed {}
fn previous_iter(&self) -> Iter; impl<T: super::IsA<super::DiscovererStreamInfo>> Sealed for T {}
} }
impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExtManual for O { pub trait DiscovererStreamInfoExtManual:
sealed::Sealed + IsA<DiscovererStreamInfo> + 'static
{
fn next_iter(&self) -> Iter { fn next_iter(&self) -> Iter {
Iter { Iter {
stream_info: self.next(), stream_info: self.next(),
@ -52,6 +54,8 @@ impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExtManual for O {
} }
} }
impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExtManual for O {}
pub struct Debug<'a>(&'a DiscovererStreamInfo); pub struct Debug<'a>(&'a DiscovererStreamInfo);
impl<'a> fmt::Debug for Debug<'a> { impl<'a> fmt::Debug for Debug<'a> {

View file

@ -8,17 +8,16 @@ use crate::auto::{
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
use crate::ElementProperties; use crate::ElementProperties;
pub trait EncodingProfileExtManual { mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::EncodingProfile>> Sealed for T {}
}
pub trait EncodingProfileExtManual: sealed::Sealed + IsA<EncodingProfile> + 'static {
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_encoding_profile_get_element_properties")] #[doc(alias = "gst_encoding_profile_get_element_properties")]
#[doc(alias = "get_element_properties")] #[doc(alias = "get_element_properties")]
fn element_properties(&self) -> Option<ElementProperties>;
}
impl<O: IsA<EncodingProfile>> EncodingProfileExtManual for O {
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
fn element_properties(&self) -> Option<ElementProperties> { fn element_properties(&self) -> Option<ElementProperties> {
unsafe { unsafe {
from_glib_full::<_, Option<_>>(ffi::gst_encoding_profile_get_element_properties( from_glib_full::<_, Option<_>>(ffi::gst_encoding_profile_get_element_properties(
@ -29,6 +28,8 @@ impl<O: IsA<EncodingProfile>> EncodingProfileExtManual for O {
} }
} }
impl<O: IsA<EncodingProfile>> EncodingProfileExtManual for O {}
trait EncodingProfileBuilderCommon { trait EncodingProfileBuilderCommon {
fn set_allow_dynamic_output(&self, allow_dynamic_output: bool); fn set_allow_dynamic_output(&self, allow_dynamic_output: bool);

View file

@ -28,22 +28,12 @@ pub trait AudioVisualizerImpl: AudioVisualizerImplExt + ElementImpl {
} }
} }
pub trait AudioVisualizerImplExt: ObjectSubclass { mod sealed {
fn parent_setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError>; pub trait Sealed {}
impl<T: super::AudioVisualizerImplExt> Sealed for T {}
fn parent_render(
&self,
audio_buffer: &gst::BufferRef,
video_frame: &mut gst_video::VideoFrameRef<&mut gst::BufferRef>,
) -> Result<(), LoggableError>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
} }
impl<T: AudioVisualizerImpl> AudioVisualizerImplExt for T { pub trait AudioVisualizerImplExt: sealed::Sealed + ObjectSubclass {
fn parent_setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> { fn parent_setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> {
assert_eq!( assert_eq!(
self.obj().as_ptr() as *mut ffi::GstAudioVisualizer, self.obj().as_ptr() as *mut ffi::GstAudioVisualizer,
@ -125,6 +115,8 @@ impl<T: AudioVisualizerImpl> AudioVisualizerImplExt for T {
} }
} }
impl<T: AudioVisualizerImpl> AudioVisualizerImplExt for T {}
unsafe impl<T: AudioVisualizerImpl> IsSubclassable<T> for AudioVisualizer { unsafe impl<T: AudioVisualizerImpl> IsSubclassable<T> for AudioVisualizer {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -16,11 +16,12 @@ unsafe impl<T: PlayVideoRendererImpl> IsImplementable<T> for PlayVideoRenderer {
} }
} }
pub trait PlayVideoRendererImplExt: ObjectSubclass { mod sealed {
fn parent_create_video_sink(&self, play: &Play) -> gst::Element; pub trait Sealed {}
impl<T: super::PlayVideoRendererImplExt> Sealed for T {}
} }
impl<T: PlayVideoRendererImpl> PlayVideoRendererImplExt for T { pub trait PlayVideoRendererImplExt: sealed::Sealed + ObjectSubclass {
fn parent_create_video_sink(&self, play: &Play) -> gst::Element { fn parent_create_video_sink(&self, play: &Play) -> gst::Element {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
@ -42,6 +43,8 @@ impl<T: PlayVideoRendererImpl> PlayVideoRendererImplExt for T {
} }
} }
impl<T: PlayVideoRendererImpl> PlayVideoRendererImplExt for T {}
unsafe extern "C" fn video_renderer_create_video_sink<T: PlayVideoRendererImpl>( unsafe extern "C" fn video_renderer_create_video_sink<T: PlayVideoRendererImpl>(
video_renderer: *mut ffi::GstPlayVideoRenderer, video_renderer: *mut ffi::GstPlayVideoRenderer,
play: *mut ffi::GstPlay, play: *mut ffi::GstPlay,

View file

@ -16,11 +16,12 @@ unsafe impl<T: PlayerVideoRendererImpl> IsImplementable<T> for PlayerVideoRender
} }
} }
pub trait PlayerVideoRendererImplExt: ObjectSubclass { mod sealed {
fn parent_create_video_sink(&self, player: &Player) -> gst::Element; pub trait Sealed {}
impl<T: super::PlayerVideoRendererImplExt> Sealed for T {}
} }
impl<T: PlayerVideoRendererImpl> PlayerVideoRendererImplExt for T { pub trait PlayerVideoRendererImplExt: sealed::Sealed + ObjectSubclass {
fn parent_create_video_sink(&self, player: &Player) -> gst::Element { fn parent_create_video_sink(&self, player: &Player) -> gst::Element {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
@ -42,6 +43,8 @@ impl<T: PlayerVideoRendererImpl> PlayerVideoRendererImplExt for T {
} }
} }
impl<T: PlayerVideoRendererImpl> PlayerVideoRendererImplExt for T {}
unsafe extern "C" fn video_renderer_create_video_sink<T: PlayerVideoRendererImpl>( unsafe extern "C" fn video_renderer_create_video_sink<T: PlayerVideoRendererImpl>(
video_renderer: *mut ffi::GstPlayerVideoRenderer, video_renderer: *mut ffi::GstPlayerVideoRenderer,
player: *mut ffi::GstPlayer, player: *mut ffi::GstPlayer,

View file

@ -2,13 +2,12 @@ use glib::object::IsA;
use crate::RTPBaseDepayload; use crate::RTPBaseDepayload;
pub trait RTPBaseDepayloadExtManual: 'static { mod sealed {
fn sink_pad(&self) -> &gst::Pad; pub trait Sealed {}
impl<T: super::IsA<super::RTPBaseDepayload>> Sealed for T {}
fn src_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExtManual for O { pub trait RTPBaseDepayloadExtManual: sealed::Sealed + IsA<RTPBaseDepayload> + 'static {
fn sink_pad(&self) -> &gst::Pad { fn sink_pad(&self) -> &gst::Pad {
unsafe { unsafe {
let elt = &*(self.as_ptr() as *const ffi::GstRTPBaseDepayload); let elt = &*(self.as_ptr() as *const ffi::GstRTPBaseDepayload);
@ -23,3 +22,5 @@ impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExtManual for O {
} }
} }
} }
impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExtManual for O {}

View file

@ -4,21 +4,16 @@ use glib::{object::IsA, translate::*};
use crate::RTPBasePayload; use crate::RTPBasePayload;
pub trait RTPBasePayloadExtManual: 'static { mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::RTPBasePayload>> Sealed for T {}
}
pub trait RTPBasePayloadExtManual: sealed::Sealed + IsA<RTPBasePayload> + 'static {
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
#[doc(alias = "gst_rtp_base_payload_set_outcaps_structure")] #[doc(alias = "gst_rtp_base_payload_set_outcaps_structure")]
#[doc(alias = "gst_rtp_base_payload_set_outcaps")] #[doc(alias = "gst_rtp_base_payload_set_outcaps")]
fn set_outcaps(&self, s: Option<&gst::StructureRef>) -> Result<(), glib::error::BoolError>;
fn sink_pad(&self) -> &gst::Pad;
fn src_pad(&self) -> &gst::Pad;
}
impl<O: IsA<RTPBasePayload>> RTPBasePayloadExtManual for O {
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
fn set_outcaps(&self, s: Option<&gst::StructureRef>) -> Result<(), glib::error::BoolError> { fn set_outcaps(&self, s: Option<&gst::StructureRef>) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib::result_from_gboolean!( glib::result_from_gboolean!(
@ -47,3 +42,5 @@ impl<O: IsA<RTPBasePayload>> RTPBasePayloadExtManual for O {
} }
} }
} }
impl<O: IsA<RTPBasePayload>> RTPBasePayloadExtManual for O {}

View file

@ -2,35 +2,13 @@ use glib::{object::IsA, translate::*};
use crate::{RTPHeaderExtension, RTPHeaderExtensionFlags}; use crate::{RTPHeaderExtension, RTPHeaderExtensionFlags};
pub trait RTPHeaderExtensionExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtp_header_extension_read")] pub trait Sealed {}
fn read( impl<T: super::IsA<super::RTPHeaderExtension>> Sealed for T {}
&self,
read_flags: RTPHeaderExtensionFlags,
data: &[u8],
buffer: &mut gst::BufferRef,
) -> bool;
#[doc(alias = "gst_rtp_header_extension_write")]
fn write(
&self,
input_meta: &gst::Buffer,
write_flags: RTPHeaderExtensionFlags,
output: &mut gst::BufferRef,
data: &mut [u8],
) -> Result<usize, glib::BoolError>;
#[doc(alias = "gst_rtp_header_extension_set_caps_from_attributes")]
fn set_caps_from_attributes(&self, caps: &mut gst::CapsRef) -> bool;
#[doc(alias = "gst_rtp_header_extension_set_caps_from_attributes_helper")]
fn set_caps_from_attributes_helper(&self, caps: &mut gst::CapsRef, attributes: &str) -> bool;
#[doc(alias = "gst_rtp_header_extension_update_non_rtp_src_caps")]
fn update_non_rtp_src_caps(&self, caps: &mut gst::CapsRef) -> bool;
} }
impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O { pub trait RTPHeaderExtensionExtManual: sealed::Sealed + IsA<RTPHeaderExtension> + 'static {
#[doc(alias = "gst_rtp_header_extension_read")]
fn read( fn read(
&self, &self,
read_flags: RTPHeaderExtensionFlags, read_flags: RTPHeaderExtensionFlags,
@ -49,6 +27,7 @@ impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
} }
} }
#[doc(alias = "gst_rtp_header_extension_write")]
fn write( fn write(
&self, &self,
input_meta: &gst::Buffer, input_meta: &gst::Buffer,
@ -75,6 +54,7 @@ impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
} }
} }
#[doc(alias = "gst_rtp_header_extension_set_caps_from_attributes")]
fn set_caps_from_attributes(&self, caps: &mut gst::CapsRef) -> bool { fn set_caps_from_attributes(&self, caps: &mut gst::CapsRef) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtp_header_extension_set_caps_from_attributes( from_glib(ffi::gst_rtp_header_extension_set_caps_from_attributes(
@ -84,6 +64,7 @@ impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
} }
} }
#[doc(alias = "gst_rtp_header_extension_set_caps_from_attributes_helper")]
fn set_caps_from_attributes_helper(&self, caps: &mut gst::CapsRef, attributes: &str) -> bool { fn set_caps_from_attributes_helper(&self, caps: &mut gst::CapsRef, attributes: &str) -> bool {
unsafe { unsafe {
from_glib( from_glib(
@ -96,6 +77,7 @@ impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
} }
} }
#[doc(alias = "gst_rtp_header_extension_update_non_rtp_src_caps")]
fn update_non_rtp_src_caps(&self, caps: &mut gst::CapsRef) -> bool { fn update_non_rtp_src_caps(&self, caps: &mut gst::CapsRef) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtp_header_extension_update_non_rtp_src_caps( from_glib(ffi::gst_rtp_header_extension_update_non_rtp_src_caps(
@ -105,3 +87,5 @@ impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
} }
} }
} }
impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {}

View file

@ -28,20 +28,12 @@ pub trait RTPBaseDepayloadImpl: RTPBaseDepayloadImplExt + ElementImpl {
} }
} }
pub trait RTPBaseDepayloadImplExt: ObjectSubclass { mod sealed {
fn parent_set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>; pub trait Sealed {}
impl<T: super::RTPBaseDepayloadImplExt> Sealed for T {}
fn parent_handle_event(&self, event: gst::Event) -> bool;
fn parent_packet_lost(&self, event: &gst::EventRef) -> bool;
fn parent_process_rtp_packet(
&self,
rtp_buffer: &crate::RTPBuffer<crate::rtp_buffer::Readable>,
) -> Option<gst::Buffer>;
} }
impl<T: RTPBaseDepayloadImpl> RTPBaseDepayloadImplExt for T { pub trait RTPBaseDepayloadImplExt: sealed::Sealed + ObjectSubclass {
fn parent_set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { fn parent_set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -126,6 +118,8 @@ impl<T: RTPBaseDepayloadImpl> RTPBaseDepayloadImplExt for T {
} }
} }
impl<T: RTPBaseDepayloadImpl> RTPBaseDepayloadImplExt for T {}
unsafe impl<T: RTPBaseDepayloadImpl> IsSubclassable<T> for RTPBaseDepayload { unsafe impl<T: RTPBaseDepayloadImpl> IsSubclassable<T> for RTPBaseDepayload {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -31,22 +31,12 @@ pub trait RTPBasePayloadImpl: RTPBasePayloadImplExt + ElementImpl {
} }
} }
pub trait RTPBasePayloadImplExt: ObjectSubclass { mod sealed {
fn parent_caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps; pub trait Sealed {}
impl<T: super::RTPBasePayloadImplExt> Sealed for T {}
fn parent_set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>;
fn parent_handle_buffer(&self, buffer: gst::Buffer)
-> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool;
fn parent_sink_event(&self, event: gst::Event) -> bool;
fn parent_src_event(&self, event: gst::Event) -> bool;
} }
impl<T: RTPBasePayloadImpl> RTPBasePayloadImplExt for T { pub trait RTPBasePayloadImplExt: sealed::Sealed + ObjectSubclass {
fn parent_caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps { fn parent_caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -175,6 +165,8 @@ impl<T: RTPBasePayloadImpl> RTPBasePayloadImplExt for T {
} }
} }
impl<T: RTPBasePayloadImpl> RTPBasePayloadImplExt for T {}
unsafe impl<T: RTPBasePayloadImpl> IsSubclassable<T> for RTPBasePayload { unsafe impl<T: RTPBasePayloadImpl> IsSubclassable<T> for RTPBasePayload {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -55,39 +55,12 @@ pub trait RTPHeaderExtensionImpl: RTPHeaderExtensionImplExt + ElementImpl {
} }
} }
pub trait RTPHeaderExtensionImplExt: ObjectSubclass { mod sealed {
fn parent_supported_flags(&self) -> crate::RTPHeaderExtensionFlags; pub trait Sealed {}
fn parent_max_size(&self, input: &gst::BufferRef) -> usize; impl<T: super::RTPHeaderExtensionImplExt> Sealed for T {}
fn parent_write(
&self,
input: &gst::BufferRef,
write_flags: crate::RTPHeaderExtensionFlags,
output: &mut gst::BufferRef,
output_data: &mut [u8],
) -> Result<usize, gst::LoggableError>;
fn parent_read(
&self,
read_flags: crate::RTPHeaderExtensionFlags,
input_data: &[u8],
output: &mut gst::BufferRef,
) -> Result<(), gst::LoggableError>;
fn parent_set_non_rtp_sink_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError>;
fn parent_update_non_rtp_src_caps(
&self,
caps: &mut gst::CapsRef,
) -> Result<(), gst::LoggableError>;
fn parent_set_attributes(
&self,
direction: crate::RTPHeaderExtensionDirection,
attributes: &str,
) -> Result<(), gst::LoggableError>;
fn parent_set_caps_from_attributes(
&self,
caps: &mut gst::CapsRef,
) -> Result<(), gst::LoggableError>;
} }
impl<T: RTPHeaderExtensionImpl> RTPHeaderExtensionImplExt for T { pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
fn parent_supported_flags(&self) -> crate::RTPHeaderExtensionFlags { fn parent_supported_flags(&self) -> crate::RTPHeaderExtensionFlags {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -287,6 +260,8 @@ impl<T: RTPHeaderExtensionImpl> RTPHeaderExtensionImplExt for T {
} }
} }
impl<T: RTPHeaderExtensionImpl> RTPHeaderExtensionImplExt for T {}
unsafe impl<T: RTPHeaderExtensionImpl> IsSubclassable<T> for crate::RTPHeaderExtension { unsafe impl<T: RTPHeaderExtensionImpl> IsSubclassable<T> for crate::RTPHeaderExtension {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -6,18 +6,13 @@ use glib::{prelude::*, translate::*};
use crate::{RTSPAddress, RTSPAddressPool, RTSPAddressPoolResult}; use crate::{RTSPAddress, RTSPAddressPool, RTSPAddressPoolResult};
pub trait RTSPAddressPoolExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_address_pool_reserve_address")] pub trait Sealed {}
fn reserve_address( impl<T: super::IsA<super::RTSPAddressPool>> Sealed for T {}
&self,
ip_address: &str,
port: u32,
n_ports: u32,
ttl: u32,
) -> Result<RTSPAddress, RTSPAddressPoolResult>;
} }
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O { pub trait RTSPAddressPoolExtManual: sealed::Sealed + IsA<RTSPAddressPool> + 'static {
#[doc(alias = "gst_rtsp_address_pool_reserve_address")]
fn reserve_address( fn reserve_address(
&self, &self,
ip_address: &str, ip_address: &str,
@ -42,3 +37,5 @@ impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExtManual for O {}

View file

@ -10,27 +10,13 @@ use glib::{
use crate::{RTSPAuth, RTSPToken}; use crate::{RTSPAuth, RTSPToken};
pub trait RTSPAuthExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_auth_set_default_token")] pub trait Sealed {}
fn set_default_token(&self, token: Option<&mut RTSPToken>); impl<T: super::IsA<super::RTSPAuth>> Sealed for T {}
fn connect_accept_certificate<
F: Fn(
&Self,
&gio::TlsConnection,
&gio::TlsCertificate,
gio::TlsCertificateFlags,
) -> Result<(), gst::LoggableError>
+ Send
+ Sync
+ 'static,
>(
&self,
f: F,
) -> SignalHandlerId;
} }
impl<O: IsA<RTSPAuth>> RTSPAuthExtManual for O { pub trait RTSPAuthExtManual: sealed::Sealed + IsA<RTSPAuth> + 'static {
#[doc(alias = "gst_rtsp_auth_set_default_token")]
fn set_default_token(&self, mut token: Option<&mut RTSPToken>) { fn set_default_token(&self, mut token: Option<&mut RTSPToken>) {
unsafe { unsafe {
ffi::gst_rtsp_auth_set_default_token( ffi::gst_rtsp_auth_set_default_token(
@ -68,6 +54,8 @@ impl<O: IsA<RTSPAuth>> RTSPAuthExtManual for O {
} }
} }
impl<O: IsA<RTSPAuth>> RTSPAuthExtManual for O {}
unsafe extern "C" fn accept_certificate_trampoline< unsafe extern "C" fn accept_certificate_trampoline<
P, P,
F: Fn( F: Fn(

View file

@ -4,12 +4,13 @@ use glib::{prelude::*, source::SourceId, translate::*};
use crate::RTSPClient; use crate::RTSPClient;
pub trait RTSPClientExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_client_attach")] pub trait Sealed {}
fn attach(&self, context: Option<&glib::MainContext>) -> SourceId; impl<T: super::IsA<super::RTSPClient>> Sealed for T {}
} }
impl<O: IsA<RTSPClient>> RTSPClientExtManual for O { pub trait RTSPClientExtManual: sealed::Sealed + IsA<RTSPClient> + 'static {
#[doc(alias = "gst_rtsp_client_attach")]
fn attach(&self, context: Option<&glib::MainContext>) -> SourceId { fn attach(&self, context: Option<&glib::MainContext>) -> SourceId {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_client_attach( from_glib(ffi::gst_rtsp_client_attach(
@ -19,3 +20,5 @@ impl<O: IsA<RTSPClient>> RTSPClientExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPClient>> RTSPClientExtManual for O {}

View file

@ -4,12 +4,13 @@ use glib::{prelude::*, translate::*};
use crate::RTSPMedia; use crate::RTSPMedia;
pub trait RTSPMediaExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_media_take_pipeline")] pub trait Sealed {}
fn take_pipeline(&self, pipeline: impl IsA<gst::Pipeline>); impl<T: super::IsA<super::RTSPMedia>> Sealed for T {}
} }
impl<O: IsA<RTSPMedia>> RTSPMediaExtManual for O { pub trait RTSPMediaExtManual: sealed::Sealed + IsA<RTSPMedia> + 'static {
#[doc(alias = "gst_rtsp_media_take_pipeline")]
fn take_pipeline(&self, pipeline: impl IsA<gst::Pipeline>) { fn take_pipeline(&self, pipeline: impl IsA<gst::Pipeline>) {
unsafe { unsafe {
let pipeline = pipeline.upcast().into_glib_ptr(); let pipeline = pipeline.upcast().into_glib_ptr();
@ -22,3 +23,5 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPMedia>> RTSPMediaExtManual for O {}

View file

@ -4,12 +4,13 @@ use glib::{prelude::*, translate::*};
use crate::RTSPMediaFactory; use crate::RTSPMediaFactory;
pub trait RTSPMediaFactoryExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_media_factory_add_role_from_structure")] pub trait Sealed {}
fn add_role_from_structure(&self, structure: &gst::StructureRef); impl<T: super::IsA<super::RTSPMediaFactory>> Sealed for T {}
} }
impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExtManual for O { pub trait RTSPMediaFactoryExtManual: sealed::Sealed + IsA<RTSPMediaFactory> + 'static {
#[doc(alias = "gst_rtsp_media_factory_add_role_from_structure")]
fn add_role_from_structure(&self, structure: &gst::StructureRef) { fn add_role_from_structure(&self, structure: &gst::StructureRef) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_add_role_from_structure( ffi::gst_rtsp_media_factory_add_role_from_structure(
@ -19,3 +20,5 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExtManual for O {}

View file

@ -4,12 +4,15 @@ use glib::{prelude::*, translate::*};
use crate::{RTSPContext, RTSPOnvifMediaFactory}; use crate::{RTSPContext, RTSPOnvifMediaFactory};
pub trait RTSPOnvifMediaFactoryExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_onvif_media_factory_requires_backchannel")] pub trait Sealed {}
fn requires_backchannel(&self, ctx: &RTSPContext) -> bool; impl<T: super::IsA<super::RTSPOnvifMediaFactory>> Sealed for T {}
} }
impl<O: IsA<RTSPOnvifMediaFactory>> RTSPOnvifMediaFactoryExtManual for O { pub trait RTSPOnvifMediaFactoryExtManual:
sealed::Sealed + IsA<RTSPOnvifMediaFactory> + 'static
{
#[doc(alias = "gst_rtsp_onvif_media_factory_requires_backchannel")]
fn requires_backchannel(&self, ctx: &RTSPContext) -> bool { fn requires_backchannel(&self, ctx: &RTSPContext) -> bool {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
@ -23,3 +26,5 @@ impl<O: IsA<RTSPOnvifMediaFactory>> RTSPOnvifMediaFactoryExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPOnvifMediaFactory>> RTSPOnvifMediaFactoryExtManual for O {}

View file

@ -4,15 +4,13 @@ use glib::{prelude::*, source::SourceId, translate::*};
use crate::RTSPServer; use crate::RTSPServer;
pub trait RTSPServerExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_server_attach")] pub trait Sealed {}
fn attach( impl<T: super::IsA<super::RTSPServer>> Sealed for T {}
&self,
context: Option<&glib::MainContext>,
) -> Result<SourceId, glib::error::BoolError>;
} }
impl<O: IsA<RTSPServer>> RTSPServerExtManual for O { pub trait RTSPServerExtManual: sealed::Sealed + IsA<RTSPServer> + 'static {
#[doc(alias = "gst_rtsp_server_attach")]
fn attach( fn attach(
&self, &self,
context: Option<&glib::MainContext>, context: Option<&glib::MainContext>,
@ -30,3 +28,5 @@ impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPServer>> RTSPServerExtManual for O {}

View file

@ -6,13 +6,14 @@ use glib::{prelude::*, translate::*};
use crate::{RTSPSession, RTSPSessionMedia}; use crate::{RTSPSession, RTSPSessionMedia};
pub trait RTSPSessionExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_session_dup_media")] pub trait Sealed {}
#[doc(alias = "gst_rtsp_session_get_media")] impl<T: super::IsA<super::RTSPSession>> Sealed for T {}
fn media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32);
} }
impl<O: IsA<RTSPSession>> RTSPSessionExtManual for O { pub trait RTSPSessionExtManual: sealed::Sealed + IsA<super::RTSPSession> + 'static {
#[doc(alias = "gst_rtsp_session_dup_media")]
#[doc(alias = "gst_rtsp_session_get_media")]
fn media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32) { fn media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32) {
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
unsafe { unsafe {
@ -36,3 +37,5 @@ impl<O: IsA<RTSPSession>> RTSPSessionExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPSession>> RTSPSessionExtManual for O {}

View file

@ -33,14 +33,13 @@ fn into_raw_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(func:
Box::into_raw(func) as gpointer Box::into_raw(func) as gpointer
} }
pub trait RTSPSessionPoolExtManual: 'static { mod sealed {
#[doc(alias = "gst_rtsp_session_pool_create_watch")] pub trait Sealed {}
fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source impl<T: super::IsA<super::RTSPSessionPool>> Sealed for T {}
where
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static;
} }
impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O { pub trait RTSPSessionPoolExtManual: sealed::Sealed + IsA<RTSPSessionPool> + 'static {
#[doc(alias = "gst_rtsp_session_pool_create_watch")]
fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source fn create_watch<F>(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source
where where
F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static, F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static,
@ -67,3 +66,5 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {
} }
} }
} }
impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExtManual for O {}

View file

@ -155,102 +155,12 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync {
} }
} }
pub trait RTSPClientImplExt: ObjectSubclass { mod sealed {
fn parent_create_sdp(&self, media: &crate::RTSPMedia) -> Option<gst_sdp::SDPMessage>; pub trait Sealed {}
impl<T: super::RTSPClientImplExt> Sealed for T {}
fn parent_configure_client_media(
&self,
media: &crate::RTSPMedia,
stream: &crate::RTSPStream,
ctx: &crate::RTSPContext,
) -> Result<(), gst::LoggableError>;
// TODO: configure_client_transport
fn parent_params_set(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPResult;
fn parent_params_get(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPResult;
fn parent_make_path_from_uri(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString>;
fn parent_closed(&self);
fn parent_new_session(&self, session: &crate::RTSPSession);
fn parent_options_request(&self, ctx: &crate::RTSPContext);
fn parent_describe_request(&self, ctx: &crate::RTSPContext);
fn parent_setup_request(&self, ctx: &crate::RTSPContext);
fn parent_play_request(&self, ctx: &crate::RTSPContext);
fn parent_pause_request(&self, ctx: &crate::RTSPContext);
fn parent_teardown_request(&self, ctx: &crate::RTSPContext);
fn parent_set_parameter_request(&self, ctx: &crate::RTSPContext);
fn parent_parameter_request(&self, ctx: &crate::RTSPContext);
fn parent_announce_request(&self, ctx: &crate::RTSPContext);
fn parent_record_request(&self, ctx: &crate::RTSPContext);
fn parent_handle_response(&self, ctx: &crate::RTSPContext);
// TODO: tunnel_http_response
// TODO: send_message
fn parent_handle_sdp(
&self,
ctx: &crate::RTSPContext,
media: &crate::RTSPMedia,
sdp: &gst_sdp::SDPMessageRef,
) -> Result<(), gst::LoggableError>;
fn parent_check_requirements(
&self,
ctx: &crate::RTSPContext,
arr: &[String],
) -> Option<glib::GString>;
fn parent_pre_options_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_describe_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_setup_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_play_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_pause_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_teardown_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_set_parameter_request(
&self,
ctx: &crate::RTSPContext,
) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_get_parameter_request(
&self,
ctx: &crate::RTSPContext,
) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_announce_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
fn parent_pre_record_request(&self, ctx: &crate::RTSPContext) -> gst_rtsp::RTSPStatusCode;
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
fn parent_adjust_error_code(
&self,
ctx: &crate::RTSPContext,
status_code: gst_rtsp::RTSPStatusCode,
) -> gst_rtsp::RTSPStatusCode;
} }
impl<T: RTSPClientImpl> RTSPClientImplExt for T { pub trait RTSPClientImplExt: sealed::Sealed + ObjectSubclass {
fn parent_create_sdp(&self, media: &crate::RTSPMedia) -> Option<gst_sdp::SDPMessage> { fn parent_create_sdp(&self, media: &crate::RTSPMedia) -> Option<gst_sdp::SDPMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -732,6 +642,9 @@ impl<T: RTSPClientImpl> RTSPClientImplExt for T {
} }
} }
} }
impl<T: RTSPClientImpl> RTSPClientImplExt for T {}
unsafe impl<T: RTSPClientImpl> IsSubclassable<T> for RTSPClient { unsafe impl<T: RTSPClientImpl> IsSubclassable<T> for RTSPClient {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -98,33 +98,12 @@ pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync {
} }
} }
pub trait RTSPMediaImplExt: ObjectSubclass { mod sealed {
fn parent_handle_message(&self, message: &gst::MessageRef) -> bool; pub trait Sealed {}
fn parent_prepare(&self, thread: &RTSPThread) -> Result<(), gst::LoggableError>; impl<T: super::RTSPMediaImplExt> Sealed for T {}
fn parent_unprepare(&self) -> Result<(), gst::LoggableError>;
fn parent_suspend(&self) -> Result<(), gst::LoggableError>;
fn parent_unsuspend(&self) -> Result<(), gst::LoggableError>;
// TODO missing: convert_range
fn parent_query_position(&self) -> Option<gst::ClockTime>;
fn parent_query_stop(&self) -> Option<gst::ClockTime>;
fn parent_create_rtpbin(&self) -> Option<gst::Element>;
fn parent_setup_rtpbin(&self, rtpbin: &gst::Element) -> Result<(), gst::LoggableError>;
fn parent_setup_sdp(
&self,
sdp: &mut gst_sdp::SDPMessageRef,
info: &SDPInfo,
) -> Result<(), gst::LoggableError>;
fn parent_new_stream(&self, stream: &crate::RTSPStream);
fn parent_removed_stream(&self, stream: &crate::RTSPStream);
fn parent_prepared(&self);
fn parent_unprepared(&self);
fn parent_target_state(&self, state: gst::State);
fn parent_new_state(&self, state: gst::State);
fn parent_handle_sdp(&self, sdp: &gst_sdp::SDPMessageRef) -> Result<(), gst::LoggableError>;
} }
impl<T: RTSPMediaImpl> RTSPMediaImplExt for T { pub trait RTSPMediaImplExt: sealed::Sealed + ObjectSubclass {
fn parent_handle_message(&self, message: &gst::MessageRef) -> bool { fn parent_handle_message(&self, message: &gst::MessageRef) -> bool {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -208,7 +187,6 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
} }
// TODO missing: convert_range // TODO missing: convert_range
fn parent_query_position(&self) -> Option<gst::ClockTime> { fn parent_query_position(&self) -> Option<gst::ClockTime> {
unsafe { unsafe {
use std::mem; use std::mem;
@ -419,6 +397,9 @@ impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {
} }
} }
} }
impl<T: RTSPMediaImpl> RTSPMediaImplExt for T {}
unsafe impl<T: RTSPMediaImpl> IsSubclassable<T> for RTSPMedia { unsafe impl<T: RTSPMediaImpl> IsSubclassable<T> for RTSPMedia {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -36,22 +36,12 @@ pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sy
} }
} }
pub trait RTSPMediaFactoryImplExt: ObjectSubclass { mod sealed {
fn parent_gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString>; pub trait Sealed {}
impl<T: super::RTSPMediaFactoryImplExt> Sealed for T {}
fn parent_create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option<gst::Element>;
fn parent_construct(&self, url: &gst_rtsp::RTSPUrl) -> Option<crate::RTSPMedia>;
fn parent_create_pipeline(&self, media: &crate::RTSPMedia) -> Option<gst::Pipeline>;
fn parent_configure(&self, media: &crate::RTSPMedia);
fn parent_media_constructed(&self, media: &crate::RTSPMedia);
fn parent_media_configure(&self, media: &crate::RTSPMedia);
} }
impl<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T { pub trait RTSPMediaFactoryImplExt: sealed::Sealed + ObjectSubclass {
fn parent_gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> { fn parent_gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -182,6 +172,8 @@ impl<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {
} }
} }
} }
impl<T: RTSPMediaFactoryImpl> RTSPMediaFactoryImplExt for T {}
unsafe impl<T: RTSPMediaFactoryImpl> IsSubclassable<T> for RTSPMediaFactory { unsafe impl<T: RTSPMediaFactoryImpl> IsSubclassable<T> for RTSPMediaFactory {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -11,11 +11,12 @@ pub trait RTSPMountPointsImpl: RTSPMountPointsImplExt + ObjectImpl + Send + Sync
} }
} }
pub trait RTSPMountPointsImplExt: ObjectSubclass { mod sealed {
fn parent_make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString>; pub trait Sealed {}
impl<T: super::RTSPMountPointsImplExt> Sealed for T {}
} }
impl<T: RTSPMountPointsImpl> RTSPMountPointsImplExt for T { pub trait RTSPMountPointsImplExt: sealed::Sealed + ObjectSubclass {
fn parent_make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> { fn parent_make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -34,6 +35,8 @@ impl<T: RTSPMountPointsImpl> RTSPMountPointsImplExt for T {
} }
} }
impl<T: RTSPMountPointsImpl> RTSPMountPointsImplExt for T {}
unsafe impl<T: RTSPMountPointsImpl> IsSubclassable<T> for RTSPMountPoints { unsafe impl<T: RTSPMountPointsImpl> IsSubclassable<T> for RTSPMountPoints {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -13,11 +13,12 @@ pub trait RTSPOnvifMediaFactoryImpl:
} }
} }
pub trait RTSPOnvifMediaFactoryImplExt: ObjectSubclass { mod sealed {
fn parent_has_backchannel_support(&self) -> bool; pub trait Sealed {}
impl<T: super::RTSPOnvifMediaFactoryImplExt> Sealed for T {}
} }
impl<T: RTSPOnvifMediaFactoryImpl> RTSPOnvifMediaFactoryImplExt for T { pub trait RTSPOnvifMediaFactoryImplExt: sealed::Sealed + ObjectSubclass {
fn parent_has_backchannel_support(&self) -> bool { fn parent_has_backchannel_support(&self) -> bool {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -37,6 +38,8 @@ impl<T: RTSPOnvifMediaFactoryImpl> RTSPOnvifMediaFactoryImplExt for T {
} }
} }
impl<T: RTSPOnvifMediaFactoryImpl> RTSPOnvifMediaFactoryImplExt for T {}
unsafe impl<T: RTSPOnvifMediaFactoryImpl> IsSubclassable<T> for RTSPOnvifMediaFactory { unsafe impl<T: RTSPOnvifMediaFactoryImpl> IsSubclassable<T> for RTSPOnvifMediaFactory {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -14,7 +14,12 @@ pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync {
} }
} }
pub trait RTSPServerImplExt: ObjectSubclass { mod sealed {
pub trait Sealed {}
impl<T: super::RTSPServerImplExt> Sealed for T {}
}
pub trait RTSPServerImplExt: sealed::Sealed + ObjectSubclass {
fn parent_create_client(&self) -> Option<crate::RTSPClient>; fn parent_create_client(&self) -> Option<crate::RTSPClient>;
fn parent_client_connected(&self, client: &crate::RTSPClient); fn parent_client_connected(&self, client: &crate::RTSPClient);

View file

@ -16,19 +16,12 @@ pub trait NavigationImpl: ObjectImpl {
} }
} }
pub trait NavigationImplExt: ObjectSubclass { mod sealed {
fn parent_send_event(&self, structure: gst::Structure); pub trait Sealed {}
impl<T: super::NavigationImplExt> Sealed for T {}
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
fn parent_send_event_simple(&self, event: gst::Event) {
if let Some(structure) = event.structure() {
self.parent_send_event(structure.to_owned());
}
}
} }
impl<T: NavigationImpl> NavigationImplExt for T { pub trait NavigationImplExt: sealed::Sealed + ObjectSubclass {
fn parent_send_event(&self, structure: gst::Structure) { fn parent_send_event(&self, structure: gst::Structure) {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
@ -68,6 +61,8 @@ impl<T: NavigationImpl> NavigationImplExt for T {
} }
} }
impl<T: NavigationImpl> NavigationImplExt for T {}
unsafe impl<T: NavigationImpl> IsImplementable<T> for Navigation { unsafe impl<T: NavigationImpl> IsImplementable<T> for Navigation {
#[cfg(not(any(feature = "v1_22", docsrs)))] #[cfg(not(any(feature = "v1_22", docsrs)))]
fn interface_init(iface: &mut glib::Interface<Self>) { fn interface_init(iface: &mut glib::Interface<Self>) {

View file

@ -30,25 +30,12 @@ pub trait VideoAggregatorImpl: VideoAggregatorImplExt + AggregatorImpl {
self.parent_find_best_format(downstream_caps) self.parent_find_best_format(downstream_caps)
} }
} }
mod sealed {
pub trait VideoAggregatorImplExt: ObjectSubclass { pub trait Sealed {}
fn parent_update_caps(&self, caps: &gst::Caps) -> Result<gst::Caps, gst::LoggableError>; impl<T: super::VideoAggregatorImplExt> Sealed for T {}
fn parent_aggregate_frames(
&self,
token: &AggregateFramesToken,
outbuf: &mut gst::BufferRef,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_create_output_buffer(&self) -> Result<Option<gst::Buffer>, gst::FlowError>;
fn parent_find_best_format(
&self,
downstream_caps: &gst::Caps,
) -> Option<(crate::VideoInfo, bool)>;
} }
impl<T: VideoAggregatorImpl> VideoAggregatorImplExt for T { pub trait VideoAggregatorImplExt: sealed::Sealed + ObjectSubclass {
fn parent_update_caps(&self, caps: &gst::Caps) -> Result<gst::Caps, gst::LoggableError> { fn parent_update_caps(&self, caps: &gst::Caps) -> Result<gst::Caps, gst::LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -155,6 +142,8 @@ impl<T: VideoAggregatorImpl> VideoAggregatorImplExt for T {
} }
} }
impl<T: VideoAggregatorImpl> VideoAggregatorImplExt for T {}
unsafe impl<T: VideoAggregatorImpl> IsSubclassable<T> for VideoAggregator { unsafe impl<T: VideoAggregatorImpl> IsSubclassable<T> for VideoAggregator {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -31,25 +31,12 @@ pub trait VideoAggregatorPadImpl: VideoAggregatorPadImplExt + AggregatorPadImpl
} }
} }
pub trait VideoAggregatorPadImplExt: ObjectSubclass { mod sealed {
fn parent_update_conversion_info(&self); pub trait Sealed {}
impl<T: super::VideoAggregatorPadImplExt> Sealed for T {}
fn parent_prepare_frame(
&self,
aggregator: &crate::VideoAggregator,
token: &AggregateFramesToken,
buffer: &gst::Buffer,
) -> Option<crate::VideoFrame<crate::video_frame::Readable>>;
fn parent_clean_frame(
&self,
aggregator: &crate::VideoAggregator,
token: &AggregateFramesToken,
frame: Option<crate::VideoFrame<crate::video_frame::Readable>>,
);
} }
impl<T: VideoAggregatorPadImpl> VideoAggregatorPadImplExt for T { pub trait VideoAggregatorPadImplExt: ObjectSubclass {
fn parent_update_conversion_info(&self) { fn parent_update_conversion_info(&self) {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -137,6 +124,8 @@ impl<T: VideoAggregatorPadImpl> VideoAggregatorPadImplExt for T {
} }
} }
impl<T: VideoAggregatorPadImpl> VideoAggregatorPadImplExt for T {}
unsafe impl<T: VideoAggregatorPadImpl> IsSubclassable<T> for VideoAggregatorPad { unsafe impl<T: VideoAggregatorPadImpl> IsSubclassable<T> for VideoAggregatorPad {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -106,71 +106,11 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl {
self.parent_handle_missing_data(timestamp, duration) self.parent_handle_missing_data(timestamp, duration)
} }
} }
mod sealed {
pub trait VideoDecoderImplExt: ObjectSubclass { pub trait Sealed {}
fn parent_open(&self) -> Result<(), gst::ErrorMessage>; impl<T: super::VideoDecoderImplExt> Sealed for T {}
fn parent_close(&self) -> Result<(), gst::ErrorMessage>;
fn parent_start(&self) -> Result<(), gst::ErrorMessage>;
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_finish(&self) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_drain(&self) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_set_format(
&self,
state: &VideoCodecState<'static, Readable>,
) -> Result<(), gst::LoggableError>;
fn parent_parse(
&self,
frame: &VideoCodecFrame,
adapter: &gst_base::Adapter,
at_eos: bool,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_handle_frame(
&self,
frame: VideoCodecFrame,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_flush(&self) -> bool;
fn parent_negotiate(&self) -> Result<(), gst::LoggableError>;
fn parent_caps(&self, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, event: gst::Event) -> bool;
fn parent_sink_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_src_event(&self, event: gst::Event) -> bool;
fn parent_src_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_propose_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
#[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
fn parent_handle_missing_data(
&self,
timestamp: gst::ClockTime,
duration: Option<gst::ClockTime>,
) -> bool;
} }
pub trait VideoDecoderImplExt: sealed::Sealed + ObjectSubclass {
impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
fn parent_open(&self) -> Result<(), gst::ErrorMessage> { fn parent_open(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -587,6 +527,8 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
} }
} }
impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {}
unsafe impl<T: VideoDecoderImpl> IsSubclassable<T> for VideoDecoder { unsafe impl<T: VideoDecoderImpl> IsSubclassable<T> for VideoDecoder {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -84,53 +84,12 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl {
} }
} }
pub trait VideoEncoderImplExt: ObjectSubclass { mod sealed {
fn parent_open(&self) -> Result<(), gst::ErrorMessage>; pub trait Sealed {}
impl<T: super::VideoEncoderImplExt> Sealed for T {}
fn parent_close(&self) -> Result<(), gst::ErrorMessage>;
fn parent_start(&self) -> Result<(), gst::ErrorMessage>;
fn parent_stop(&self) -> Result<(), gst::ErrorMessage>;
fn parent_finish(&self) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_set_format(
&self,
state: &VideoCodecState<'static, Readable>,
) -> Result<(), gst::LoggableError>;
fn parent_handle_frame(
&self,
frame: VideoCodecFrame,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_flush(&self) -> bool;
fn parent_negotiate(&self) -> Result<(), gst::LoggableError>;
fn parent_caps(&self, filter: Option<&gst::Caps>) -> gst::Caps;
fn parent_sink_event(&self, event: gst::Event) -> bool;
fn parent_sink_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_src_event(&self, event: gst::Event) -> bool;
fn parent_src_query(&self, query: &mut gst::QueryRef) -> bool;
fn parent_propose_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
fn parent_decide_allocation(
&self,
query: &mut gst::query::Allocation,
) -> Result<(), gst::LoggableError>;
} }
impl<T: VideoEncoderImpl> VideoEncoderImplExt for T { pub trait VideoEncoderImplExt: sealed::Sealed + ObjectSubclass {
fn parent_open(&self) -> Result<(), gst::ErrorMessage> { fn parent_open(&self) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -478,6 +437,8 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
} }
} }
impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {}
unsafe impl<T: VideoEncoderImpl> IsSubclassable<T> for VideoEncoder { unsafe impl<T: VideoEncoderImpl> IsSubclassable<T> for VideoEncoder {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -39,33 +39,12 @@ pub trait VideoFilterImpl: VideoFilterImplExt + BaseTransformImpl {
} }
} }
pub trait VideoFilterImplExt: ObjectSubclass { mod sealed {
fn parent_set_info( pub trait Sealed {}
&self, impl<T: super::VideoFilterImplExt> Sealed for T {}
incaps: &gst::Caps,
in_info: &VideoInfo,
outcaps: &gst::Caps,
out_info: &VideoInfo,
) -> Result<(), gst::LoggableError>;
fn parent_transform_frame(
&self,
inframe: &VideoFrameRef<&gst::BufferRef>,
outframe: &mut VideoFrameRef<&mut gst::BufferRef>,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_transform_frame_ip(
&self,
frame: &mut VideoFrameRef<&mut gst::BufferRef>,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn parent_transform_frame_ip_passthrough(
&self,
frame: &VideoFrameRef<&gst::BufferRef>,
) -> Result<gst::FlowSuccess, gst::FlowError>;
} }
impl<T: VideoFilterImpl> VideoFilterImplExt for T { pub trait VideoFilterImplExt: sealed::Sealed + ObjectSubclass {
fn parent_set_info( fn parent_set_info(
&self, &self,
incaps: &gst::Caps, incaps: &gst::Caps,
@ -192,6 +171,8 @@ impl<T: VideoFilterImpl> VideoFilterImplExt for T {
} }
} }
impl<T: VideoFilterImpl> VideoFilterImplExt for T {}
unsafe impl<T: VideoFilterImpl> IsSubclassable<T> for VideoFilter { unsafe impl<T: VideoFilterImpl> IsSubclassable<T> for VideoFilter {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
use gst_base::subclass::base_transform::BaseTransformMode; use gst_base::subclass::base_transform::BaseTransformMode;

View file

@ -11,11 +11,12 @@ pub trait VideoSinkImpl: VideoSinkImplExt + BaseSinkImpl + ElementImpl {
} }
} }
pub trait VideoSinkImplExt: ObjectSubclass { mod sealed {
fn parent_show_frame(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError>; pub trait Sealed {}
impl<T: super::VideoSinkImplExt> Sealed for T {}
} }
impl<T: VideoSinkImpl> VideoSinkImplExt for T { pub trait VideoSinkImplExt: sealed::Sealed + ObjectSubclass {
fn parent_show_frame(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { fn parent_show_frame(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -33,6 +34,8 @@ impl<T: VideoSinkImpl> VideoSinkImplExt for T {
} }
} }
impl<T: VideoSinkImpl> VideoSinkImplExt for T {}
unsafe impl<T: VideoSinkImpl> IsSubclassable<T> for VideoSink { unsafe impl<T: VideoSinkImpl> IsSubclassable<T> for VideoSink {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -3,11 +3,12 @@ use gst::prelude::*;
use crate::auto::VideoAggregator; use crate::auto::VideoAggregator;
pub trait VideoAggregatorExtManual: 'static { mod sealed {
fn video_info(&self) -> Option<crate::VideoInfo>; pub trait Sealed {}
impl<T: super::IsA<super::VideoAggregator>> Sealed for T {}
} }
impl<O: IsA<VideoAggregator>> VideoAggregatorExtManual for O { pub trait VideoAggregatorExtManual: sealed::Sealed + IsA<VideoAggregator> + 'static {
fn video_info(&self) -> Option<crate::VideoInfo> { fn video_info(&self) -> Option<crate::VideoInfo> {
unsafe { unsafe {
let ptr = self.as_ptr() as *mut ffi::GstVideoAggregator; let ptr = self.as_ptr() as *mut ffi::GstVideoAggregator;
@ -25,3 +26,5 @@ impl<O: IsA<VideoAggregator>> VideoAggregatorExtManual for O {
} }
} }
} }
impl<O: IsA<VideoAggregator>> VideoAggregatorExtManual for O {}

View file

@ -9,26 +9,21 @@ use glib::{
use crate::auto::VideoAggregatorConvertPad; use crate::auto::VideoAggregatorConvertPad;
pub trait VideoAggregatorConvertPadExtManual: 'static { mod sealed {
#[doc(alias = "converter-config")] pub trait Sealed {}
fn converter_config(&self) -> Option<crate::VideoConverterConfig>; impl<T: super::IsA<super::VideoAggregatorConvertPad>> Sealed for T {}
#[doc(alias = "converter-config")]
fn set_converter_config(&self, converter_config: Option<&crate::VideoConverterConfig>);
#[doc(alias = "converter-config")]
fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
} }
impl<O: IsA<VideoAggregatorConvertPad>> VideoAggregatorConvertPadExtManual for O { pub trait VideoAggregatorConvertPadExtManual:
sealed::Sealed + IsA<VideoAggregatorConvertPad> + 'static
{
#[doc(alias = "converter-config")]
fn converter_config(&self) -> Option<crate::VideoConverterConfig> { fn converter_config(&self) -> Option<crate::VideoConverterConfig> {
glib::ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config") glib::ObjectExt::property::<Option<gst::Structure>>(self.as_ref(), "converter-config")
.map(|c| c.try_into().unwrap()) .map(|c| c.try_into().unwrap())
} }
#[doc(alias = "converter-config")]
fn set_converter_config(&self, converter_config: Option<&crate::VideoConverterConfig>) { fn set_converter_config(&self, converter_config: Option<&crate::VideoConverterConfig>) {
glib::ObjectExt::set_property( glib::ObjectExt::set_property(
self.as_ref(), self.as_ref(),
@ -37,6 +32,7 @@ impl<O: IsA<VideoAggregatorConvertPad>> VideoAggregatorConvertPadExtManual for O
) )
} }
#[doc(alias = "converter-config")]
fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>( fn connect_converter_config_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self, &self,
f: F, f: F,
@ -65,3 +61,5 @@ impl<O: IsA<VideoAggregatorConvertPad>> VideoAggregatorConvertPadExtManual for O
} }
} }
} }
impl<O: IsA<VideoAggregatorConvertPad>> VideoAggregatorConvertPadExtManual for O {}

View file

@ -3,23 +3,13 @@ use gst::prelude::*;
use crate::{auto::VideoAggregatorPad, subclass::AggregateFramesToken}; use crate::{auto::VideoAggregatorPad, subclass::AggregateFramesToken};
pub trait VideoAggregatorPadExtManual: 'static { mod sealed {
#[doc(alias = "gst_video_aggregator_pad_has_current_buffer")] pub trait Sealed {}
fn has_current_buffer(&self, token: &AggregateFramesToken) -> bool; impl<T: super::IsA<super::VideoAggregatorPad>> Sealed for T {}
#[doc(alias = "gst_video_aggregator_pad_get_current_buffer")]
fn current_buffer(&self, token: &AggregateFramesToken) -> Option<gst::Buffer>;
#[doc(alias = "gst_video_aggregator_pad_get_prepared_frame")]
fn prepared_frame<'a>(
&self,
token: &'a AggregateFramesToken,
) -> Option<crate::VideoFrameRef<&'a gst::BufferRef>>;
fn video_info(&self) -> Option<crate::VideoInfo>;
} }
impl<O: IsA<VideoAggregatorPad>> VideoAggregatorPadExtManual for O { pub trait VideoAggregatorPadExtManual: sealed::Sealed + IsA<VideoAggregatorPad> + 'static {
#[doc(alias = "gst_video_aggregator_pad_has_current_buffer")]
fn has_current_buffer(&self, _token: &AggregateFramesToken) -> bool { fn has_current_buffer(&self, _token: &AggregateFramesToken) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_video_aggregator_pad_has_current_buffer( from_glib(ffi::gst_video_aggregator_pad_has_current_buffer(
@ -28,6 +18,7 @@ impl<O: IsA<VideoAggregatorPad>> VideoAggregatorPadExtManual for O {
} }
} }
#[doc(alias = "gst_video_aggregator_pad_get_current_buffer")]
fn current_buffer(&self, _token: &AggregateFramesToken) -> Option<gst::Buffer> { fn current_buffer(&self, _token: &AggregateFramesToken) -> Option<gst::Buffer> {
unsafe { unsafe {
from_glib_none(ffi::gst_video_aggregator_pad_get_current_buffer( from_glib_none(ffi::gst_video_aggregator_pad_get_current_buffer(
@ -36,6 +27,7 @@ impl<O: IsA<VideoAggregatorPad>> VideoAggregatorPadExtManual for O {
} }
} }
#[doc(alias = "gst_video_aggregator_pad_get_prepared_frame")]
fn prepared_frame<'a>( fn prepared_frame<'a>(
&self, &self,
_token: &'a AggregateFramesToken, _token: &'a AggregateFramesToken,
@ -69,3 +61,5 @@ impl<O: IsA<VideoAggregatorPad>> VideoAggregatorPadExtManual for O {
} }
} }
} }
impl<O: IsA<VideoAggregatorPad>> VideoAggregatorPadExtManual for O {}

View file

@ -27,75 +27,12 @@ extern "C" {
) -> gst::ffi::GstFlowReturn; ) -> gst::ffi::GstFlowReturn;
} }
pub trait VideoDecoderExtManual: 'static { mod sealed {
#[doc(alias = "gst_video_decoder_allocate_output_frame")] pub trait Sealed {}
fn allocate_output_frame( impl<T: super::IsA<super::VideoDecoder>> Sealed for T {}
&self,
frame: &mut VideoCodecFrame,
params: Option<&gst::BufferPoolAcquireParams>,
) -> Result<gst::FlowSuccess, gst::FlowError>;
#[doc(alias = "get_frame")]
fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame>;
#[doc(alias = "get_frames")]
fn frames(&self) -> Vec<VideoCodecFrame>;
#[doc(alias = "get_oldest_frame")]
fn oldest_frame(&self) -> Option<VideoCodecFrame>;
#[doc(alias = "get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
#[doc(alias = "get_latency")]
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>);
fn set_latency(
&self,
min_latency: gst::ClockTime,
max_latency: impl Into<Option<gst::ClockTime>>,
);
#[doc(alias = "get_output_state")]
fn output_state(&self) -> Option<VideoCodecState<'static, Readable>>;
fn set_output_state(
&self,
fmt: VideoFormat,
width: u32,
height: u32,
reference: Option<&VideoCodecState<Readable>>,
) -> Result<VideoCodecState<InNegotiation>, gst::FlowError>;
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
fn set_interlaced_output_state(
&self,
fmt: VideoFormat,
mode: VideoInterlaceMode,
width: u32,
height: u32,
reference: Option<&VideoCodecState<Readable>>,
) -> Result<VideoCodecState<InNegotiation>, gst::FlowError>;
fn negotiate<'a>(
&'a self,
output_state: VideoCodecState<'a, InNegotiation<'a>>,
) -> Result<(), gst::FlowError>;
#[allow(clippy::too_many_arguments)]
fn error<T: gst::MessageErrorDomain>(
&self,
weight: i32,
code: T,
message: Option<&str>,
debug: Option<&str>,
file: &str,
function: &str,
line: u32,
) -> Result<gst::FlowSuccess, gst::FlowError>;
fn sink_pad(&self) -> &gst::Pad;
fn src_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O { pub trait VideoDecoderExtManual: sealed::Sealed + IsA<VideoDecoder> + 'static {
#[doc(alias = "gst_video_decoder_allocate_output_frame")] #[doc(alias = "gst_video_decoder_allocate_output_frame")]
fn allocate_output_frame( fn allocate_output_frame(
&self, &self,
@ -112,6 +49,55 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
} }
} }
#[doc(alias = "get_frame")]
#[doc(alias = "gst_video_decoder_get_frame")]
fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame> {
let frame = unsafe {
ffi::gst_video_decoder_get_frame(self.as_ref().to_glib_none().0, frame_number)
};
if frame.is_null() {
None
} else {
unsafe { Some(VideoCodecFrame::new(frame, self.as_ref())) }
}
}
#[doc(alias = "get_frames")]
#[doc(alias = "gst_video_decoder_get_frames")]
fn frames(&self) -> Vec<VideoCodecFrame> {
unsafe {
let frames = ffi::gst_video_decoder_get_frames(self.as_ref().to_glib_none().0);
let mut iter: *const glib::ffi::GList = frames;
let mut vec = Vec::new();
while !iter.is_null() {
let frame_ptr = Ptr::from((*iter).data);
/* transfer ownership of the frame */
let frame = VideoCodecFrame::new(frame_ptr, self.as_ref());
vec.push(frame);
iter = (*iter).next;
}
glib::ffi::g_list_free(frames);
vec
}
}
#[doc(alias = "get_oldest_frame")]
#[doc(alias = "gst_video_decoder_get_oldest_frame")]
fn oldest_frame(&self) -> Option<VideoCodecFrame> {
let frame =
unsafe { ffi::gst_video_decoder_get_oldest_frame(self.as_ref().to_glib_none().0) };
if frame.is_null() {
None
} else {
unsafe { Some(VideoCodecFrame::new(frame, self.as_ref())) }
}
}
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_video_decoder_get_allocator")] #[doc(alias = "gst_video_decoder_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) { fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
unsafe { unsafe {
@ -125,7 +111,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
(from_glib_full(allocator), params.assume_init().into()) (from_glib_full(allocator), params.assume_init().into())
} }
} }
#[doc(alias = "get_latency")]
#[doc(alias = "gst_video_decoder_get_latency")] #[doc(alias = "gst_video_decoder_get_latency")]
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>) { fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>) {
let mut min_latency = gst::ffi::GST_CLOCK_TIME_NONE; let mut min_latency = gst::ffi::GST_CLOCK_TIME_NONE;
@ -160,51 +146,7 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
} }
} }
#[doc(alias = "gst_video_decoder_get_frame")] #[doc(alias = "get_output_state")]
fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame> {
let frame = unsafe {
ffi::gst_video_decoder_get_frame(self.as_ref().to_glib_none().0, frame_number)
};
if frame.is_null() {
None
} else {
unsafe { Some(VideoCodecFrame::new(frame, self.as_ref())) }
}
}
#[doc(alias = "gst_video_decoder_get_frames")]
fn frames(&self) -> Vec<VideoCodecFrame> {
unsafe {
let frames = ffi::gst_video_decoder_get_frames(self.as_ref().to_glib_none().0);
let mut iter: *const glib::ffi::GList = frames;
let mut vec = Vec::new();
while !iter.is_null() {
let frame_ptr = Ptr::from((*iter).data);
/* transfer ownership of the frame */
let frame = VideoCodecFrame::new(frame_ptr, self.as_ref());
vec.push(frame);
iter = (*iter).next;
}
glib::ffi::g_list_free(frames);
vec
}
}
#[doc(alias = "gst_video_decoder_get_oldest_frame")]
fn oldest_frame(&self) -> Option<VideoCodecFrame> {
let frame =
unsafe { ffi::gst_video_decoder_get_oldest_frame(self.as_ref().to_glib_none().0) };
if frame.is_null() {
None
} else {
unsafe { Some(VideoCodecFrame::new(frame, self.as_ref())) }
}
}
#[doc(alias = "gst_video_decoder_get_output_state")] #[doc(alias = "gst_video_decoder_get_output_state")]
fn output_state(&self) -> Option<VideoCodecState<'static, Readable>> { fn output_state(&self) -> Option<VideoCodecState<'static, Readable>> {
let state = let state =
@ -299,6 +241,8 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
Err(gst::FlowError::NotNegotiated) Err(gst::FlowError::NotNegotiated)
} }
} }
#[allow(clippy::too_many_arguments)]
fn error<T: gst::MessageErrorDomain>( fn error<T: gst::MessageErrorDomain>(
&self, &self,
weight: i32, weight: i32,
@ -339,6 +283,8 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
} }
} }
impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {}
impl HasStreamLock for VideoDecoder { impl HasStreamLock for VideoDecoder {
fn stream_lock(&self) -> *mut glib::ffi::GRecMutex { fn stream_lock(&self) -> *mut glib::ffi::GRecMutex {
let decoder_sys: *const ffi::GstVideoDecoder = self.to_glib_none().0; let decoder_sys: *const ffi::GstVideoDecoder = self.to_glib_none().0;

View file

@ -9,69 +9,13 @@ use crate::{
video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext}, video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext},
VideoCodecFrame, VideoEncoder, VideoCodecFrame, VideoEncoder,
}; };
mod sealed {
pub trait VideoEncoderExtManual: 'static { pub trait Sealed {}
#[doc(alias = "gst_video_encoder_allocate_output_frame")] impl<T: super::IsA<super::VideoEncoder>> Sealed for T {}
fn allocate_output_frame(
&self,
frame: &mut VideoCodecFrame,
size: usize,
) -> Result<gst::FlowSuccess, gst::FlowError>;
#[doc(alias = "get_frame")]
#[doc(alias = "gst_video_encoder_get_frame")]
fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame>;
#[doc(alias = "get_frames")]
#[doc(alias = "gst_video_encoder_get_frames")]
fn frames(&self) -> Vec<VideoCodecFrame>;
#[doc(alias = "get_oldest_frame")]
#[doc(alias = "gst_video_encoder_get_oldest_frame")]
fn oldest_frame(&self) -> Option<VideoCodecFrame>;
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_video_encoder_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_video_encoder_finish_subframe")]
fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
#[doc(alias = "get_latency")]
#[doc(alias = "gst_video_encoder_get_latency")]
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>);
#[doc(alias = "gst_video_encoder_set_latency")]
fn set_latency(
&self,
min_latency: gst::ClockTime,
max_latency: impl Into<Option<gst::ClockTime>>,
);
#[doc(alias = "get_output_state")]
#[doc(alias = "gst_video_encoder_get_output_state")]
fn output_state(&self) -> Option<VideoCodecState<'static, Readable>>;
#[doc(alias = "gst_video_encoder_set_output_state")]
fn set_output_state(
&self,
caps: gst::Caps,
reference: Option<&VideoCodecState<Readable>>,
) -> Result<VideoCodecState<InNegotiation>, gst::FlowError>;
#[doc(alias = "gst_video_encoder_negotiate")]
fn negotiate<'a>(
&'a self,
output_state: VideoCodecState<'a, InNegotiation<'a>>,
) -> Result<(), gst::FlowError>;
#[doc(alias = "gst_video_encoder_set_headers")]
fn set_headers(&self, headers: impl IntoIterator<Item = gst::Buffer>);
fn sink_pad(&self) -> &gst::Pad;
fn src_pad(&self) -> &gst::Pad;
} }
impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O { pub trait VideoEncoderExtManual: sealed::Sealed + IsA<VideoEncoder> + 'static {
#[doc(alias = "gst_video_encoder_allocate_output_frame")]
fn allocate_output_frame( fn allocate_output_frame(
&self, &self,
frame: &mut VideoCodecFrame, frame: &mut VideoCodecFrame,
@ -86,62 +30,8 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) { #[doc(alias = "get_frame")]
unsafe { #[doc(alias = "gst_video_encoder_get_frame")]
let mut allocator = ptr::null_mut();
let mut params = mem::MaybeUninit::uninit();
ffi::gst_video_encoder_get_allocator(
self.as_ref().to_glib_none().0,
&mut allocator,
params.as_mut_ptr(),
);
(from_glib_full(allocator), params.assume_init().into())
}
}
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
try_from_glib(ffi::gst_video_encoder_finish_subframe(
self.as_ref().to_glib_none().0,
frame.to_glib_none().0,
))
}
}
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>) {
let mut min_latency = gst::ffi::GST_CLOCK_TIME_NONE;
let mut max_latency = gst::ffi::GST_CLOCK_TIME_NONE;
unsafe {
ffi::gst_video_encoder_get_latency(
self.as_ref().to_glib_none().0,
&mut min_latency,
&mut max_latency,
);
(
try_from_glib(min_latency).expect("undefined min_latency"),
from_glib(max_latency),
)
}
}
fn set_latency(
&self,
min_latency: gst::ClockTime,
max_latency: impl Into<Option<gst::ClockTime>>,
) {
unsafe {
ffi::gst_video_encoder_set_latency(
self.as_ref().to_glib_none().0,
min_latency.into_glib(),
max_latency.into().into_glib(),
);
}
}
fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame> { fn frame(&self, frame_number: i32) -> Option<VideoCodecFrame> {
let frame = unsafe { let frame = unsafe {
ffi::gst_video_encoder_get_frame(self.as_ref().to_glib_none().0, frame_number) ffi::gst_video_encoder_get_frame(self.as_ref().to_glib_none().0, frame_number)
@ -154,6 +44,8 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
#[doc(alias = "get_frames")]
#[doc(alias = "gst_video_encoder_get_frames")]
fn frames(&self) -> Vec<VideoCodecFrame> { fn frames(&self) -> Vec<VideoCodecFrame> {
unsafe { unsafe {
let frames = ffi::gst_video_encoder_get_frames(self.as_ref().to_glib_none().0); let frames = ffi::gst_video_encoder_get_frames(self.as_ref().to_glib_none().0);
@ -173,6 +65,8 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
#[doc(alias = "get_oldest_frame")]
#[doc(alias = "gst_video_encoder_get_oldest_frame")]
fn oldest_frame(&self) -> Option<VideoCodecFrame> { fn oldest_frame(&self) -> Option<VideoCodecFrame> {
let frame = let frame =
unsafe { ffi::gst_video_encoder_get_oldest_frame(self.as_ref().to_glib_none().0) }; unsafe { ffi::gst_video_encoder_get_oldest_frame(self.as_ref().to_glib_none().0) };
@ -184,6 +78,69 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
#[doc(alias = "get_allocator")]
#[doc(alias = "gst_video_encoder_get_allocator")]
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams) {
unsafe {
let mut allocator = ptr::null_mut();
let mut params = mem::MaybeUninit::uninit();
ffi::gst_video_encoder_get_allocator(
self.as_ref().to_glib_none().0,
&mut allocator,
params.as_mut_ptr(),
);
(from_glib_full(allocator), params.assume_init().into())
}
}
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_video_encoder_finish_subframe")]
fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
try_from_glib(ffi::gst_video_encoder_finish_subframe(
self.as_ref().to_glib_none().0,
frame.to_glib_none().0,
))
}
}
#[doc(alias = "get_latency")]
#[doc(alias = "gst_video_encoder_get_latency")]
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>) {
let mut min_latency = gst::ffi::GST_CLOCK_TIME_NONE;
let mut max_latency = gst::ffi::GST_CLOCK_TIME_NONE;
unsafe {
ffi::gst_video_encoder_get_latency(
self.as_ref().to_glib_none().0,
&mut min_latency,
&mut max_latency,
);
(
try_from_glib(min_latency).expect("undefined min_latency"),
from_glib(max_latency),
)
}
}
#[doc(alias = "gst_video_encoder_set_latency")]
fn set_latency(
&self,
min_latency: gst::ClockTime,
max_latency: impl Into<Option<gst::ClockTime>>,
) {
unsafe {
ffi::gst_video_encoder_set_latency(
self.as_ref().to_glib_none().0,
min_latency.into_glib(),
max_latency.into().into_glib(),
);
}
}
#[doc(alias = "get_output_state")]
#[doc(alias = "gst_video_encoder_get_output_state")]
fn output_state(&self) -> Option<VideoCodecState<'static, Readable>> { fn output_state(&self) -> Option<VideoCodecState<'static, Readable>> {
let state = let state =
unsafe { ffi::gst_video_encoder_get_output_state(self.as_ref().to_glib_none().0) }; unsafe { ffi::gst_video_encoder_get_output_state(self.as_ref().to_glib_none().0) };
@ -195,6 +152,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
#[doc(alias = "gst_video_encoder_set_output_state")]
fn set_output_state( fn set_output_state(
&self, &self,
caps: gst::Caps, caps: gst::Caps,
@ -219,6 +177,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
#[doc(alias = "gst_video_encoder_negotiate")]
fn negotiate<'a>( fn negotiate<'a>(
&'a self, &'a self,
output_state: VideoCodecState<'a, InNegotiation<'a>>, output_state: VideoCodecState<'a, InNegotiation<'a>>,
@ -239,6 +198,7 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
#[doc(alias = "gst_video_encoder_set_headers")]
fn set_headers(&self, headers: impl IntoIterator<Item = gst::Buffer>) { fn set_headers(&self, headers: impl IntoIterator<Item = gst::Buffer>) {
unsafe { unsafe {
ffi::gst_video_encoder_set_headers( ffi::gst_video_encoder_set_headers(
@ -266,6 +226,8 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
} }
} }
impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {}
impl HasStreamLock for VideoEncoder { impl HasStreamLock for VideoEncoder {
fn stream_lock(&self) -> *mut glib::ffi::GRecMutex { fn stream_lock(&self) -> *mut glib::ffi::GRecMutex {
let encoder_sys: *const ffi::GstVideoEncoder = self.to_glib_none().0; let encoder_sys: *const ffi::GstVideoEncoder = self.to_glib_none().0;

View file

@ -5,12 +5,12 @@ use libc::uintptr_t;
use crate::VideoOverlay; use crate::VideoOverlay;
pub trait VideoOverlayExtManual: 'static { mod sealed {
unsafe fn set_window_handle(&self, handle: uintptr_t); pub trait Sealed {}
unsafe fn got_window_handle(&self, handle: uintptr_t); impl<T: super::IsA<super::VideoOverlay>> Sealed for T {}
} }
impl<O: IsA<VideoOverlay>> VideoOverlayExtManual for O { pub trait VideoOverlayExtManual: sealed::Sealed + IsA<VideoOverlay> + 'static {
unsafe fn set_window_handle(&self, handle: uintptr_t) { unsafe fn set_window_handle(&self, handle: uintptr_t) {
ffi::gst_video_overlay_set_window_handle(self.as_ref().to_glib_none().0, handle) ffi::gst_video_overlay_set_window_handle(self.as_ref().to_glib_none().0, handle)
} }
@ -20,6 +20,8 @@ impl<O: IsA<VideoOverlay>> VideoOverlayExtManual for O {
} }
} }
impl<O: IsA<VideoOverlay>> VideoOverlayExtManual for O {}
#[doc(alias = "gst_is_video_overlay_prepare_window_handle_message")] #[doc(alias = "gst_is_video_overlay_prepare_window_handle_message")]
pub fn is_video_overlay_prepare_window_handle_message(msg: &gst::MessageRef) -> bool { pub fn is_video_overlay_prepare_window_handle_message(msg: &gst::MessageRef) -> bool {
skip_assert_initialized!(); skip_assert_initialized!();

View file

@ -4,22 +4,13 @@ use glib::{prelude::*, translate::*};
use crate::{WebRTCICE, WebRTCICEStream}; use crate::{WebRTCICE, WebRTCICEStream};
pub trait WebRTCICEExtManual: 'static { mod sealed {
#[doc(alias = "gst_webrtc_ice_add_candidate")] pub trait Sealed {}
fn add_candidate(&self, stream: &impl IsA<WebRTCICEStream>, candidate: &str); impl<T: super::IsA<super::WebRTCICE>> Sealed for T {}
#[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_webrtc_ice_add_candidate")]
fn add_candidate_full(
&self,
stream: &impl IsA<WebRTCICEStream>,
candidate: &str,
promise: Option<&gst::Promise>,
);
} }
impl<O: IsA<WebRTCICE>> WebRTCICEExtManual for O { pub trait WebRTCICEExtManual: sealed::Sealed + IsA<WebRTCICE> + 'static {
#[doc(alias = "gst_webrtc_ice_add_candidate")]
fn add_candidate(&self, stream: &impl IsA<WebRTCICEStream>, candidate: &str) { fn add_candidate(&self, stream: &impl IsA<WebRTCICEStream>, candidate: &str) {
#[cfg(not(feature = "v1_24"))] #[cfg(not(feature = "v1_24"))]
unsafe { unsafe {
@ -61,6 +52,7 @@ impl<O: IsA<WebRTCICE>> WebRTCICEExtManual for O {
#[cfg(feature = "v1_24")] #[cfg(feature = "v1_24")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
#[doc(alias = "gst_webrtc_ice_add_candidate")]
fn add_candidate_full( fn add_candidate_full(
&self, &self,
stream: &impl IsA<WebRTCICEStream>, stream: &impl IsA<WebRTCICEStream>,
@ -77,3 +69,5 @@ impl<O: IsA<WebRTCICE>> WebRTCICEExtManual for O {
} }
} }
} }
impl<O: IsA<WebRTCICE>> WebRTCICEExtManual for O {}

View file

@ -42,70 +42,13 @@ impl Bin {
} }
} }
pub trait GstBinExtManual: 'static { mod sealed {
#[doc(alias = "gst_bin_add_many")] pub trait Sealed {}
fn add_many( impl<T: super::IsA<super::Bin>> Sealed for T {}
&self,
elements: impl IntoIterator<Item = impl AsRef<Element>>,
) -> Result<(), glib::BoolError>;
#[doc(alias = "gst_bin_remove_many")]
fn remove_many(
&self,
elements: impl IntoIterator<Item = impl AsRef<Element>>,
) -> Result<(), glib::BoolError>;
#[doc(alias = "do-latency")]
fn connect_do_latency<F: Fn(&Self) -> Result<(), LoggableError> + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_bin_iterate_all_by_element_factory_name")]
fn iterate_all_by_element_factory_name(&self, factory_name: &str) -> crate::Iterator<Element>;
#[doc(alias = "gst_bin_iterate_all_by_interface")]
fn iterate_all_by_interface(&self, iface: glib::types::Type) -> crate::Iterator<Element>;
#[doc(alias = "gst_bin_iterate_elements")]
fn iterate_elements(&self) -> crate::Iterator<Element>;
#[doc(alias = "gst_bin_iterate_recurse")]
fn iterate_recurse(&self) -> crate::Iterator<Element>;
#[doc(alias = "gst_bin_iterate_sinks")]
fn iterate_sinks(&self) -> crate::Iterator<Element>;
#[doc(alias = "gst_bin_iterate_sorted")]
fn iterate_sorted(&self) -> crate::Iterator<Element>;
#[doc(alias = "gst_bin_iterate_sources")]
fn iterate_sources(&self) -> crate::Iterator<Element>;
#[doc(alias = "get_children")]
fn children(&self) -> Vec<Element>;
#[doc(alias = "gst_debug_bin_to_dot_data")]
fn debug_to_dot_data(&self, details: crate::DebugGraphDetails) -> GString;
#[doc(alias = "GST_DEBUG_BIN_TO_DOT_FILE")]
#[doc(alias = "gst_debug_bin_to_dot_file")]
fn debug_to_dot_file(
&self,
details: crate::DebugGraphDetails,
file_name: impl AsRef<path::Path>,
);
#[doc(alias = "GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS")]
#[doc(alias = "gst_debug_bin_to_dot_file_with_ts")]
fn debug_to_dot_file_with_ts(
&self,
details: crate::DebugGraphDetails,
file_name: impl AsRef<path::Path>,
);
fn set_bin_flags(&self, flags: BinFlags);
fn unset_bin_flags(&self, flags: BinFlags);
#[doc(alias = "get_bin_flags")]
fn bin_flags(&self) -> BinFlags;
} }
impl<O: IsA<Bin>> GstBinExtManual for O { pub trait GstBinExtManual: sealed::Sealed + IsA<Bin> + 'static {
#[doc(alias = "gst_bin_add_many")]
fn add_many( fn add_many(
&self, &self,
elements: impl IntoIterator<Item = impl AsRef<Element>>, elements: impl IntoIterator<Item = impl AsRef<Element>>,
@ -122,6 +65,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
Ok(()) Ok(())
} }
#[doc(alias = "gst_bin_remove_many")]
fn remove_many( fn remove_many(
&self, &self,
elements: impl IntoIterator<Item = impl AsRef<Element>>, elements: impl IntoIterator<Item = impl AsRef<Element>>,
@ -141,6 +85,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
Ok(()) Ok(())
} }
#[doc(alias = "do-latency")]
fn connect_do_latency<F: Fn(&Self) -> Result<(), LoggableError> + Send + Sync + 'static>( fn connect_do_latency<F: Fn(&Self) -> Result<(), LoggableError> + Send + Sync + 'static>(
&self, &self,
f: F, f: F,
@ -160,6 +105,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_bin_iterate_all_by_element_factory_name")]
fn iterate_all_by_element_factory_name(&self, factory_name: &str) -> crate::Iterator<Element> { fn iterate_all_by_element_factory_name(&self, factory_name: &str) -> crate::Iterator<Element> {
unsafe { unsafe {
from_glib_full(ffi::gst_bin_iterate_all_by_element_factory_name( from_glib_full(ffi::gst_bin_iterate_all_by_element_factory_name(
@ -168,7 +114,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
)) ))
} }
} }
#[doc(alias = "gst_bin_iterate_all_by_interface")]
fn iterate_all_by_interface(&self, iface: glib::types::Type) -> crate::Iterator<Element> { fn iterate_all_by_interface(&self, iface: glib::types::Type) -> crate::Iterator<Element> {
unsafe { unsafe {
from_glib_full(ffi::gst_bin_iterate_all_by_interface( from_glib_full(ffi::gst_bin_iterate_all_by_interface(
@ -178,6 +124,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
} }
} }
#[doc(alias = "gst_bin_iterate_elements")]
fn iterate_elements(&self) -> crate::Iterator<Element> { fn iterate_elements(&self) -> crate::Iterator<Element> {
unsafe { unsafe {
from_glib_full(ffi::gst_bin_iterate_elements( from_glib_full(ffi::gst_bin_iterate_elements(
@ -186,22 +133,27 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
} }
} }
#[doc(alias = "gst_bin_iterate_recurse")]
fn iterate_recurse(&self) -> crate::Iterator<Element> { fn iterate_recurse(&self) -> crate::Iterator<Element> {
unsafe { from_glib_full(ffi::gst_bin_iterate_recurse(self.as_ref().to_glib_none().0)) } unsafe { from_glib_full(ffi::gst_bin_iterate_recurse(self.as_ref().to_glib_none().0)) }
} }
#[doc(alias = "gst_bin_iterate_sinks")]
fn iterate_sinks(&self) -> crate::Iterator<Element> { fn iterate_sinks(&self) -> crate::Iterator<Element> {
unsafe { from_glib_full(ffi::gst_bin_iterate_sinks(self.as_ref().to_glib_none().0)) } unsafe { from_glib_full(ffi::gst_bin_iterate_sinks(self.as_ref().to_glib_none().0)) }
} }
#[doc(alias = "gst_bin_iterate_sorted")]
fn iterate_sorted(&self) -> crate::Iterator<Element> { fn iterate_sorted(&self) -> crate::Iterator<Element> {
unsafe { from_glib_full(ffi::gst_bin_iterate_sorted(self.as_ref().to_glib_none().0)) } unsafe { from_glib_full(ffi::gst_bin_iterate_sorted(self.as_ref().to_glib_none().0)) }
} }
#[doc(alias = "gst_bin_iterate_sources")]
fn iterate_sources(&self) -> crate::Iterator<Element> { fn iterate_sources(&self) -> crate::Iterator<Element> {
unsafe { from_glib_full(ffi::gst_bin_iterate_sources(self.as_ref().to_glib_none().0)) } unsafe { from_glib_full(ffi::gst_bin_iterate_sources(self.as_ref().to_glib_none().0)) }
} }
#[doc(alias = "get_children")]
fn children(&self) -> Vec<Element> { fn children(&self) -> Vec<Element> {
unsafe { unsafe {
let bin: &ffi::GstBin = &*(self.as_ptr() as *const _); let bin: &ffi::GstBin = &*(self.as_ptr() as *const _);
@ -210,10 +162,13 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
} }
} }
#[doc(alias = "gst_debug_bin_to_dot_data")]
fn debug_to_dot_data(&self, details: crate::DebugGraphDetails) -> GString { fn debug_to_dot_data(&self, details: crate::DebugGraphDetails) -> GString {
crate::debug_bin_to_dot_data(self, details) crate::debug_bin_to_dot_data(self, details)
} }
#[doc(alias = "GST_DEBUG_BIN_TO_DOT_FILE")]
#[doc(alias = "gst_debug_bin_to_dot_file")]
fn debug_to_dot_file( fn debug_to_dot_file(
&self, &self,
details: crate::DebugGraphDetails, details: crate::DebugGraphDetails,
@ -222,6 +177,8 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
crate::debug_bin_to_dot_file(self, details, file_name) crate::debug_bin_to_dot_file(self, details, file_name)
} }
#[doc(alias = "GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS")]
#[doc(alias = "gst_debug_bin_to_dot_file_with_ts")]
fn debug_to_dot_file_with_ts( fn debug_to_dot_file_with_ts(
&self, &self,
details: crate::DebugGraphDetails, details: crate::DebugGraphDetails,
@ -246,6 +203,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
} }
} }
#[doc(alias = "get_bin_flags")]
fn bin_flags(&self) -> BinFlags { fn bin_flags(&self) -> BinFlags {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
@ -255,6 +213,8 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
} }
} }
impl<O: IsA<Bin>> GstBinExtManual for O {}
impl Default for Bin { impl Default for Bin {
fn default() -> Self { fn default() -> Self {
glib::object::Object::new() glib::object::Object::new()

View file

@ -345,23 +345,14 @@ impl FromGlibPtrNone<*mut ffi::GstBufferPoolAcquireParams> for BufferPoolAcquire
} }
} }
pub trait BufferPoolExtManual: 'static { mod sealed {
#[doc(alias = "get_config")] pub trait Sealed {}
#[doc(alias = "gst_buffer_pool_get_config")] impl<T: super::IsA<super::BufferPool>> Sealed for T {}
fn config(&self) -> BufferPoolConfig;
#[doc(alias = "gst_buffer_pool_set_config")]
fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError>;
fn is_flushing(&self) -> bool;
#[doc(alias = "gst_buffer_pool_acquire_buffer")]
fn acquire_buffer(
&self,
params: Option<&BufferPoolAcquireParams>,
) -> Result<crate::Buffer, crate::FlowError>;
} }
impl<O: IsA<BufferPool>> BufferPoolExtManual for O { pub trait BufferPoolExtManual: sealed::Sealed + IsA<BufferPool> + 'static {
#[doc(alias = "get_config")]
#[doc(alias = "gst_buffer_pool_get_config")]
fn config(&self) -> BufferPoolConfig { fn config(&self) -> BufferPoolConfig {
unsafe { unsafe {
let ptr = ffi::gst_buffer_pool_get_config(self.as_ref().to_glib_none().0); let ptr = ffi::gst_buffer_pool_get_config(self.as_ref().to_glib_none().0);
@ -369,6 +360,7 @@ impl<O: IsA<BufferPool>> BufferPoolExtManual for O {
} }
} }
#[doc(alias = "gst_buffer_pool_set_config")]
fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError> { fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib::result_from_gboolean!( glib::result_from_gboolean!(
@ -390,6 +382,7 @@ impl<O: IsA<BufferPool>> BufferPoolExtManual for O {
} }
} }
#[doc(alias = "gst_buffer_pool_acquire_buffer")]
fn acquire_buffer( fn acquire_buffer(
&self, &self,
params: Option<&BufferPoolAcquireParams>, params: Option<&BufferPoolAcquireParams>,
@ -408,6 +401,8 @@ impl<O: IsA<BufferPool>> BufferPoolExtManual for O {
} }
} }
impl<O: IsA<BufferPool>> BufferPoolExtManual for O {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -6,24 +6,13 @@ use glib::{prelude::*, translate::*};
use crate::ChildProxy; use crate::ChildProxy;
pub trait ChildProxyExtManual: 'static { mod sealed {
#[doc(alias = "gst_child_proxy_lookup")] pub trait Sealed {}
fn lookup(&self, name: &str) -> Result<(glib::Object, glib::ParamSpec), glib::BoolError>; impl<T: super::IsA<super::ChildProxy>> Sealed for T {}
#[doc(alias = "get_child_property")]
#[doc(alias = "gst_child_proxy_get")]
fn child_property<V: for<'b> glib::value::FromValue<'b> + 'static>(&self, name: &str) -> V;
#[doc(alias = "get_child_property")]
#[doc(alias = "gst_child_proxy_get")]
fn child_property_value(&self, name: &str) -> glib::Value;
#[doc(alias = "gst_child_proxy_set")]
fn set_child_property(&self, name: &str, value: impl Into<glib::Value>);
#[doc(alias = "gst_child_proxy_set_property")]
fn set_child_property_from_value(&self, name: &str, value: &glib::Value);
} }
impl<O: IsA<ChildProxy>> ChildProxyExtManual for O { pub trait ChildProxyExtManual: sealed::Sealed + IsA<ChildProxy> + 'static {
#[doc(alias = "gst_child_proxy_lookup")]
fn lookup(&self, name: &str) -> Result<(glib::Object, glib::ParamSpec), glib::BoolError> { fn lookup(&self, name: &str) -> Result<(glib::Object, glib::ParamSpec), glib::BoolError> {
unsafe { unsafe {
let mut target = ptr::null_mut(); let mut target = ptr::null_mut();
@ -42,27 +31,35 @@ impl<O: IsA<ChildProxy>> ChildProxyExtManual for O {
} }
} }
#[doc(alias = "get_child_property")]
#[doc(alias = "gst_child_proxy_get")]
#[track_caller] #[track_caller]
fn child_property<V: for<'b> glib::value::FromValue<'b> + 'static>(&self, name: &str) -> V { fn child_property<V: for<'b> glib::value::FromValue<'b> + 'static>(&self, name: &str) -> V {
let (child, pspec) = self.lookup(name).unwrap(); let (child, pspec) = self.lookup(name).unwrap();
child.property(pspec.name()) child.property(pspec.name())
} }
#[doc(alias = "get_child_property")]
#[doc(alias = "gst_child_proxy_get")]
#[track_caller] #[track_caller]
fn child_property_value(&self, name: &str) -> glib::Value { fn child_property_value(&self, name: &str) -> glib::Value {
let (child, pspec) = self.lookup(name).unwrap(); let (child, pspec) = self.lookup(name).unwrap();
child.property_value(pspec.name()) child.property_value(pspec.name())
} }
#[doc(alias = "gst_child_proxy_set")]
#[track_caller] #[track_caller]
fn set_child_property(&self, name: &str, value: impl Into<glib::Value>) { fn set_child_property(&self, name: &str, value: impl Into<glib::Value>) {
let (child, pspec) = self.lookup(name).unwrap(); let (child, pspec) = self.lookup(name).unwrap();
child.set_property(pspec.name(), value) child.set_property(pspec.name(), value)
} }
#[doc(alias = "gst_child_proxy_set_property")]
#[track_caller] #[track_caller]
fn set_child_property_from_value(&self, name: &str, value: &glib::Value) { fn set_child_property_from_value(&self, name: &str, value: &glib::Value) {
let (child, pspec) = self.lookup(name).unwrap(); let (child, pspec) = self.lookup(name).unwrap();
child.set_property_from_value(pspec.name(), value) child.set_property_from_value(pspec.name(), value)
} }
} }
impl<O: IsA<ChildProxy>> ChildProxyExtManual for O {}

View file

@ -420,37 +420,13 @@ impl Clock {
} }
} }
pub trait ClockExtManual: 'static { mod sealed {
#[doc(alias = "gst_clock_new_periodic_id")] pub trait Sealed {}
fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> PeriodicClockId; impl<T: super::IsA<super::Clock>> Sealed for T {}
#[doc(alias = "gst_clock_periodic_id_reinit")]
fn periodic_id_reinit(
&self,
id: &PeriodicClockId,
start_time: ClockTime,
interval: ClockTime,
) -> Result<(), glib::BoolError>;
#[doc(alias = "gst_clock_new_single_shot_id")]
fn new_single_shot_id(&self, time: ClockTime) -> SingleShotClockId;
#[doc(alias = "gst_clock_single_shot_id_reinit")]
fn single_shot_id_reinit(
&self,
id: &SingleShotClockId,
time: ClockTime,
) -> Result<(), glib::BoolError>;
fn set_clock_flags(&self, flags: ClockFlags);
fn unset_clock_flags(&self, flags: ClockFlags);
#[doc(alias = "get_clock_flags")]
fn clock_flags(&self) -> ClockFlags;
} }
impl<O: IsA<Clock>> ClockExtManual for O { pub trait ClockExtManual: sealed::Sealed + IsA<Clock> + 'static {
#[doc(alias = "gst_clock_new_periodic_id")]
fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> PeriodicClockId { fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> PeriodicClockId {
assert_ne!(interval, ClockTime::ZERO); assert_ne!(interval, ClockTime::ZERO);
@ -463,6 +439,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
} }
} }
#[doc(alias = "gst_clock_periodic_id_reinit")]
fn periodic_id_reinit( fn periodic_id_reinit(
&self, &self,
id: &PeriodicClockId, id: &PeriodicClockId,
@ -484,6 +461,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
} }
} }
#[doc(alias = "gst_clock_new_single_shot_id")]
fn new_single_shot_id(&self, time: ClockTime) -> SingleShotClockId { fn new_single_shot_id(&self, time: ClockTime) -> SingleShotClockId {
unsafe { unsafe {
SingleShotClockId(from_glib_full(ffi::gst_clock_new_single_shot_id( SingleShotClockId(from_glib_full(ffi::gst_clock_new_single_shot_id(
@ -493,6 +471,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
} }
} }
#[doc(alias = "gst_clock_single_shot_id_reinit")]
fn single_shot_id_reinit( fn single_shot_id_reinit(
&self, &self,
id: &SingleShotClockId, id: &SingleShotClockId,
@ -528,6 +507,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
} }
} }
#[doc(alias = "get_clock_flags")]
fn clock_flags(&self) -> ClockFlags { fn clock_flags(&self) -> ClockFlags {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
@ -537,6 +517,8 @@ impl<O: IsA<Clock>> ClockExtManual for O {
} }
} }
impl<O: IsA<Clock>> ClockExtManual for O {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::sync::mpsc::channel; use std::sync::mpsc::channel;

View file

@ -4,18 +4,14 @@ use glib::{prelude::*, translate::*};
use crate::{ClockTime, ControlBinding}; use crate::{ClockTime, ControlBinding};
pub trait ControlBindingExtManual: 'static { mod sealed {
#[doc(alias = "get_g_value_array")] pub trait Sealed {}
#[doc(alias = "gst_control_binding_get_g_value_array")] impl<T: super::IsA<super::ControlBinding>> Sealed for T {}
fn g_value_array(
&self,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [glib::Value],
) -> Result<(), glib::error::BoolError>;
} }
impl<O: IsA<ControlBinding>> ControlBindingExtManual for O { pub trait ControlBindingExtManual: sealed::Sealed + IsA<ControlBinding> + 'static {
#[doc(alias = "get_g_value_array")]
#[doc(alias = "gst_control_binding_get_g_value_array")]
fn g_value_array( fn g_value_array(
&self, &self,
timestamp: ClockTime, timestamp: ClockTime,
@ -37,3 +33,5 @@ impl<O: IsA<ControlBinding>> ControlBindingExtManual for O {
} }
} }
} }
impl<O: IsA<ControlBinding>> ControlBindingExtManual for O {}

View file

@ -4,18 +4,14 @@ use glib::{prelude::*, translate::*};
use crate::{ClockTime, ControlSource}; use crate::{ClockTime, ControlSource};
pub trait ControlSourceExtManual: 'static { mod sealed {
#[doc(alias = "get_value_array")] pub trait Sealed {}
#[doc(alias = "gst_control_source_get_value_array")] impl<T: super::IsA<super::ControlSource>> Sealed for T {}
fn value_array(
&self,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [f64],
) -> Result<(), glib::error::BoolError>;
} }
impl<O: IsA<ControlSource>> ControlSourceExtManual for O { pub trait ControlSourceExtManual: sealed::Sealed + IsA<ControlSource> + 'static {
#[doc(alias = "get_value_array")]
#[doc(alias = "gst_control_source_get_value_array")]
fn value_array( fn value_array(
&self, &self,
timestamp: ClockTime, timestamp: ClockTime,
@ -37,3 +33,5 @@ impl<O: IsA<ControlSource>> ControlSourceExtManual for O {
} }
} }
} }
impl<O: IsA<ControlSource>> ControlSourceExtManual for O {}

View file

@ -26,25 +26,13 @@ impl FromGlib<libc::c_uint> for DeviceMonitorFilterId {
DeviceMonitorFilterId(NonZeroU32::new_unchecked(val)) DeviceMonitorFilterId(NonZeroU32::new_unchecked(val))
} }
} }
mod sealed {
pub trait DeviceMonitorExtManual: 'static { pub trait Sealed {}
#[doc(alias = "gst_device_monitor_add_filter")] impl<T: super::IsA<super::DeviceMonitor>> Sealed for T {}
fn add_filter(
&self,
classes: Option<&str>,
caps: Option<&Caps>,
) -> Option<DeviceMonitorFilterId>;
#[doc(alias = "gst_device_monitor_remove_filter")]
fn remove_filter(&self, filter_id: DeviceMonitorFilterId)
-> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_device_monitor_get_devices")]
#[doc(alias = "get_devices")]
fn devices(&self) -> glib::List<crate::Device>;
} }
impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O { pub trait DeviceMonitorExtManual: sealed::Sealed + IsA<DeviceMonitor> + 'static {
#[doc(alias = "gst_device_monitor_add_filter")]
fn add_filter( fn add_filter(
&self, &self,
classes: Option<&str>, classes: Option<&str>,
@ -65,6 +53,7 @@ impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O {
} }
} }
#[doc(alias = "gst_device_monitor_remove_filter")]
fn remove_filter( fn remove_filter(
&self, &self,
filter_id: DeviceMonitorFilterId, filter_id: DeviceMonitorFilterId,
@ -80,6 +69,8 @@ impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O {
} }
} }
#[doc(alias = "gst_device_monitor_get_devices")]
#[doc(alias = "get_devices")]
fn devices(&self) -> glib::List<crate::Device> { fn devices(&self) -> glib::List<crate::Device> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_devices( FromGlibPtrContainer::from_glib_full(ffi::gst_device_monitor_get_devices(
@ -88,3 +79,5 @@ impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O {
} }
} }
} }
impl<O: IsA<DeviceMonitor>> DeviceMonitorExtManual for O {}

View file

@ -29,17 +29,14 @@ impl DeviceProvider {
} }
} }
pub trait DeviceProviderExtManual: 'static { mod sealed {
#[doc(alias = "get_metadata")] pub trait Sealed {}
#[doc(alias = "gst_device_provider_class_get_metadata")] impl<T: super::IsA<super::DeviceProvider>> Sealed for T {}
fn metadata<'a>(&self, key: &str) -> Option<&'a str>;
#[doc(alias = "gst_device_provider_get_devices")]
#[doc(alias = "get_devices")]
fn devices(&self) -> glib::List<crate::Device>;
} }
impl<O: IsA<DeviceProvider>> DeviceProviderExtManual for O { pub trait DeviceProviderExtManual: sealed::Sealed + IsA<DeviceProvider> + 'static {
#[doc(alias = "get_metadata")]
#[doc(alias = "gst_device_provider_class_get_metadata")]
fn metadata<'a>(&self, key: &str) -> Option<&'a str> { fn metadata<'a>(&self, key: &str) -> Option<&'a str> {
unsafe { unsafe {
let klass = (*(self.as_ptr() as *mut glib::gobject_ffi::GTypeInstance)).g_class let klass = (*(self.as_ptr() as *mut glib::gobject_ffi::GTypeInstance)).g_class
@ -55,6 +52,8 @@ impl<O: IsA<DeviceProvider>> DeviceProviderExtManual for O {
} }
} }
#[doc(alias = "gst_device_provider_get_devices")]
#[doc(alias = "get_devices")]
fn devices(&self) -> glib::List<crate::Device> { fn devices(&self) -> glib::List<crate::Device> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_devices( FromGlibPtrContainer::from_glib_full(ffi::gst_device_provider_get_devices(
@ -63,3 +62,5 @@ impl<O: IsA<DeviceProvider>> DeviceProviderExtManual for O {
} }
} }
} }
impl<O: IsA<DeviceProvider>> DeviceProviderExtManual for O {}

View file

@ -101,203 +101,13 @@ impl FromGlib<libc::c_ulong> for NotifyWatchId {
} }
} }
pub trait ElementExtManual: 'static { mod sealed {
#[doc(alias = "get_element_class")] pub trait Sealed {}
fn element_class(&self) -> &glib::Class<Element>; impl<T: super::IsA<super::Element>> Sealed for T {}
#[doc(alias = "get_current_state")]
fn current_state(&self) -> State;
#[doc(alias = "get_pending_state")]
fn pending_state(&self) -> State;
#[doc(alias = "gst_element_query")]
fn query(&self, query: &mut QueryRef) -> bool;
#[doc(alias = "gst_element_send_event")]
fn send_event(&self, event: impl Into<Event>) -> bool;
#[doc(alias = "get_metadata")]
fn metadata<'a>(&self, key: &str) -> Option<&'a str>;
#[doc(alias = "get_pad_template")]
fn pad_template(&self, name: &str) -> Option<PadTemplate>;
#[doc(alias = "get_pad_template_list")]
fn pad_template_list(&self) -> glib::List<PadTemplate>;
#[allow(clippy::too_many_arguments)]
#[doc(alias = "gst_element_message_full")]
fn message_full<T: crate::MessageErrorDomain>(
&self,
type_: ElementMessageType,
code: T,
message: Option<&str>,
debug: Option<&str>,
file: &str,
function: &str,
line: u32,
);
fn set_element_flags(&self, flags: ElementFlags);
fn unset_element_flags(&self, flags: ElementFlags);
#[doc(alias = "get_element_flags")]
fn element_flags(&self) -> ElementFlags;
#[allow(clippy::too_many_arguments)]
#[doc(alias = "gst_element_message_full_with_details")]
fn message_full_with_details<T: crate::MessageErrorDomain>(
&self,
type_: ElementMessageType,
code: T,
message: Option<&str>,
debug: Option<&str>,
file: &str,
function: &str,
line: u32,
structure: crate::Structure,
);
fn post_error_message(&self, msg: crate::ErrorMessage);
#[doc(alias = "gst_element_iterate_pads")]
fn iterate_pads(&self) -> crate::Iterator<Pad>;
#[doc(alias = "gst_element_iterate_sink_pads")]
fn iterate_sink_pads(&self) -> crate::Iterator<Pad>;
#[doc(alias = "gst_element_iterate_src_pads")]
fn iterate_src_pads(&self) -> crate::Iterator<Pad>;
#[doc(alias = "get_pads")]
#[doc(alias = "gst_element_foreach_pad")]
fn pads(&self) -> Vec<Pad>;
#[doc(alias = "get_sink_pads")]
#[doc(alias = "gst_element_foreach_sink_pad")]
fn sink_pads(&self) -> Vec<Pad>;
#[doc(alias = "get_src_pads")]
#[doc(alias = "gst_element_foreach_src_pad")]
fn src_pads(&self) -> Vec<Pad>;
fn num_pads(&self) -> u16;
fn num_sink_pads(&self) -> u16;
fn num_src_pads(&self) -> u16;
#[doc(alias = "gst_element_add_property_deep_notify_watch")]
fn add_property_deep_notify_watch(
&self,
property_name: Option<&str>,
include_value: bool,
) -> NotifyWatchId;
#[doc(alias = "gst_element_add_property_notify_watch")]
fn add_property_notify_watch(
&self,
property_name: Option<&str>,
include_value: bool,
) -> NotifyWatchId;
#[doc(alias = "gst_element_remove_property_notify_watch")]
fn remove_property_notify_watch(&self, watch_id: NotifyWatchId);
#[doc(alias = "gst_element_query_convert")]
fn query_convert<U: SpecificFormattedValueFullRange>(
&self,
src_val: impl FormattedValue,
) -> Option<U>;
fn query_convert_generic(
&self,
src_val: impl FormattedValue,
dest_format: Format,
) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_element_query_duration")]
fn query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T>;
#[doc(alias = "gst_element_query_duration")]
fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_element_query_position")]
fn query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T>;
#[doc(alias = "gst_element_query_position")]
fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_element_seek")]
fn seek<V: FormattedValue>(
&self,
rate: f64,
flags: crate::SeekFlags,
start_type: crate::SeekType,
start: V,
stop_type: crate::SeekType,
stop: impl CompatibleFormattedValue<V>,
) -> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_element_seek_simple")]
fn seek_simple(
&self,
seek_flags: crate::SeekFlags,
seek_pos: impl FormattedValue,
) -> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_element_call_async")]
fn call_async<F>(&self, func: F)
where
F: FnOnce(&Self) + Send + 'static;
fn call_async_future<F, T>(&self, func: F) -> Pin<Box<dyn Future<Output = T> + Send + 'static>>
where
F: FnOnce(&Self) -> T + Send + 'static,
T: Send + 'static;
#[doc(alias = "get_current_running_time")]
#[doc(alias = "gst_element_get_current_running_time")]
fn current_running_time(&self) -> Option<crate::ClockTime>;
#[doc(alias = "get_current_clock_time")]
#[doc(alias = "gst_element_get_current_clock_time")]
fn current_clock_time(&self) -> Option<crate::ClockTime>;
#[doc(alias = "gst_element_get_request_pad")]
#[doc(alias = "get_request_pad")]
#[doc(alias = "gst_element_request_pad_simple")]
fn request_pad_simple(&self, name: &str) -> Option<Pad>;
#[doc(alias = "gst_element_link")]
fn link(&self, dest: &impl IsA<Element>) -> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_element_link_filtered")]
fn link_filtered(
&self,
dest: &impl IsA<Element>,
filter: &crate::Caps,
) -> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_element_link_pads")]
fn link_pads(
&self,
srcpadname: Option<&str>,
dest: &impl IsA<Element>,
destpadname: Option<&str>,
) -> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_element_link_pads_filtered")]
fn link_pads_filtered(
&self,
srcpadname: Option<&str>,
dest: &impl IsA<Element>,
destpadname: Option<&str>,
filter: &crate::Caps,
) -> Result<(), glib::error::BoolError>;
#[doc(alias = "gst_element_link_pads_full")]
fn link_pads_full(
&self,
srcpadname: Option<&str>,
dest: &impl IsA<Element>,
destpadname: Option<&str>,
flags: crate::PadLinkCheck,
) -> Result<(), glib::error::BoolError>;
} }
impl<O: IsA<Element>> ElementExtManual for O { pub trait ElementExtManual: sealed::Sealed + IsA<Element> + 'static {
#[doc(alias = "get_element_class")]
#[inline] #[inline]
fn element_class(&self) -> &glib::Class<Element> { fn element_class(&self) -> &glib::Class<Element> {
unsafe { unsafe {
@ -307,14 +117,17 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "get_current_state")]
fn current_state(&self) -> State { fn current_state(&self) -> State {
self.state(Some(ClockTime::ZERO)).1 self.state(Some(ClockTime::ZERO)).1
} }
#[doc(alias = "get_pending_state")]
fn pending_state(&self) -> State { fn pending_state(&self) -> State {
self.state(Some(ClockTime::ZERO)).2 self.state(Some(ClockTime::ZERO)).2
} }
#[doc(alias = "gst_element_query")]
fn query(&self, query: &mut QueryRef) -> bool { fn query(&self, query: &mut QueryRef) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_element_query( from_glib(ffi::gst_element_query(
@ -324,6 +137,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_send_event")]
fn send_event(&self, event: impl Into<Event>) -> bool { fn send_event(&self, event: impl Into<Event>) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_element_send_event( from_glib(ffi::gst_element_send_event(
@ -333,42 +147,26 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "get_metadata")]
#[doc(alias = "gst_element_class_get_metadata")]
fn metadata<'a>(&self, key: &str) -> Option<&'a str> { fn metadata<'a>(&self, key: &str) -> Option<&'a str> {
self.element_class().metadata(key) self.element_class().metadata(key)
} }
#[doc(alias = "get_pad_template")]
#[doc(alias = "gst_element_class_get_pad_template")]
fn pad_template(&self, name: &str) -> Option<PadTemplate> { fn pad_template(&self, name: &str) -> Option<PadTemplate> {
self.element_class().pad_template(name) self.element_class().pad_template(name)
} }
#[doc(alias = "get_pad_template_list")]
#[doc(alias = "gst_element_class_get_pad_template_list")]
fn pad_template_list(&self) -> glib::List<PadTemplate> { fn pad_template_list(&self) -> glib::List<PadTemplate> {
self.element_class().pad_template_list() self.element_class().pad_template_list()
} }
fn set_element_flags(&self, flags: ElementFlags) { #[allow(clippy::too_many_arguments)]
unsafe { #[doc(alias = "gst_element_message_full")]
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = self.as_ref().object_lock();
(*ptr).flags |= flags.into_glib();
}
}
fn unset_element_flags(&self, flags: ElementFlags) {
unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = self.as_ref().object_lock();
(*ptr).flags &= !flags.into_glib();
}
}
fn element_flags(&self) -> ElementFlags {
unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = self.as_ref().object_lock();
from_glib((*ptr).flags)
}
}
fn message_full<T: crate::MessageErrorDomain>( fn message_full<T: crate::MessageErrorDomain>(
&self, &self,
type_: ElementMessageType, type_: ElementMessageType,
@ -400,6 +198,33 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
fn set_element_flags(&self, flags: ElementFlags) {
unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = self.as_ref().object_lock();
(*ptr).flags |= flags.into_glib();
}
}
fn unset_element_flags(&self, flags: ElementFlags) {
unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = self.as_ref().object_lock();
(*ptr).flags &= !flags.into_glib();
}
}
#[doc(alias = "get_element_flags")]
fn element_flags(&self) -> ElementFlags {
unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
let _guard = self.as_ref().object_lock();
from_glib((*ptr).flags)
}
}
#[allow(clippy::too_many_arguments)]
#[doc(alias = "gst_element_message_full_with_details")]
fn message_full_with_details<T: crate::MessageErrorDomain>( fn message_full_with_details<T: crate::MessageErrorDomain>(
&self, &self,
type_: ElementMessageType, type_: ElementMessageType,
@ -459,6 +284,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_iterate_pads")]
fn iterate_pads(&self) -> crate::Iterator<Pad> { fn iterate_pads(&self) -> crate::Iterator<Pad> {
unsafe { unsafe {
from_glib_full(ffi::gst_element_iterate_pads( from_glib_full(ffi::gst_element_iterate_pads(
@ -467,6 +293,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_iterate_sink_pads")]
fn iterate_sink_pads(&self) -> crate::Iterator<Pad> { fn iterate_sink_pads(&self) -> crate::Iterator<Pad> {
unsafe { unsafe {
from_glib_full(ffi::gst_element_iterate_sink_pads( from_glib_full(ffi::gst_element_iterate_sink_pads(
@ -475,6 +302,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_iterate_src_pads")]
fn iterate_src_pads(&self) -> crate::Iterator<Pad> { fn iterate_src_pads(&self) -> crate::Iterator<Pad> {
unsafe { unsafe {
from_glib_full(ffi::gst_element_iterate_src_pads( from_glib_full(ffi::gst_element_iterate_src_pads(
@ -483,6 +311,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "get_pads")]
#[doc(alias = "gst_element_foreach_pad")]
fn pads(&self) -> Vec<Pad> { fn pads(&self) -> Vec<Pad> {
unsafe { unsafe {
let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); let elt: &ffi::GstElement = &*(self.as_ptr() as *const _);
@ -491,6 +321,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "get_sink_pads")]
#[doc(alias = "gst_element_foreach_sink_pad")]
fn sink_pads(&self) -> Vec<Pad> { fn sink_pads(&self) -> Vec<Pad> {
unsafe { unsafe {
let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); let elt: &ffi::GstElement = &*(self.as_ptr() as *const _);
@ -499,6 +331,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "get_src_pads")]
#[doc(alias = "gst_element_foreach_src_pad")]
fn src_pads(&self) -> Vec<Pad> { fn src_pads(&self) -> Vec<Pad> {
unsafe { unsafe {
let elt: &ffi::GstElement = &*(self.as_ptr() as *const _); let elt: &ffi::GstElement = &*(self.as_ptr() as *const _);
@ -531,6 +365,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_add_property_deep_notify_watch")]
fn add_property_deep_notify_watch( fn add_property_deep_notify_watch(
&self, &self,
property_name: Option<&str>, property_name: Option<&str>,
@ -546,6 +381,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_add_property_notify_watch")]
fn add_property_notify_watch( fn add_property_notify_watch(
&self, &self,
property_name: Option<&str>, property_name: Option<&str>,
@ -561,6 +397,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_remove_property_notify_watch")]
fn remove_property_notify_watch(&self, watch_id: NotifyWatchId) { fn remove_property_notify_watch(&self, watch_id: NotifyWatchId) {
unsafe { unsafe {
ffi::gst_element_remove_property_notify_watch( ffi::gst_element_remove_property_notify_watch(
@ -570,6 +407,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_query_convert")]
fn query_convert<U: SpecificFormattedValueFullRange>( fn query_convert<U: SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl FormattedValue, src_val: impl FormattedValue,
@ -591,6 +429,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_query_convert")]
fn query_convert_generic( fn query_convert_generic(
&self, &self,
src_val: impl FormattedValue, src_val: impl FormattedValue,
@ -616,6 +455,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_query_duration")]
fn query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { fn query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> {
unsafe { unsafe {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
@ -632,6 +472,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_query_duration")]
fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> { fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> {
unsafe { unsafe {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
@ -648,6 +489,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_query_position")]
fn query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { fn query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> {
unsafe { unsafe {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
@ -664,6 +506,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_query_position")]
fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> { fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> {
unsafe { unsafe {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
@ -680,6 +523,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_seek")]
fn seek<V: FormattedValue>( fn seek<V: FormattedValue>(
&self, &self,
rate: f64, rate: f64,
@ -708,6 +552,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_seek_simple")]
fn seek_simple( fn seek_simple(
&self, &self,
seek_flags: crate::SeekFlags, seek_flags: crate::SeekFlags,
@ -726,6 +571,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_call_async")]
fn call_async<F>(&self, func: F) fn call_async<F>(&self, func: F)
where where
F: FnOnce(&Self) + Send + 'static, F: FnOnce(&Self) + Send + 'static,
@ -774,6 +620,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
Box::pin(async move { receiver.await.expect("sender dropped") }) Box::pin(async move { receiver.await.expect("sender dropped") })
} }
#[doc(alias = "get_current_running_time")]
#[doc(alias = "gst_element_get_current_running_time")]
fn current_running_time(&self) -> Option<crate::ClockTime> { fn current_running_time(&self) -> Option<crate::ClockTime> {
let base_time = self.base_time(); let base_time = self.base_time();
let clock_time = self.current_clock_time(); let clock_time = self.current_clock_time();
@ -783,6 +631,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
.and_then(|(ct, bt)| ct.checked_sub(bt)) .and_then(|(ct, bt)| ct.checked_sub(bt))
} }
#[doc(alias = "get_current_clock_time")]
#[doc(alias = "gst_element_get_current_clock_time")]
fn current_clock_time(&self) -> Option<crate::ClockTime> { fn current_clock_time(&self) -> Option<crate::ClockTime> {
if let Some(clock) = self.clock() { if let Some(clock) = self.clock() {
clock.time() clock.time()
@ -791,6 +641,9 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_get_request_pad")]
#[doc(alias = "get_request_pad")]
#[doc(alias = "gst_element_request_pad_simple")]
fn request_pad_simple(&self, name: &str) -> Option<Pad> { fn request_pad_simple(&self, name: &str) -> Option<Pad> {
unsafe { unsafe {
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
@ -810,6 +663,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_link")]
fn link(&self, dest: &impl IsA<Element>) -> Result<(), glib::error::BoolError> { fn link(&self, dest: &impl IsA<Element>) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib::result_from_gboolean!( glib::result_from_gboolean!(
@ -824,6 +678,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_link_filtered")]
fn link_filtered( fn link_filtered(
&self, &self,
dest: &impl IsA<Element>, dest: &impl IsA<Element>,
@ -844,6 +699,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_link_pads")]
fn link_pads( fn link_pads(
&self, &self,
srcpadname: Option<&str>, srcpadname: Option<&str>,
@ -873,6 +729,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_link_pads_filtered")]
fn link_pads_filtered( fn link_pads_filtered(
&self, &self,
srcpadname: Option<&str>, srcpadname: Option<&str>,
@ -905,6 +762,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
#[doc(alias = "gst_element_link_pads_full")]
fn link_pads_full( fn link_pads_full(
&self, &self,
srcpadname: Option<&str>, srcpadname: Option<&str>,
@ -938,6 +796,8 @@ impl<O: IsA<Element>> ElementExtManual for O {
} }
} }
impl<O: IsA<Element>> ElementExtManual for O {}
pub unsafe trait ElementClassExt { pub unsafe trait ElementClassExt {
#[doc(alias = "get_metadata")] #[doc(alias = "get_metadata")]
#[doc(alias = "gst_element_class_get_metadata")] #[doc(alias = "gst_element_class_get_metadata")]

View file

@ -4,12 +4,13 @@ use glib::prelude::*;
use crate::value::GstValueExt; use crate::value::GstValueExt;
pub trait GObjectExtManualGst: 'static { mod sealed {
#[doc(alias = "gst_util_set_object_arg")] pub trait Sealed {}
fn set_property_from_str(&self, name: &str, value: &str); impl<T: super::IsA<glib::Object>> Sealed for T {}
} }
impl<O: IsA<glib::Object>> GObjectExtManualGst for O { pub trait GObjectExtManualGst: sealed::Sealed + IsA<glib::Object> + 'static {
#[doc(alias = "gst_util_set_object_arg")]
#[track_caller] #[track_caller]
fn set_property_from_str(&self, name: &str, value: &str) { fn set_property_from_str(&self, name: &str, value: &str) {
let pspec = self.find_property(name).unwrap_or_else(|| { let pspec = self.find_property(name).unwrap_or_else(|| {
@ -49,6 +50,8 @@ impl<O: IsA<glib::Object>> GObjectExtManualGst for O {
} }
} }
impl<O: IsA<glib::Object>> GObjectExtManualGst for O {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -2,37 +2,15 @@
use glib::{prelude::*, signal::SignalHandlerId, translate::*}; use glib::{prelude::*, signal::SignalHandlerId, translate::*};
use crate::{ClockTime, ObjectFlags}; use crate::{ClockTime, Object, ObjectFlags};
pub trait GstObjectExtManual: 'static { mod sealed {
#[doc(alias = "deep-notify")] pub trait Sealed {}
fn connect_deep_notify<F: Fn(&Self, &crate::Object, &glib::ParamSpec) + Send + Sync + 'static>( impl<T: super::IsA<super::Object>> Sealed for T {}
&self,
name: Option<&str>,
f: F,
) -> SignalHandlerId;
fn set_object_flags(&self, flags: ObjectFlags);
fn unset_object_flags(&self, flags: ObjectFlags);
#[doc(alias = "get_object_flags")]
fn object_flags(&self) -> ObjectFlags;
#[doc(alias = "get_g_value_array")]
#[doc(alias = "gst_object_get_g_value_array")]
fn g_value_array(
&self,
property_name: &str,
timestamp: ClockTime,
interval: ClockTime,
values: &mut [glib::Value],
) -> Result<(), glib::error::BoolError>;
fn object_lock(&self) -> crate::utils::ObjectLockGuard<Self>;
} }
impl<O: IsA<crate::Object>> GstObjectExtManual for O { pub trait GstObjectExtManual: sealed::Sealed + IsA<Object> + 'static {
#[doc(alias = "deep-notify")]
fn connect_deep_notify< fn connect_deep_notify<
F: Fn(&Self, &crate::Object, &glib::ParamSpec) + Send + Sync + 'static, F: Fn(&Self, &crate::Object, &glib::ParamSpec) + Send + Sync + 'static,
>( >(
@ -53,7 +31,7 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
// It would be nice to display the actual signal name in the panic messages below, // It would be nice to display the actual signal name in the panic messages below,
// but that would require to copy `signal_name` so as to move it into the closure // but that would require to copy `signal_name` so as to move it into the closure
// which seems too much for the messages of development errors // which seems too much for the messages of development errors
let obj: O = unsafe { let obj: Self = unsafe {
values[0] values[0]
.get::<crate::Object>() .get::<crate::Object>()
.unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[0]: {err}")) .unwrap_or_else(|err| panic!("Object signal \"deep-notify\": values[0]: {err}"))
@ -90,6 +68,7 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
} }
} }
#[doc(alias = "get_object_flags")]
fn object_flags(&self) -> ObjectFlags { fn object_flags(&self) -> ObjectFlags {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
@ -98,6 +77,9 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
} }
} }
#[doc(alias = "get_g_value_array")]
#[doc(alias = "gst_object_get_g_value_array")]
fn g_value_array( fn g_value_array(
&self, &self,
property_name: &str, property_name: &str,
@ -127,6 +109,8 @@ impl<O: IsA<crate::Object>> GstObjectExtManual for O {
} }
} }
impl<O: IsA<Object>> GstObjectExtManual for O {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};

View file

@ -95,217 +95,13 @@ pub enum EventForeachAction {
Replace(Event), Replace(Event),
} }
pub trait PadExtManual: 'static { mod sealed {
#[doc(alias = "gst_pad_add_probe")] pub trait Sealed {}
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId> impl<T: super::IsA<super::Pad>> Sealed for T {}
where
F: Fn(&Self, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static;
#[doc(alias = "gst_pad_remove_probe")]
fn remove_probe(&self, id: PadProbeId);
#[doc(alias = "gst_pad_pull_range")]
fn pull_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError>;
fn pull_range_fill(
&self,
offset: u64,
buffer: &mut crate::BufferRef,
size: u32,
) -> Result<(), FlowError>;
#[doc(alias = "get_range")]
#[doc(alias = "gst_pad_get_range")]
fn range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError>;
#[doc(alias = "get_range_fill")]
fn range_fill(
&self,
offset: u64,
buffer: &mut crate::BufferRef,
size: u32,
) -> Result<(), FlowError>;
#[doc(alias = "gst_pad_peer_query")]
fn peer_query(&self, query: &mut QueryRef) -> bool;
#[doc(alias = "gst_pad_query")]
fn query(&self, query: &mut QueryRef) -> bool;
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool;
#[doc(alias = "gst_pad_proxy_query_accept_caps")]
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool;
#[doc(alias = "gst_pad_push_event")]
fn push_event(&self, event: impl Into<Event>) -> bool;
#[doc(alias = "gst_pad_send_event")]
fn send_event(&self, event: impl Into<Event>) -> bool;
#[doc(alias = "gst_pad_iterate_internal_links")]
fn iterate_internal_links(&self) -> crate::Iterator<Pad>;
fn stream_lock(&self) -> StreamLock;
#[doc(alias = "gst_pad_set_activate_function")]
#[doc(alias = "gst_pad_set_activate_function_full")]
unsafe fn set_activate_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>) -> Result<(), LoggableError> + Send + Sync + 'static;
#[doc(alias = "gst_pad_set_activatemode_function")]
#[doc(alias = "gst_pad_set_activatemode_function_full")]
unsafe fn set_activatemode_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>, crate::PadMode, bool) -> Result<(), LoggableError>
+ Send
+ Sync
+ 'static;
#[doc(alias = "gst_pad_set_chain_function")]
#[doc(alias = "gst_pad_set_chain_function_full")]
unsafe fn set_chain_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>, crate::Buffer) -> Result<FlowSuccess, FlowError>
+ Send
+ Sync
+ 'static;
#[doc(alias = "gst_pad_set_chain_list_function")]
#[doc(alias = "gst_pad_set_chain_list_function_full")]
unsafe fn set_chain_list_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>, crate::BufferList) -> Result<FlowSuccess, FlowError>
+ Send
+ Sync
+ 'static;
#[doc(alias = "gst_pad_set_event_function")]
#[doc(alias = "gst_pad_set_event_function_full")]
unsafe fn set_event_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>, crate::Event) -> bool + Send + Sync + 'static;
#[doc(alias = "gst_pad_set_event_full_function")]
#[doc(alias = "gst_pad_set_event_full_function_full")]
unsafe fn set_event_full_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>, crate::Event) -> Result<FlowSuccess, FlowError>
+ Send
+ Sync
+ 'static;
#[doc(alias = "gst_pad_set_getrange_function")]
#[doc(alias = "gst_pad_set_getrange_function_full")]
unsafe fn set_getrange_function<F>(&self, func: F)
where
F: Fn(
&Self,
Option<&crate::Object>,
u64,
Option<&mut crate::BufferRef>,
u32,
) -> Result<PadGetRangeSuccess, crate::FlowError>
+ Send
+ Sync
+ 'static;
#[doc(alias = "gst_pad_set_iterate_internal_links_function")]
#[doc(alias = "gst_pad_set_iterate_internal_links_function_full")]
unsafe fn set_iterate_internal_links_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>) -> crate::Iterator<Pad> + Send + Sync + 'static;
#[doc(alias = "gst_pad_set_link_function")]
#[doc(alias = "gst_pad_set_link_function_full")]
unsafe fn set_link_function<F>(&self, func: F)
where
F: Fn(
&Self,
Option<&crate::Object>,
&Pad,
) -> Result<crate::PadLinkSuccess, crate::PadLinkError>
+ Send
+ Sync
+ 'static;
#[doc(alias = "gst_pad_set_query_function")]
#[doc(alias = "gst_pad_set_query_function_full")]
unsafe fn set_query_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>, &mut crate::QueryRef) -> bool + Send + Sync + 'static;
#[doc(alias = "gst_pad_set_unlink_function")]
#[doc(alias = "gst_pad_set_unlink_function_full")]
unsafe fn set_unlink_function<F>(&self, func: F)
where
F: Fn(&Self, Option<&crate::Object>) + Send + Sync + 'static;
#[doc(alias = "gst_pad_start_task")]
fn start_task<F: FnMut() + Send + 'static>(&self, func: F) -> Result<(), glib::BoolError>;
#[doc(alias = "gst_pad_peer_query_convert")]
fn peer_query_convert<U: SpecificFormattedValueFullRange>(
&self,
src_val: impl FormattedValue,
) -> Option<U>;
#[doc(alias = "gst_pad_peer_query_convert")]
fn peer_query_convert_generic(
&self,
src_val: impl FormattedValue,
dest_format: Format,
) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_pad_peer_query_duration")]
fn peer_query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T>;
#[doc(alias = "gst_pad_peer_query_duration")]
fn peer_query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_pad_peer_query_position")]
fn peer_query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T>;
#[doc(alias = "gst_pad_peer_query_position")]
fn peer_query_position_generic(&self, format: Format) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_pad_query_convert")]
fn query_convert<U: SpecificFormattedValueFullRange>(
&self,
src_val: impl FormattedValue,
) -> Option<U>;
#[doc(alias = "gst_pad_query_convert")]
fn query_convert_generic(
&self,
src_val: impl FormattedValue,
dest_format: Format,
) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_pad_query_duration")]
fn query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T>;
#[doc(alias = "gst_pad_query_duration")]
fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue>;
#[doc(alias = "gst_pad_query_position")]
fn query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T>;
#[doc(alias = "gst_pad_query_position")]
fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue>;
#[doc(alias = "get_mode")]
#[doc(alias = "GST_PAD_MODE")]
fn mode(&self) -> crate::PadMode;
#[doc(alias = "gst_pad_sticky_events_foreach")]
fn sticky_events_foreach<
F: FnMut(&Event) -> ControlFlow<EventForeachAction, EventForeachAction>,
>(
&self,
func: F,
);
#[doc(alias = "gst_pad_get_sticky_event")]
#[doc(alias = "get_sticky_event")]
fn sticky_event<T: crate::event::StickyEventType>(&self, idx: u32) -> Option<T::Owned>;
fn set_pad_flags(&self, flags: PadFlags);
fn unset_pad_flags(&self, flags: PadFlags);
#[doc(alias = "get_pad_flags")]
fn pad_flags(&self) -> PadFlags;
} }
impl<O: IsA<Pad>> PadExtManual for O { pub trait PadExtManual: sealed::Sealed + IsA<Pad> + 'static {
#[doc(alias = "gst_pad_add_probe")]
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId> fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId>
where where
F: Fn(&Self, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static, F: Fn(&Self, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static,
@ -328,52 +124,14 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_remove_probe")]
fn remove_probe(&self, id: PadProbeId) { fn remove_probe(&self, id: PadProbeId) {
unsafe { unsafe {
ffi::gst_pad_remove_probe(self.as_ref().to_glib_none().0, id.into_glib()); ffi::gst_pad_remove_probe(self.as_ref().to_glib_none().0, id.into_glib());
} }
} }
fn range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError> { #[doc(alias = "gst_pad_pull_range")]
unsafe {
let mut buffer = ptr::null_mut();
FlowSuccess::try_from_glib(ffi::gst_pad_get_range(
self.as_ref().to_glib_none().0,
offset,
size,
&mut buffer,
))
.map(|_| from_glib_full(buffer))
}
}
fn range_fill(
&self,
offset: u64,
buffer: &mut crate::BufferRef,
size: u32,
) -> Result<(), FlowError> {
assert!(buffer.size() >= size as usize);
unsafe {
let mut buffer_ref = buffer.as_mut_ptr();
FlowSuccess::try_from_glib(ffi::gst_pad_get_range(
self.as_ref().to_glib_none().0,
offset,
size,
&mut buffer_ref,
))
.and_then(|_| {
if buffer.as_mut_ptr() != buffer_ref {
ffi::gst_mini_object_unref(buffer_ref as *mut _);
Err(crate::FlowError::Error)
} else {
Ok(())
}
})
}
}
fn pull_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError> { fn pull_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError> {
unsafe { unsafe {
let mut buffer = ptr::null_mut(); let mut buffer = ptr::null_mut();
@ -414,15 +172,50 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
fn query(&self, query: &mut QueryRef) -> bool { #[doc(alias = "get_range")]
#[doc(alias = "gst_pad_get_range")]
fn range(&self, offset: u64, size: u32) -> Result<Buffer, FlowError> {
unsafe { unsafe {
from_glib(ffi::gst_pad_query( let mut buffer = ptr::null_mut();
FlowSuccess::try_from_glib(ffi::gst_pad_get_range(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
query.as_mut_ptr(), offset,
size,
&mut buffer,
)) ))
.map(|_| from_glib_full(buffer))
} }
} }
#[doc(alias = "get_range_fill")]
fn range_fill(
&self,
offset: u64,
buffer: &mut crate::BufferRef,
size: u32,
) -> Result<(), FlowError> {
assert!(buffer.size() >= size as usize);
unsafe {
let mut buffer_ref = buffer.as_mut_ptr();
FlowSuccess::try_from_glib(ffi::gst_pad_get_range(
self.as_ref().to_glib_none().0,
offset,
size,
&mut buffer_ref,
))
.and_then(|_| {
if buffer.as_mut_ptr() != buffer_ref {
ffi::gst_mini_object_unref(buffer_ref as *mut _);
Err(crate::FlowError::Error)
} else {
Ok(())
}
})
}
}
#[doc(alias = "gst_pad_peer_query")]
fn peer_query(&self, query: &mut QueryRef) -> bool { fn peer_query(&self, query: &mut QueryRef) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_pad_peer_query( from_glib(ffi::gst_pad_peer_query(
@ -432,9 +225,10 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool { #[doc(alias = "gst_pad_query")]
fn query(&self, query: &mut QueryRef) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_pad_proxy_query_accept_caps( from_glib(ffi::gst_pad_query(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
query.as_mut_ptr(), query.as_mut_ptr(),
)) ))
@ -450,6 +244,17 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_proxy_query_accept_caps")]
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool {
unsafe {
from_glib(ffi::gst_pad_proxy_query_accept_caps(
self.as_ref().to_glib_none().0,
query.as_mut_ptr(),
))
}
}
#[doc(alias = "gst_pad_push_event")]
fn push_event(&self, event: impl Into<Event>) -> bool { fn push_event(&self, event: impl Into<Event>) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_pad_push_event( from_glib(ffi::gst_pad_push_event(
@ -459,6 +264,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_send_event")]
fn send_event(&self, event: impl Into<Event>) -> bool { fn send_event(&self, event: impl Into<Event>) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_pad_send_event( from_glib(ffi::gst_pad_send_event(
@ -468,6 +274,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_iterate_internal_links")]
fn iterate_internal_links(&self) -> crate::Iterator<Pad> { fn iterate_internal_links(&self) -> crate::Iterator<Pad> {
unsafe { unsafe {
from_glib_full(ffi::gst_pad_iterate_internal_links( from_glib_full(ffi::gst_pad_iterate_internal_links(
@ -484,6 +291,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_set_activate_function")]
#[doc(alias = "gst_pad_set_activate_function_full")]
unsafe fn set_activate_function<F>(&self, func: F) unsafe fn set_activate_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>) -> Result<(), LoggableError> + Send + Sync + 'static, F: Fn(&Self, Option<&crate::Object>) -> Result<(), LoggableError> + Send + Sync + 'static,
@ -497,6 +306,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_activatemode_function")]
#[doc(alias = "gst_pad_set_activatemode_function_full")]
unsafe fn set_activatemode_function<F>(&self, func: F) unsafe fn set_activatemode_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>, crate::PadMode, bool) -> Result<(), LoggableError> F: Fn(&Self, Option<&crate::Object>, crate::PadMode, bool) -> Result<(), LoggableError>
@ -513,6 +324,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_chain_function")]
#[doc(alias = "gst_pad_set_chain_function_full")]
unsafe fn set_chain_function<F>(&self, func: F) unsafe fn set_chain_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>, crate::Buffer) -> Result<FlowSuccess, FlowError> F: Fn(&Self, Option<&crate::Object>, crate::Buffer) -> Result<FlowSuccess, FlowError>
@ -529,6 +342,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_chain_list_function")]
#[doc(alias = "gst_pad_set_chain_list_function_full")]
unsafe fn set_chain_list_function<F>(&self, func: F) unsafe fn set_chain_list_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>, crate::BufferList) -> Result<FlowSuccess, FlowError> F: Fn(&Self, Option<&crate::Object>, crate::BufferList) -> Result<FlowSuccess, FlowError>
@ -545,6 +360,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_event_function")]
#[doc(alias = "gst_pad_set_event_function_full")]
unsafe fn set_event_function<F>(&self, func: F) unsafe fn set_event_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>, crate::Event) -> bool + Send + Sync + 'static, F: Fn(&Self, Option<&crate::Object>, crate::Event) -> bool + Send + Sync + 'static,
@ -558,6 +375,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_event_full_function")]
#[doc(alias = "gst_pad_set_event_full_function_full")]
unsafe fn set_event_full_function<F>(&self, func: F) unsafe fn set_event_full_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>, crate::Event) -> Result<FlowSuccess, FlowError> F: Fn(&Self, Option<&crate::Object>, crate::Event) -> Result<FlowSuccess, FlowError>
@ -574,6 +393,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_getrange_function")]
#[doc(alias = "gst_pad_set_getrange_function_full")]
unsafe fn set_getrange_function<F>(&self, func: F) unsafe fn set_getrange_function<F>(&self, func: F)
where where
F: Fn( F: Fn(
@ -596,6 +417,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_iterate_internal_links_function")]
#[doc(alias = "gst_pad_set_iterate_internal_links_function_full")]
unsafe fn set_iterate_internal_links_function<F>(&self, func: F) unsafe fn set_iterate_internal_links_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>) -> crate::Iterator<Pad> + Send + Sync + 'static, F: Fn(&Self, Option<&crate::Object>) -> crate::Iterator<Pad> + Send + Sync + 'static,
@ -609,6 +432,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_link_function")]
#[doc(alias = "gst_pad_set_link_function_full")]
unsafe fn set_link_function<F>(&self, func: F) unsafe fn set_link_function<F>(&self, func: F)
where where
F: Fn( F: Fn(
@ -629,6 +454,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_query_function")]
#[doc(alias = "gst_pad_set_query_function_full")]
unsafe fn set_query_function<F>(&self, func: F) unsafe fn set_query_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>, &mut crate::QueryRef) -> bool + Send + Sync + 'static, F: Fn(&Self, Option<&crate::Object>, &mut crate::QueryRef) -> bool + Send + Sync + 'static,
@ -642,6 +469,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_set_unlink_function")]
#[doc(alias = "gst_pad_set_unlink_function_full")]
unsafe fn set_unlink_function<F>(&self, func: F) unsafe fn set_unlink_function<F>(&self, func: F)
where where
F: Fn(&Self, Option<&crate::Object>) + Send + Sync + 'static, F: Fn(&Self, Option<&crate::Object>) + Send + Sync + 'static,
@ -655,6 +484,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
); );
} }
#[doc(alias = "gst_pad_start_task")]
fn start_task<F: FnMut() + Send + 'static>(&self, func: F) -> Result<(), glib::BoolError> { fn start_task<F: FnMut() + Send + 'static>(&self, func: F) -> Result<(), glib::BoolError> {
unsafe extern "C" fn trampoline_pad_task<F: FnMut() + Send + 'static>(func: gpointer) { unsafe extern "C" fn trampoline_pad_task<F: FnMut() + Send + 'static>(func: gpointer) {
let (func, pad) = &mut *(func as *mut (F, *mut ffi::GstPad)); let (func, pad) = &mut *(func as *mut (F, *mut ffi::GstPad));
@ -700,7 +530,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
) )
} }
} }
#[doc(alias = "gst_pad_peer_query_convert")]
fn peer_query_convert<U: SpecificFormattedValueFullRange>( fn peer_query_convert<U: SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl FormattedValue, src_val: impl FormattedValue,
@ -722,6 +552,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_peer_query_convert")]
fn peer_query_convert_generic( fn peer_query_convert_generic(
&self, &self,
src_val: impl FormattedValue, src_val: impl FormattedValue,
@ -747,6 +578,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_peer_query_duration")]
fn peer_query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { fn peer_query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> {
unsafe { unsafe {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
@ -763,6 +595,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_peer_query_duration")]
fn peer_query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> { fn peer_query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> {
unsafe { unsafe {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
@ -779,6 +612,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_peer_query_position")]
fn peer_query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { fn peer_query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> {
unsafe { unsafe {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
@ -795,6 +629,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_peer_query_position")]
fn peer_query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> { fn peer_query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> {
unsafe { unsafe {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
@ -811,6 +646,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_query_convert")]
fn query_convert<U: SpecificFormattedValueFullRange>( fn query_convert<U: SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl FormattedValue, src_val: impl FormattedValue,
@ -832,6 +668,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_query_convert")]
fn query_convert_generic( fn query_convert_generic(
&self, &self,
src_val: impl FormattedValue, src_val: impl FormattedValue,
@ -857,6 +694,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_query_duration")]
fn query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { fn query_duration<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> {
unsafe { unsafe {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
@ -873,6 +711,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_query_duration")]
fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> { fn query_duration_generic(&self, format: Format) -> Option<GenericFormattedValue> {
unsafe { unsafe {
let mut duration = mem::MaybeUninit::uninit(); let mut duration = mem::MaybeUninit::uninit();
@ -889,6 +728,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_query_position")]
fn query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> { fn query_position<T: SpecificFormattedValueIntrinsic>(&self) -> Option<T> {
unsafe { unsafe {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
@ -905,6 +745,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_query_position")]
fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> { fn query_position_generic(&self, format: Format) -> Option<GenericFormattedValue> {
unsafe { unsafe {
let mut cur = mem::MaybeUninit::uninit(); let mut cur = mem::MaybeUninit::uninit();
@ -921,6 +762,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "get_mode")]
#[doc(alias = "GST_PAD_MODE")]
fn mode(&self) -> crate::PadMode { fn mode(&self) -> crate::PadMode {
unsafe { unsafe {
let ptr: &ffi::GstPad = &*(self.as_ptr() as *const _); let ptr: &ffi::GstPad = &*(self.as_ptr() as *const _);
@ -928,6 +771,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_sticky_events_foreach")]
fn sticky_events_foreach< fn sticky_events_foreach<
F: FnMut(&Event) -> ControlFlow<EventForeachAction, EventForeachAction>, F: FnMut(&Event) -> ControlFlow<EventForeachAction, EventForeachAction>,
>( >(
@ -978,6 +822,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "gst_pad_get_sticky_event")]
#[doc(alias = "get_sticky_event")]
fn sticky_event<T: crate::event::StickyEventType>(&self, idx: u32) -> Option<T::Owned> { fn sticky_event<T: crate::event::StickyEventType>(&self, idx: u32) -> Option<T::Owned> {
unsafe { unsafe {
let ptr = ffi::gst_pad_get_sticky_event( let ptr = ffi::gst_pad_get_sticky_event(
@ -1010,6 +856,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
#[doc(alias = "get_pad_flags")]
fn pad_flags(&self) -> PadFlags { fn pad_flags(&self) -> PadFlags {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
@ -1019,6 +866,8 @@ impl<O: IsA<Pad>> PadExtManual for O {
} }
} }
impl<O: IsA<Pad>> PadExtManual for O {}
unsafe fn create_probe_info<'a>( unsafe fn create_probe_info<'a>(
info: *mut ffi::GstPadProbeInfo, info: *mut ffi::GstPadProbeInfo,
) -> (PadProbeInfo<'a>, Option<glib::Type>) { ) -> (PadProbeInfo<'a>, Option<glib::Type>) {

View file

@ -40,16 +40,12 @@ impl Pipeline {
} }
} }
pub trait GstPipelineExtManual: 'static { mod sealed {
fn set_pipeline_flags(&self, flags: PipelineFlags); pub trait Sealed {}
impl<T: super::IsA<super::Pipeline>> Sealed for T {}
fn unset_pipeline_flags(&self, flags: PipelineFlags);
#[doc(alias = "get_pipeline_flags")]
fn pipeline_flags(&self) -> PipelineFlags;
} }
impl<O: IsA<crate::Pipeline>> GstPipelineExtManual for O { pub trait GstPipelineExtManual: sealed::Sealed + IsA<Pipeline> + 'static {
fn set_pipeline_flags(&self, flags: PipelineFlags) { fn set_pipeline_flags(&self, flags: PipelineFlags) {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
@ -66,6 +62,7 @@ impl<O: IsA<crate::Pipeline>> GstPipelineExtManual for O {
} }
} }
#[doc(alias = "get_pipeline_flags")]
fn pipeline_flags(&self) -> PipelineFlags { fn pipeline_flags(&self) -> PipelineFlags {
unsafe { unsafe {
let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _;
@ -75,6 +72,8 @@ impl<O: IsA<crate::Pipeline>> GstPipelineExtManual for O {
} }
} }
impl<O: IsA<Pipeline>> GstPipelineExtManual for O {}
impl Default for Pipeline { impl Default for Pipeline {
fn default() -> Self { fn default() -> Self {
glib::object::Object::new() glib::object::Object::new()

View file

@ -7,17 +7,14 @@ use glib::{
use crate::{PluginFeature, Rank}; use crate::{PluginFeature, Rank};
pub trait PluginFeatureExtManual: Sized + 'static { mod sealed {
#[doc(alias = "get_rank")] pub trait Sealed {}
#[doc(alias = "gst_plugin_feature_get_rank")] impl<T: super::IsA<super::PluginFeature>> Sealed for T {}
fn rank(&self) -> Rank;
#[doc(alias = "gst_plugin_feature_set_rank")]
fn set_rank(&self, rank: Rank);
#[doc(alias = "gst_plugin_feature_load")]
fn load(&self) -> Result<Self, glib::BoolError>;
} }
impl<O: IsA<PluginFeature>> PluginFeatureExtManual for O { pub trait PluginFeatureExtManual: sealed::Sealed + IsA<PluginFeature> + Sized + 'static {
#[doc(alias = "get_rank")]
#[doc(alias = "gst_plugin_feature_get_rank")]
fn rank(&self) -> Rank { fn rank(&self) -> Rank {
unsafe { unsafe {
let rank = ffi::gst_plugin_feature_get_rank(self.as_ref().to_glib_none().0); let rank = ffi::gst_plugin_feature_get_rank(self.as_ref().to_glib_none().0);
@ -25,6 +22,7 @@ impl<O: IsA<PluginFeature>> PluginFeatureExtManual for O {
} }
} }
#[doc(alias = "gst_plugin_feature_set_rank")]
fn set_rank(&self, rank: Rank) { fn set_rank(&self, rank: Rank) {
unsafe { unsafe {
ffi::gst_plugin_feature_set_rank( ffi::gst_plugin_feature_set_rank(
@ -34,6 +32,7 @@ impl<O: IsA<PluginFeature>> PluginFeatureExtManual for O {
} }
} }
#[doc(alias = "gst_plugin_feature_load")]
fn load(&self) -> Result<Self, glib::BoolError> { fn load(&self) -> Result<Self, glib::BoolError> {
unsafe { unsafe {
let loaded = Option::<PluginFeature>::from_glib_full(ffi::gst_plugin_feature_load( let loaded = Option::<PluginFeature>::from_glib_full(ffi::gst_plugin_feature_load(
@ -45,6 +44,8 @@ impl<O: IsA<PluginFeature>> PluginFeatureExtManual for O {
} }
} }
impl<O: IsA<PluginFeature>> PluginFeatureExtManual for O {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -17,17 +17,12 @@ pub trait AllocatorImpl: AllocatorImplExt + GstObjectImpl + Send + Sync {
} }
} }
pub trait AllocatorImplExt: ObjectSubclass { mod sealed {
fn parent_alloc( pub trait Sealed {}
&self, impl<T: super::AllocatorImplExt> Sealed for T {}
size: usize,
params: Option<&AllocationParams>,
) -> Result<Memory, BoolError>;
fn parent_free(&self, memory: Memory);
} }
impl<T: AllocatorImpl> AllocatorImplExt for T { pub trait AllocatorImplExt: sealed::Sealed + ObjectSubclass {
fn parent_alloc( fn parent_alloc(
&self, &self,
size: usize, size: usize,
@ -65,6 +60,8 @@ impl<T: AllocatorImpl> AllocatorImplExt for T {
} }
} }
impl<T: AllocatorImpl> AllocatorImplExt for T {}
unsafe impl<T: AllocatorImpl> IsSubclassable<T> for Allocator { unsafe impl<T: AllocatorImpl> IsSubclassable<T> for Allocator {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -23,17 +23,12 @@ pub trait BinImpl: BinImplExt + ElementImpl {
} }
} }
pub trait BinImplExt: ObjectSubclass { mod sealed {
fn parent_add_element(&self, element: &Element) -> Result<(), LoggableError>; pub trait Sealed {}
impl<T: super::BinImplExt> Sealed for T {}
fn parent_remove_element(&self, element: &Element) -> Result<(), LoggableError>;
fn parent_do_latency(&self) -> Result<(), LoggableError>;
fn parent_handle_message(&self, message: Message);
} }
impl<T: BinImpl> BinImplExt for T { pub trait BinImplExt: sealed::Sealed + ObjectSubclass {
fn parent_add_element(&self, element: &Element) -> Result<(), LoggableError> { fn parent_add_element(&self, element: &Element) -> Result<(), LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -108,6 +103,8 @@ impl<T: BinImpl> BinImplExt for T {
} }
} }
impl<T: BinImpl> BinImplExt for T {}
unsafe impl<T: BinImpl> IsSubclassable<T> for Bin { unsafe impl<T: BinImpl> IsSubclassable<T> for Bin {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -64,35 +64,12 @@ pub trait BufferPoolImpl: BufferPoolImplExt + GstObjectImpl + Send + Sync {
} }
} }
pub trait BufferPoolImplExt: ObjectSubclass { mod sealed {
fn parent_acquire_buffer( pub trait Sealed {}
&self, impl<T: super::BufferPoolImplExt> Sealed for T {}
params: Option<&BufferPoolAcquireParams>,
) -> Result<crate::Buffer, crate::FlowError>;
fn parent_alloc_buffer(
&self,
params: Option<&BufferPoolAcquireParams>,
) -> Result<crate::Buffer, crate::FlowError>;
fn parent_free_buffer(&self, buffer: crate::Buffer);
fn parent_release_buffer(&self, buffer: crate::Buffer);
fn parent_reset_buffer(&self, buffer: &mut crate::BufferRef);
fn parent_start(&self) -> bool;
fn parent_stop(&self) -> bool;
fn parent_set_config(&self, config: &mut BufferPoolConfigRef) -> bool;
fn parent_flush_start(&self);
fn parent_flush_stop(&self);
} }
impl<T: BufferPoolImpl> BufferPoolImplExt for T { pub trait BufferPoolImplExt: sealed::Sealed + ObjectSubclass {
fn parent_acquire_buffer( fn parent_acquire_buffer(
&self, &self,
params: Option<&BufferPoolAcquireParams>, params: Option<&BufferPoolAcquireParams>,
@ -280,6 +257,8 @@ impl<T: BufferPoolImpl> BufferPoolImplExt for T {
} }
} }
impl<T: BufferPoolImpl> BufferPoolImplExt for T {}
unsafe impl<T: BufferPoolImpl> IsSubclassable<T> for BufferPool { unsafe impl<T: BufferPoolImpl> IsSubclassable<T> for BufferPool {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -21,17 +21,12 @@ pub trait ChildProxyImpl: GstObjectImpl + Send + Sync {
} }
} }
pub trait ChildProxyImplExt: ObjectSubclass { mod sealed {
fn parent_child_by_name(&self, name: &str) -> Option<glib::Object>; pub trait Sealed {}
impl<T: super::ChildProxyImplExt> Sealed for T {}
fn parent_child_by_index(&self, index: u32) -> Option<glib::Object>;
fn parent_children_count(&self) -> u32;
fn parent_child_added(&self, _child: &glib::Object, _name: &str);
fn parent_child_removed(&self, _child: &glib::Object, _name: &str);
} }
impl<T: ChildProxyImpl> ChildProxyImplExt for T { pub trait ChildProxyImplExt: sealed::Sealed + ObjectSubclass {
fn parent_child_by_name(&self, name: &str) -> Option<glib::Object> { fn parent_child_by_name(&self, name: &str) -> Option<glib::Object> {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
@ -112,6 +107,8 @@ impl<T: ChildProxyImpl> ChildProxyImplExt for T {
} }
} }
impl<T: ChildProxyImpl> ChildProxyImplExt for T {}
unsafe impl<T: ChildProxyImpl> IsImplementable<T> for ChildProxy { unsafe impl<T: ChildProxyImpl> IsImplementable<T> for ChildProxy {
fn interface_init(iface: &mut glib::Interface<Self>) { fn interface_init(iface: &mut glib::Interface<Self>) {
let iface = iface.as_mut(); let iface = iface.as_mut();

View file

@ -31,49 +31,18 @@ pub trait ClockImpl: ClockImplExt + GstObjectImpl + Send + Sync {
} }
} }
pub trait ClockImplExt: ObjectSubclass { mod sealed {
pub trait Sealed {}
impl<T: super::ClockImplExt> Sealed for T {}
}
pub trait ClockImplExt: sealed::Sealed + ObjectSubclass {
fn parent_change_resolution( fn parent_change_resolution(
&self, &self,
old_resolution: ClockTime, old_resolution: ClockTime,
new_resolution: ClockTime, new_resolution: ClockTime,
) -> ClockTime; ) -> ClockTime;
fn parent_resolution(&self) -> ClockTime;
fn parent_internal_time(&self) -> ClockTime;
fn parent_wait(&self, id: &ClockId) -> (Result<ClockSuccess, ClockError>, ClockTimeDiff);
fn parent_wait_async(&self, id: &ClockId) -> Result<ClockSuccess, ClockError>;
fn parent_unschedule(&self, id: &ClockId);
fn wake_id(&self, id: &ClockId);
}
impl<T: ClockImpl> ClockImplExt for T {
fn parent_change_resolution(
&self,
old_resolution: ClockTime,
new_resolution: ClockTime,
) -> ClockTime {
unsafe {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass;
if let Some(func) = (*parent_class).change_resolution {
try_from_glib(func(
self.obj().unsafe_cast_ref::<Clock>().to_glib_none().0,
old_resolution.into_glib(),
new_resolution.into_glib(),
))
.expect("undefined resolution")
} else {
self.resolution()
}
}
}
fn parent_resolution(&self) -> ClockTime { fn parent_resolution(&self) -> ClockTime {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -191,6 +160,30 @@ impl<T: ClockImpl> ClockImplExt for T {
} }
} }
impl<T: ClockImpl> ClockImplExt for T {
fn parent_change_resolution(
&self,
old_resolution: ClockTime,
new_resolution: ClockTime,
) -> ClockTime {
unsafe {
let data = Self::type_data();
let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass;
if let Some(func) = (*parent_class).change_resolution {
try_from_glib(func(
self.obj().unsafe_cast_ref::<Clock>().to_glib_none().0,
old_resolution.into_glib(),
new_resolution.into_glib(),
))
.expect("undefined resolution")
} else {
self.resolution()
}
}
}
}
unsafe impl<T: ClockImpl> IsSubclassable<T> for Clock { unsafe impl<T: ClockImpl> IsSubclassable<T> for Clock {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -17,13 +17,12 @@ pub trait DeviceImpl: DeviceImplExt + GstObjectImpl + Send + Sync {
} }
} }
pub trait DeviceImplExt: ObjectSubclass { mod sealed {
fn parent_create_element(&self, name: Option<&str>) -> Result<Element, LoggableError>; pub trait Sealed {}
impl<T: super::DeviceImplExt> Sealed for T {}
fn parent_reconfigure_element(&self, element: &Element) -> Result<(), LoggableError>;
} }
impl<T: DeviceImpl> DeviceImplExt for T { pub trait DeviceImplExt: sealed::Sealed + ObjectSubclass {
fn parent_create_element(&self, name: Option<&str>) -> Result<Element, LoggableError> { fn parent_create_element(&self, name: Option<&str>) -> Result<Element, LoggableError> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -72,6 +71,8 @@ impl<T: DeviceImpl> DeviceImplExt for T {
} }
} }
impl<T: DeviceImpl> DeviceImplExt for T {}
unsafe impl<T: DeviceImpl> IsSubclassable<T> for Device { unsafe impl<T: DeviceImpl> IsSubclassable<T> for Device {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -82,15 +82,12 @@ pub trait DeviceProviderImpl: DeviceProviderImplExt + GstObjectImpl + Send + Syn
} }
} }
pub trait DeviceProviderImplExt: ObjectSubclass { mod sealed {
fn parent_probe(&self) -> Vec<Device>; pub trait Sealed {}
impl<T: super::DeviceProviderImplExt> Sealed for T {}
fn parent_start(&self) -> Result<(), LoggableError>;
fn parent_stop(&self);
} }
impl<T: DeviceProviderImpl> DeviceProviderImplExt for T { pub trait DeviceProviderImplExt: sealed::Sealed + ObjectSubclass {
fn parent_probe(&self) -> Vec<Device> { fn parent_probe(&self) -> Vec<Device> {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -141,6 +138,8 @@ impl<T: DeviceProviderImpl> DeviceProviderImplExt for T {
} }
} }
impl<T: DeviceProviderImpl> DeviceProviderImplExt for T {}
unsafe impl<T: DeviceProviderImpl> IsSubclassable<T> for DeviceProvider { unsafe impl<T: DeviceProviderImpl> IsSubclassable<T> for DeviceProvider {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -121,47 +121,12 @@ pub trait ElementImpl: ElementImplExt + GstObjectImpl + Send + Sync {
} }
} }
pub trait ElementImplExt: ObjectSubclass { mod sealed {
fn parent_change_state( pub trait Sealed {}
&self, impl<T: super::ElementImplExt> Sealed for T {}
transition: StateChange,
) -> Result<StateChangeSuccess, StateChangeError>;
fn parent_request_new_pad(
&self,
templ: &crate::PadTemplate,
name: Option<&str>,
caps: Option<&crate::Caps>,
) -> Option<crate::Pad>;
fn parent_release_pad(&self, pad: &crate::Pad);
fn parent_send_event(&self, event: Event) -> bool;
fn parent_query(&self, query: &mut QueryRef) -> bool;
fn parent_set_context(&self, context: &crate::Context);
fn parent_set_clock(&self, clock: Option<&crate::Clock>) -> bool;
fn parent_provide_clock(&self) -> Option<crate::Clock>;
fn parent_post_message(&self, msg: crate::Message) -> bool;
fn panicked(&self) -> &atomic::AtomicBool;
fn catch_panic<R, F: FnOnce(&Self) -> R, G: FnOnce() -> R>(&self, fallback: G, f: F) -> R;
fn catch_panic_pad_function<R, F: FnOnce(&Self) -> R, G: FnOnce() -> R>(
parent: Option<&crate::Object>,
fallback: G,
f: F,
) -> R;
fn post_error_message(&self, msg: crate::ErrorMessage);
} }
impl<T: ElementImpl> ElementImplExt for T { pub trait ElementImplExt: sealed::Sealed + ObjectSubclass {
fn parent_change_state( fn parent_change_state(
&self, &self,
transition: StateChange, transition: StateChange,
@ -349,6 +314,8 @@ impl<T: ElementImpl> ElementImplExt for T {
} }
} }
impl<T: ElementImpl> ElementImplExt for T {}
unsafe impl<T: ElementImpl> IsSubclassable<T> for Element { unsafe impl<T: ElementImpl> IsSubclassable<T> for Element {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -15,13 +15,12 @@ pub trait PadImpl: PadImplExt + GstObjectImpl + Send + Sync {
} }
} }
pub trait PadImplExt: ObjectSubclass { mod sealed {
fn parent_linked(&self, peer: &Pad); pub trait Sealed {}
impl<T: super::PadImplExt> Sealed for T {}
fn parent_unlinked(&self, peer: &Pad);
} }
impl<T: PadImpl> PadImplExt for T { pub trait PadImplExt: sealed::Sealed + ObjectSubclass {
fn parent_linked(&self, peer: &Pad) { fn parent_linked(&self, peer: &Pad) {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();
@ -57,6 +56,8 @@ impl<T: PadImpl> PadImplExt for T {
} }
} }
impl<T: PadImpl> PadImplExt for T {}
unsafe impl<T: PadImpl> IsSubclassable<T> for Pad { unsafe impl<T: PadImpl> IsSubclassable<T> for Pad {
fn class_init(klass: &mut glib::Class<Self>) { fn class_init(klass: &mut glib::Class<Self>) {
Self::parent_class_init::<T>(klass); Self::parent_class_init::<T>(klass);

View file

@ -13,13 +13,12 @@ pub trait URIHandlerImpl: super::element::ElementImpl {
fn set_uri(&self, uri: &str) -> Result<(), glib::Error>; fn set_uri(&self, uri: &str) -> Result<(), glib::Error>;
} }
pub trait URIHandlerImplExt: ObjectSubclass { mod sealed {
fn parent_protocols() -> Vec<String>; pub trait Sealed {}
fn parent_uri(&self) -> Option<String>; impl<T: super::URIHandlerImplExt> Sealed for T {}
fn parent_set_uri(&self, uri: &str) -> Result<(), glib::Error>;
} }
impl<T: URIHandlerImpl> URIHandlerImplExt for T { pub trait URIHandlerImplExt: sealed::Sealed + ObjectSubclass {
fn parent_protocols() -> Vec<String> { fn parent_protocols() -> Vec<String> {
unsafe { unsafe {
let type_data = Self::type_data(); let type_data = Self::type_data();
@ -74,6 +73,8 @@ impl<T: URIHandlerImpl> URIHandlerImplExt for T {
} }
} }
impl<T: URIHandlerImpl> URIHandlerImplExt for T {}
unsafe impl<T: URIHandlerImpl> IsImplementable<T> for URIHandler { unsafe impl<T: URIHandlerImpl> IsImplementable<T> for URIHandler {
fn interface_init(iface: &mut glib::Interface<Self>) { fn interface_init(iface: &mut glib::Interface<Self>) {
let iface = iface.as_mut(); let iface = iface.as_mut();

View file

@ -4,12 +4,13 @@ use glib::{prelude::*, translate::*};
use crate::{tags::*, TagMergeMode, TagSetter}; use crate::{tags::*, TagMergeMode, TagSetter};
pub trait TagSetterExtManual: 'static { mod sealed {
#[doc(alias = "gst_tag_setter_add_tag_value")] pub trait Sealed {}
fn add_tag<'a, T: Tag<'a>>(&self, value: &T::TagType, mode: TagMergeMode); impl<T: super::IsA<super::TagSetter>> Sealed for T {}
} }
impl<O: IsA<TagSetter>> TagSetterExtManual for O { pub trait TagSetterExtManual: sealed::Sealed + IsA<TagSetter> + 'static {
#[doc(alias = "gst_tag_setter_add_tag_value")]
fn add_tag<'a, T: Tag<'a>>(&self, value: &T::TagType, mode: TagMergeMode) { fn add_tag<'a, T: Tag<'a>>(&self, value: &T::TagType, mode: TagMergeMode) {
unsafe { unsafe {
let v = value.to_send_value(); let v = value.to_send_value();
@ -23,3 +24,5 @@ impl<O: IsA<TagSetter>> TagSetterExtManual for O {
} }
} }
} }
impl<O: IsA<TagSetter>> TagSetterExtManual for O {}

View file

@ -10,16 +10,13 @@ unsafe extern "C" fn task_pool_trampoline<P: FnOnce() + Send + 'static>(data: gp
let func = Box::from_raw(data as *mut P); let func = Box::from_raw(data as *mut P);
func() func()
} }
mod sealed {
pub trait TaskPoolExtManual: 'static { pub trait Sealed {}
#[doc(alias = "gst_task_pool_push")] impl<T: super::IsA<super::TaskPool>> Sealed for T {}
fn push<P: FnOnce() + Send + 'static>(
&self,
func: P,
) -> Result<Option<TaskPoolTaskHandle>, glib::Error>;
} }
impl<O: IsA<TaskPool>> TaskPoolExtManual for O { pub trait TaskPoolExtManual: sealed::Sealed + IsA<TaskPool> + 'static {
#[doc(alias = "gst_task_pool_push")]
fn push<P: FnOnce() + Send + 'static>( fn push<P: FnOnce() + Send + 'static>(
&self, &self,
func: P, func: P,
@ -56,6 +53,8 @@ impl<O: IsA<TaskPool>> TaskPoolExtManual for O {
} }
} }
impl<O: IsA<TaskPool>> TaskPoolExtManual for O {}
impl TaskPool { impl TaskPool {
unsafe fn join(&self, id: ptr::NonNull<libc::c_void>) { unsafe fn join(&self, id: ptr::NonNull<libc::c_void>) {
ffi::gst_task_pool_join(self.to_glib_none().0, id.as_ptr()) ffi::gst_task_pool_join(self.to_glib_none().0, id.as_ptr())