From 445a4122d5035f77a4732a00a02ae7768a69f4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 19 Oct 2024 22:18:53 +0300 Subject: [PATCH] Remove unnecessary sealing of ImplExt traits and enforce type hierarchy more strictly Part-of: --- .../src/bin/subclass_vfuncs/iirfilter/mod.rs | 2 +- .../src/subclass/dma_buf_allocator.rs | 7 +++-- .../src/subclass/fd_allocator.rs | 4 +-- .../src/subclass/audio_aggregator.rs | 9 ++---- .../subclass/audio_aggregator_convert_pad.rs | 7 +++-- .../src/subclass/audio_aggregator_pad.rs | 11 +++---- .../src/subclass/audio_base_sink.rs | 4 +-- .../src/subclass/audio_base_src.rs | 4 +-- gstreamer-audio/src/subclass/audio_decoder.rs | 9 ++---- gstreamer-audio/src/subclass/audio_encoder.rs | 9 ++---- gstreamer-audio/src/subclass/audio_filter.rs | 9 ++---- gstreamer-audio/src/subclass/audio_sink.rs | 9 ++---- gstreamer-audio/src/subclass/audio_src.rs | 9 ++---- gstreamer-base/src/subclass/aggregator.rs | 9 ++---- gstreamer-base/src/subclass/aggregator_pad.rs | 9 ++---- gstreamer-base/src/subclass/base_parse.rs | 9 ++---- gstreamer-base/src/subclass/base_sink.rs | 9 ++---- gstreamer-base/src/subclass/base_src.rs | 9 ++---- gstreamer-base/src/subclass/base_transform.rs | 9 ++---- gstreamer-base/src/subclass/push_src.rs | 11 ++----- .../src/subclass/formatter.rs | 9 ++---- gstreamer-gl/src/subclass/gl_base_filter.rs | 9 ++---- gstreamer-gl/src/subclass/gl_base_src.rs | 9 ++---- gstreamer-gl/src/subclass/gl_filter.rs | 9 ++---- .../src/subclass/audio_visualizer.rs | 9 ++---- .../src/subclass/play_video_renderer.rs | 9 ++---- .../src/subclass/player_video_renderer.rs | 11 +++---- .../src/subclass/rtp_base_depayload.rs | 9 ++---- .../src/subclass/rtp_base_payload.rs | 9 ++---- .../src/subclass/rtp_header_extension.rs | 30 +++++++++---------- .../src/subclass/rtsp_auth.rs | 9 ++---- .../src/subclass/rtsp_client.rs | 9 ++---- .../src/subclass/rtsp_media.rs | 9 ++---- .../src/subclass/rtsp_media_factory.rs | 11 +++---- .../src/subclass/rtsp_mount_points.rs | 11 +++---- .../src/subclass/rtsp_onvif_client.rs | 7 +++-- .../src/subclass/rtsp_onvif_media.rs | 7 +++-- .../src/subclass/rtsp_onvif_media_factory.rs | 9 ++---- .../src/subclass/rtsp_onvif_server.rs | 7 +++-- .../src/subclass/rtsp_server.rs | 9 ++---- gstreamer-video/src/subclass/navigation.rs | 9 ++---- .../src/subclass/video_aggregator.rs | 8 ++--- .../subclass/video_aggregator_convert_pad.rs | 7 +++-- .../src/subclass/video_aggregator_pad.rs | 11 +++---- gstreamer-video/src/subclass/video_decoder.rs | 9 ++---- gstreamer-video/src/subclass/video_encoder.rs | 9 ++---- gstreamer-video/src/subclass/video_filter.rs | 9 ++---- gstreamer-video/src/subclass/video_sink.rs | 9 ++---- gstreamer/src/subclass/allocator.rs | 9 ++---- gstreamer/src/subclass/bin.rs | 9 ++---- gstreamer/src/subclass/buffer_pool.rs | 9 ++---- gstreamer/src/subclass/child_proxy.rs | 9 ++---- gstreamer/src/subclass/clock.rs | 9 ++---- gstreamer/src/subclass/device.rs | 9 ++---- gstreamer/src/subclass/device_provider.rs | 9 ++---- gstreamer/src/subclass/element.rs | 9 ++---- gstreamer/src/subclass/ghost_pad.rs | 4 +-- gstreamer/src/subclass/object.rs | 7 +++-- gstreamer/src/subclass/pad.rs | 9 ++---- gstreamer/src/subclass/pipeline.rs | 4 +-- gstreamer/src/subclass/preset.rs | 4 +-- gstreamer/src/subclass/proxy_pad.rs | 4 +-- gstreamer/src/subclass/system_clock.rs | 4 +-- gstreamer/src/subclass/tag_setter.rs | 7 +++-- gstreamer/src/subclass/task_pool.rs | 4 +-- gstreamer/src/subclass/tracer.rs | 4 +-- gstreamer/src/subclass/uri_handler.rs | 11 +++---- 67 files changed, 183 insertions(+), 381 deletions(-) diff --git a/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs b/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs index b7bc5c007..8d38c5802 100644 --- a/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs +++ b/examples/src/bin/subclass_vfuncs/iirfilter/mod.rs @@ -27,7 +27,7 @@ pub trait IirFilterExt: IsA { impl> IirFilterExt for O {} /// Trait to implement in `IirFilter` subclasses. -pub trait IirFilterImpl: AudioFilterImpl { +pub trait IirFilterImpl: AudioFilterImpl + ObjectSubclass> { /// Called whenever the sample rate is changing. fn set_rate(&self, rate: u32) { self.parent_set_rate(rate); diff --git a/gstreamer-allocators/src/subclass/dma_buf_allocator.rs b/gstreamer-allocators/src/subclass/dma_buf_allocator.rs index e288026e3..adb06686a 100644 --- a/gstreamer-allocators/src/subclass/dma_buf_allocator.rs +++ b/gstreamer-allocators/src/subclass/dma_buf_allocator.rs @@ -1,6 +1,9 @@ -use glib::subclass::prelude::*; +use glib::{prelude::*, subclass::prelude::*}; use crate::{subclass::fd_allocator::FdAllocatorImpl, DmaBufAllocator}; -pub trait DmaBufAllocatorImpl: FdAllocatorImpl {} +pub trait DmaBufAllocatorImpl: + FdAllocatorImpl + ObjectSubclass> +{ +} unsafe impl IsSubclassable for DmaBufAllocator {} diff --git a/gstreamer-allocators/src/subclass/fd_allocator.rs b/gstreamer-allocators/src/subclass/fd_allocator.rs index 82f45c4bb..0834f6a37 100644 --- a/gstreamer-allocators/src/subclass/fd_allocator.rs +++ b/gstreamer-allocators/src/subclass/fd_allocator.rs @@ -1,7 +1,7 @@ -use glib::subclass::prelude::*; +use glib::{prelude::*, subclass::prelude::*}; use crate::FdAllocator; use gst::subclass::prelude::AllocatorImpl; -pub trait FdAllocatorImpl: AllocatorImpl {} +pub trait FdAllocatorImpl: AllocatorImpl + ObjectSubclass> {} unsafe impl IsSubclassable for FdAllocator {} diff --git a/gstreamer-audio/src/subclass/audio_aggregator.rs b/gstreamer-audio/src/subclass/audio_aggregator.rs index 1fa751d5a..40d9bd1bb 100644 --- a/gstreamer-audio/src/subclass/audio_aggregator.rs +++ b/gstreamer-audio/src/subclass/audio_aggregator.rs @@ -7,7 +7,7 @@ use gst_base::{prelude::*, subclass::prelude::*}; use crate::{ffi, AudioAggregator, AudioAggregatorPad}; -pub trait AudioAggregatorImpl: AudioAggregatorImplExt + AggregatorImpl { +pub trait AudioAggregatorImpl: AggregatorImpl + ObjectSubclass> { fn create_output_buffer(&self, num_frames: u32) -> Option { self.parent_create_output_buffer(num_frames) } @@ -26,12 +26,7 @@ pub trait AudioAggregatorImpl: AudioAggregatorImplExt + AggregatorImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioAggregatorImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioAggregatorImplExt: AudioAggregatorImpl { fn parent_create_output_buffer(&self, num_frames: u32) -> Option { unsafe { let data = Self::type_data(); diff --git a/gstreamer-audio/src/subclass/audio_aggregator_convert_pad.rs b/gstreamer-audio/src/subclass/audio_aggregator_convert_pad.rs index 8bff851d6..ee699761e 100644 --- a/gstreamer-audio/src/subclass/audio_aggregator_convert_pad.rs +++ b/gstreamer-audio/src/subclass/audio_aggregator_convert_pad.rs @@ -1,10 +1,13 @@ // 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 crate::AudioAggregatorConvertPad; -pub trait AudioAggregatorConvertPadImpl: AudioAggregatorPadImpl {} +pub trait AudioAggregatorConvertPadImpl: + AudioAggregatorPadImpl + ObjectSubclass> +{ +} unsafe impl IsSubclassable for AudioAggregatorConvertPad {} diff --git a/gstreamer-audio/src/subclass/audio_aggregator_pad.rs b/gstreamer-audio/src/subclass/audio_aggregator_pad.rs index ddeee83a9..f99caab14 100644 --- a/gstreamer-audio/src/subclass/audio_aggregator_pad.rs +++ b/gstreamer-audio/src/subclass/audio_aggregator_pad.rs @@ -7,7 +7,9 @@ use gst_base::{prelude::*, subclass::prelude::*}; use crate::{ffi, AudioAggregatorPad}; -pub trait AudioAggregatorPadImpl: AudioAggregatorPadImplExt + AggregatorPadImpl { +pub trait AudioAggregatorPadImpl: + AggregatorPadImpl + ObjectSubclass> +{ const HANDLE_CONVERSION: bool = false; fn update_conversion_info(&self) { @@ -24,12 +26,7 @@ pub trait AudioAggregatorPadImpl: AudioAggregatorPadImplExt + AggregatorPadImpl } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioAggregatorPadImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioAggregatorPadImplExt: AudioAggregatorPadImpl { fn parent_update_conversion_info(&self) { unsafe { let data = Self::type_data(); diff --git a/gstreamer-audio/src/subclass/audio_base_sink.rs b/gstreamer-audio/src/subclass/audio_base_sink.rs index 01506ad03..822541fec 100644 --- a/gstreamer-audio/src/subclass/audio_base_sink.rs +++ b/gstreamer-audio/src/subclass/audio_base_sink.rs @@ -1,9 +1,9 @@ // 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; -pub trait AudioBaseSinkImpl: BaseSinkImpl {} +pub trait AudioBaseSinkImpl: BaseSinkImpl + ObjectSubclass> {} unsafe impl IsSubclassable for AudioBaseSink {} diff --git a/gstreamer-audio/src/subclass/audio_base_src.rs b/gstreamer-audio/src/subclass/audio_base_src.rs index abc295ac1..edd968b04 100644 --- a/gstreamer-audio/src/subclass/audio_base_src.rs +++ b/gstreamer-audio/src/subclass/audio_base_src.rs @@ -1,9 +1,9 @@ // 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; -pub trait AudioBaseSrcImpl: BaseSrcImpl {} +pub trait AudioBaseSrcImpl: BaseSrcImpl + ObjectSubclass> {} unsafe impl IsSubclassable for AudioBaseSrc {} diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index eaa948e13..6eabf32c7 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -7,7 +7,7 @@ use gst::subclass::prelude::*; use crate::{ffi, prelude::*, AudioDecoder}; -pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl { +pub trait AudioDecoderImpl: ElementImpl + ObjectSubclass> { fn open(&self) -> Result<(), gst::ErrorMessage> { self.parent_open() } @@ -86,12 +86,7 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioDecoderImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioDecoderImplExt: AudioDecoderImpl { fn parent_open(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index 59991527c..65161ecff 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -7,7 +7,7 @@ use gst::subclass::prelude::*; use crate::{ffi, prelude::*, AudioEncoder, AudioInfo}; -pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl { +pub trait AudioEncoderImpl: ElementImpl + ObjectSubclass> { fn open(&self) -> Result<(), gst::ErrorMessage> { self.parent_open() } @@ -82,12 +82,7 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioEncoderImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioEncoderImplExt: AudioEncoderImpl { fn parent_open(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-audio/src/subclass/audio_filter.rs b/gstreamer-audio/src/subclass/audio_filter.rs index ed306f87d..9712cc850 100644 --- a/gstreamer-audio/src/subclass/audio_filter.rs +++ b/gstreamer-audio/src/subclass/audio_filter.rs @@ -5,7 +5,7 @@ use gst_base::{prelude::*, subclass::prelude::*}; use crate::{ffi, AudioFilter, AudioInfo}; -pub trait AudioFilterImpl: AudioFilterImplExt + BaseTransformImpl { +pub trait AudioFilterImpl: BaseTransformImpl + ObjectSubclass> { fn allowed_caps() -> &'static gst::Caps { Self::parent_allowed_caps() } @@ -15,12 +15,7 @@ pub trait AudioFilterImpl: AudioFilterImplExt + BaseTransformImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioFilterImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioFilterImplExt: AudioFilterImpl { fn parent_setup(&self, info: &AudioInfo) -> Result<(), gst::LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-audio/src/subclass/audio_sink.rs b/gstreamer-audio/src/subclass/audio_sink.rs index 043a757d5..6031cca8e 100644 --- a/gstreamer-audio/src/subclass/audio_sink.rs +++ b/gstreamer-audio/src/subclass/audio_sink.rs @@ -7,7 +7,7 @@ use gst_base::subclass::prelude::*; use super::prelude::*; use crate::{ffi, AudioRingBufferSpec, AudioSink}; -pub trait AudioSinkImpl: AudioSinkImplExt + AudioBaseSinkImpl { +pub trait AudioSinkImpl: AudioBaseSinkImpl + ObjectSubclass> { fn close(&self) -> Result<(), LoggableError> { self.parent_close() } @@ -37,12 +37,7 @@ pub trait AudioSinkImpl: AudioSinkImplExt + AudioBaseSinkImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioSinkImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioSinkImplExt: AudioSinkImpl { fn parent_close(&self) -> Result<(), LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-audio/src/subclass/audio_src.rs b/gstreamer-audio/src/subclass/audio_src.rs index 891f3e49f..3022535c2 100644 --- a/gstreamer-audio/src/subclass/audio_src.rs +++ b/gstreamer-audio/src/subclass/audio_src.rs @@ -9,7 +9,7 @@ use gst_base::subclass::prelude::*; use super::prelude::*; use crate::{ffi, AudioRingBufferSpec, AudioSrc}; -pub trait AudioSrcImpl: AudioSrcImplExt + AudioBaseSrcImpl { +pub trait AudioSrcImpl: AudioBaseSrcImpl + ObjectSubclass> { fn close(&self) -> Result<(), LoggableError> { self.parent_close() } @@ -39,12 +39,7 @@ pub trait AudioSrcImpl: AudioSrcImplExt + AudioBaseSrcImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioSrcImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioSrcImplExt: AudioSrcImpl { fn parent_close(&self) -> Result<(), LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index 9e5177b76..9e355bdbf 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -7,7 +7,7 @@ use gst::subclass::prelude::*; use crate::{ffi, Aggregator, AggregatorPad}; -pub trait AggregatorImpl: AggregatorImplExt + ElementImpl { +pub trait AggregatorImpl: ElementImpl + ObjectSubclass> { fn flush(&self) -> Result { self.parent_flush() } @@ -135,12 +135,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AggregatorImplExt: sealed::Sealed + ObjectSubclass { +pub trait AggregatorImplExt: AggregatorImpl { fn parent_flush(&self) -> Result { unsafe { let data = Self::type_data(); diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index 264244f59..1125019bb 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -5,7 +5,7 @@ use gst::subclass::prelude::*; use crate::{ffi, Aggregator, AggregatorPad}; -pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl { +pub trait AggregatorPadImpl: PadImpl + ObjectSubclass> { fn flush(&self, aggregator: &Aggregator) -> Result { self.parent_flush(aggregator) } @@ -15,12 +15,7 @@ pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AggregatorPadImplExt: sealed::Sealed + ObjectSubclass { +pub trait AggregatorPadImplExt: AggregatorPadImpl { fn parent_flush(&self, aggregator: &Aggregator) -> Result { unsafe { let data = Self::type_data(); diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index 0560fcb66..58104e06f 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -7,7 +7,7 @@ use gst::subclass::prelude::*; use crate::{ffi, prelude::*, BaseParse, BaseParseFrame}; -pub trait BaseParseImpl: BaseParseImplExt + ElementImpl { +pub trait BaseParseImpl: ElementImpl + ObjectSubclass> { fn start(&self) -> Result<(), gst::ErrorMessage> { self.parent_start() } @@ -36,12 +36,7 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BaseParseImplExt: sealed::Sealed + ObjectSubclass { +pub trait BaseParseImplExt: BaseParseImpl { fn parent_start(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index 773ba1e92..ede120ad2 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -7,7 +7,7 @@ use gst::subclass::prelude::*; use crate::{ffi, BaseSink}; -pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl { +pub trait BaseSinkImpl: ElementImpl + ObjectSubclass> { fn start(&self) -> Result<(), gst::ErrorMessage> { self.parent_start() } @@ -68,12 +68,7 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BaseSinkImplExt: sealed::Sealed + ObjectSubclass { +pub trait BaseSinkImplExt: BaseSinkImpl { fn parent_start(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 2dc95846d..e743e2230 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -20,7 +20,7 @@ pub enum CreateSuccess { NewBufferList(gst::BufferList), } -pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl { +pub trait BaseSrcImpl: ElementImpl + ObjectSubclass> { fn start(&self) -> Result<(), gst::ErrorMessage> { self.parent_start() } @@ -108,12 +108,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BaseSrcImplExt: sealed::Sealed + ObjectSubclass { +pub trait BaseSrcImplExt: BaseSrcImpl { fn parent_start(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 19b58aca6..b4e71db9d 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -14,7 +14,7 @@ pub enum BaseTransformMode { Both, } -pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl { +pub trait BaseTransformImpl: ElementImpl + ObjectSubclass> { const MODE: BaseTransformMode; const PASSTHROUGH_ON_SAME_CAPS: bool; const TRANSFORM_IP_ON_PASSTHROUGH: bool; @@ -154,12 +154,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BaseTransformImplExt: sealed::Sealed + ObjectSubclass { +pub trait BaseTransformImplExt: BaseTransformImpl { fn parent_start(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index 81bc19643..ef2f488c3 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -3,12 +3,12 @@ use std::ptr; use glib::{prelude::*, subclass::prelude::*, translate::*}; -use gst::prelude::*; +use gst::{prelude::*, subclass::prelude::*}; use super::base_src::{BaseSrcImpl, CreateSuccess}; use crate::{ffi, prelude::*, PushSrc}; -pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl { +pub trait PushSrcImpl: BaseSrcImpl + ObjectSubclass> { fn fill(&self, buffer: &mut gst::BufferRef) -> Result { PushSrcImplExt::parent_fill(self, buffer) } @@ -22,12 +22,7 @@ pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PushSrcImplExt: sealed::Sealed + ObjectSubclass { +pub trait PushSrcImplExt: PushSrcImpl { fn parent_fill(&self, buffer: &mut gst::BufferRef) -> Result { unsafe { let data = Self::type_data(); diff --git a/gstreamer-editing-services/src/subclass/formatter.rs b/gstreamer-editing-services/src/subclass/formatter.rs index f4baac2e8..555e9cb40 100644 --- a/gstreamer-editing-services/src/subclass/formatter.rs +++ b/gstreamer-editing-services/src/subclass/formatter.rs @@ -3,7 +3,7 @@ use crate::{ffi, prelude::*, Formatter}; use glib::{subclass::prelude::*, translate::*}; -pub trait FormatterImpl: FormatterImplExt + ObjectImpl + Send + Sync { +pub trait FormatterImpl: ObjectImpl + ObjectSubclass> + Send + Sync { fn can_load_uri(&self, uri: &str) -> Result<(), glib::Error> { self.parent_can_load_uri(uri) } @@ -22,12 +22,7 @@ pub trait FormatterImpl: FormatterImplExt + ObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait FormatterImplExt: sealed::Sealed + ObjectSubclass { +pub trait FormatterImplExt: FormatterImpl { fn parent_can_load_uri(&self, uri: &str) -> Result<(), glib::Error> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-gl/src/subclass/gl_base_filter.rs b/gstreamer-gl/src/subclass/gl_base_filter.rs index 849aef14b..1f06ff939 100644 --- a/gstreamer-gl/src/subclass/gl_base_filter.rs +++ b/gstreamer-gl/src/subclass/gl_base_filter.rs @@ -5,7 +5,7 @@ use gst_base::subclass::prelude::*; use crate::{ffi, prelude::*, GLBaseFilter}; -pub trait GLBaseFilterImpl: GLBaseFilterImplExt + BaseTransformImpl { +pub trait GLBaseFilterImpl: BaseTransformImpl + ObjectSubclass> { fn gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> { self.parent_gl_set_caps(incaps, outcaps) } @@ -19,12 +19,7 @@ pub trait GLBaseFilterImpl: GLBaseFilterImplExt + BaseTransformImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait GLBaseFilterImplExt: sealed::Sealed + ObjectSubclass { +pub trait GLBaseFilterImplExt: GLBaseFilterImpl { fn parent_gl_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-gl/src/subclass/gl_base_src.rs b/gstreamer-gl/src/subclass/gl_base_src.rs index 7e0b5b06f..71726bc52 100644 --- a/gstreamer-gl/src/subclass/gl_base_src.rs +++ b/gstreamer-gl/src/subclass/gl_base_src.rs @@ -5,7 +5,7 @@ use gst_base::subclass::prelude::*; use crate::{ffi, prelude::*, GLBaseSrc, GLMemory, GLAPI}; -pub trait GLBaseSrcImpl: GLBaseSrcImplExt + PushSrcImpl { +pub trait GLBaseSrcImpl: PushSrcImpl + ObjectSubclass> { const SUPPORTED_GL_API: GLAPI; fn gl_start(&self) -> Result<(), LoggableError> { @@ -21,12 +21,7 @@ pub trait GLBaseSrcImpl: GLBaseSrcImplExt + PushSrcImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait GLBaseSrcImplExt: sealed::Sealed + ObjectSubclass { +pub trait GLBaseSrcImplExt: GLBaseSrcImpl { fn parent_gl_start(&self) -> Result<(), LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-gl/src/subclass/gl_filter.rs b/gstreamer-gl/src/subclass/gl_filter.rs index f475e76ec..3317585f8 100644 --- a/gstreamer-gl/src/subclass/gl_filter.rs +++ b/gstreamer-gl/src/subclass/gl_filter.rs @@ -13,7 +13,7 @@ pub enum GLFilterMode { Texture, } -pub trait GLFilterImpl: GLFilterImplExt + GLBaseFilterImpl { +pub trait GLFilterImpl: GLBaseFilterImpl + ObjectSubclass> { const MODE: GLFilterMode; // rustdoc-stripper-ignore-next /// 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 Sealed {} - impl Sealed for T {} -} - -pub trait GLFilterImplExt: sealed::Sealed + ObjectSubclass { +pub trait GLFilterImplExt: GLFilterImpl { fn parent_set_caps(&self, incaps: &Caps, outcaps: &Caps) -> Result<(), LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-pbutils/src/subclass/audio_visualizer.rs b/gstreamer-pbutils/src/subclass/audio_visualizer.rs index a332e8f97..fa44572af 100644 --- a/gstreamer-pbutils/src/subclass/audio_visualizer.rs +++ b/gstreamer-pbutils/src/subclass/audio_visualizer.rs @@ -7,7 +7,7 @@ use crate::{ffi, AudioVisualizer}; pub struct AudioVisualizerSetupToken<'a>(pub(crate) &'a AudioVisualizer); -pub trait AudioVisualizerImpl: AudioVisualizerImplExt + ElementImpl { +pub trait AudioVisualizerImpl: ElementImpl + ObjectSubclass> { fn setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> { self.parent_setup(token) } @@ -28,12 +28,7 @@ pub trait AudioVisualizerImpl: AudioVisualizerImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AudioVisualizerImplExt: sealed::Sealed + ObjectSubclass { +pub trait AudioVisualizerImplExt: AudioVisualizerImpl { fn parent_setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> { assert_eq!( self.obj().as_ptr() as *mut ffi::GstAudioVisualizer, diff --git a/gstreamer-play/src/subclass/play_video_renderer.rs b/gstreamer-play/src/subclass/play_video_renderer.rs index f6dea7854..bcfd8b7c6 100644 --- a/gstreamer-play/src/subclass/play_video_renderer.rs +++ b/gstreamer-play/src/subclass/play_video_renderer.rs @@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, Play, PlayVideoRenderer}; -pub trait PlayVideoRendererImpl: ObjectImpl { +pub trait PlayVideoRendererImpl: ObjectImpl + ObjectSubclass> { fn create_video_sink(&self, play: &Play) -> gst::Element; } @@ -16,12 +16,7 @@ unsafe impl IsImplementable for PlayVideoRenderer { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PlayVideoRendererImplExt: sealed::Sealed + ObjectSubclass { +pub trait PlayVideoRendererImplExt: PlayVideoRendererImpl { fn parent_create_video_sink(&self, play: &Play) -> gst::Element { unsafe { let type_data = Self::type_data(); diff --git a/gstreamer-player/src/subclass/player_video_renderer.rs b/gstreamer-player/src/subclass/player_video_renderer.rs index 7c524ddca..3e2231c56 100644 --- a/gstreamer-player/src/subclass/player_video_renderer.rs +++ b/gstreamer-player/src/subclass/player_video_renderer.rs @@ -4,7 +4,9 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, Player, PlayerVideoRenderer}; -pub trait PlayerVideoRendererImpl: ObjectImpl { +pub trait PlayerVideoRendererImpl: + ObjectImpl + ObjectSubclass> +{ fn create_video_sink(&self, player: &Player) -> gst::Element; } @@ -16,12 +18,7 @@ unsafe impl IsImplementable for PlayerVideoRender } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PlayerVideoRendererImplExt: sealed::Sealed + ObjectSubclass { +pub trait PlayerVideoRendererImplExt: PlayerVideoRendererImpl { fn parent_create_video_sink(&self, player: &Player) -> gst::Element { unsafe { let type_data = Self::type_data(); diff --git a/gstreamer-rtp/src/subclass/rtp_base_depayload.rs b/gstreamer-rtp/src/subclass/rtp_base_depayload.rs index 64b75554f..9c409173a 100644 --- a/gstreamer-rtp/src/subclass/rtp_base_depayload.rs +++ b/gstreamer-rtp/src/subclass/rtp_base_depayload.rs @@ -7,7 +7,7 @@ use gst::subclass::prelude::*; use crate::{ffi, prelude::*, RTPBaseDepayload}; -pub trait RTPBaseDepayloadImpl: RTPBaseDepayloadImplExt + ElementImpl { +pub trait RTPBaseDepayloadImpl: ElementImpl + ObjectSubclass> { fn set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { self.parent_set_caps(caps) } @@ -28,12 +28,7 @@ pub trait RTPBaseDepayloadImpl: RTPBaseDepayloadImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTPBaseDepayloadImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTPBaseDepayloadImplExt: RTPBaseDepayloadImpl { fn parent_set_caps(&self, caps: &gst::Caps) -> Result<(), gst::LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtp/src/subclass/rtp_base_payload.rs b/gstreamer-rtp/src/subclass/rtp_base_payload.rs index 8002ebd3b..7b270808f 100644 --- a/gstreamer-rtp/src/subclass/rtp_base_payload.rs +++ b/gstreamer-rtp/src/subclass/rtp_base_payload.rs @@ -5,7 +5,7 @@ use gst::subclass::prelude::*; use crate::{ffi, prelude::*, RTPBasePayload}; -pub trait RTPBasePayloadImpl: RTPBasePayloadImplExt + ElementImpl { +pub trait RTPBasePayloadImpl: ElementImpl + ObjectSubclass> { fn caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps { self.parent_caps(pad, filter) } @@ -31,12 +31,7 @@ pub trait RTPBasePayloadImpl: RTPBasePayloadImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTPBasePayloadImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTPBasePayloadImplExt: RTPBasePayloadImpl { fn parent_caps(&self, pad: &gst::Pad, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtp/src/subclass/rtp_header_extension.rs b/gstreamer-rtp/src/subclass/rtp_header_extension.rs index 319a7d5dc..16f4131b5 100644 --- a/gstreamer-rtp/src/subclass/rtp_header_extension.rs +++ b/gstreamer-rtp/src/subclass/rtp_header_extension.rs @@ -4,8 +4,11 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::ffi; +use crate::RTPHeaderExtension; -pub trait RTPHeaderExtensionImpl: RTPHeaderExtensionImplExt + ElementImpl { +pub trait RTPHeaderExtensionImpl: + ElementImpl + ObjectSubclass> +{ const URI: &'static str; fn supported_flags(&self) -> crate::RTPHeaderExtensionFlags { @@ -56,12 +59,7 @@ pub trait RTPHeaderExtensionImpl: RTPHeaderExtensionImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTPHeaderExtensionImplExt: RTPHeaderExtensionImpl { fn parent_supported_flags(&self) -> crate::RTPHeaderExtensionFlags { unsafe { let data = Self::type_data(); @@ -71,7 +69,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { .expect("no parent \"get_supported_flags\" implementation"); from_glib(f(self .obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0)) } @@ -86,7 +84,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { .expect("no parent \"get_max_size\" implementation"); f( self.obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0, input.as_ptr(), @@ -110,7 +108,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { let res = f( self.obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0, input.as_ptr(), @@ -147,7 +145,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { gst::result_from_gboolean!( f( self.obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0, read_flags.into_glib(), @@ -169,7 +167,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { gst::result_from_gboolean!( f( self.obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0, caps.as_mut_ptr(), @@ -194,7 +192,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { gst::result_from_gboolean!( f( self.obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0, caps.as_mut_ptr(), @@ -220,7 +218,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { gst::result_from_gboolean!( f( self.obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0, direction.into_glib(), @@ -249,7 +247,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { gst::result_from_gboolean!( f( self.obj() - .unsafe_cast_ref::() + .unsafe_cast_ref::() .to_glib_none() .0, caps.as_mut_ptr(), @@ -263,7 +261,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass { impl RTPHeaderExtensionImplExt for T {} -unsafe impl IsSubclassable for crate::RTPHeaderExtension { +unsafe impl IsSubclassable for RTPHeaderExtension { fn class_init(klass: &mut glib::Class) { Self::parent_class_init::(klass); let klass = klass.as_mut(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_auth.rs b/gstreamer-rtsp-server/src/subclass/rtsp_auth.rs index f626a61ff..3d4ab2487 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_auth.rs @@ -4,7 +4,7 @@ use crate::{ffi, RTSPAuth, RTSPContext}; use glib::{prelude::*, subclass::prelude::*, translate::*}; use libc::c_char; -pub trait RTSPAuthImpl: RTSPAuthImplExt + ObjectImpl + Send + Sync { +pub trait RTSPAuthImpl: ObjectImpl + ObjectSubclass> + Send + Sync { fn authenticate(&self, ctx: &RTSPContext) -> bool { self.parent_authenticate(ctx) } @@ -18,12 +18,7 @@ pub trait RTSPAuthImpl: RTSPAuthImplExt + ObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTSPAuthImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTSPAuthImplExt: RTSPAuthImpl { fn parent_authenticate(&self, ctx: &RTSPContext) -> bool { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs index 63e4de92f..1956ebe69 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs @@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, RTSPClient}; -pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { +pub trait RTSPClientImpl: ObjectImpl + ObjectSubclass> + Send + Sync { fn create_sdp(&self, media: &crate::RTSPMedia) -> Option { self.parent_create_sdp(media) } @@ -155,12 +155,7 @@ pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTSPClientImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTSPClientImplExt: RTSPClientImpl { fn parent_create_sdp(&self, media: &crate::RTSPMedia) -> Option { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs index ee61f395f..a30d99b6d 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs @@ -22,7 +22,7 @@ impl SDPInfo { } } -pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync { +pub trait RTSPMediaImpl: ObjectImpl + ObjectSubclass> + Send + Sync { fn handle_message(&self, message: &gst::MessageRef) -> bool { self.parent_handle_message(message) } @@ -98,12 +98,7 @@ pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTSPMediaImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTSPMediaImplExt: RTSPMediaImpl { fn parent_handle_message(&self, message: &gst::MessageRef) -> bool { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index ec9679867..a2202883f 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -6,7 +6,9 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, RTSPMediaFactory}; -pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sync { +pub trait RTSPMediaFactoryImpl: + ObjectImpl + ObjectSubclass> + Send + Sync +{ fn gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option { self.parent_gen_key(url) } @@ -36,12 +38,7 @@ pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sy } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTSPMediaFactoryImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTSPMediaFactoryImplExt: RTSPMediaFactoryImpl { fn parent_gen_key(&self, url: &gst_rtsp::RTSPUrl) -> Option { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs b/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs index 6d4e4e9d7..4868a13d3 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs @@ -5,18 +5,15 @@ use gst_rtsp::ffi::GstRTSPUrl; use crate::{ffi, RTSPMountPoints}; -pub trait RTSPMountPointsImpl: RTSPMountPointsImplExt + ObjectImpl + Send + Sync { +pub trait RTSPMountPointsImpl: + ObjectImpl + ObjectSubclass> + Send + Sync +{ fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option { self.parent_make_path(url) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTSPMountPointsImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTSPMountPointsImplExt: RTSPMountPointsImpl { fn parent_make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_client.rs index b0007da4a..406f07a29 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_client.rs @@ -1,10 +1,13 @@ // 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 crate::RTSPOnvifClient; -pub trait RTSPOnvifClientImpl: RTSPClientImpl + Send + Sync {} +pub trait RTSPOnvifClientImpl: + RTSPClientImpl + ObjectSubclass> + Send + Sync +{ +} unsafe impl IsSubclassable for RTSPOnvifClient {} diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media.rs index cfec2f9a4..ed495ff6c 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media.rs @@ -1,10 +1,13 @@ // 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 crate::RTSPOnvifMedia; -pub trait RTSPOnvifMediaImpl: RTSPMediaImpl + Send + Sync {} +pub trait RTSPOnvifMediaImpl: + RTSPMediaImpl + ObjectSubclass> + Send + Sync +{ +} unsafe impl IsSubclassable for RTSPOnvifMedia {} diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs index c06efaa28..ffa5d4a83 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs @@ -6,19 +6,14 @@ use super::prelude::*; use crate::{ffi, RTSPOnvifMediaFactory}; pub trait RTSPOnvifMediaFactoryImpl: - RTSPMediaFactoryImplExt + RTSPMediaFactoryImpl + Send + Sync + RTSPMediaFactoryImpl + ObjectSubclass> + Send + Sync { fn has_backchannel_support(&self) -> bool { self.parent_has_backchannel_support() } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTSPOnvifMediaFactoryImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTSPOnvifMediaFactoryImplExt: RTSPOnvifMediaFactoryImpl { fn parent_has_backchannel_support(&self) -> bool { unsafe { let data = Self::type_data(); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_server.rs b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_server.rs index 96d0ae423..9bcc4106e 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_server.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_server.rs @@ -1,10 +1,13 @@ // 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 crate::RTSPOnvifServer; -pub trait RTSPOnvifServerImpl: RTSPServerImpl + Send + Sync {} +pub trait RTSPOnvifServerImpl: + RTSPServerImpl + ObjectSubclass> + Send + Sync +{ +} unsafe impl IsSubclassable for RTSPOnvifServer {} diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs index 5d7f99059..917d30b24 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs @@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, RTSPServer}; -pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync { +pub trait RTSPServerImpl: ObjectImpl + ObjectSubclass> + Send + Sync { fn create_client(&self) -> Option { self.parent_create_client() } @@ -14,12 +14,7 @@ pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait RTSPServerImplExt: sealed::Sealed + ObjectSubclass { +pub trait RTSPServerImplExt: RTSPServerImpl { fn parent_create_client(&self) -> Option; fn parent_client_connected(&self, client: &crate::RTSPClient); diff --git a/gstreamer-video/src/subclass/navigation.rs b/gstreamer-video/src/subclass/navigation.rs index 5a7393f20..b51b67fbb 100644 --- a/gstreamer-video/src/subclass/navigation.rs +++ b/gstreamer-video/src/subclass/navigation.rs @@ -4,7 +4,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, Navigation}; -pub trait NavigationImpl: ObjectImpl { +pub trait NavigationImpl: ObjectImpl + ObjectSubclass> { fn send_event(&self, structure: gst::Structure); #[cfg(feature = "v1_22")] @@ -16,12 +16,7 @@ pub trait NavigationImpl: ObjectImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait NavigationImplExt: sealed::Sealed + ObjectSubclass { +pub trait NavigationImplExt: NavigationImpl { fn parent_send_event(&self, structure: gst::Structure) { unsafe { let type_data = Self::type_data(); diff --git a/gstreamer-video/src/subclass/video_aggregator.rs b/gstreamer-video/src/subclass/video_aggregator.rs index 2d798f35b..d79952a6a 100644 --- a/gstreamer-video/src/subclass/video_aggregator.rs +++ b/gstreamer-video/src/subclass/video_aggregator.rs @@ -9,7 +9,7 @@ use crate::{ffi, VideoAggregator}; pub struct AggregateFramesToken<'a>(pub(crate) &'a VideoAggregator); -pub trait VideoAggregatorImpl: VideoAggregatorImplExt + AggregatorImpl { +pub trait VideoAggregatorImpl: AggregatorImpl + ObjectSubclass> { fn update_caps(&self, caps: &gst::Caps) -> Result { self.parent_update_caps(caps) } @@ -30,12 +30,8 @@ pub trait VideoAggregatorImpl: VideoAggregatorImplExt + AggregatorImpl { self.parent_find_best_format(downstream_caps) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} -pub trait VideoAggregatorImplExt: sealed::Sealed + ObjectSubclass { +pub trait VideoAggregatorImplExt: VideoAggregatorImpl { fn parent_update_caps(&self, caps: &gst::Caps) -> Result { unsafe { let data = Self::type_data(); diff --git a/gstreamer-video/src/subclass/video_aggregator_convert_pad.rs b/gstreamer-video/src/subclass/video_aggregator_convert_pad.rs index d46ad0485..a332baa42 100644 --- a/gstreamer-video/src/subclass/video_aggregator_convert_pad.rs +++ b/gstreamer-video/src/subclass/video_aggregator_convert_pad.rs @@ -1,10 +1,13 @@ // 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 crate::VideoAggregatorConvertPad; -pub trait VideoAggregatorConvertPadImpl: VideoAggregatorPadImpl {} +pub trait VideoAggregatorConvertPadImpl: + VideoAggregatorPadImpl + ObjectSubclass> +{ +} unsafe impl IsSubclassable for VideoAggregatorConvertPad {} diff --git a/gstreamer-video/src/subclass/video_aggregator_pad.rs b/gstreamer-video/src/subclass/video_aggregator_pad.rs index 6d4c51ddd..96ee7087d 100644 --- a/gstreamer-video/src/subclass/video_aggregator_pad.rs +++ b/gstreamer-video/src/subclass/video_aggregator_pad.rs @@ -7,7 +7,9 @@ use gst_base::{prelude::*, subclass::prelude::*}; use crate::{ffi, subclass::AggregateFramesToken, VideoAggregator, VideoAggregatorPad}; -pub trait VideoAggregatorPadImpl: VideoAggregatorPadImplExt + AggregatorPadImpl { +pub trait VideoAggregatorPadImpl: + AggregatorPadImpl + ObjectSubclass> +{ fn update_conversion_info(&self) { self.parent_update_conversion_info() } @@ -31,12 +33,7 @@ pub trait VideoAggregatorPadImpl: VideoAggregatorPadImplExt + AggregatorPadImpl } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait VideoAggregatorPadImplExt: ObjectSubclass + sealed::Sealed { +pub trait VideoAggregatorPadImplExt: VideoAggregatorPadImpl { fn parent_update_conversion_info(&self) { unsafe { let data = Self::type_data(); diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index 0f474b676..bad635aac 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -10,7 +10,7 @@ use crate::{ VideoCodecFrame, VideoDecoder, }; -pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl { +pub trait VideoDecoderImpl: ElementImpl + ObjectSubclass> { fn open(&self) -> Result<(), gst::ErrorMessage> { self.parent_open() } @@ -107,11 +107,8 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl { self.parent_handle_missing_data(timestamp, duration) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} -pub trait VideoDecoderImplExt: sealed::Sealed + ObjectSubclass { + +pub trait VideoDecoderImplExt: VideoDecoderImpl { fn parent_open(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 4745cdfb5..c07ea2f4d 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -10,7 +10,7 @@ use crate::{ VideoCodecFrame, VideoEncoder, }; -pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl { +pub trait VideoEncoderImpl: ElementImpl + ObjectSubclass> { fn open(&self) -> Result<(), gst::ErrorMessage> { self.parent_open() } @@ -85,12 +85,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait VideoEncoderImplExt: sealed::Sealed + ObjectSubclass { +pub trait VideoEncoderImplExt: VideoEncoderImpl { fn parent_open(&self) -> Result<(), gst::ErrorMessage> { unsafe { let data = Self::type_data(); diff --git a/gstreamer-video/src/subclass/video_filter.rs b/gstreamer-video/src/subclass/video_filter.rs index e820d8b1a..23da958fa 100644 --- a/gstreamer-video/src/subclass/video_filter.rs +++ b/gstreamer-video/src/subclass/video_filter.rs @@ -5,7 +5,7 @@ use gst_base::{prelude::*, subclass::prelude::*}; use crate::{ffi, VideoFilter, VideoFrameExt, VideoFrameRef, VideoInfo}; -pub trait VideoFilterImpl: VideoFilterImplExt + BaseTransformImpl { +pub trait VideoFilterImpl: BaseTransformImpl + ObjectSubclass> { fn set_info( &self, incaps: &gst::Caps, @@ -39,12 +39,7 @@ pub trait VideoFilterImpl: VideoFilterImplExt + BaseTransformImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait VideoFilterImplExt: sealed::Sealed + ObjectSubclass { +pub trait VideoFilterImplExt: VideoFilterImpl { fn parent_set_info( &self, incaps: &gst::Caps, diff --git a/gstreamer-video/src/subclass/video_sink.rs b/gstreamer-video/src/subclass/video_sink.rs index 8bf209a8c..c84a24e88 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -5,18 +5,13 @@ use gst_base::subclass::prelude::*; use crate::{ffi, VideoSink}; -pub trait VideoSinkImpl: VideoSinkImplExt + BaseSinkImpl + ElementImpl { +pub trait VideoSinkImpl: BaseSinkImpl + ObjectSubclass> { fn show_frame(&self, buffer: &gst::Buffer) -> Result { self.parent_show_frame(buffer) } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait VideoSinkImplExt: sealed::Sealed + ObjectSubclass { +pub trait VideoSinkImplExt: VideoSinkImpl { fn parent_show_frame(&self, buffer: &gst::Buffer) -> Result { unsafe { let data = Self::type_data(); diff --git a/gstreamer/src/subclass/allocator.rs b/gstreamer/src/subclass/allocator.rs index 494429492..db5ffb6dc 100644 --- a/gstreamer/src/subclass/allocator.rs +++ b/gstreamer/src/subclass/allocator.rs @@ -7,7 +7,7 @@ use glib::{bool_error, prelude::*, subclass::prelude::*, translate::*, BoolError use super::prelude::*; use crate::{ffi, AllocationParams, Allocator, Memory}; -pub trait AllocatorImpl: AllocatorImplExt + GstObjectImpl + Send + Sync { +pub trait AllocatorImpl: GstObjectImpl + ObjectSubclass> { fn alloc(&self, size: usize, params: Option<&AllocationParams>) -> Result { self.parent_alloc(size, params) } @@ -17,12 +17,7 @@ pub trait AllocatorImpl: AllocatorImplExt + GstObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait AllocatorImplExt: sealed::Sealed + ObjectSubclass { +pub trait AllocatorImplExt: AllocatorImpl { fn parent_alloc( &self, size: usize, diff --git a/gstreamer/src/subclass/bin.rs b/gstreamer/src/subclass/bin.rs index 7b6b96b8d..317ebf82f 100644 --- a/gstreamer/src/subclass/bin.rs +++ b/gstreamer/src/subclass/bin.rs @@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::{ffi, Bin, Element, LoggableError, Message}; -pub trait BinImpl: BinImplExt + ElementImpl { +pub trait BinImpl: ElementImpl + ObjectSubclass> { fn add_element(&self, element: &Element) -> Result<(), LoggableError> { self.parent_add_element(element) } @@ -23,12 +23,7 @@ pub trait BinImpl: BinImplExt + ElementImpl { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BinImplExt: sealed::Sealed + ObjectSubclass { +pub trait BinImplExt: BinImpl { fn parent_add_element(&self, element: &Element) -> Result<(), LoggableError> { unsafe { let data = Self::type_data(); diff --git a/gstreamer/src/subclass/buffer_pool.rs b/gstreamer/src/subclass/buffer_pool.rs index bcb7baa7a..f17043633 100644 --- a/gstreamer/src/subclass/buffer_pool.rs +++ b/gstreamer/src/subclass/buffer_pool.rs @@ -12,7 +12,7 @@ use libc::c_char; use super::prelude::*; use crate::{ffi, BufferPool, BufferPoolAcquireParams, BufferPoolConfigRef}; -pub trait BufferPoolImpl: BufferPoolImplExt + GstObjectImpl + Send + Sync { +pub trait BufferPoolImpl: GstObjectImpl + ObjectSubclass> { fn acquire_buffer( &self, params: Option<&BufferPoolAcquireParams>, @@ -64,12 +64,7 @@ pub trait BufferPoolImpl: BufferPoolImplExt + GstObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait BufferPoolImplExt: sealed::Sealed + ObjectSubclass { +pub trait BufferPoolImplExt: BufferPoolImpl { fn parent_acquire_buffer( &self, params: Option<&BufferPoolAcquireParams>, diff --git a/gstreamer/src/subclass/child_proxy.rs b/gstreamer/src/subclass/child_proxy.rs index 7ddcaae6c..6f13bf3be 100644 --- a/gstreamer/src/subclass/child_proxy.rs +++ b/gstreamer/src/subclass/child_proxy.rs @@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::{ffi, ChildProxy}; -pub trait ChildProxyImpl: GstObjectImpl + Send + Sync { +pub trait ChildProxyImpl: GstObjectImpl + ObjectSubclass> { fn child_by_name(&self, name: &str) -> Option { self.parent_child_by_name(name) } @@ -21,12 +21,7 @@ pub trait ChildProxyImpl: GstObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ChildProxyImplExt: sealed::Sealed + ObjectSubclass { +pub trait ChildProxyImplExt: ChildProxyImpl { fn parent_child_by_name(&self, name: &str) -> Option { unsafe { let type_data = Self::type_data(); diff --git a/gstreamer/src/subclass/clock.rs b/gstreamer/src/subclass/clock.rs index 70bb16365..5c525a952 100644 --- a/gstreamer/src/subclass/clock.rs +++ b/gstreamer/src/subclass/clock.rs @@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::{ffi, Clock, ClockError, ClockId, ClockReturn, ClockSuccess, ClockTime, ClockTimeDiff}; -pub trait ClockImpl: ClockImplExt + GstObjectImpl + Send + Sync { +pub trait ClockImpl: GstObjectImpl + ObjectSubclass> { fn change_resolution(&self, old_resolution: ClockTime, new_resolution: ClockTime) -> ClockTime { self.parent_change_resolution(old_resolution, new_resolution) } @@ -31,12 +31,7 @@ pub trait ClockImpl: ClockImplExt + GstObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ClockImplExt: sealed::Sealed + ObjectSubclass { +pub trait ClockImplExt: ClockImpl { fn parent_change_resolution( &self, old_resolution: ClockTime, diff --git a/gstreamer/src/subclass/device.rs b/gstreamer/src/subclass/device.rs index 1ae74ef73..fe3c05167 100644 --- a/gstreamer/src/subclass/device.rs +++ b/gstreamer/src/subclass/device.rs @@ -7,7 +7,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::{ffi, Device, Element, LoggableError}; -pub trait DeviceImpl: DeviceImplExt + GstObjectImpl + Send + Sync { +pub trait DeviceImpl: GstObjectImpl + ObjectSubclass> { fn create_element(&self, name: Option<&str>) -> Result { self.parent_create_element(name) } @@ -17,12 +17,7 @@ pub trait DeviceImpl: DeviceImplExt + GstObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait DeviceImplExt: sealed::Sealed + ObjectSubclass { +pub trait DeviceImplExt: DeviceImpl { fn parent_create_element(&self, name: Option<&str>) -> Result { unsafe { let data = Self::type_data(); diff --git a/gstreamer/src/subclass/device_provider.rs b/gstreamer/src/subclass/device_provider.rs index c87a56911..407f0d1d0 100644 --- a/gstreamer/src/subclass/device_provider.rs +++ b/gstreamer/src/subclass/device_provider.rs @@ -64,7 +64,7 @@ impl DeviceProviderMetadata { } } -pub trait DeviceProviderImpl: DeviceProviderImplExt + GstObjectImpl + Send + Sync { +pub trait DeviceProviderImpl: GstObjectImpl + ObjectSubclass> { fn metadata() -> Option<&'static DeviceProviderMetadata> { None } @@ -82,12 +82,7 @@ pub trait DeviceProviderImpl: DeviceProviderImplExt + GstObjectImpl + Send + Syn } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait DeviceProviderImplExt: sealed::Sealed + ObjectSubclass { +pub trait DeviceProviderImplExt: DeviceProviderImpl { fn parent_probe(&self) -> Vec { unsafe { let data = Self::type_data(); diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 18fd5ed80..9769f9fe3 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -67,7 +67,7 @@ impl ElementMetadata { } } -pub trait ElementImpl: ElementImplExt + GstObjectImpl + Send + Sync { +pub trait ElementImpl: GstObjectImpl + ObjectSubclass> { fn metadata() -> Option<&'static ElementMetadata> { None } @@ -121,12 +121,7 @@ pub trait ElementImpl: ElementImplExt + GstObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait ElementImplExt: sealed::Sealed + ObjectSubclass { +pub trait ElementImplExt: ElementImpl { fn parent_change_state( &self, transition: StateChange, diff --git a/gstreamer/src/subclass/ghost_pad.rs b/gstreamer/src/subclass/ghost_pad.rs index 76238f3f3..7ab6442ca 100644 --- a/gstreamer/src/subclass/ghost_pad.rs +++ b/gstreamer/src/subclass/ghost_pad.rs @@ -1,10 +1,10 @@ // 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 crate::GhostPad; -pub trait GhostPadImpl: ProxyPadImpl {} +pub trait GhostPadImpl: ProxyPadImpl + ObjectSubclass> {} unsafe impl IsSubclassable for GhostPad {} diff --git a/gstreamer/src/subclass/object.rs b/gstreamer/src/subclass/object.rs index 82d307013..0b0632a43 100644 --- a/gstreamer/src/subclass/object.rs +++ b/gstreamer/src/subclass/object.rs @@ -1,7 +1,10 @@ // 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> + Send + Sync +{ +} unsafe impl IsSubclassable for crate::Object {} diff --git a/gstreamer/src/subclass/pad.rs b/gstreamer/src/subclass/pad.rs index cba86c401..83d4a822f 100644 --- a/gstreamer/src/subclass/pad.rs +++ b/gstreamer/src/subclass/pad.rs @@ -5,7 +5,7 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::{ffi, Pad}; -pub trait PadImpl: PadImplExt + GstObjectImpl + Send + Sync { +pub trait PadImpl: GstObjectImpl + ObjectSubclass> { fn linked(&self, peer: &Pad) { self.parent_linked(peer) } @@ -15,12 +15,7 @@ pub trait PadImpl: PadImplExt + GstObjectImpl + Send + Sync { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait PadImplExt: sealed::Sealed + ObjectSubclass { +pub trait PadImplExt: PadImpl { fn parent_linked(&self, peer: &Pad) { unsafe { let data = Self::type_data(); diff --git a/gstreamer/src/subclass/pipeline.rs b/gstreamer/src/subclass/pipeline.rs index 294f9c483..7b1815380 100644 --- a/gstreamer/src/subclass/pipeline.rs +++ b/gstreamer/src/subclass/pipeline.rs @@ -1,10 +1,10 @@ // 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 crate::Pipeline; -pub trait PipelineImpl: BinImpl {} +pub trait PipelineImpl: BinImpl + ObjectSubclass> {} unsafe impl IsSubclassable for Pipeline {} diff --git a/gstreamer/src/subclass/preset.rs b/gstreamer/src/subclass/preset.rs index 5dc8a6464..ab82a48ba 100644 --- a/gstreamer/src/subclass/preset.rs +++ b/gstreamer/src/subclass/preset.rs @@ -1,9 +1,9 @@ // 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; -pub trait PresetImpl: super::element::ElementImpl {} +pub trait PresetImpl: super::element::ElementImpl + ObjectSubclass> {} unsafe impl IsImplementable for Preset {} diff --git a/gstreamer/src/subclass/proxy_pad.rs b/gstreamer/src/subclass/proxy_pad.rs index 7178eb996..ccfb9f158 100644 --- a/gstreamer/src/subclass/proxy_pad.rs +++ b/gstreamer/src/subclass/proxy_pad.rs @@ -1,10 +1,10 @@ // 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 crate::ProxyPad; -pub trait ProxyPadImpl: PadImpl {} +pub trait ProxyPadImpl: PadImpl + ObjectSubclass> {} unsafe impl IsSubclassable for ProxyPad {} diff --git a/gstreamer/src/subclass/system_clock.rs b/gstreamer/src/subclass/system_clock.rs index 929eb3cb5..07daba6a6 100644 --- a/gstreamer/src/subclass/system_clock.rs +++ b/gstreamer/src/subclass/system_clock.rs @@ -1,10 +1,10 @@ // 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 crate::SystemClock; -pub trait SystemClockImpl: ClockImpl {} +pub trait SystemClockImpl: ClockImpl + ObjectSubclass> {} unsafe impl IsSubclassable for SystemClock {} diff --git a/gstreamer/src/subclass/tag_setter.rs b/gstreamer/src/subclass/tag_setter.rs index b2b1fe062..7f10d6a61 100644 --- a/gstreamer/src/subclass/tag_setter.rs +++ b/gstreamer/src/subclass/tag_setter.rs @@ -1,9 +1,12 @@ // 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; -pub trait TagSetterImpl: super::element::ElementImpl {} +pub trait TagSetterImpl: + super::element::ElementImpl + ObjectSubclass> +{ +} unsafe impl IsImplementable for TagSetter {} diff --git a/gstreamer/src/subclass/task_pool.rs b/gstreamer/src/subclass/task_pool.rs index df1e37599..da84bb673 100644 --- a/gstreamer/src/subclass/task_pool.rs +++ b/gstreamer/src/subclass/task_pool.rs @@ -6,12 +6,12 @@ use std::{ sync::{Arc, Mutex}, }; -use glib::{ffi::gpointer, subclass::prelude::*, translate::*}; +use glib::{ffi::gpointer, prelude::*, subclass::prelude::*, translate::*}; use super::prelude::*; use crate::{ffi, TaskHandle, TaskPool}; -pub trait TaskPoolImpl: GstObjectImpl + Send + Sync { +pub trait TaskPoolImpl: GstObjectImpl + ObjectSubclass> { // rustdoc-stripper-ignore-next /// Handle to be returned from the `push` function to allow the caller to wait for the task's /// completion. diff --git a/gstreamer/src/subclass/tracer.rs b/gstreamer/src/subclass/tracer.rs index f6a8304cf..8536ef3bc 100644 --- a/gstreamer/src/subclass/tracer.rs +++ b/gstreamer/src/subclass/tracer.rs @@ -10,7 +10,7 @@ use crate::{ }; #[allow(unused_variables)] -pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync { +pub trait TracerImpl: GstObjectImpl + ObjectSubclass> { 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_remove_post(&self, ts: u64, bin: &Bin, success: bool) {} @@ -85,7 +85,7 @@ pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync { unsafe impl IsSubclassable for Tracer {} -pub trait TracerImplExt: ObjectSubclass { +pub trait TracerImplExt: TracerImpl { // rustdoc-stripper-ignore-next /// Register a corresponding hook to be called for this tracer when certain events occur. /// diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index 3164383c5..824057e1f 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -6,19 +6,16 @@ use glib::{prelude::*, subclass::prelude::*, translate::*}; use crate::{ffi, URIHandler, URIType}; -pub trait URIHandlerImpl: super::element::ElementImpl { +pub trait URIHandlerImpl: + super::element::ElementImpl + ObjectSubclass> +{ const URI_TYPE: URIType; fn protocols() -> &'static [&'static str]; fn uri(&self) -> Option; fn set_uri(&self, uri: &str) -> Result<(), glib::Error>; } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait URIHandlerImplExt: sealed::Sealed + ObjectSubclass { +pub trait URIHandlerImplExt: URIHandlerImpl { fn parent_protocols() -> Vec { unsafe { let type_data = Self::type_data();