From abbc85c3d0b73ab2916bc562fab5eb283e29469a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 19 Oct 2024 18:09:56 +0300 Subject: [PATCH] Remove unnecessary trait sealing For all these traits only the implementation that already exists is possible. Part-of: --- gstreamer-audio/src/audio_aggregator.rs | 7 +------ .../src/audio_aggregator_convert_pad.rs | 9 +-------- gstreamer-audio/src/audio_aggregator_pad.rs | 7 +------ gstreamer-audio/src/audio_decoder.rs | 7 +------ gstreamer-audio/src/audio_encoder.rs | 7 +------ gstreamer-audio/src/audio_filter.rs | 7 +------ gstreamer-base/src/aggregator.rs | 7 +------ gstreamer-base/src/aggregator_pad.rs | 7 +------ gstreamer-base/src/base_parse.rs | 7 +------ gstreamer-base/src/base_sink.rs | 7 +------ gstreamer-base/src/base_src.rs | 7 +------ gstreamer-base/src/base_transform.rs | 7 +------ gstreamer-editing-services/src/formatter.rs | 7 +------ gstreamer-gl/src/gl_context.rs | 7 +------ gstreamer-gl/src/gl_display.rs | 7 +------ gstreamer-gl/src/gl_framebuffer.rs | 7 +------ gstreamer-gl/src/gl_video_frame.rs | 17 ++++++----------- gstreamer-pbutils/src/audio_visualizer.rs | 19 ++++++------------- .../src/discoverer_stream_info.rs | 9 +-------- gstreamer-pbutils/src/encoding_profile.rs | 7 +------ gstreamer-rtp/src/rtp_base_depayload.rs | 7 +------ gstreamer-rtp/src/rtp_base_payload.rs | 7 +------ gstreamer-rtp/src/rtp_header_extension.rs | 7 +------ .../src/rtsp_address_pool.rs | 7 +------ gstreamer-rtsp-server/src/rtsp_auth.rs | 7 +------ gstreamer-rtsp-server/src/rtsp_client.rs | 7 +------ gstreamer-rtsp-server/src/rtsp_media.rs | 7 +------ .../src/rtsp_media_factory.rs | 7 +------ .../src/rtsp_onvif_media_factory.rs | 9 +-------- gstreamer-rtsp-server/src/rtsp_server.rs | 7 +------ gstreamer-rtsp-server/src/rtsp_session.rs | 7 +------ .../src/rtsp_session_pool.rs | 7 +------ gstreamer-video/src/video_aggregator.rs | 7 +------ .../src/video_aggregator_convert_pad.rs | 9 +-------- gstreamer-video/src/video_aggregator_pad.rs | 7 +------ gstreamer-video/src/video_decoder.rs | 7 +------ gstreamer-video/src/video_encoder.rs | 6 +----- gstreamer-video/src/video_filter.rs | 7 +------ gstreamer-video/src/video_frame.rs | 13 ++++--------- gstreamer-video/src/video_overlay.rs | 7 +------ gstreamer-webrtc/src/web_rtcice.rs | 7 +------ gstreamer/src/bin.rs | 7 +------ gstreamer/src/buffer_pool.rs | 7 +------ gstreamer/src/bus_unix.rs | 7 ++++--- gstreamer/src/bus_windows.rs | 7 ++++--- gstreamer/src/child_proxy.rs | 7 +------ gstreamer/src/clock.rs | 7 +------ gstreamer/src/control_binding.rs | 7 +------ gstreamer/src/control_source.rs | 7 +------ gstreamer/src/device_monitor.rs | 6 +----- gstreamer/src/device_provider.rs | 7 +------ gstreamer/src/element.rs | 7 +------ gstreamer/src/gobject.rs | 7 +------ gstreamer/src/object.rs | 7 +------ gstreamer/src/pad.rs | 7 +------ gstreamer/src/pipeline.rs | 7 +------ gstreamer/src/plugin_feature.rs | 7 +------ gstreamer/src/tag_setter.rs | 7 +------ gstreamer/src/task_pool.rs | 6 +----- 59 files changed, 78 insertions(+), 368 deletions(-) diff --git a/gstreamer-audio/src/audio_aggregator.rs b/gstreamer-audio/src/audio_aggregator.rs index ea4a8a17f..c477c7d81 100644 --- a/gstreamer-audio/src/audio_aggregator.rs +++ b/gstreamer-audio/src/audio_aggregator.rs @@ -10,12 +10,7 @@ use gst::prelude::*; use crate::{ffi, AudioAggregator, AudioAggregatorPad}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AudioAggregatorExtManual: sealed::Sealed + IsA + 'static { +pub trait AudioAggregatorExtManual: IsA + 'static { #[doc(alias = "gst_audio_aggregator_set_sink_caps")] fn set_sink_caps(&self, pad: &impl IsA, caps: &gst::CapsRef) { unsafe { diff --git a/gstreamer-audio/src/audio_aggregator_convert_pad.rs b/gstreamer-audio/src/audio_aggregator_convert_pad.rs index ff2fb7c23..a639581fe 100644 --- a/gstreamer-audio/src/audio_aggregator_convert_pad.rs +++ b/gstreamer-audio/src/audio_aggregator_convert_pad.rs @@ -8,14 +8,7 @@ use glib::{ use crate::{ffi, AudioAggregatorConvertPad}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AudioAggregatorConvertPadExtManual: - sealed::Sealed + IsA + 'static -{ +pub trait AudioAggregatorConvertPadExtManual: IsA + 'static { #[doc(alias = "converter-config")] fn converter_config(&self) -> Option { ObjectExt::property::>(self.as_ref(), "converter-config") diff --git a/gstreamer-audio/src/audio_aggregator_pad.rs b/gstreamer-audio/src/audio_aggregator_pad.rs index 8bd99da9c..62b17d660 100644 --- a/gstreamer-audio/src/audio_aggregator_pad.rs +++ b/gstreamer-audio/src/audio_aggregator_pad.rs @@ -3,12 +3,7 @@ use gst::prelude::*; use crate::{ffi, AudioAggregatorPad}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AudioAggregatorPadExtManual: sealed::Sealed + IsA + 'static { +pub trait AudioAggregatorPadExtManual: IsA + 'static { fn audio_info(&self) -> Option { unsafe { let ptr = self.as_ptr() as *mut ffi::GstAudioAggregatorPad; diff --git a/gstreamer-audio/src/audio_decoder.rs b/gstreamer-audio/src/audio_decoder.rs index a000df4ff..8ee9880df 100644 --- a/gstreamer-audio/src/audio_decoder.rs +++ b/gstreamer-audio/src/audio_decoder.rs @@ -20,12 +20,7 @@ extern "C" { ) -> gst::ffi::GstFlowReturn; } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AudioDecoderExtManual: sealed::Sealed + IsA + 'static { +pub trait AudioDecoderExtManual: IsA + 'static { #[doc(alias = "gst_audio_decoder_negotiate")] fn negotiate(&self) -> Result<(), gst::FlowError> { unsafe { diff --git a/gstreamer-audio/src/audio_encoder.rs b/gstreamer-audio/src/audio_encoder.rs index 23e101b84..ae1cb694f 100644 --- a/gstreamer-audio/src/audio_encoder.rs +++ b/gstreamer-audio/src/audio_encoder.rs @@ -6,12 +6,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, AudioEncoder}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AudioEncoderExtManual: sealed::Sealed + IsA + 'static { +pub trait AudioEncoderExtManual: IsA + 'static { #[doc(alias = "gst_audio_encoder_negotiate")] fn negotiate(&self) -> Result<(), gst::FlowError> { unsafe { diff --git a/gstreamer-audio/src/audio_filter.rs b/gstreamer-audio/src/audio_filter.rs index e6eb41a6a..8849b64b4 100644 --- a/gstreamer-audio/src/audio_filter.rs +++ b/gstreamer-audio/src/audio_filter.rs @@ -5,12 +5,7 @@ use gst_base::prelude::*; use crate::{ffi, AudioFilter, AudioInfo}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AudioFilterExtManual: sealed::Sealed + IsA + 'static { +pub trait AudioFilterExtManual: IsA + 'static { fn audio_info(&self) -> Option { unsafe { let ptr: &ffi::GstAudioFilter = &*(self.as_ptr() as *const _); diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index 03f9a203f..50bb6a50e 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -16,12 +16,7 @@ use gst::{format::FormattedValue, prelude::*}; use crate::{ffi, Aggregator, AggregatorPad}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AggregatorExtManual: sealed::Sealed + IsA + 'static { +pub trait AggregatorExtManual: IsA + 'static { #[doc(alias = "get_allocator")] #[doc(alias = "gst_aggregator_get_allocator")] fn allocator(&self) -> (Option, gst::AllocationParams) { diff --git a/gstreamer-base/src/aggregator_pad.rs b/gstreamer-base/src/aggregator_pad.rs index fedd04fc9..ec1116fb5 100644 --- a/gstreamer-base/src/aggregator_pad.rs +++ b/gstreamer-base/src/aggregator_pad.rs @@ -5,12 +5,7 @@ use gst::prelude::*; use crate::{ffi, AggregatorPad}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AggregatorPadExtManual: sealed::Sealed + IsA + 'static { +pub trait AggregatorPadExtManual: IsA + 'static { #[doc(alias = "get_segment")] fn segment(&self) -> gst::Segment { unsafe { diff --git a/gstreamer-base/src/base_parse.rs b/gstreamer-base/src/base_parse.rs index fca514ee2..81ea153c7 100644 --- a/gstreamer-base/src/base_parse.rs +++ b/gstreamer-base/src/base_parse.rs @@ -10,12 +10,7 @@ use gst::{ use crate::{ffi, BaseParse, BaseParseFrame}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait BaseParseExtManual: sealed::Sealed + IsA + 'static { +pub trait BaseParseExtManual: IsA + 'static { #[doc(alias = "get_sink_pad")] fn sink_pad(&self) -> &gst::Pad { unsafe { diff --git a/gstreamer-base/src/base_sink.rs b/gstreamer-base/src/base_sink.rs index 23fd7c270..fedcc340d 100644 --- a/gstreamer-base/src/base_sink.rs +++ b/gstreamer-base/src/base_sink.rs @@ -7,12 +7,7 @@ use gst::prelude::*; use crate::{ffi, BaseSink}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait BaseSinkExtManual: sealed::Sealed + IsA + 'static { +pub trait BaseSinkExtManual: IsA + 'static { #[doc(alias = "get_segment")] fn segment(&self) -> gst::Segment { unsafe { diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index 09ca0e13d..d80ee472b 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -7,12 +7,7 @@ use gst::prelude::*; use crate::{ffi, BaseSrc}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait BaseSrcExtManual: sealed::Sealed + IsA + 'static { +pub trait BaseSrcExtManual: IsA + 'static { #[doc(alias = "get_allocator")] #[doc(alias = "gst_base_src_get_allocator")] fn allocator(&self) -> (Option, gst::AllocationParams) { diff --git a/gstreamer-base/src/base_transform.rs b/gstreamer-base/src/base_transform.rs index 3bcfbf557..3a2cd4868 100644 --- a/gstreamer-base/src/base_transform.rs +++ b/gstreamer-base/src/base_transform.rs @@ -7,12 +7,7 @@ use gst::prelude::*; use crate::{ffi, BaseTransform}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait BaseTransformExtManual: sealed::Sealed + IsA + 'static { +pub trait BaseTransformExtManual: IsA + 'static { #[doc(alias = "get_allocator")] #[doc(alias = "gst_base_transform_get_allocator")] fn allocator(&self) -> (Option, gst::AllocationParams) { diff --git a/gstreamer-editing-services/src/formatter.rs b/gstreamer-editing-services/src/formatter.rs index 455002b26..ef9e84f1b 100644 --- a/gstreamer-editing-services/src/formatter.rs +++ b/gstreamer-editing-services/src/formatter.rs @@ -2,12 +2,7 @@ use crate::{ffi, prelude::*, Formatter}; use gst::glib::translate::*; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait FormatterExtManual: sealed::Sealed + IsA + 'static { +pub trait FormatterExtManual: IsA + 'static { fn can_load_uri(&self, uri: &str) -> Result<(), glib::Error> { unsafe { let klass = self.class_of::().unwrap(); diff --git a/gstreamer-gl/src/gl_context.rs b/gstreamer-gl/src/gl_context.rs index ee7106ea5..97c4e8ed7 100644 --- a/gstreamer-gl/src/gl_context.rs +++ b/gstreamer-gl/src/gl_context.rs @@ -45,12 +45,7 @@ impl GLContext { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait GLContextExtManual: sealed::Sealed + IsA + 'static { +pub trait GLContextExtManual: IsA + 'static { #[doc(alias = "get_gl_context")] #[doc(alias = "gst_gl_context_get_gl_context")] fn gl_context(&self) -> uintptr_t { diff --git a/gstreamer-gl/src/gl_display.rs b/gstreamer-gl/src/gl_display.rs index 3430e26cc..f981d1786 100644 --- a/gstreamer-gl/src/gl_display.rs +++ b/gstreamer-gl/src/gl_display.rs @@ -3,12 +3,7 @@ use crate::{ffi, GLContext, GLDisplay}; use glib::prelude::*; use glib::translate::*; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait GLDisplayExtManual: sealed::Sealed + IsA + 'static { +pub trait GLDisplayExtManual: IsA + 'static { #[doc(alias = "gst_gl_display_get_handle")] #[doc(alias = "get_handle")] fn handle(&self) -> usize { diff --git a/gstreamer-gl/src/gl_framebuffer.rs b/gstreamer-gl/src/gl_framebuffer.rs index fae4df122..a57e9a900 100644 --- a/gstreamer-gl/src/gl_framebuffer.rs +++ b/gstreamer-gl/src/gl_framebuffer.rs @@ -2,12 +2,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, GLFramebuffer, GLMemoryRef}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait GLFramebufferExtManual: sealed::Sealed + IsA + 'static { +pub trait GLFramebufferExtManual: IsA + 'static { #[doc(alias = "gst_gl_framebuffer_draw_to_texture")] fn draw_to_texture(&self, mem: &mut GLMemoryRef, func: F) { let mut func = std::mem::ManuallyDrop::new(func); diff --git a/gstreamer-gl/src/gl_video_frame.rs b/gstreamer-gl/src/gl_video_frame.rs index 4f9436695..a549aaed5 100644 --- a/gstreamer-gl/src/gl_video_frame.rs +++ b/gstreamer-gl/src/gl_video_frame.rs @@ -12,14 +12,9 @@ pub enum Writable {} // TODO: implement copy for videoframes. This would need to go through all the individual memories // and copy them. Some GL textures can be copied, others cannot. -pub trait IsGLVideoFrame: IsVideoFrame + Sized {} +pub unsafe trait IsGLVideoFrame: IsVideoFrame {} -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait GLVideoFrameExt: sealed::Sealed + IsGLVideoFrame { +pub trait GLVideoFrameExt: IsGLVideoFrame + VideoFrameExt { #[inline] fn memory(&self, idx: u32) -> Result<&GLMemoryRef, glib::BoolError> { if idx >= self.info().n_planes() { @@ -80,14 +75,14 @@ pub struct GLVideoFrame { unsafe impl Send for GLVideoFrame {} unsafe impl Sync for GLVideoFrame {} -impl IsVideoFrame for GLVideoFrame { +unsafe impl IsVideoFrame for GLVideoFrame { #[inline] fn as_raw(&self) -> &gst_video::ffi::GstVideoFrame { &self.frame } } -impl IsGLVideoFrame for GLVideoFrame {} +unsafe impl IsGLVideoFrame for GLVideoFrame {} impl Debug for GLVideoFrame { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { @@ -272,14 +267,14 @@ pub struct GLVideoFrameRef { unsafe impl Send for GLVideoFrameRef {} unsafe impl Sync for GLVideoFrameRef {} -impl IsVideoFrame for GLVideoFrameRef { +unsafe impl IsVideoFrame for GLVideoFrameRef { #[inline] fn as_raw(&self) -> &gst_video::ffi::GstVideoFrame { &self.frame } } -impl IsGLVideoFrame for GLVideoFrameRef {} +unsafe impl IsGLVideoFrame for GLVideoFrameRef {} impl Debug for GLVideoFrameRef { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/gstreamer-pbutils/src/audio_visualizer.rs b/gstreamer-pbutils/src/audio_visualizer.rs index f04602b05..ebf04f806 100644 --- a/gstreamer-pbutils/src/audio_visualizer.rs +++ b/gstreamer-pbutils/src/audio_visualizer.rs @@ -4,18 +4,11 @@ use gst::prelude::*; use crate::{ffi, subclass::AudioVisualizerSetupToken, AudioVisualizer}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait AudioVisualizerExtManual: - sealed::Sealed + IsA + IsA + 'static -{ +pub trait AudioVisualizerExtManual: IsA + 'static { // rustdoc-stripper-ignore-next /// Returns the number of samples per frame required before calling the render method fn req_spf(&self) -> u32 { - let sinkpad = self.static_pad("sink").expect("sink pad presence"); + let sinkpad = self.as_ref().static_pad("sink").expect("sink pad presence"); let _stream_lock = sinkpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; @@ -31,7 +24,7 @@ pub trait AudioVisualizerExtManual: token.0.as_ptr() ); - let sinkpad = self.static_pad("sink").expect("sink pad presence"); + let sinkpad = self.as_ref().static_pad("sink").expect("sink pad presence"); let _stream_lock = sinkpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; @@ -41,7 +34,7 @@ pub trait AudioVisualizerExtManual: } fn audio_info(&self) -> gst_audio::AudioInfo { - let sinkpad = self.static_pad("sink").expect("sink pad presence"); + let sinkpad = self.as_ref().static_pad("sink").expect("sink pad presence"); let _stream_lock = sinkpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; @@ -54,7 +47,7 @@ pub trait AudioVisualizerExtManual: } fn video_info(&self) -> gst_video::VideoInfo { - let srcpad = self.static_pad("src").expect("src pad presence"); + let srcpad = self.as_ref().static_pad("src").expect("src pad presence"); let _stream_lock = srcpad.stream_lock(); let ptr = self.as_ptr() as *mut ffi::GstAudioVisualizer; @@ -67,4 +60,4 @@ pub trait AudioVisualizerExtManual: } } -impl + IsA> AudioVisualizerExtManual for O {} +impl> AudioVisualizerExtManual for O {} diff --git a/gstreamer-pbutils/src/discoverer_stream_info.rs b/gstreamer-pbutils/src/discoverer_stream_info.rs index 2e135d9a5..fb4c6ba0a 100644 --- a/gstreamer-pbutils/src/discoverer_stream_info.rs +++ b/gstreamer-pbutils/src/discoverer_stream_info.rs @@ -31,14 +31,7 @@ impl Iterator for Iter { impl std::iter::FusedIterator for Iter {} -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait DiscovererStreamInfoExtManual: - sealed::Sealed + IsA + 'static -{ +pub trait DiscovererStreamInfoExtManual: IsA + 'static { fn next_iter(&self) -> Iter { Iter { stream_info: self.next(), diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index cada5ad99..3531f5d1e 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -8,12 +8,7 @@ use crate::{ ffi, EncodingAudioProfile, EncodingContainerProfile, EncodingProfile, EncodingVideoProfile, }; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait EncodingProfileExtManual: sealed::Sealed + IsA + 'static { +pub trait EncodingProfileExtManual: IsA + 'static { #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_encoding_profile_get_element_properties")] diff --git a/gstreamer-rtp/src/rtp_base_depayload.rs b/gstreamer-rtp/src/rtp_base_depayload.rs index 8d8d1bfb3..a95ce57ed 100644 --- a/gstreamer-rtp/src/rtp_base_depayload.rs +++ b/gstreamer-rtp/src/rtp_base_depayload.rs @@ -5,12 +5,7 @@ use glib::translate::*; use crate::{ffi, RTPBaseDepayload}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTPBaseDepayloadExtManual: sealed::Sealed + IsA + 'static { +pub trait RTPBaseDepayloadExtManual: IsA + 'static { #[cfg(feature = "v1_24")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))] fn extensions(&self) -> Vec { diff --git a/gstreamer-rtp/src/rtp_base_payload.rs b/gstreamer-rtp/src/rtp_base_payload.rs index 2fb645166..af043b094 100644 --- a/gstreamer-rtp/src/rtp_base_payload.rs +++ b/gstreamer-rtp/src/rtp_base_payload.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, RTPBasePayload}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTPBasePayloadExtManual: sealed::Sealed + IsA + 'static { +pub trait RTPBasePayloadExtManual: IsA + 'static { #[cfg(feature = "v1_20")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[doc(alias = "gst_rtp_base_payload_set_outcaps_structure")] diff --git a/gstreamer-rtp/src/rtp_header_extension.rs b/gstreamer-rtp/src/rtp_header_extension.rs index 24b69b238..fd4ccdea8 100644 --- a/gstreamer-rtp/src/rtp_header_extension.rs +++ b/gstreamer-rtp/src/rtp_header_extension.rs @@ -2,12 +2,7 @@ use glib::{object::IsA, translate::*}; use crate::{ffi, RTPHeaderExtension, RTPHeaderExtensionFlags}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTPHeaderExtensionExtManual: sealed::Sealed + IsA + 'static { +pub trait RTPHeaderExtensionExtManual: IsA + 'static { #[doc(alias = "gst_rtp_header_extension_read")] fn read( &self, diff --git a/gstreamer-rtsp-server/src/rtsp_address_pool.rs b/gstreamer-rtsp-server/src/rtsp_address_pool.rs index 0b11a252f..7cb6faf85 100644 --- a/gstreamer-rtsp-server/src/rtsp_address_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_address_pool.rs @@ -6,12 +6,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, RTSPAddress, RTSPAddressPool, RTSPAddressPoolResult}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPAddressPoolExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPAddressPoolExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_address_pool_reserve_address")] fn reserve_address( &self, diff --git a/gstreamer-rtsp-server/src/rtsp_auth.rs b/gstreamer-rtsp-server/src/rtsp_auth.rs index 82bdaf18b..c0bc44d0b 100644 --- a/gstreamer-rtsp-server/src/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/rtsp_auth.rs @@ -10,12 +10,7 @@ use glib::{ use crate::{ffi, RTSPAuth, RTSPToken}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPAuthExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPAuthExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_auth_set_default_token")] fn set_default_token(&self, mut token: Option<&mut RTSPToken>) { unsafe { diff --git a/gstreamer-rtsp-server/src/rtsp_client.rs b/gstreamer-rtsp-server/src/rtsp_client.rs index ef108d319..e0af262f4 100644 --- a/gstreamer-rtsp-server/src/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/rtsp_client.rs @@ -4,12 +4,7 @@ use crate::{ffi, RTSPClient, RTSPSession}; use glib::{prelude::*, source::SourceId, translate::*}; use gst_rtsp::rtsp_message::RTSPMessage; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPClientExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPClientExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_client_attach")] fn attach(&self, context: Option<&glib::MainContext>) -> SourceId { unsafe { diff --git a/gstreamer-rtsp-server/src/rtsp_media.rs b/gstreamer-rtsp-server/src/rtsp_media.rs index 3466b9cbf..62bc3e8bf 100644 --- a/gstreamer-rtsp-server/src/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/rtsp_media.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, RTSPMedia}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPMediaExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPMediaExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_media_take_pipeline")] fn take_pipeline(&self, pipeline: &impl IsA) { unsafe { diff --git a/gstreamer-rtsp-server/src/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/rtsp_media_factory.rs index ac31b87b1..712de3f0a 100644 --- a/gstreamer-rtsp-server/src/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/rtsp_media_factory.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, RTSPMediaFactory}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPMediaFactoryExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPMediaFactoryExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_media_factory_add_role_from_structure")] fn add_role_from_structure(&self, structure: &gst::StructureRef) { unsafe { diff --git a/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs b/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs index bf69ebf6d..bbc5b602a 100644 --- a/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs +++ b/gstreamer-rtsp-server/src/rtsp_onvif_media_factory.rs @@ -4,14 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, RTSPContext, RTSPOnvifMediaFactory}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPOnvifMediaFactoryExtManual: - sealed::Sealed + IsA + 'static -{ +pub trait RTSPOnvifMediaFactoryExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_onvif_media_factory_requires_backchannel")] fn requires_backchannel(&self, ctx: &RTSPContext) -> bool { skip_assert_initialized!(); diff --git a/gstreamer-rtsp-server/src/rtsp_server.rs b/gstreamer-rtsp-server/src/rtsp_server.rs index 8762b8ea5..b982f83cd 100644 --- a/gstreamer-rtsp-server/src/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/rtsp_server.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, source::SourceId, translate::*}; use crate::{ffi, RTSPServer}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPServerExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPServerExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_server_attach")] fn attach( &self, diff --git a/gstreamer-rtsp-server/src/rtsp_session.rs b/gstreamer-rtsp-server/src/rtsp_session.rs index 1584682ef..e1d2eaab6 100644 --- a/gstreamer-rtsp-server/src/rtsp_session.rs +++ b/gstreamer-rtsp-server/src/rtsp_session.rs @@ -6,12 +6,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, RTSPSession, RTSPSessionMedia}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPSessionExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPSessionExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_session_dup_media")] #[doc(alias = "gst_rtsp_session_get_media")] fn media(&self, path: &str) -> (Option, i32) { diff --git a/gstreamer-rtsp-server/src/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/rtsp_session_pool.rs index b764ad08b..c6e0b7240 100644 --- a/gstreamer-rtsp-server/src/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_session_pool.rs @@ -36,12 +36,7 @@ fn into_raw_watch ControlFlow + Send + 'static>(fu Box::into_raw(func) as gpointer } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait RTSPSessionPoolExtManual: sealed::Sealed + IsA + 'static { +pub trait RTSPSessionPoolExtManual: IsA + 'static { #[doc(alias = "gst_rtsp_session_pool_create_watch")] fn create_watch(&self, name: Option<&str>, priority: Priority, func: F) -> glib::Source where diff --git a/gstreamer-video/src/video_aggregator.rs b/gstreamer-video/src/video_aggregator.rs index e610f18a0..f30439815 100644 --- a/gstreamer-video/src/video_aggregator.rs +++ b/gstreamer-video/src/video_aggregator.rs @@ -3,12 +3,7 @@ use gst::prelude::*; use crate::{ffi, VideoAggregator}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait VideoAggregatorExtManual: sealed::Sealed + IsA + 'static { +pub trait VideoAggregatorExtManual: IsA + 'static { fn video_info(&self) -> Option { unsafe { let ptr = self.as_ptr() as *mut ffi::GstVideoAggregator; diff --git a/gstreamer-video/src/video_aggregator_convert_pad.rs b/gstreamer-video/src/video_aggregator_convert_pad.rs index 5f39b9588..f65f4dcdb 100644 --- a/gstreamer-video/src/video_aggregator_convert_pad.rs +++ b/gstreamer-video/src/video_aggregator_convert_pad.rs @@ -8,14 +8,7 @@ use glib::{ use crate::{ffi, VideoAggregatorConvertPad}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait VideoAggregatorConvertPadExtManual: - sealed::Sealed + IsA + 'static -{ +pub trait VideoAggregatorConvertPadExtManual: IsA + 'static { #[doc(alias = "converter-config")] fn converter_config(&self) -> Option { ObjectExt::property::>(self.as_ref(), "converter-config") diff --git a/gstreamer-video/src/video_aggregator_pad.rs b/gstreamer-video/src/video_aggregator_pad.rs index 426b38484..2ffc640de 100644 --- a/gstreamer-video/src/video_aggregator_pad.rs +++ b/gstreamer-video/src/video_aggregator_pad.rs @@ -3,12 +3,7 @@ use gst::prelude::*; use crate::{ffi, subclass::AggregateFramesToken, VideoAggregatorPad}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait VideoAggregatorPadExtManual: sealed::Sealed + IsA + 'static { +pub trait VideoAggregatorPadExtManual: IsA + 'static { #[doc(alias = "gst_video_aggregator_pad_has_current_buffer")] fn has_current_buffer(&self, _token: &AggregateFramesToken) -> bool { unsafe { diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index 972a6d3a8..d11a69503 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -28,12 +28,7 @@ extern "C" { ) -> gst::ffi::GstFlowReturn; } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait VideoDecoderExtManual: sealed::Sealed + IsA + 'static { +pub trait VideoDecoderExtManual: IsA + 'static { #[doc(alias = "gst_video_decoder_allocate_output_frame")] fn allocate_output_frame( &self, diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index b459f5d7d..fb013d532 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -10,12 +10,8 @@ use crate::{ video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext}, VideoCodecFrame, VideoEncoder, }; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} -pub trait VideoEncoderExtManual: sealed::Sealed + IsA + 'static { +pub trait VideoEncoderExtManual: IsA + 'static { #[doc(alias = "gst_video_encoder_allocate_output_frame")] fn allocate_output_frame( &self, diff --git a/gstreamer-video/src/video_filter.rs b/gstreamer-video/src/video_filter.rs index c6ef1df73..8f51d0f9a 100644 --- a/gstreamer-video/src/video_filter.rs +++ b/gstreamer-video/src/video_filter.rs @@ -6,12 +6,7 @@ use gst_base::prelude::*; use crate::{ffi, VideoFilter}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait VideoFilterExtManual: sealed::Sealed + IsA + 'static { +pub trait VideoFilterExtManual: IsA + 'static { fn input_video_info(&self) -> Option { unsafe { let ptr = self.as_ptr() as *mut ffi::GstVideoFilter; diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 7d8c4c976..d74e39984 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -8,11 +8,11 @@ use glib::translate::{from_glib, from_glib_none, Borrowed, ToGlibPtr}; pub enum Readable {} pub enum Writable {} -pub trait IsVideoFrame { +pub unsafe trait IsVideoFrame { fn as_raw(&self) -> &ffi::GstVideoFrame; } -impl IsVideoFrame for VideoFrame { +unsafe impl IsVideoFrame for VideoFrame { #[inline] fn as_raw(&self) -> &ffi::GstVideoFrame { &self.frame @@ -39,12 +39,7 @@ impl fmt::Debug for VideoFrame { } } -mod sealed { - pub trait Sealed {} - impl Sealed for T {} -} - -pub trait VideoFrameExt: sealed::Sealed + IsVideoFrame { +pub trait VideoFrameExt: IsVideoFrame { #[inline] fn as_ptr(&self) -> *const ffi::GstVideoFrame { self.as_raw() as _ @@ -556,7 +551,7 @@ pub struct VideoFrameRef { phantom: PhantomData, } -impl IsVideoFrame for VideoFrameRef { +unsafe impl IsVideoFrame for VideoFrameRef { #[inline] fn as_raw(&self) -> &ffi::GstVideoFrame { &self.frame diff --git a/gstreamer-video/src/video_overlay.rs b/gstreamer-video/src/video_overlay.rs index fe196691c..ac1023049 100644 --- a/gstreamer-video/src/video_overlay.rs +++ b/gstreamer-video/src/video_overlay.rs @@ -5,12 +5,7 @@ use libc::uintptr_t; use crate::{ffi, VideoOverlay}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait VideoOverlayExtManual: sealed::Sealed + IsA + 'static { +pub trait VideoOverlayExtManual: IsA + 'static { unsafe fn set_window_handle(&self, handle: uintptr_t) { ffi::gst_video_overlay_set_window_handle(self.as_ref().to_glib_none().0, handle) } diff --git a/gstreamer-webrtc/src/web_rtcice.rs b/gstreamer-webrtc/src/web_rtcice.rs index ccb5bb3e9..0f8dc4007 100644 --- a/gstreamer-webrtc/src/web_rtcice.rs +++ b/gstreamer-webrtc/src/web_rtcice.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, WebRTCICE, WebRTCICEStream}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait WebRTCICEExtManual: sealed::Sealed + IsA + 'static { +pub trait WebRTCICEExtManual: IsA + 'static { #[doc(alias = "gst_webrtc_ice_add_candidate")] fn add_candidate(&self, stream: &impl IsA, candidate: &str) { #[cfg(not(feature = "v1_24"))] diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 3cf17087e..4e2e91f94 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -42,12 +42,7 @@ impl Bin { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait GstBinExtManual: sealed::Sealed + IsA + 'static { +pub trait GstBinExtManual: IsA + 'static { #[doc(alias = "gst_bin_add_many")] fn add_many( &self, diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index 6e418d479..8e07e5891 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -345,12 +345,7 @@ impl FromGlibPtrNone<*mut ffi::GstBufferPoolAcquireParams> for BufferPoolAcquire } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait BufferPoolExtManual: sealed::Sealed + IsA + 'static { +pub trait BufferPoolExtManual: IsA + 'static { #[doc(alias = "get_config")] #[doc(alias = "gst_buffer_pool_get_config")] fn config(&self) -> BufferPoolConfig { diff --git a/gstreamer/src/bus_unix.rs b/gstreamer/src/bus_unix.rs index 6dba647d8..02c34e769 100644 --- a/gstreamer/src/bus_unix.rs +++ b/gstreamer/src/bus_unix.rs @@ -17,19 +17,20 @@ cfg_if::cfg_if! { } use super::Bus; +use glib::prelude::*; -pub trait UnixBusExtManual: 'static { +pub trait UnixBusExtManual: IsA + 'static { #[doc(alias = "get_pollfd")] #[doc(alias = "gst_bus_get_pollfd")] fn pollfd(&self) -> unix::io::RawFd; } -impl UnixBusExtManual for Bus { +impl> UnixBusExtManual for T { fn pollfd(&self) -> unix::io::RawFd { #[cfg(unix)] unsafe { let mut pollfd = mem::MaybeUninit::uninit(); - crate::ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr()); + crate::ffi::gst_bus_get_pollfd(self.as_ref().to_glib_none().0, pollfd.as_mut_ptr()); let pollfd = pollfd.assume_init(); pollfd.fd } diff --git a/gstreamer/src/bus_windows.rs b/gstreamer/src/bus_windows.rs index 7d80c49da..f5c683f10 100644 --- a/gstreamer/src/bus_windows.rs +++ b/gstreamer/src/bus_windows.rs @@ -16,20 +16,21 @@ cfg_if::cfg_if! { } } +use glib::prelude::*; use super::Bus; -pub trait WindowsBusExtManual: 'static { +pub trait WindowsBusExtManual: IsA + 'static { #[doc(alias = "get_pollfd")] #[doc(alias = "gst_bus_get_pollfd")] fn pollfd(&self) -> windows::io::RawHandle; } -impl WindowsBusExtManual for Bus { +impl> WindowsBusExtManual for T { fn pollfd(&self) -> windows::io::RawHandle { #[cfg(windows)] unsafe { let mut pollfd = mem::MaybeUninit::uninit(); - crate::ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr()); + crate::ffi::gst_bus_get_pollfd(self.as_ref().to_glib_none().0, pollfd.as_mut_ptr()); let pollfd = pollfd.assume_init(); pollfd.fd as *mut _ } diff --git a/gstreamer/src/child_proxy.rs b/gstreamer/src/child_proxy.rs index 003e652dd..f09ee3dac 100644 --- a/gstreamer/src/child_proxy.rs +++ b/gstreamer/src/child_proxy.rs @@ -6,12 +6,7 @@ use glib::{prelude::*, translate::*}; use crate::ChildProxy; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ChildProxyExtManual: sealed::Sealed + IsA + 'static { +pub trait ChildProxyExtManual: IsA + 'static { #[doc(alias = "gst_child_proxy_lookup")] fn lookup(&self, name: &str) -> Result<(glib::Object, glib::ParamSpec), glib::BoolError> { unsafe { diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 2b3312d33..cf710e67f 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -420,12 +420,7 @@ impl Clock { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ClockExtManual: sealed::Sealed + IsA + 'static { +pub trait ClockExtManual: IsA + 'static { #[doc(alias = "gst_clock_new_periodic_id")] fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> PeriodicClockId { assert_ne!(interval, ClockTime::ZERO); diff --git a/gstreamer/src/control_binding.rs b/gstreamer/src/control_binding.rs index b499b1e0f..8430adb4c 100644 --- a/gstreamer/src/control_binding.rs +++ b/gstreamer/src/control_binding.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ClockTime, ControlBinding}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ControlBindingExtManual: sealed::Sealed + IsA + 'static { +pub trait ControlBindingExtManual: IsA + 'static { #[doc(alias = "get_g_value_array")] #[doc(alias = "gst_control_binding_get_g_value_array")] fn g_value_array( diff --git a/gstreamer/src/control_source.rs b/gstreamer/src/control_source.rs index dd588da66..ec04e9245 100644 --- a/gstreamer/src/control_source.rs +++ b/gstreamer/src/control_source.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ClockTime, ControlSource}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ControlSourceExtManual: sealed::Sealed + IsA + 'static { +pub trait ControlSourceExtManual: IsA + 'static { #[doc(alias = "get_value_array")] #[doc(alias = "gst_control_source_get_value_array")] fn value_array( diff --git a/gstreamer/src/device_monitor.rs b/gstreamer/src/device_monitor.rs index a1cfb373e..a26951562 100644 --- a/gstreamer/src/device_monitor.rs +++ b/gstreamer/src/device_monitor.rs @@ -26,12 +26,8 @@ impl FromGlib for DeviceMonitorFilterId { DeviceMonitorFilterId(NonZeroU32::new_unchecked(val)) } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} -pub trait DeviceMonitorExtManual: sealed::Sealed + IsA + 'static { +pub trait DeviceMonitorExtManual: IsA + 'static { #[doc(alias = "gst_device_monitor_add_filter")] fn add_filter( &self, diff --git a/gstreamer/src/device_provider.rs b/gstreamer/src/device_provider.rs index b41c6917b..9d15a7c3f 100644 --- a/gstreamer/src/device_provider.rs +++ b/gstreamer/src/device_provider.rs @@ -29,12 +29,7 @@ impl DeviceProvider { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait DeviceProviderExtManual: sealed::Sealed + IsA + 'static { +pub trait DeviceProviderExtManual: IsA + 'static { #[doc(alias = "get_metadata")] #[doc(alias = "gst_device_provider_class_get_metadata")] fn metadata<'a>(&self, key: &str) -> Option<&'a str> { diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 7575baab5..bc0057221 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -102,12 +102,7 @@ impl FromGlib for NotifyWatchId { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ElementExtManual: sealed::Sealed + IsA + 'static { +pub trait ElementExtManual: IsA + 'static { #[doc(alias = "get_element_class")] #[inline] fn element_class(&self) -> &glib::Class { diff --git a/gstreamer/src/gobject.rs b/gstreamer/src/gobject.rs index 1041a3c5c..c3d52fc13 100644 --- a/gstreamer/src/gobject.rs +++ b/gstreamer/src/gobject.rs @@ -4,12 +4,7 @@ use glib::prelude::*; use crate::value::GstValueExt; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait GObjectExtManualGst: sealed::Sealed + IsA + 'static { +pub trait GObjectExtManualGst: IsA + 'static { #[doc(alias = "gst_util_set_object_arg")] #[track_caller] fn set_property_from_str(&self, name: &str, value: &str) { diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index a3ff05417..87fde009d 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, signal::SignalHandlerId, translate::*}; use crate::{ffi, ClockTime, Object, ObjectFlags}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait GstObjectExtManual: sealed::Sealed + IsA + 'static { +pub trait GstObjectExtManual: IsA + 'static { #[doc(alias = "deep-notify")] fn connect_deep_notify< F: Fn(&Self, &crate::Object, &glib::ParamSpec) + Send + Sync + 'static, diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index be00de92b..3b12998a4 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -195,12 +195,7 @@ pub enum EventForeachAction { Replace(Event), } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait PadExtManual: sealed::Sealed + IsA + 'static { +pub trait PadExtManual: IsA + 'static { #[doc(alias = "gst_pad_add_probe")] fn add_probe(&self, mask: PadProbeType, func: F) -> Option where diff --git a/gstreamer/src/pipeline.rs b/gstreamer/src/pipeline.rs index 3d0a54d54..f68fc0a74 100644 --- a/gstreamer/src/pipeline.rs +++ b/gstreamer/src/pipeline.rs @@ -40,12 +40,7 @@ impl Pipeline { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait GstPipelineExtManual: sealed::Sealed + IsA + 'static { +pub trait GstPipelineExtManual: IsA + 'static { fn set_pipeline_flags(&self, flags: PipelineFlags) { unsafe { let ptr: *mut ffi::GstObject = self.as_ptr() as *mut _; diff --git a/gstreamer/src/plugin_feature.rs b/gstreamer/src/plugin_feature.rs index 1e82b58d0..4df3f1db9 100644 --- a/gstreamer/src/plugin_feature.rs +++ b/gstreamer/src/plugin_feature.rs @@ -7,12 +7,7 @@ use glib::{ use crate::{ffi, PluginFeature, Rank}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait PluginFeatureExtManual: sealed::Sealed + IsA + Sized + 'static { +pub trait PluginFeatureExtManual: IsA + 'static { #[doc(alias = "get_rank")] #[doc(alias = "gst_plugin_feature_get_rank")] fn rank(&self) -> Rank { diff --git a/gstreamer/src/tag_setter.rs b/gstreamer/src/tag_setter.rs index 270050052..5bc336bd3 100644 --- a/gstreamer/src/tag_setter.rs +++ b/gstreamer/src/tag_setter.rs @@ -4,12 +4,7 @@ use glib::{prelude::*, translate::*}; use crate::{ffi, tags::*, TagMergeMode, TagSetter}; -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait TagSetterExtManual: sealed::Sealed + IsA + 'static { +pub trait TagSetterExtManual: IsA + 'static { #[doc(alias = "gst_tag_setter_add_tag_value")] fn add_tag<'a, T: Tag<'a>>(&self, value: &T::TagType, mode: TagMergeMode) { unsafe { diff --git a/gstreamer/src/task_pool.rs b/gstreamer/src/task_pool.rs index a1fc6479e..2f617e65f 100644 --- a/gstreamer/src/task_pool.rs +++ b/gstreamer/src/task_pool.rs @@ -10,12 +10,8 @@ unsafe extern "C" fn task_pool_trampoline(data: gp let func = Box::from_raw(data as *mut P); func() } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} -pub trait TaskPoolExtManual: sealed::Sealed + IsA + 'static { +pub trait TaskPoolExtManual: IsA + 'static { #[doc(alias = "gst_task_pool_push")] fn push( &self,