Remove unnecessary sealing of ImplExt traits and enforce type hierarchy more strictly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
This commit is contained in:
Sebastian Dröge 2024-10-19 22:18:53 +03:00 committed by GStreamer Marge Bot
parent abbc85c3d0
commit 445a4122d5
67 changed files with 183 additions and 381 deletions

View file

@ -27,7 +27,7 @@ pub trait IirFilterExt: IsA<IirFilter> {
impl<O: IsA<IirFilter>> IirFilterExt for O {} impl<O: IsA<IirFilter>> IirFilterExt for O {}
/// Trait to implement in `IirFilter` subclasses. /// Trait to implement in `IirFilter` subclasses.
pub trait IirFilterImpl: AudioFilterImpl { pub trait IirFilterImpl: AudioFilterImpl + ObjectSubclass<Type: IsA<IirFilter>> {
/// Called whenever the sample rate is changing. /// Called whenever the sample rate is changing.
fn set_rate(&self, rate: u32) { fn set_rate(&self, rate: u32) {
self.parent_set_rate(rate); self.parent_set_rate(rate);

View file

@ -1,6 +1,9 @@
use glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use crate::{subclass::fd_allocator::FdAllocatorImpl, DmaBufAllocator}; use crate::{subclass::fd_allocator::FdAllocatorImpl, DmaBufAllocator};
pub trait DmaBufAllocatorImpl: FdAllocatorImpl {} pub trait DmaBufAllocatorImpl:
FdAllocatorImpl + ObjectSubclass<Type: IsA<DmaBufAllocator>>
{
}
unsafe impl<T: DmaBufAllocatorImpl> IsSubclassable<T> for DmaBufAllocator {} unsafe impl<T: DmaBufAllocatorImpl> IsSubclassable<T> for DmaBufAllocator {}

View file

@ -1,7 +1,7 @@
use glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use crate::FdAllocator; use crate::FdAllocator;
use gst::subclass::prelude::AllocatorImpl; use gst::subclass::prelude::AllocatorImpl;
pub trait FdAllocatorImpl: AllocatorImpl {} pub trait FdAllocatorImpl: AllocatorImpl + ObjectSubclass<Type: IsA<FdAllocator>> {}
unsafe impl<T: FdAllocatorImpl> IsSubclassable<T> for FdAllocator {} unsafe impl<T: FdAllocatorImpl> IsSubclassable<T> for FdAllocator {}

View file

@ -7,7 +7,7 @@ use gst_base::{prelude::*, subclass::prelude::*};
use crate::{ffi, AudioAggregator, AudioAggregatorPad}; use crate::{ffi, AudioAggregator, AudioAggregatorPad};
pub trait AudioAggregatorImpl: AudioAggregatorImplExt + AggregatorImpl { pub trait AudioAggregatorImpl: AggregatorImpl + ObjectSubclass<Type: IsA<AudioAggregator>> {
fn create_output_buffer(&self, num_frames: u32) -> Option<gst::Buffer> { fn create_output_buffer(&self, num_frames: u32) -> Option<gst::Buffer> {
self.parent_create_output_buffer(num_frames) self.parent_create_output_buffer(num_frames)
} }
@ -26,12 +26,7 @@ pub trait AudioAggregatorImpl: AudioAggregatorImplExt + AggregatorImpl {
} }
} }
mod sealed { pub trait AudioAggregatorImplExt: AudioAggregatorImpl {
pub trait Sealed {}
impl<T: super::AudioAggregatorImplExt> Sealed 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();

View file

@ -1,10 +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 gst_base::subclass::prelude::*; use gst_base::{prelude::*, subclass::prelude::*};
use super::prelude::AudioAggregatorPadImpl; use super::prelude::AudioAggregatorPadImpl;
use crate::AudioAggregatorConvertPad; use crate::AudioAggregatorConvertPad;
pub trait AudioAggregatorConvertPadImpl: AudioAggregatorPadImpl {} pub trait AudioAggregatorConvertPadImpl:
AudioAggregatorPadImpl + ObjectSubclass<Type: IsA<AudioAggregatorConvertPad>>
{
}
unsafe impl<T: AudioAggregatorConvertPadImpl> IsSubclassable<T> for AudioAggregatorConvertPad {} unsafe impl<T: AudioAggregatorConvertPadImpl> IsSubclassable<T> for AudioAggregatorConvertPad {}

View file

@ -7,7 +7,9 @@ use gst_base::{prelude::*, subclass::prelude::*};
use crate::{ffi, AudioAggregatorPad}; use crate::{ffi, AudioAggregatorPad};
pub trait AudioAggregatorPadImpl: AudioAggregatorPadImplExt + AggregatorPadImpl { pub trait AudioAggregatorPadImpl:
AggregatorPadImpl + ObjectSubclass<Type: IsA<AudioAggregatorPad>>
{
const HANDLE_CONVERSION: bool = false; const HANDLE_CONVERSION: bool = false;
fn update_conversion_info(&self) { fn update_conversion_info(&self) {
@ -24,12 +26,7 @@ pub trait AudioAggregatorPadImpl: AudioAggregatorPadImplExt + AggregatorPadImpl
} }
} }
mod sealed { pub trait AudioAggregatorPadImplExt: AudioAggregatorPadImpl {
pub trait Sealed {}
impl<T: super::AudioAggregatorPadImplExt> Sealed 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();

View file

@ -1,9 +1,9 @@
// 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 gst_base::subclass::prelude::*; use gst_base::{prelude::*, subclass::prelude::*};
use crate::AudioBaseSink; use crate::AudioBaseSink;
pub trait AudioBaseSinkImpl: BaseSinkImpl {} pub trait AudioBaseSinkImpl: BaseSinkImpl + ObjectSubclass<Type: IsA<AudioBaseSink>> {}
unsafe impl<T: AudioBaseSinkImpl> IsSubclassable<T> for AudioBaseSink {} unsafe impl<T: AudioBaseSinkImpl> IsSubclassable<T> for AudioBaseSink {}

View file

@ -1,9 +1,9 @@
// 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 gst_base::subclass::prelude::*; use gst_base::{prelude::*, subclass::prelude::*};
use crate::AudioBaseSrc; use crate::AudioBaseSrc;
pub trait AudioBaseSrcImpl: BaseSrcImpl {} pub trait AudioBaseSrcImpl: BaseSrcImpl + ObjectSubclass<Type: IsA<AudioBaseSrc>> {}
unsafe impl<T: AudioBaseSrcImpl> IsSubclassable<T> for AudioBaseSrc {} unsafe impl<T: AudioBaseSrcImpl> IsSubclassable<T> for AudioBaseSrc {}

View file

@ -7,7 +7,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, prelude::*, AudioDecoder}; use crate::{ffi, prelude::*, AudioDecoder};
pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl { pub trait AudioDecoderImpl: ElementImpl + ObjectSubclass<Type: IsA<AudioDecoder>> {
fn open(&self) -> Result<(), gst::ErrorMessage> { fn open(&self) -> Result<(), gst::ErrorMessage> {
self.parent_open() self.parent_open()
} }
@ -86,12 +86,7 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl {
} }
} }
mod sealed { pub trait AudioDecoderImplExt: AudioDecoderImpl {
pub trait Sealed {}
impl<T: super::AudioDecoderImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, prelude::*, AudioEncoder, AudioInfo}; use crate::{ffi, prelude::*, AudioEncoder, AudioInfo};
pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl { pub trait AudioEncoderImpl: ElementImpl + ObjectSubclass<Type: IsA<AudioEncoder>> {
fn open(&self) -> Result<(), gst::ErrorMessage> { fn open(&self) -> Result<(), gst::ErrorMessage> {
self.parent_open() self.parent_open()
} }
@ -82,12 +82,7 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl {
} }
} }
mod sealed { pub trait AudioEncoderImplExt: AudioEncoderImpl {
pub trait Sealed {}
impl<T: super::AudioEncoderImplExt> Sealed 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();

View file

@ -5,7 +5,7 @@ use gst_base::{prelude::*, subclass::prelude::*};
use crate::{ffi, AudioFilter, AudioInfo}; use crate::{ffi, AudioFilter, AudioInfo};
pub trait AudioFilterImpl: AudioFilterImplExt + BaseTransformImpl { pub trait AudioFilterImpl: BaseTransformImpl + ObjectSubclass<Type: IsA<AudioFilter>> {
fn allowed_caps() -> &'static gst::Caps { fn allowed_caps() -> &'static gst::Caps {
Self::parent_allowed_caps() Self::parent_allowed_caps()
} }
@ -15,12 +15,7 @@ pub trait AudioFilterImpl: AudioFilterImplExt + BaseTransformImpl {
} }
} }
mod sealed { pub trait AudioFilterImplExt: AudioFilterImpl {
pub trait Sealed {}
impl<T: super::AudioFilterImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use gst_base::subclass::prelude::*;
use super::prelude::*; use super::prelude::*;
use crate::{ffi, AudioRingBufferSpec, AudioSink}; use crate::{ffi, AudioRingBufferSpec, AudioSink};
pub trait AudioSinkImpl: AudioSinkImplExt + AudioBaseSinkImpl { pub trait AudioSinkImpl: AudioBaseSinkImpl + ObjectSubclass<Type: IsA<AudioSink>> {
fn close(&self) -> Result<(), LoggableError> { fn close(&self) -> Result<(), LoggableError> {
self.parent_close() self.parent_close()
} }
@ -37,12 +37,7 @@ pub trait AudioSinkImpl: AudioSinkImplExt + AudioBaseSinkImpl {
} }
} }
mod sealed { pub trait AudioSinkImplExt: AudioSinkImpl {
pub trait Sealed {}
impl<T: super::AudioSinkImplExt> Sealed 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();

View file

@ -9,7 +9,7 @@ use gst_base::subclass::prelude::*;
use super::prelude::*; use super::prelude::*;
use crate::{ffi, AudioRingBufferSpec, AudioSrc}; use crate::{ffi, AudioRingBufferSpec, AudioSrc};
pub trait AudioSrcImpl: AudioSrcImplExt + AudioBaseSrcImpl { pub trait AudioSrcImpl: AudioBaseSrcImpl + ObjectSubclass<Type: IsA<AudioSrc>> {
fn close(&self) -> Result<(), LoggableError> { fn close(&self) -> Result<(), LoggableError> {
self.parent_close() self.parent_close()
} }
@ -39,12 +39,7 @@ pub trait AudioSrcImpl: AudioSrcImplExt + AudioBaseSrcImpl {
} }
} }
mod sealed { pub trait AudioSrcImplExt: AudioSrcImpl {
pub trait Sealed {}
impl<T: super::AudioSrcImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, Aggregator, AggregatorPad}; use crate::{ffi, Aggregator, AggregatorPad};
pub trait AggregatorImpl: AggregatorImplExt + ElementImpl { pub trait AggregatorImpl: ElementImpl + ObjectSubclass<Type: IsA<Aggregator>> {
fn flush(&self) -> Result<gst::FlowSuccess, gst::FlowError> { fn flush(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
self.parent_flush() self.parent_flush()
} }
@ -135,12 +135,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
} }
} }
mod sealed { pub trait AggregatorImplExt: AggregatorImpl {
pub trait Sealed {}
impl<T: super::AggregatorImplExt> Sealed 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();

View file

@ -5,7 +5,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, Aggregator, AggregatorPad}; use crate::{ffi, Aggregator, AggregatorPad};
pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl { pub trait AggregatorPadImpl: PadImpl + ObjectSubclass<Type: IsA<AggregatorPad>> {
fn flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> { fn flush(&self, aggregator: &Aggregator) -> Result<gst::FlowSuccess, gst::FlowError> {
self.parent_flush(aggregator) self.parent_flush(aggregator)
} }
@ -15,12 +15,7 @@ pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
} }
} }
mod sealed { pub trait AggregatorPadImplExt: AggregatorPadImpl {
pub trait Sealed {}
impl<T: super::AggregatorPadImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, prelude::*, BaseParse, BaseParseFrame}; use crate::{ffi, prelude::*, BaseParse, BaseParseFrame};
pub trait BaseParseImpl: BaseParseImplExt + ElementImpl { pub trait BaseParseImpl: ElementImpl + ObjectSubclass<Type: IsA<BaseParse>> {
fn start(&self) -> Result<(), gst::ErrorMessage> { fn start(&self) -> Result<(), gst::ErrorMessage> {
self.parent_start() self.parent_start()
} }
@ -36,12 +36,7 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
} }
} }
mod sealed { pub trait BaseParseImplExt: BaseParseImpl {
pub trait Sealed {}
impl<T: super::BaseParseImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, BaseSink}; use crate::{ffi, BaseSink};
pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl { pub trait BaseSinkImpl: ElementImpl + ObjectSubclass<Type: IsA<BaseSink>> {
fn start(&self) -> Result<(), gst::ErrorMessage> { fn start(&self) -> Result<(), gst::ErrorMessage> {
self.parent_start() self.parent_start()
} }
@ -68,12 +68,7 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
} }
} }
mod sealed { pub trait BaseSinkImplExt: BaseSinkImpl {
pub trait Sealed {}
impl<T: super::BaseSinkImplExt> Sealed 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();

View file

@ -20,7 +20,7 @@ pub enum CreateSuccess {
NewBufferList(gst::BufferList), NewBufferList(gst::BufferList),
} }
pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl { pub trait BaseSrcImpl: ElementImpl + ObjectSubclass<Type: IsA<BaseSrc>> {
fn start(&self) -> Result<(), gst::ErrorMessage> { fn start(&self) -> Result<(), gst::ErrorMessage> {
self.parent_start() self.parent_start()
} }
@ -108,12 +108,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
} }
} }
mod sealed { pub trait BaseSrcImplExt: BaseSrcImpl {
pub trait Sealed {}
impl<T: super::BaseSrcImplExt> Sealed 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();

View file

@ -14,7 +14,7 @@ pub enum BaseTransformMode {
Both, Both,
} }
pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl { pub trait BaseTransformImpl: ElementImpl + ObjectSubclass<Type: IsA<BaseTransform>> {
const MODE: BaseTransformMode; const MODE: BaseTransformMode;
const PASSTHROUGH_ON_SAME_CAPS: bool; const PASSTHROUGH_ON_SAME_CAPS: bool;
const TRANSFORM_IP_ON_PASSTHROUGH: bool; const TRANSFORM_IP_ON_PASSTHROUGH: bool;
@ -154,12 +154,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
} }
} }
mod sealed { pub trait BaseTransformImplExt: BaseTransformImpl {
pub trait Sealed {}
impl<T: super::BaseTransformImplExt> Sealed 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();

View file

@ -3,12 +3,12 @@
use std::ptr; use std::ptr;
use glib::{prelude::*, subclass::prelude::*, translate::*}; use glib::{prelude::*, subclass::prelude::*, translate::*};
use gst::prelude::*; use gst::{prelude::*, subclass::prelude::*};
use super::base_src::{BaseSrcImpl, CreateSuccess}; use super::base_src::{BaseSrcImpl, CreateSuccess};
use crate::{ffi, prelude::*, PushSrc}; use crate::{ffi, prelude::*, PushSrc};
pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl { pub trait PushSrcImpl: BaseSrcImpl + ObjectSubclass<Type: IsA<PushSrc>> {
fn fill(&self, buffer: &mut gst::BufferRef) -> Result<gst::FlowSuccess, gst::FlowError> { fn fill(&self, buffer: &mut gst::BufferRef) -> Result<gst::FlowSuccess, gst::FlowError> {
PushSrcImplExt::parent_fill(self, buffer) PushSrcImplExt::parent_fill(self, buffer)
} }
@ -22,12 +22,7 @@ pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl {
} }
} }
mod sealed { pub trait PushSrcImplExt: PushSrcImpl {
pub trait Sealed {}
impl<T: super::PushSrcImplExt> Sealed 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();

View file

@ -3,7 +3,7 @@
use crate::{ffi, prelude::*, Formatter}; use crate::{ffi, prelude::*, Formatter};
use glib::{subclass::prelude::*, translate::*}; use glib::{subclass::prelude::*, translate::*};
pub trait FormatterImpl: FormatterImplExt + ObjectImpl + Send + Sync { pub trait FormatterImpl: ObjectImpl + ObjectSubclass<Type: IsA<Formatter>> + Send + Sync {
fn can_load_uri(&self, uri: &str) -> Result<(), glib::Error> { fn can_load_uri(&self, uri: &str) -> Result<(), glib::Error> {
self.parent_can_load_uri(uri) self.parent_can_load_uri(uri)
} }
@ -22,12 +22,7 @@ pub trait FormatterImpl: FormatterImplExt + ObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait FormatterImplExt: FormatterImpl {
pub trait Sealed {}
impl<T: super::FormatterImplExt> Sealed 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();

View file

@ -5,7 +5,7 @@ use gst_base::subclass::prelude::*;
use crate::{ffi, prelude::*, GLBaseFilter}; use crate::{ffi, prelude::*, GLBaseFilter};
pub trait GLBaseFilterImpl: GLBaseFilterImplExt + BaseTransformImpl { pub trait GLBaseFilterImpl: BaseTransformImpl + ObjectSubclass<Type: IsA<GLBaseFilter>> {
fn gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> { fn gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> {
self.parent_gl_set_caps(incaps, outcaps) self.parent_gl_set_caps(incaps, outcaps)
} }
@ -19,12 +19,7 @@ pub trait GLBaseFilterImpl: GLBaseFilterImplExt + BaseTransformImpl {
} }
} }
mod sealed { pub trait GLBaseFilterImplExt: GLBaseFilterImpl {
pub trait Sealed {}
impl<T: super::GLBaseFilterImplExt> Sealed 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();

View file

@ -5,7 +5,7 @@ use gst_base::subclass::prelude::*;
use crate::{ffi, prelude::*, GLBaseSrc, GLMemory, GLAPI}; use crate::{ffi, prelude::*, GLBaseSrc, GLMemory, GLAPI};
pub trait GLBaseSrcImpl: GLBaseSrcImplExt + PushSrcImpl { pub trait GLBaseSrcImpl: PushSrcImpl + ObjectSubclass<Type: IsA<GLBaseSrc>> {
const SUPPORTED_GL_API: GLAPI; const SUPPORTED_GL_API: GLAPI;
fn gl_start(&self) -> Result<(), LoggableError> { fn gl_start(&self) -> Result<(), LoggableError> {
@ -21,12 +21,7 @@ pub trait GLBaseSrcImpl: GLBaseSrcImplExt + PushSrcImpl {
} }
} }
mod sealed { pub trait GLBaseSrcImplExt: GLBaseSrcImpl {
pub trait Sealed {}
impl<T: super::GLBaseSrcImplExt> Sealed 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();

View file

@ -13,7 +13,7 @@ pub enum GLFilterMode {
Texture, Texture,
} }
pub trait GLFilterImpl: GLFilterImplExt + GLBaseFilterImpl { pub trait GLFilterImpl: GLBaseFilterImpl + ObjectSubclass<Type: IsA<GLFilter>> {
const MODE: GLFilterMode; const MODE: GLFilterMode;
// rustdoc-stripper-ignore-next // rustdoc-stripper-ignore-next
/// Calls [`add_rgba_pad_templates`](ffi::gst_gl_filter_add_rgba_pad_templates) /// Calls [`add_rgba_pad_templates`](ffi::gst_gl_filter_add_rgba_pad_templates)
@ -46,12 +46,7 @@ pub trait GLFilterImpl: GLFilterImplExt + GLBaseFilterImpl {
} }
} }
mod sealed { pub trait GLFilterImplExt: GLFilterImpl {
pub trait Sealed {}
impl<T: super::GLFilterImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use crate::{ffi, AudioVisualizer};
pub struct AudioVisualizerSetupToken<'a>(pub(crate) &'a AudioVisualizer); pub struct AudioVisualizerSetupToken<'a>(pub(crate) &'a AudioVisualizer);
pub trait AudioVisualizerImpl: AudioVisualizerImplExt + ElementImpl { pub trait AudioVisualizerImpl: ElementImpl + ObjectSubclass<Type: IsA<AudioVisualizer>> {
fn setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> { fn setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> {
self.parent_setup(token) self.parent_setup(token)
} }
@ -28,12 +28,7 @@ pub trait AudioVisualizerImpl: AudioVisualizerImplExt + ElementImpl {
} }
} }
mod sealed { pub trait AudioVisualizerImplExt: AudioVisualizerImpl {
pub trait Sealed {}
impl<T: super::AudioVisualizerImplExt> Sealed 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,

View file

@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use crate::{ffi, Play, PlayVideoRenderer}; use crate::{ffi, Play, PlayVideoRenderer};
pub trait PlayVideoRendererImpl: ObjectImpl { pub trait PlayVideoRendererImpl: ObjectImpl + ObjectSubclass<Type: IsA<PlayVideoRenderer>> {
fn create_video_sink(&self, play: &Play) -> gst::Element; fn create_video_sink(&self, play: &Play) -> gst::Element;
} }
@ -16,12 +16,7 @@ unsafe impl<T: PlayVideoRendererImpl> IsImplementable<T> for PlayVideoRenderer {
} }
} }
mod sealed { pub trait PlayVideoRendererImplExt: PlayVideoRendererImpl {
pub trait Sealed {}
impl<T: super::PlayVideoRendererImplExt> Sealed 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();

View file

@ -4,7 +4,9 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use crate::{ffi, Player, PlayerVideoRenderer}; use crate::{ffi, Player, PlayerVideoRenderer};
pub trait PlayerVideoRendererImpl: ObjectImpl { pub trait PlayerVideoRendererImpl:
ObjectImpl + ObjectSubclass<Type: IsA<PlayerVideoRenderer>>
{
fn create_video_sink(&self, player: &Player) -> gst::Element; fn create_video_sink(&self, player: &Player) -> gst::Element;
} }
@ -16,12 +18,7 @@ unsafe impl<T: PlayerVideoRendererImpl> IsImplementable<T> for PlayerVideoRender
} }
} }
mod sealed { pub trait PlayerVideoRendererImplExt: PlayerVideoRendererImpl {
pub trait Sealed {}
impl<T: super::PlayerVideoRendererImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, prelude::*, RTPBaseDepayload}; use crate::{ffi, prelude::*, RTPBaseDepayload};
pub trait RTPBaseDepayloadImpl: RTPBaseDepayloadImplExt + ElementImpl { pub trait RTPBaseDepayloadImpl: ElementImpl + ObjectSubclass<Type: IsA<RTPBaseDepayload>> {
fn set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { fn set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> {
self.parent_set_caps(caps) self.parent_set_caps(caps)
} }
@ -28,12 +28,7 @@ pub trait RTPBaseDepayloadImpl: RTPBaseDepayloadImplExt + ElementImpl {
} }
} }
mod sealed { pub trait RTPBaseDepayloadImplExt: RTPBaseDepayloadImpl {
pub trait Sealed {}
impl<T: super::RTPBaseDepayloadImplExt> Sealed 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();

View file

@ -5,7 +5,7 @@ use gst::subclass::prelude::*;
use crate::{ffi, prelude::*, RTPBasePayload}; use crate::{ffi, prelude::*, RTPBasePayload};
pub trait RTPBasePayloadImpl: RTPBasePayloadImplExt + ElementImpl { pub trait RTPBasePayloadImpl: ElementImpl + ObjectSubclass<Type: IsA<RTPBasePayload>> {
fn caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps { fn caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps {
self.parent_caps(pad, filter) self.parent_caps(pad, filter)
} }
@ -31,12 +31,7 @@ pub trait RTPBasePayloadImpl: RTPBasePayloadImplExt + ElementImpl {
} }
} }
mod sealed { pub trait RTPBasePayloadImplExt: RTPBasePayloadImpl {
pub trait Sealed {}
impl<T: super::RTPBasePayloadImplExt> Sealed 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();

View file

@ -4,8 +4,11 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use super::prelude::*; use super::prelude::*;
use crate::ffi; use crate::ffi;
use crate::RTPHeaderExtension;
pub trait RTPHeaderExtensionImpl: RTPHeaderExtensionImplExt + ElementImpl { pub trait RTPHeaderExtensionImpl:
ElementImpl + ObjectSubclass<Type: IsA<RTPHeaderExtension>>
{
const URI: &'static str; const URI: &'static str;
fn supported_flags(&self) -> crate::RTPHeaderExtensionFlags { fn supported_flags(&self) -> crate::RTPHeaderExtensionFlags {
@ -56,12 +59,7 @@ pub trait RTPHeaderExtensionImpl: RTPHeaderExtensionImplExt + ElementImpl {
} }
} }
mod sealed { pub trait RTPHeaderExtensionImplExt: RTPHeaderExtensionImpl {
pub trait Sealed {}
impl<T: super::RTPHeaderExtensionImplExt> Sealed 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();
@ -71,7 +69,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
.expect("no parent \"get_supported_flags\" implementation"); .expect("no parent \"get_supported_flags\" implementation");
from_glib(f(self from_glib(f(self
.obj() .obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0)) .0))
} }
@ -86,7 +84,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
.expect("no parent \"get_max_size\" implementation"); .expect("no parent \"get_max_size\" implementation");
f( f(
self.obj() self.obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0, .0,
input.as_ptr(), input.as_ptr(),
@ -110,7 +108,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
let res = f( let res = f(
self.obj() self.obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0, .0,
input.as_ptr(), input.as_ptr(),
@ -147,7 +145,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
gst::result_from_gboolean!( gst::result_from_gboolean!(
f( f(
self.obj() self.obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0, .0,
read_flags.into_glib(), read_flags.into_glib(),
@ -169,7 +167,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
gst::result_from_gboolean!( gst::result_from_gboolean!(
f( f(
self.obj() self.obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0, .0,
caps.as_mut_ptr(), caps.as_mut_ptr(),
@ -194,7 +192,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
gst::result_from_gboolean!( gst::result_from_gboolean!(
f( f(
self.obj() self.obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0, .0,
caps.as_mut_ptr(), caps.as_mut_ptr(),
@ -220,7 +218,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
gst::result_from_gboolean!( gst::result_from_gboolean!(
f( f(
self.obj() self.obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0, .0,
direction.into_glib(), direction.into_glib(),
@ -249,7 +247,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
gst::result_from_gboolean!( gst::result_from_gboolean!(
f( f(
self.obj() self.obj()
.unsafe_cast_ref::<crate::RTPHeaderExtension>() .unsafe_cast_ref::<RTPHeaderExtension>()
.to_glib_none() .to_glib_none()
.0, .0,
caps.as_mut_ptr(), caps.as_mut_ptr(),
@ -263,7 +261,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
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 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);
let klass = klass.as_mut(); let klass = klass.as_mut();

View file

@ -4,7 +4,7 @@ use crate::{ffi, RTSPAuth, RTSPContext};
use glib::{prelude::*, subclass::prelude::*, translate::*}; use glib::{prelude::*, subclass::prelude::*, translate::*};
use libc::c_char; use libc::c_char;
pub trait RTSPAuthImpl: RTSPAuthImplExt + ObjectImpl + Send + Sync { pub trait RTSPAuthImpl: ObjectImpl + ObjectSubclass<Type: IsA<RTSPAuth>> + Send + Sync {
fn authenticate(&self, ctx: &RTSPContext) -> bool { fn authenticate(&self, ctx: &RTSPContext) -> bool {
self.parent_authenticate(ctx) self.parent_authenticate(ctx)
} }
@ -18,12 +18,7 @@ pub trait RTSPAuthImpl: RTSPAuthImplExt + ObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait RTSPAuthImplExt: RTSPAuthImpl {
pub trait Sealed {}
impl<T: super::RTSPAuthImplExt> Sealed for T {}
}
pub trait RTSPAuthImplExt: sealed::Sealed + ObjectSubclass {
fn parent_authenticate(&self, ctx: &RTSPContext) -> bool { fn parent_authenticate(&self, ctx: &RTSPContext) -> bool {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();

View file

@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use crate::{ffi, RTSPClient}; use crate::{ffi, RTSPClient};
pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { pub trait RTSPClientImpl: ObjectImpl + ObjectSubclass<Type: IsA<RTSPClient>> + Send + Sync {
fn create_sdp(&self, media: &crate::RTSPMedia) -> Option<gst_sdp::SDPMessage> { fn create_sdp(&self, media: &crate::RTSPMedia) -> Option<gst_sdp::SDPMessage> {
self.parent_create_sdp(media) self.parent_create_sdp(media)
} }
@ -155,12 +155,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait RTSPClientImplExt: RTSPClientImpl {
pub trait Sealed {}
impl<T: super::RTSPClientImplExt> Sealed 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();

View file

@ -22,7 +22,7 @@ impl SDPInfo {
} }
} }
pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync { pub trait RTSPMediaImpl: ObjectImpl + ObjectSubclass<Type: IsA<RTSPMedia>> + Send + Sync {
fn handle_message(&self, message: &gst::MessageRef) -> bool { fn handle_message(&self, message: &gst::MessageRef) -> bool {
self.parent_handle_message(message) self.parent_handle_message(message)
} }
@ -98,12 +98,7 @@ pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait RTSPMediaImplExt: RTSPMediaImpl {
pub trait Sealed {}
impl<T: super::RTSPMediaImplExt> Sealed 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();

View file

@ -6,7 +6,9 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use crate::{ffi, RTSPMediaFactory}; use crate::{ffi, RTSPMediaFactory};
pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sync { pub trait RTSPMediaFactoryImpl:
ObjectImpl + ObjectSubclass<Type: IsA<RTSPMediaFactory>> + Send + Sync
{
fn gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> { fn gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> {
self.parent_gen_key(url) self.parent_gen_key(url)
} }
@ -36,12 +38,7 @@ pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sy
} }
} }
mod sealed { pub trait RTSPMediaFactoryImplExt: RTSPMediaFactoryImpl {
pub trait Sealed {}
impl<T: super::RTSPMediaFactoryImplExt> Sealed 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();

View file

@ -5,18 +5,15 @@ use gst_rtsp::ffi::GstRTSPUrl;
use crate::{ffi, RTSPMountPoints}; use crate::{ffi, RTSPMountPoints};
pub trait RTSPMountPointsImpl: RTSPMountPointsImplExt + ObjectImpl + Send + Sync { pub trait RTSPMountPointsImpl:
ObjectImpl + ObjectSubclass<Type: IsA<RTSPMountPoints>> + Send + Sync
{
fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> { fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<glib::GString> {
self.parent_make_path(url) self.parent_make_path(url)
} }
} }
mod sealed { pub trait RTSPMountPointsImplExt: RTSPMountPointsImpl {
pub trait Sealed {}
impl<T: super::RTSPMountPointsImplExt> Sealed 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();

View file

@ -1,10 +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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use super::prelude::*; use super::prelude::*;
use crate::RTSPOnvifClient; use crate::RTSPOnvifClient;
pub trait RTSPOnvifClientImpl: RTSPClientImpl + Send + Sync {} pub trait RTSPOnvifClientImpl:
RTSPClientImpl + ObjectSubclass<Type: IsA<RTSPOnvifClient>> + Send + Sync
{
}
unsafe impl<T: RTSPOnvifClientImpl> IsSubclassable<T> for RTSPOnvifClient {} unsafe impl<T: RTSPOnvifClientImpl> IsSubclassable<T> for RTSPOnvifClient {}

View file

@ -1,10 +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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use super::prelude::*; use super::prelude::*;
use crate::RTSPOnvifMedia; use crate::RTSPOnvifMedia;
pub trait RTSPOnvifMediaImpl: RTSPMediaImpl + Send + Sync {} pub trait RTSPOnvifMediaImpl:
RTSPMediaImpl + ObjectSubclass<Type: IsA<RTSPOnvifMedia>> + Send + Sync
{
}
unsafe impl<T: RTSPOnvifMediaImpl> IsSubclassable<T> for RTSPOnvifMedia {} unsafe impl<T: RTSPOnvifMediaImpl> IsSubclassable<T> for RTSPOnvifMedia {}

View file

@ -6,19 +6,14 @@ use super::prelude::*;
use crate::{ffi, RTSPOnvifMediaFactory}; use crate::{ffi, RTSPOnvifMediaFactory};
pub trait RTSPOnvifMediaFactoryImpl: pub trait RTSPOnvifMediaFactoryImpl:
RTSPMediaFactoryImplExt + RTSPMediaFactoryImpl + Send + Sync RTSPMediaFactoryImpl + ObjectSubclass<Type: IsA<RTSPOnvifMediaFactory>> + Send + Sync
{ {
fn has_backchannel_support(&self) -> bool { fn has_backchannel_support(&self) -> bool {
self.parent_has_backchannel_support() self.parent_has_backchannel_support()
} }
} }
mod sealed { pub trait RTSPOnvifMediaFactoryImplExt: RTSPOnvifMediaFactoryImpl {
pub trait Sealed {}
impl<T: super::RTSPOnvifMediaFactoryImplExt> Sealed 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();

View file

@ -1,10 +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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use super::prelude::*; use super::prelude::*;
use crate::RTSPOnvifServer; use crate::RTSPOnvifServer;
pub trait RTSPOnvifServerImpl: RTSPServerImpl + Send + Sync {} pub trait RTSPOnvifServerImpl:
RTSPServerImpl + ObjectSubclass<Type: IsA<RTSPOnvifServer>> + Send + Sync
{
}
unsafe impl<T: RTSPOnvifServerImpl> IsSubclassable<T> for RTSPOnvifServer {} unsafe impl<T: RTSPOnvifServerImpl> IsSubclassable<T> for RTSPOnvifServer {}

View file

@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use crate::{ffi, RTSPServer}; use crate::{ffi, RTSPServer};
pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync { pub trait RTSPServerImpl: ObjectImpl + ObjectSubclass<Type: IsA<RTSPServer>> + Send + Sync {
fn create_client(&self) -> Option<crate::RTSPClient> { fn create_client(&self) -> Option<crate::RTSPClient> {
self.parent_create_client() self.parent_create_client()
} }
@ -14,12 +14,7 @@ pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait RTSPServerImplExt: RTSPServerImpl {
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

@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use crate::{ffi, Navigation}; use crate::{ffi, Navigation};
pub trait NavigationImpl: ObjectImpl { pub trait NavigationImpl: ObjectImpl + ObjectSubclass<Type: IsA<Navigation>> {
fn send_event(&self, structure: gst::Structure); fn send_event(&self, structure: gst::Structure);
#[cfg(feature = "v1_22")] #[cfg(feature = "v1_22")]
@ -16,12 +16,7 @@ pub trait NavigationImpl: ObjectImpl {
} }
} }
mod sealed { pub trait NavigationImplExt: NavigationImpl {
pub trait Sealed {}
impl<T: super::NavigationImplExt> Sealed 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();

View file

@ -9,7 +9,7 @@ use crate::{ffi, VideoAggregator};
pub struct AggregateFramesToken<'a>(pub(crate) &'a VideoAggregator); pub struct AggregateFramesToken<'a>(pub(crate) &'a VideoAggregator);
pub trait VideoAggregatorImpl: VideoAggregatorImplExt + AggregatorImpl { pub trait VideoAggregatorImpl: AggregatorImpl + ObjectSubclass<Type: IsA<VideoAggregator>> {
fn update_caps(&self, caps: &gst::Caps) -> Result<gst::Caps, gst::LoggableError> { fn update_caps(&self, caps: &gst::Caps) -> Result<gst::Caps, gst::LoggableError> {
self.parent_update_caps(caps) self.parent_update_caps(caps)
} }
@ -30,12 +30,8 @@ pub trait VideoAggregatorImpl: VideoAggregatorImplExt + AggregatorImpl {
self.parent_find_best_format(downstream_caps) self.parent_find_best_format(downstream_caps)
} }
} }
mod sealed {
pub trait Sealed {}
impl<T: super::VideoAggregatorImplExt> Sealed for T {}
}
pub trait VideoAggregatorImplExt: sealed::Sealed + ObjectSubclass { pub trait VideoAggregatorImplExt: VideoAggregatorImpl {
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();

View file

@ -1,10 +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 gst_base::subclass::prelude::*; use gst_base::{prelude::*, subclass::prelude::*};
use super::prelude::VideoAggregatorPadImpl; use super::prelude::VideoAggregatorPadImpl;
use crate::VideoAggregatorConvertPad; use crate::VideoAggregatorConvertPad;
pub trait VideoAggregatorConvertPadImpl: VideoAggregatorPadImpl {} pub trait VideoAggregatorConvertPadImpl:
VideoAggregatorPadImpl + ObjectSubclass<Type: IsA<VideoAggregatorConvertPad>>
{
}
unsafe impl<T: VideoAggregatorConvertPadImpl> IsSubclassable<T> for VideoAggregatorConvertPad {} unsafe impl<T: VideoAggregatorConvertPadImpl> IsSubclassable<T> for VideoAggregatorConvertPad {}

View file

@ -7,7 +7,9 @@ use gst_base::{prelude::*, subclass::prelude::*};
use crate::{ffi, subclass::AggregateFramesToken, VideoAggregator, VideoAggregatorPad}; use crate::{ffi, subclass::AggregateFramesToken, VideoAggregator, VideoAggregatorPad};
pub trait VideoAggregatorPadImpl: VideoAggregatorPadImplExt + AggregatorPadImpl { pub trait VideoAggregatorPadImpl:
AggregatorPadImpl + ObjectSubclass<Type: IsA<VideoAggregatorPad>>
{
fn update_conversion_info(&self) { fn update_conversion_info(&self) {
self.parent_update_conversion_info() self.parent_update_conversion_info()
} }
@ -31,12 +33,7 @@ pub trait VideoAggregatorPadImpl: VideoAggregatorPadImplExt + AggregatorPadImpl
} }
} }
mod sealed { pub trait VideoAggregatorPadImplExt: VideoAggregatorPadImpl {
pub trait Sealed {}
impl<T: super::VideoAggregatorPadImplExt> Sealed for T {}
}
pub trait VideoAggregatorPadImplExt: ObjectSubclass + sealed::Sealed {
fn parent_update_conversion_info(&self) { fn parent_update_conversion_info(&self) {
unsafe { unsafe {
let data = Self::type_data(); let data = Self::type_data();

View file

@ -10,7 +10,7 @@ use crate::{
VideoCodecFrame, VideoDecoder, VideoCodecFrame, VideoDecoder,
}; };
pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl { pub trait VideoDecoderImpl: ElementImpl + ObjectSubclass<Type: IsA<VideoDecoder>> {
fn open(&self) -> Result<(), gst::ErrorMessage> { fn open(&self) -> Result<(), gst::ErrorMessage> {
self.parent_open() self.parent_open()
} }
@ -107,11 +107,8 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl {
self.parent_handle_missing_data(timestamp, duration) self.parent_handle_missing_data(timestamp, duration)
} }
} }
mod sealed {
pub trait Sealed {} pub trait VideoDecoderImplExt: VideoDecoderImpl {
impl<T: super::VideoDecoderImplExt> Sealed for T {}
}
pub trait VideoDecoderImplExt: 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();

View file

@ -10,7 +10,7 @@ use crate::{
VideoCodecFrame, VideoEncoder, VideoCodecFrame, VideoEncoder,
}; };
pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl { pub trait VideoEncoderImpl: ElementImpl + ObjectSubclass<Type: IsA<VideoEncoder>> {
fn open(&self) -> Result<(), gst::ErrorMessage> { fn open(&self) -> Result<(), gst::ErrorMessage> {
self.parent_open() self.parent_open()
} }
@ -85,12 +85,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl {
} }
} }
mod sealed { pub trait VideoEncoderImplExt: VideoEncoderImpl {
pub trait Sealed {}
impl<T: super::VideoEncoderImplExt> Sealed 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();

View file

@ -5,7 +5,7 @@ use gst_base::{prelude::*, subclass::prelude::*};
use crate::{ffi, VideoFilter, VideoFrameExt, VideoFrameRef, VideoInfo}; use crate::{ffi, VideoFilter, VideoFrameExt, VideoFrameRef, VideoInfo};
pub trait VideoFilterImpl: VideoFilterImplExt + BaseTransformImpl { pub trait VideoFilterImpl: BaseTransformImpl + ObjectSubclass<Type: IsA<VideoFilter>> {
fn set_info( fn set_info(
&self, &self,
incaps: &gst::Caps, incaps: &gst::Caps,
@ -39,12 +39,7 @@ pub trait VideoFilterImpl: VideoFilterImplExt + BaseTransformImpl {
} }
} }
mod sealed { pub trait VideoFilterImplExt: VideoFilterImpl {
pub trait Sealed {}
impl<T: super::VideoFilterImplExt> Sealed for T {}
}
pub trait VideoFilterImplExt: sealed::Sealed + ObjectSubclass {
fn parent_set_info( fn parent_set_info(
&self, &self,
incaps: &gst::Caps, incaps: &gst::Caps,

View file

@ -5,18 +5,13 @@ use gst_base::subclass::prelude::*;
use crate::{ffi, VideoSink}; use crate::{ffi, VideoSink};
pub trait VideoSinkImpl: VideoSinkImplExt + BaseSinkImpl + ElementImpl { pub trait VideoSinkImpl: BaseSinkImpl + ObjectSubclass<Type: IsA<VideoSink>> {
fn show_frame(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { fn show_frame(&self, buffer: &gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
self.parent_show_frame(buffer) self.parent_show_frame(buffer)
} }
} }
mod sealed { pub trait VideoSinkImplExt: VideoSinkImpl {
pub trait Sealed {}
impl<T: super::VideoSinkImplExt> Sealed 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();

View file

@ -7,7 +7,7 @@ use glib::{bool_error, prelude::*, subclass::prelude::*, translate::*, BoolError
use super::prelude::*; use super::prelude::*;
use crate::{ffi, AllocationParams, Allocator, Memory}; use crate::{ffi, AllocationParams, Allocator, Memory};
pub trait AllocatorImpl: AllocatorImplExt + GstObjectImpl + Send + Sync { pub trait AllocatorImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Allocator>> {
fn alloc(&self, size: usize, params: Option<&AllocationParams>) -> Result<Memory, BoolError> { fn alloc(&self, size: usize, params: Option<&AllocationParams>) -> Result<Memory, BoolError> {
self.parent_alloc(size, params) self.parent_alloc(size, params)
} }
@ -17,12 +17,7 @@ pub trait AllocatorImpl: AllocatorImplExt + GstObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait AllocatorImplExt: AllocatorImpl {
pub trait Sealed {}
impl<T: super::AllocatorImplExt> Sealed for T {}
}
pub trait AllocatorImplExt: sealed::Sealed + ObjectSubclass {
fn parent_alloc( fn parent_alloc(
&self, &self,
size: usize, size: usize,

View file

@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use super::prelude::*; use super::prelude::*;
use crate::{ffi, Bin, Element, LoggableError, Message}; use crate::{ffi, Bin, Element, LoggableError, Message};
pub trait BinImpl: BinImplExt + ElementImpl { pub trait BinImpl: ElementImpl + ObjectSubclass<Type: IsA<Bin>> {
fn add_element(&self, element: &Element) -> Result<(), LoggableError> { fn add_element(&self, element: &Element) -> Result<(), LoggableError> {
self.parent_add_element(element) self.parent_add_element(element)
} }
@ -23,12 +23,7 @@ pub trait BinImpl: BinImplExt + ElementImpl {
} }
} }
mod sealed { pub trait BinImplExt: BinImpl {
pub trait Sealed {}
impl<T: super::BinImplExt> Sealed 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();

View file

@ -12,7 +12,7 @@ use libc::c_char;
use super::prelude::*; use super::prelude::*;
use crate::{ffi, BufferPool, BufferPoolAcquireParams, BufferPoolConfigRef}; use crate::{ffi, BufferPool, BufferPoolAcquireParams, BufferPoolConfigRef};
pub trait BufferPoolImpl: BufferPoolImplExt + GstObjectImpl + Send + Sync { pub trait BufferPoolImpl: GstObjectImpl + ObjectSubclass<Type: IsA<BufferPool>> {
fn acquire_buffer( fn acquire_buffer(
&self, &self,
params: Option<&BufferPoolAcquireParams>, params: Option<&BufferPoolAcquireParams>,
@ -64,12 +64,7 @@ pub trait BufferPoolImpl: BufferPoolImplExt + GstObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait BufferPoolImplExt: BufferPoolImpl {
pub trait Sealed {}
impl<T: super::BufferPoolImplExt> Sealed for T {}
}
pub trait BufferPoolImplExt: sealed::Sealed + ObjectSubclass {
fn parent_acquire_buffer( fn parent_acquire_buffer(
&self, &self,
params: Option<&BufferPoolAcquireParams>, params: Option<&BufferPoolAcquireParams>,

View file

@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use super::prelude::*; use super::prelude::*;
use crate::{ffi, ChildProxy}; use crate::{ffi, ChildProxy};
pub trait ChildProxyImpl: GstObjectImpl + Send + Sync { pub trait ChildProxyImpl: GstObjectImpl + ObjectSubclass<Type: IsA<ChildProxy>> {
fn child_by_name(&self, name: &str) -> Option<glib::Object> { fn child_by_name(&self, name: &str) -> Option<glib::Object> {
self.parent_child_by_name(name) self.parent_child_by_name(name)
} }
@ -21,12 +21,7 @@ pub trait ChildProxyImpl: GstObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait ChildProxyImplExt: ChildProxyImpl {
pub trait Sealed {}
impl<T: super::ChildProxyImplExt> Sealed 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();

View file

@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use super::prelude::*; use super::prelude::*;
use crate::{ffi, Clock, ClockError, ClockId, ClockReturn, ClockSuccess, ClockTime, ClockTimeDiff}; use crate::{ffi, Clock, ClockError, ClockId, ClockReturn, ClockSuccess, ClockTime, ClockTimeDiff};
pub trait ClockImpl: ClockImplExt + GstObjectImpl + Send + Sync { pub trait ClockImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Clock>> {
fn change_resolution(&self, old_resolution: ClockTime, new_resolution: ClockTime) -> ClockTime { fn change_resolution(&self, old_resolution: ClockTime, new_resolution: ClockTime) -> ClockTime {
self.parent_change_resolution(old_resolution, new_resolution) self.parent_change_resolution(old_resolution, new_resolution)
} }
@ -31,12 +31,7 @@ pub trait ClockImpl: ClockImplExt + GstObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait ClockImplExt: ClockImpl {
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,

View file

@ -7,7 +7,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use super::prelude::*; use super::prelude::*;
use crate::{ffi, Device, Element, LoggableError}; use crate::{ffi, Device, Element, LoggableError};
pub trait DeviceImpl: DeviceImplExt + GstObjectImpl + Send + Sync { pub trait DeviceImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Device>> {
fn create_element(&self, name: Option<&str>) -> Result<Element, LoggableError> { fn create_element(&self, name: Option<&str>) -> Result<Element, LoggableError> {
self.parent_create_element(name) self.parent_create_element(name)
} }
@ -17,12 +17,7 @@ pub trait DeviceImpl: DeviceImplExt + GstObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait DeviceImplExt: DeviceImpl {
pub trait Sealed {}
impl<T: super::DeviceImplExt> Sealed 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();

View file

@ -64,7 +64,7 @@ impl DeviceProviderMetadata {
} }
} }
pub trait DeviceProviderImpl: DeviceProviderImplExt + GstObjectImpl + Send + Sync { pub trait DeviceProviderImpl: GstObjectImpl + ObjectSubclass<Type: IsA<DeviceProvider>> {
fn metadata() -> Option<&'static DeviceProviderMetadata> { fn metadata() -> Option<&'static DeviceProviderMetadata> {
None None
} }
@ -82,12 +82,7 @@ pub trait DeviceProviderImpl: DeviceProviderImplExt + GstObjectImpl + Send + Syn
} }
} }
mod sealed { pub trait DeviceProviderImplExt: DeviceProviderImpl {
pub trait Sealed {}
impl<T: super::DeviceProviderImplExt> Sealed 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();

View file

@ -67,7 +67,7 @@ impl ElementMetadata {
} }
} }
pub trait ElementImpl: ElementImplExt + GstObjectImpl + Send + Sync { pub trait ElementImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Element>> {
fn metadata() -> Option<&'static ElementMetadata> { fn metadata() -> Option<&'static ElementMetadata> {
None None
} }
@ -121,12 +121,7 @@ pub trait ElementImpl: ElementImplExt + GstObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait ElementImplExt: ElementImpl {
pub trait Sealed {}
impl<T: super::ElementImplExt> Sealed for T {}
}
pub trait ElementImplExt: sealed::Sealed + ObjectSubclass {
fn parent_change_state( fn parent_change_state(
&self, &self,
transition: StateChange, transition: StateChange,

View file

@ -1,10 +1,10 @@
// 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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use super::prelude::*; use super::prelude::*;
use crate::GhostPad; use crate::GhostPad;
pub trait GhostPadImpl: ProxyPadImpl {} pub trait GhostPadImpl: ProxyPadImpl + ObjectSubclass<Type: IsA<GhostPad>> {}
unsafe impl<T: GhostPadImpl> IsSubclassable<T> for GhostPad {} unsafe impl<T: GhostPadImpl> IsSubclassable<T> for GhostPad {}

View file

@ -1,7 +1,10 @@
// 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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
pub trait GstObjectImpl: ObjectImpl {} pub trait GstObjectImpl:
ObjectImpl + ObjectSubclass<Type: IsA<crate::Object>> + Send + Sync
{
}
unsafe impl<T: GstObjectImpl> IsSubclassable<T> for crate::Object {} unsafe impl<T: GstObjectImpl> IsSubclassable<T> for crate::Object {}

View file

@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use super::prelude::*; use super::prelude::*;
use crate::{ffi, Pad}; use crate::{ffi, Pad};
pub trait PadImpl: PadImplExt + GstObjectImpl + Send + Sync { pub trait PadImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Pad>> {
fn linked(&self, peer: &Pad) { fn linked(&self, peer: &Pad) {
self.parent_linked(peer) self.parent_linked(peer)
} }
@ -15,12 +15,7 @@ pub trait PadImpl: PadImplExt + GstObjectImpl + Send + Sync {
} }
} }
mod sealed { pub trait PadImplExt: PadImpl {
pub trait Sealed {}
impl<T: super::PadImplExt> Sealed 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();

View file

@ -1,10 +1,10 @@
// 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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use super::prelude::*; use super::prelude::*;
use crate::Pipeline; use crate::Pipeline;
pub trait PipelineImpl: BinImpl {} pub trait PipelineImpl: BinImpl + ObjectSubclass<Type: IsA<Pipeline>> {}
unsafe impl<T: PipelineImpl> IsSubclassable<T> for Pipeline {} unsafe impl<T: PipelineImpl> IsSubclassable<T> for Pipeline {}

View file

@ -1,9 +1,9 @@
// 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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use crate::Preset; use crate::Preset;
pub trait PresetImpl: super::element::ElementImpl {} pub trait PresetImpl: super::element::ElementImpl + ObjectSubclass<Type: IsA<Preset>> {}
unsafe impl<T: PresetImpl> IsImplementable<T> for Preset {} unsafe impl<T: PresetImpl> IsImplementable<T> for Preset {}

View file

@ -1,10 +1,10 @@
// 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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use super::prelude::*; use super::prelude::*;
use crate::ProxyPad; use crate::ProxyPad;
pub trait ProxyPadImpl: PadImpl {} pub trait ProxyPadImpl: PadImpl + ObjectSubclass<Type: IsA<ProxyPad>> {}
unsafe impl<T: ProxyPadImpl> IsSubclassable<T> for ProxyPad {} unsafe impl<T: ProxyPadImpl> IsSubclassable<T> for ProxyPad {}

View file

@ -1,10 +1,10 @@
// 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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use super::prelude::*; use super::prelude::*;
use crate::SystemClock; use crate::SystemClock;
pub trait SystemClockImpl: ClockImpl {} pub trait SystemClockImpl: ClockImpl + ObjectSubclass<Type: IsA<SystemClock>> {}
unsafe impl<T: SystemClockImpl> IsSubclassable<T> for SystemClock {} unsafe impl<T: SystemClockImpl> IsSubclassable<T> for SystemClock {}

View file

@ -1,9 +1,12 @@
// 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 glib::subclass::prelude::*; use glib::{prelude::*, subclass::prelude::*};
use crate::TagSetter; use crate::TagSetter;
pub trait TagSetterImpl: super::element::ElementImpl {} pub trait TagSetterImpl:
super::element::ElementImpl + ObjectSubclass<Type: IsA<TagSetter>>
{
}
unsafe impl<T: TagSetterImpl> IsImplementable<T> for TagSetter {} unsafe impl<T: TagSetterImpl> IsImplementable<T> for TagSetter {}

View file

@ -6,12 +6,12 @@ use std::{
sync::{Arc, Mutex}, sync::{Arc, Mutex},
}; };
use glib::{ffi::gpointer, subclass::prelude::*, translate::*}; use glib::{ffi::gpointer, prelude::*, subclass::prelude::*, translate::*};
use super::prelude::*; use super::prelude::*;
use crate::{ffi, TaskHandle, TaskPool}; use crate::{ffi, TaskHandle, TaskPool};
pub trait TaskPoolImpl: GstObjectImpl + Send + Sync { pub trait TaskPoolImpl: GstObjectImpl + ObjectSubclass<Type: IsA<TaskPool>> {
// rustdoc-stripper-ignore-next // rustdoc-stripper-ignore-next
/// Handle to be returned from the `push` function to allow the caller to wait for the task's /// Handle to be returned from the `push` function to allow the caller to wait for the task's
/// completion. /// completion.

View file

@ -10,7 +10,7 @@ use crate::{
}; };
#[allow(unused_variables)] #[allow(unused_variables)]
pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync { pub trait TracerImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Tracer>> {
fn bin_add_post(&self, ts: u64, bin: &Bin, element: &Element, success: bool) {} fn bin_add_post(&self, ts: u64, bin: &Bin, element: &Element, success: bool) {}
fn bin_add_pre(&self, ts: u64, bin: &Bin, element: &Element) {} fn bin_add_pre(&self, ts: u64, bin: &Bin, element: &Element) {}
fn bin_remove_post(&self, ts: u64, bin: &Bin, success: bool) {} fn bin_remove_post(&self, ts: u64, bin: &Bin, success: bool) {}
@ -85,7 +85,7 @@ pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync {
unsafe impl<T: TracerImpl> IsSubclassable<T> for Tracer {} unsafe impl<T: TracerImpl> IsSubclassable<T> for Tracer {}
pub trait TracerImplExt: ObjectSubclass { pub trait TracerImplExt: TracerImpl {
// rustdoc-stripper-ignore-next // rustdoc-stripper-ignore-next
/// Register a corresponding hook to be called for this tracer when certain events occur. /// Register a corresponding hook to be called for this tracer when certain events occur.
/// ///

View file

@ -6,19 +6,16 @@ use glib::{prelude::*, subclass::prelude::*, translate::*};
use crate::{ffi, URIHandler, URIType}; use crate::{ffi, URIHandler, URIType};
pub trait URIHandlerImpl: super::element::ElementImpl { pub trait URIHandlerImpl:
super::element::ElementImpl + ObjectSubclass<Type: IsA<URIHandler>>
{
const URI_TYPE: URIType; const URI_TYPE: URIType;
fn protocols() -> &'static [&'static str]; fn protocols() -> &'static [&'static str];
fn uri(&self) -> Option<String>; fn uri(&self) -> Option<String>;
fn set_uri(&self, uri: &str) -> Result<(), glib::Error>; fn set_uri(&self, uri: &str) -> Result<(), glib::Error>;
} }
mod sealed { pub trait URIHandlerImplExt: URIHandlerImpl {
pub trait Sealed {}
impl<T: super::URIHandlerImplExt> Sealed 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();