From 4f5b2f5060ad138688aca95e37c6b2459e55ee38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 25 Jul 2020 11:02:04 +0300 Subject: [PATCH] Update for removal of ObjectImpl::get_type_data() --- examples/src/bin/rtsp-server-subclass.rs | 19 +- examples/src/bin/subclass.rs | 6 +- gstreamer-audio/src/subclass/audio_decoder.rs | 91 +++--- gstreamer-audio/src/subclass/audio_encoder.rs | 86 +++--- gstreamer-audio/src/subclass/audio_sink.rs | 43 ++- gstreamer-audio/src/subclass/audio_src.rs | 41 ++- gstreamer-base/src/subclass/aggregator.rs | 101 +++---- gstreamer-base/src/subclass/aggregator_pad.rs | 24 +- gstreamer-base/src/subclass/base_parse.rs | 31 +- gstreamer-base/src/subclass/base_sink.rs | 71 ++--- gstreamer-base/src/subclass/base_src.rs | 91 +++--- gstreamer-base/src/subclass/base_transform.rs | 107 +++---- gstreamer-base/src/subclass/push_src.rs | 21 +- .../src/subclass/rtsp_client.rs | 264 +++++++----------- .../src/subclass/rtsp_media.rs | 152 ++++------ .../src/subclass/rtsp_media_factory.rs | 68 ++--- .../src/subclass/rtsp_server.rs | 23 +- gstreamer-video/src/subclass/video_decoder.rs | 96 +++---- gstreamer-video/src/subclass/video_encoder.rs | 86 +++--- gstreamer-video/src/subclass/video_sink.rs | 13 +- gstreamer/src/subclass/bin.rs | 21 +- gstreamer/src/subclass/child_proxy.rs | 37 +-- gstreamer/src/subclass/clock.rs | 59 ++-- gstreamer/src/subclass/device.rs | 24 +- gstreamer/src/subclass/device_provider.rs | 33 +-- gstreamer/src/subclass/element.rs | 53 ++-- gstreamer/src/subclass/ghost_pad.rs | 4 +- gstreamer/src/subclass/pad.rs | 27 +- gstreamer/src/subclass/pipeline.rs | 4 +- gstreamer/src/subclass/preset.rs | 4 +- gstreamer/src/subclass/system_clock.rs | 4 +- gstreamer/src/subclass/tag_setter.rs | 4 +- gstreamer/src/subclass/uri_handler.rs | 32 +-- 33 files changed, 665 insertions(+), 1075 deletions(-) diff --git a/examples/src/bin/rtsp-server-subclass.rs b/examples/src/bin/rtsp-server-subclass.rs index 04dd5e99a..bbec1e3ae 100644 --- a/examples/src/bin/rtsp-server-subclass.rs +++ b/examples/src/bin/rtsp-server-subclass.rs @@ -14,7 +14,6 @@ extern crate gstreamer_sdp as gst_sdp; use gst_rtsp_server::prelude::*; -use glib::glib_object_impl; use glib::glib_object_subclass; use glib::glib_object_wrapper; use glib::glib_wrapper; @@ -123,9 +122,6 @@ mod media_factory { // Implementation of glib::Object virtual methods impl ObjectImpl for Factory { - // This macro provides some boilerplate. - glib_object_impl!(); - fn constructed(&self, obj: &glib::Object) { self.parent_constructed(obj); @@ -238,10 +234,7 @@ mod media { } // Implementation of glib::Object virtual methods - impl ObjectImpl for Media { - // This macro provides some boilerplate. - glib_object_impl!(); - } + impl ObjectImpl for Media {} // Implementation of gst_rtsp_server::RTSPMedia virtual methods impl RTSPMediaImpl for Media { @@ -320,10 +313,7 @@ mod server { } // Implementation of glib::Object virtual methods - impl ObjectImpl for Server { - // This macro provides some boilerplate. - glib_object_impl!(); - } + impl ObjectImpl for Server {} // Implementation of gst_rtsp_server::RTSPServer virtual methods impl RTSPServerImpl for Server { @@ -422,10 +412,7 @@ mod client { } // Implementation of glib::Object virtual methods - impl ObjectImpl for Client { - // This macro provides some boilerplate. - glib_object_impl!(); - } + impl ObjectImpl for Client {} // Implementation of gst_rtsp_server::RTSPClient virtual methods impl RTSPClientImpl for Client { diff --git a/examples/src/bin/subclass.rs b/examples/src/bin/subclass.rs index 5df6c4852..47c4945f4 100644 --- a/examples/src/bin/subclass.rs +++ b/examples/src/bin/subclass.rs @@ -6,7 +6,6 @@ // Our filter can only handle F32 mono and acts as a FIR filter. The filter impulse response / // coefficients are provided via Rust API on the filter as a Vec. -use glib::glib_object_impl; use glib::glib_object_subclass; use glib::glib_object_wrapper; use glib::glib_wrapper; @@ -160,10 +159,7 @@ mod fir_filter { } // Implementation of glib::Object virtual methods - impl ObjectImpl for FirFilter { - // This macro provides some boilerplate. - glib_object_impl!(); - } + impl ObjectImpl for FirFilter {} // Implementation of gst::Element virtual methods impl ElementImpl for FirFilter {} diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index 5e6be2c95..820ecc9ba 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -25,7 +25,7 @@ use crate::prelude::*; use AudioDecoder; use AudioDecoderClass; -pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl + Send + Sync + 'static { +pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl { fn open(&self, element: &AudioDecoder) -> Result<(), gst::ErrorMessage> { self.parent_open(element) } @@ -179,10 +179,10 @@ pub trait AudioDecoderImplExt { ) -> Result<(), gst::ErrorMessage>; } -impl AudioDecoderImplExt for T { +impl AudioDecoderImplExt for T { fn parent_open(&self, element: &AudioDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -203,7 +203,7 @@ impl AudioDecoderImplExt for T { fn parent_close(&self, element: &AudioDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -224,7 +224,7 @@ impl AudioDecoderImplExt for T { fn parent_start(&self, element: &AudioDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -245,7 +245,7 @@ impl AudioDecoderImplExt for T { fn parent_stop(&self, element: &AudioDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -270,7 +270,7 @@ impl AudioDecoderImplExt for T { caps: &gst::Caps, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -292,7 +292,7 @@ impl AudioDecoderImplExt for T { adapter: &gst_base::Adapter, ) -> Result<(u32, u32), gst::FlowError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -328,7 +328,7 @@ impl AudioDecoderImplExt for T { buffer: Option<&gst::Buffer>, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -352,7 +352,7 @@ impl AudioDecoderImplExt for T { buffer: gst::Buffer, ) -> Result, gst::FlowError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; if let Some(f) = (*parent_class).pre_push { @@ -371,7 +371,7 @@ impl AudioDecoderImplExt for T { fn parent_flush(&self, element: &AudioDecoder, hard: bool) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -383,7 +383,7 @@ impl AudioDecoderImplExt for T { fn parent_negotiate(&self, element: &AudioDecoder) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -401,7 +401,7 @@ impl AudioDecoderImplExt for T { fn parent_get_caps(&self, element: &AudioDecoder, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -413,7 +413,7 @@ impl AudioDecoderImplExt for T { fn parent_sink_event(&self, element: &AudioDecoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; let f = (*parent_class) @@ -425,7 +425,7 @@ impl AudioDecoderImplExt for T { fn parent_sink_query(&self, element: &AudioDecoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; let f = (*parent_class) @@ -437,7 +437,7 @@ impl AudioDecoderImplExt for T { fn parent_src_event(&self, element: &AudioDecoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; let f = (*parent_class) @@ -449,7 +449,7 @@ impl AudioDecoderImplExt for T { fn parent_src_query(&self, element: &AudioDecoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; let f = (*parent_class) @@ -465,7 +465,7 @@ impl AudioDecoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -490,7 +490,7 @@ impl AudioDecoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioDecoderClass; (*parent_class) @@ -510,7 +510,7 @@ impl AudioDecoderImplExt for T { } } -unsafe impl IsSubclassable for AudioDecoderClass +unsafe impl IsSubclassable for AudioDecoderClass where ::Instance: PanicPoison, { @@ -539,11 +539,10 @@ where } } -unsafe extern "C" fn audio_decoder_open( +unsafe extern "C" fn audio_decoder_open( ptr: *mut gst_audio_sys::GstAudioDecoder, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -562,11 +561,10 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_close( +unsafe extern "C" fn audio_decoder_close( ptr: *mut gst_audio_sys::GstAudioDecoder, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -585,11 +583,10 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_start( +unsafe extern "C" fn audio_decoder_start( ptr: *mut gst_audio_sys::GstAudioDecoder, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -608,11 +605,10 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_stop( +unsafe extern "C" fn audio_decoder_stop( ptr: *mut gst_audio_sys::GstAudioDecoder, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -631,12 +627,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_set_format( +unsafe extern "C" fn audio_decoder_set_format( ptr: *mut gst_audio_sys::GstAudioDecoder, caps: *mut gst_sys::GstCaps, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -655,14 +650,13 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_parse( +unsafe extern "C" fn audio_decoder_parse( ptr: *mut gst_audio_sys::GstAudioDecoder, adapter: *mut gst_base_sys::GstAdapter, offset: *mut i32, len: *mut i32, ) -> gst_sys::GstFlowReturn where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -685,12 +679,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_handle_frame( +unsafe extern "C" fn audio_decoder_handle_frame( ptr: *mut gst_audio_sys::GstAudioDecoder, buffer: *mut *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: AudioDecoderImpl, T::Instance: PanicPoison, { // FIXME: Misgenerated in gstreamer-audio-sys @@ -709,12 +702,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_pre_push( +unsafe extern "C" fn audio_decoder_pre_push( ptr: *mut gst_audio_sys::GstAudioDecoder, buffer: *mut *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -738,11 +730,10 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_flush( +unsafe extern "C" fn audio_decoder_flush( ptr: *mut gst_audio_sys::GstAudioDecoder, hard: glib_sys::gboolean, ) where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -754,11 +745,10 @@ unsafe extern "C" fn audio_decoder_flush( }) } -unsafe extern "C" fn audio_decoder_negotiate( +unsafe extern "C" fn audio_decoder_negotiate( ptr: *mut gst_audio_sys::GstAudioDecoder, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -777,12 +767,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_getcaps( +unsafe extern "C" fn audio_decoder_getcaps( ptr: *mut gst_audio_sys::GstAudioDecoder, filter: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -801,12 +790,11 @@ where .to_glib_full() } -unsafe extern "C" fn audio_decoder_sink_event( +unsafe extern "C" fn audio_decoder_sink_event( ptr: *mut gst_audio_sys::GstAudioDecoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -819,12 +807,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_sink_query( +unsafe extern "C" fn audio_decoder_sink_query( ptr: *mut gst_audio_sys::GstAudioDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -837,12 +824,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_src_event( +unsafe extern "C" fn audio_decoder_src_event( ptr: *mut gst_audio_sys::GstAudioDecoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -855,12 +841,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_src_query( +unsafe extern "C" fn audio_decoder_src_query( ptr: *mut gst_audio_sys::GstAudioDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -873,12 +858,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_propose_allocation( +unsafe extern "C" fn audio_decoder_propose_allocation( ptr: *mut gst_audio_sys::GstAudioDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -898,12 +882,11 @@ where .to_glib() } -unsafe extern "C" fn audio_decoder_decide_allocation( +unsafe extern "C" fn audio_decoder_decide_allocation( ptr: *mut gst_audio_sys::GstAudioDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index 5ed7dc0b1..013166b36 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -24,7 +24,7 @@ use AudioEncoder; use AudioEncoderClass; use AudioInfo; -pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl + Send + Sync + 'static { +pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl { fn open(&self, element: &AudioEncoder) -> Result<(), gst::ErrorMessage> { self.parent_open(element) } @@ -164,10 +164,10 @@ pub trait AudioEncoderImplExt { ) -> Result<(), gst::ErrorMessage>; } -impl AudioEncoderImplExt for T { +impl AudioEncoderImplExt for T { fn parent_open(&self, element: &AudioEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -188,7 +188,7 @@ impl AudioEncoderImplExt for T { fn parent_close(&self, element: &AudioEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -209,7 +209,7 @@ impl AudioEncoderImplExt for T { fn parent_start(&self, element: &AudioEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -230,7 +230,7 @@ impl AudioEncoderImplExt for T { fn parent_stop(&self, element: &AudioEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -255,7 +255,7 @@ impl AudioEncoderImplExt for T { info: &AudioInfo, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -277,7 +277,7 @@ impl AudioEncoderImplExt for T { buffer: Option<&gst::Buffer>, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -301,7 +301,7 @@ impl AudioEncoderImplExt for T { buffer: gst::Buffer, ) -> Result, gst::FlowError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; if let Some(f) = (*parent_class).pre_push { @@ -320,7 +320,7 @@ impl AudioEncoderImplExt for T { fn parent_flush(&self, element: &AudioEncoder) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -332,7 +332,7 @@ impl AudioEncoderImplExt for T { fn parent_negotiate(&self, element: &AudioEncoder) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -350,7 +350,7 @@ impl AudioEncoderImplExt for T { fn parent_get_caps(&self, element: &AudioEncoder, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -362,7 +362,7 @@ impl AudioEncoderImplExt for T { fn parent_sink_event(&self, element: &AudioEncoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; let f = (*parent_class) @@ -374,7 +374,7 @@ impl AudioEncoderImplExt for T { fn parent_sink_query(&self, element: &AudioEncoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; let f = (*parent_class) @@ -386,7 +386,7 @@ impl AudioEncoderImplExt for T { fn parent_src_event(&self, element: &AudioEncoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; let f = (*parent_class) @@ -398,7 +398,7 @@ impl AudioEncoderImplExt for T { fn parent_src_query(&self, element: &AudioEncoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; let f = (*parent_class) @@ -414,7 +414,7 @@ impl AudioEncoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -439,7 +439,7 @@ impl AudioEncoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioEncoderClass; (*parent_class) @@ -459,7 +459,7 @@ impl AudioEncoderImplExt for T { } } -unsafe impl IsSubclassable for AudioEncoderClass +unsafe impl IsSubclassable for AudioEncoderClass where ::Instance: PanicPoison, { @@ -487,11 +487,10 @@ where } } -unsafe extern "C" fn audio_encoder_open( +unsafe extern "C" fn audio_encoder_open( ptr: *mut gst_audio_sys::GstAudioEncoder, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -510,11 +509,10 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_close( +unsafe extern "C" fn audio_encoder_close( ptr: *mut gst_audio_sys::GstAudioEncoder, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -533,11 +531,10 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_start( +unsafe extern "C" fn audio_encoder_start( ptr: *mut gst_audio_sys::GstAudioEncoder, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -556,11 +553,10 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_stop( +unsafe extern "C" fn audio_encoder_stop( ptr: *mut gst_audio_sys::GstAudioEncoder, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -579,12 +575,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_set_format( +unsafe extern "C" fn audio_encoder_set_format( ptr: *mut gst_audio_sys::GstAudioEncoder, info: *mut gst_audio_sys::GstAudioInfo, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -603,12 +598,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_handle_frame( +unsafe extern "C" fn audio_encoder_handle_frame( ptr: *mut gst_audio_sys::GstAudioEncoder, buffer: *mut *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: AudioEncoderImpl, T::Instance: PanicPoison, { // FIXME: Misgenerated in gstreamer-audio-sys @@ -627,12 +621,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_pre_push( +unsafe extern "C" fn audio_encoder_pre_push( ptr: *mut gst_audio_sys::GstAudioEncoder, buffer: *mut *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -656,10 +649,9 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_flush( +unsafe extern "C" fn audio_encoder_flush( ptr: *mut gst_audio_sys::GstAudioEncoder, ) where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -671,11 +663,10 @@ unsafe extern "C" fn audio_encoder_flush( }) } -unsafe extern "C" fn audio_encoder_negotiate( +unsafe extern "C" fn audio_encoder_negotiate( ptr: *mut gst_audio_sys::GstAudioEncoder, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -694,12 +685,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_getcaps( +unsafe extern "C" fn audio_encoder_getcaps( ptr: *mut gst_audio_sys::GstAudioEncoder, filter: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -718,12 +708,11 @@ where .to_glib_full() } -unsafe extern "C" fn audio_encoder_sink_event( +unsafe extern "C" fn audio_encoder_sink_event( ptr: *mut gst_audio_sys::GstAudioEncoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -736,12 +725,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_sink_query( +unsafe extern "C" fn audio_encoder_sink_query( ptr: *mut gst_audio_sys::GstAudioEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -754,12 +742,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_src_event( +unsafe extern "C" fn audio_encoder_src_event( ptr: *mut gst_audio_sys::GstAudioEncoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -772,12 +759,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_src_query( +unsafe extern "C" fn audio_encoder_src_query( ptr: *mut gst_audio_sys::GstAudioEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -790,12 +776,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_propose_allocation( +unsafe extern "C" fn audio_encoder_propose_allocation( ptr: *mut gst_audio_sys::GstAudioEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -815,12 +800,11 @@ where .to_glib() } -unsafe extern "C" fn audio_encoder_decide_allocation( +unsafe extern "C" fn audio_encoder_decide_allocation( ptr: *mut gst_audio_sys::GstAudioEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AudioEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-audio/src/subclass/audio_sink.rs b/gstreamer-audio/src/subclass/audio_sink.rs index 4e773ae93..03c987bb0 100644 --- a/gstreamer-audio/src/subclass/audio_sink.rs +++ b/gstreamer-audio/src/subclass/audio_sink.rs @@ -12,7 +12,7 @@ use AudioRingBufferSpec; use AudioSink; use AudioSinkClass; -pub trait AudioSinkImpl: AudioSinkImplExt + BaseSinkImpl + Send + Sync + 'static { +pub trait AudioSinkImpl: AudioSinkImplExt + BaseSinkImpl { fn close(&self, sink: &AudioSink) -> Result<(), LoggableError> { self.parent_close(sink) } @@ -60,10 +60,10 @@ pub trait AudioSinkImplExt { fn parent_reset(&self, sink: &AudioSink); } -impl AudioSinkImplExt for T { +impl AudioSinkImplExt for T { fn parent_close(&self, sink: &AudioSink) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSinkClass; let f = match (*parent_class).close { @@ -80,7 +80,7 @@ impl AudioSinkImplExt for T { fn parent_delay(&self, sink: &AudioSink) -> u32 { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSinkClass; let f = match (*parent_class).delay { @@ -93,7 +93,7 @@ impl AudioSinkImplExt for T { fn parent_open(&self, sink: &AudioSink) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSinkClass; let f = match (*parent_class).open { @@ -114,7 +114,7 @@ impl AudioSinkImplExt for T { spec: &mut AudioRingBufferSpec, ) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSinkClass; let f = match (*parent_class).prepare { @@ -131,7 +131,7 @@ impl AudioSinkImplExt for T { fn parent_unprepare(&self, sink: &AudioSink) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSinkClass; let f = match (*parent_class).unprepare { @@ -153,7 +153,7 @@ impl AudioSinkImplExt for T { fn parent_write(&self, sink: &AudioSink, buffer: &[u8]) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSinkClass; let f = match (*parent_class).write { @@ -175,7 +175,7 @@ impl AudioSinkImplExt for T { fn parent_reset(&self, sink: &AudioSink) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSinkClass; if let Some(f) = (*parent_class).reset { @@ -185,7 +185,7 @@ impl AudioSinkImplExt for T { } } -unsafe impl IsSubclassable for AudioSinkClass +unsafe impl IsSubclassable for AudioSinkClass where ::Instance: PanicPoison, { @@ -204,11 +204,10 @@ where } } -unsafe extern "C" fn audiosink_close( +unsafe extern "C" fn audiosink_close( ptr: *mut gst_audio_sys::GstAudioSink, ) -> glib_sys::gboolean where - T: AudioSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -227,11 +226,8 @@ where .to_glib() } -unsafe extern "C" fn audiosink_delay( - ptr: *mut gst_audio_sys::GstAudioSink, -) -> u32 +unsafe extern "C" fn audiosink_delay(ptr: *mut gst_audio_sys::GstAudioSink) -> u32 where - T: AudioSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -241,11 +237,10 @@ where gst_panic_to_error!(&wrap, &instance.panicked(), 0, { imp.delay(&wrap) }) } -unsafe extern "C" fn audiosink_open( +unsafe extern "C" fn audiosink_open( ptr: *mut gst_audio_sys::GstAudioSink, ) -> glib_sys::gboolean where - T: AudioSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -264,12 +259,11 @@ where .to_glib() } -unsafe extern "C" fn audiosink_prepare( +unsafe extern "C" fn audiosink_prepare( ptr: *mut gst_audio_sys::GstAudioSink, spec: *mut gst_audio_sys::GstAudioRingBufferSpec, ) -> glib_sys::gboolean where - T: AudioSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -290,11 +284,10 @@ where .to_glib() } -unsafe extern "C" fn audiosink_unprepare( +unsafe extern "C" fn audiosink_unprepare( ptr: *mut gst_audio_sys::GstAudioSink, ) -> glib_sys::gboolean where - T: AudioSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -313,13 +306,12 @@ where .to_glib() } -unsafe extern "C" fn audiosink_write( +unsafe extern "C" fn audiosink_write( ptr: *mut gst_audio_sys::GstAudioSink, data: glib_sys::gpointer, length: u32, ) -> i32 where - T: AudioSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -332,9 +324,8 @@ where }) } -unsafe extern "C" fn audiosink_reset(ptr: *mut gst_audio_sys::GstAudioSink) +unsafe extern "C" fn audiosink_reset(ptr: *mut gst_audio_sys::GstAudioSink) where - T: AudioSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-audio/src/subclass/audio_src.rs b/gstreamer-audio/src/subclass/audio_src.rs index 473fb13f4..1a595a87b 100644 --- a/gstreamer-audio/src/subclass/audio_src.rs +++ b/gstreamer-audio/src/subclass/audio_src.rs @@ -14,7 +14,7 @@ use AudioRingBufferSpec; use AudioSrc; use AudioSrcClass; -pub trait AudioSrcImpl: AudioSrcImplExt + BaseSrcImpl + Send + Sync + 'static { +pub trait AudioSrcImpl: AudioSrcImplExt + BaseSrcImpl { fn close(&self, src: &AudioSrc) -> Result<(), LoggableError> { self.parent_close(src) } @@ -66,10 +66,10 @@ pub trait AudioSrcImplExt { fn parent_reset(&self, src: &AudioSrc); } -impl AudioSrcImplExt for T { +impl AudioSrcImplExt for T { fn parent_close(&self, src: &AudioSrc) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSrcClass; let f = match (*parent_class).close { @@ -86,7 +86,7 @@ impl AudioSrcImplExt for T { fn parent_delay(&self, src: &AudioSrc) -> u32 { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSrcClass; let f = match (*parent_class).delay { @@ -99,7 +99,7 @@ impl AudioSrcImplExt for T { fn parent_open(&self, src: &AudioSrc) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSrcClass; let f = match (*parent_class).open { @@ -120,7 +120,7 @@ impl AudioSrcImplExt for T { spec: &mut AudioRingBufferSpec, ) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSrcClass; let f = match (*parent_class).prepare { @@ -137,7 +137,7 @@ impl AudioSrcImplExt for T { fn parent_unprepare(&self, src: &AudioSrc) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSrcClass; let f = match (*parent_class).unprepare { @@ -163,7 +163,7 @@ impl AudioSrcImplExt for T { buffer: &mut [u8], ) -> Result<(u32, gst::ClockTime), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSrcClass; let f = match (*parent_class).read { @@ -191,7 +191,7 @@ impl AudioSrcImplExt for T { fn parent_reset(&self, src: &AudioSrc) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_audio_sys::GstAudioSrcClass; if let Some(f) = (*parent_class).reset { @@ -201,7 +201,7 @@ impl AudioSrcImplExt for T { } } -unsafe impl IsSubclassable for AudioSrcClass +unsafe impl IsSubclassable for AudioSrcClass where ::Instance: PanicPoison, { @@ -220,11 +220,10 @@ where } } -unsafe extern "C" fn audiosrc_close( +unsafe extern "C" fn audiosrc_close( ptr: *mut gst_audio_sys::GstAudioSrc, ) -> glib_sys::gboolean where - T: AudioSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -243,9 +242,8 @@ where .to_glib() } -unsafe extern "C" fn audiosrc_delay(ptr: *mut gst_audio_sys::GstAudioSrc) -> u32 +unsafe extern "C" fn audiosrc_delay(ptr: *mut gst_audio_sys::GstAudioSrc) -> u32 where - T: AudioSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -255,11 +253,10 @@ where gst_panic_to_error!(&wrap, &instance.panicked(), 0, { imp.delay(&wrap) }) } -unsafe extern "C" fn audiosrc_open( +unsafe extern "C" fn audiosrc_open( ptr: *mut gst_audio_sys::GstAudioSrc, ) -> glib_sys::gboolean where - T: AudioSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -278,12 +275,11 @@ where .to_glib() } -unsafe extern "C" fn audiosrc_prepare( +unsafe extern "C" fn audiosrc_prepare( ptr: *mut gst_audio_sys::GstAudioSrc, spec: *mut gst_audio_sys::GstAudioRingBufferSpec, ) -> glib_sys::gboolean where - T: AudioSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -304,11 +300,10 @@ where .to_glib() } -unsafe extern "C" fn audiosrc_unprepare( +unsafe extern "C" fn audiosrc_unprepare( ptr: *mut gst_audio_sys::GstAudioSrc, ) -> glib_sys::gboolean where - T: AudioSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -327,14 +322,13 @@ where .to_glib() } -unsafe extern "C" fn audiosrc_read( +unsafe extern "C" fn audiosrc_read( ptr: *mut gst_audio_sys::GstAudioSrc, data: glib_sys::gpointer, length: u32, timestamp: *mut gst_sys::GstClockTime, ) -> u32 where - T: AudioSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -352,9 +346,8 @@ where }) } -unsafe extern "C" fn audiosrc_reset(ptr: *mut gst_audio_sys::GstAudioSrc) +unsafe extern "C" fn audiosrc_reset(ptr: *mut gst_audio_sys::GstAudioSrc) where - T: AudioSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index e779aad7f..10f202b42 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -24,7 +24,7 @@ use Aggregator; use AggregatorClass; use AggregatorPad; -pub trait AggregatorImpl: AggregatorImplExt + ElementImpl + Send + Sync + 'static { +pub trait AggregatorImpl: AggregatorImplExt + ElementImpl { fn flush(&self, aggregator: &Aggregator) -> Result { self.parent_flush(aggregator) } @@ -252,10 +252,10 @@ pub trait AggregatorImplExt { fn parent_negotiate(&self, aggregator: &Aggregator) -> bool; } -impl AggregatorImplExt for T { +impl AggregatorImplExt for T { fn parent_flush(&self, aggregator: &Aggregator) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) @@ -273,7 +273,7 @@ impl AggregatorImplExt for T { buffer: gst::Buffer, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; match (*parent_class).clip { @@ -293,7 +293,7 @@ impl AggregatorImplExt for T { buffer: gst::Buffer, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -311,7 +311,7 @@ impl AggregatorImplExt for T { event: gst::Event, ) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -333,7 +333,7 @@ impl AggregatorImplExt for T { event: gst::Event, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -355,7 +355,7 @@ impl AggregatorImplExt for T { query: &mut gst::QueryRef, ) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -377,7 +377,7 @@ impl AggregatorImplExt for T { query: &mut gst::QueryRef, ) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -393,7 +393,7 @@ impl AggregatorImplExt for T { fn parent_src_event(&self, aggregator: &Aggregator, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -405,7 +405,7 @@ impl AggregatorImplExt for T { fn parent_src_query(&self, aggregator: &Aggregator, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -422,7 +422,7 @@ impl AggregatorImplExt for T { active: bool, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; match (*parent_class).src_activate { @@ -446,7 +446,7 @@ impl AggregatorImplExt for T { timeout: bool, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -459,7 +459,7 @@ impl AggregatorImplExt for T { fn parent_start(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) @@ -480,7 +480,7 @@ impl AggregatorImplExt for T { fn parent_stop(&self, aggregator: &Aggregator) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) @@ -501,7 +501,7 @@ impl AggregatorImplExt for T { fn parent_get_next_time(&self, aggregator: &Aggregator) -> gst::ClockTime { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) @@ -519,7 +519,7 @@ impl AggregatorImplExt for T { caps: Option<&gst::Caps>, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -540,7 +540,7 @@ impl AggregatorImplExt for T { caps: &gst::Caps, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; let f = (*parent_class) @@ -559,7 +559,7 @@ impl AggregatorImplExt for T { fn parent_fixate_src_caps(&self, aggregator: &Aggregator, caps: gst::Caps) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; @@ -576,7 +576,7 @@ impl AggregatorImplExt for T { caps: &gst::Caps, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) @@ -595,7 +595,7 @@ impl AggregatorImplExt for T { #[cfg(any(feature = "v1_18", feature = "dox"))] fn parent_negotiate(&self, aggregator: &Aggregator) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass; (*parent_class) @@ -606,7 +606,7 @@ impl AggregatorImplExt for T { } } -unsafe impl IsSubclassable for AggregatorClass +unsafe impl IsSubclassable for AggregatorClass where ::Instance: PanicPoison, { @@ -640,11 +640,10 @@ where } } -unsafe extern "C" fn aggregator_flush( +unsafe extern "C" fn aggregator_flush( ptr: *mut gst_base_sys::GstAggregator, ) -> gst_sys::GstFlowReturn where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -657,13 +656,12 @@ where .to_glib() } -unsafe extern "C" fn aggregator_clip( +unsafe extern "C" fn aggregator_clip( ptr: *mut gst_base_sys::GstAggregator, aggregator_pad: *mut gst_base_sys::GstAggregatorPad, buffer: *mut gst_sys::GstBuffer, ) -> *mut gst_sys::GstBuffer where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -681,12 +679,11 @@ where ret.map(|r| r.into_ptr()).unwrap_or(ptr::null_mut()) } -unsafe extern "C" fn aggregator_finish_buffer( +unsafe extern "C" fn aggregator_finish_buffer( ptr: *mut gst_base_sys::GstAggregator, buffer: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -699,13 +696,12 @@ where .to_glib() } -unsafe extern "C" fn aggregator_sink_event( +unsafe extern "C" fn aggregator_sink_event( ptr: *mut gst_base_sys::GstAggregator, aggregator_pad: *mut gst_base_sys::GstAggregatorPad, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -723,13 +719,12 @@ where } #[cfg(any(feature = "v1_18", feature = "dox"))] -unsafe extern "C" fn aggregator_sink_event_pre_queue( +unsafe extern "C" fn aggregator_sink_event_pre_queue( ptr: *mut gst_base_sys::GstAggregator, aggregator_pad: *mut gst_base_sys::GstAggregatorPad, event: *mut gst_sys::GstEvent, ) -> gst_sys::GstFlowReturn where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -747,13 +742,12 @@ where .to_glib() } -unsafe extern "C" fn aggregator_sink_query( +unsafe extern "C" fn aggregator_sink_query( ptr: *mut gst_base_sys::GstAggregator, aggregator_pad: *mut gst_base_sys::GstAggregatorPad, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -771,13 +765,12 @@ where } #[cfg(any(feature = "v1_18", feature = "dox"))] -unsafe extern "C" fn aggregator_sink_query_pre_queue( +unsafe extern "C" fn aggregator_sink_query_pre_queue( ptr: *mut gst_base_sys::GstAggregator, aggregator_pad: *mut gst_base_sys::GstAggregatorPad, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -794,12 +787,11 @@ where .to_glib() } -unsafe extern "C" fn aggregator_src_event( +unsafe extern "C" fn aggregator_src_event( ptr: *mut gst_base_sys::GstAggregator, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -812,12 +804,11 @@ where .to_glib() } -unsafe extern "C" fn aggregator_src_query( +unsafe extern "C" fn aggregator_src_query( ptr: *mut gst_base_sys::GstAggregator, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -830,13 +821,12 @@ where .to_glib() } -unsafe extern "C" fn aggregator_src_activate( +unsafe extern "C" fn aggregator_src_activate( ptr: *mut gst_base_sys::GstAggregator, mode: gst_sys::GstPadMode, active: glib_sys::gboolean, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -855,12 +845,11 @@ where .to_glib() } -unsafe extern "C" fn aggregator_aggregate( +unsafe extern "C" fn aggregator_aggregate( ptr: *mut gst_base_sys::GstAggregator, timeout: glib_sys::gboolean, ) -> gst_sys::GstFlowReturn where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -873,11 +862,10 @@ where .to_glib() } -unsafe extern "C" fn aggregator_start( +unsafe extern "C" fn aggregator_start( ptr: *mut gst_base_sys::GstAggregator, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -896,11 +884,10 @@ where .to_glib() } -unsafe extern "C" fn aggregator_stop( +unsafe extern "C" fn aggregator_stop( ptr: *mut gst_base_sys::GstAggregator, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -919,11 +906,10 @@ where .to_glib() } -unsafe extern "C" fn aggregator_get_next_time( +unsafe extern "C" fn aggregator_get_next_time( ptr: *mut gst_base_sys::GstAggregator, ) -> gst_sys::GstClockTime where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -936,14 +922,13 @@ where .to_glib() } -unsafe extern "C" fn aggregator_create_new_pad( +unsafe extern "C" fn aggregator_create_new_pad( ptr: *mut gst_base_sys::GstAggregator, templ: *mut gst_sys::GstPadTemplate, req_name: *const libc::c_char, caps: *const gst_sys::GstCaps, ) -> *mut gst_base_sys::GstAggregatorPad where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -965,13 +950,12 @@ where .to_glib_full() } -unsafe extern "C" fn aggregator_update_src_caps( +unsafe extern "C" fn aggregator_update_src_caps( ptr: *mut gst_base_sys::GstAggregator, caps: *mut gst_sys::GstCaps, res: *mut *mut gst_sys::GstCaps, ) -> gst_sys::GstFlowReturn where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -992,12 +976,11 @@ where .to_glib() } -unsafe extern "C" fn aggregator_fixate_src_caps( +unsafe extern "C" fn aggregator_fixate_src_caps( ptr: *mut gst_base_sys::GstAggregator, caps: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1010,12 +993,11 @@ where .into_ptr() } -unsafe extern "C" fn aggregator_negotiated_src_caps( +unsafe extern "C" fn aggregator_negotiated_src_caps( ptr: *mut gst_base_sys::GstAggregator, caps: *mut gst_sys::GstCaps, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1035,11 +1017,10 @@ where } #[cfg(any(feature = "v1_18", feature = "dox"))] -unsafe extern "C" fn aggregator_negotiate( +unsafe extern "C" fn aggregator_negotiate( ptr: *mut gst_base_sys::GstAggregator, ) -> glib_sys::gboolean where - T: AggregatorImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index 4bd1f3ab5..d54d3be0d 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -20,7 +20,7 @@ use Aggregator; use AggregatorPad; use AggregatorPadClass; -pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl + Send + Sync + 'static { +pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl { fn flush( &self, aggregator_pad: &AggregatorPad, @@ -54,14 +54,14 @@ pub trait AggregatorPadImplExt { ) -> bool; } -impl AggregatorPadImplExt for T { +impl AggregatorPadImplExt for T { fn parent_flush( &self, aggregator_pad: &AggregatorPad, aggregator: &Aggregator, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorPadClass; (*parent_class) @@ -84,7 +84,7 @@ impl AggregatorPadImplExt for T { buffer: &gst::Buffer, ) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorPadClass; (*parent_class) @@ -100,7 +100,7 @@ impl AggregatorPadImplExt for T { } } } -unsafe impl IsSubclassable for AggregatorPadClass { +unsafe impl IsSubclassable for AggregatorPadClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { @@ -111,13 +111,10 @@ unsafe impl IsSubclassable for Aggrega } } -unsafe extern "C" fn aggregator_pad_flush( +unsafe extern "C" fn aggregator_pad_flush( ptr: *mut gst_base_sys::GstAggregatorPad, aggregator: *mut gst_base_sys::GstAggregator, -) -> gst_sys::GstFlowReturn -where - T: AggregatorPadImpl, -{ +) -> gst_sys::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -126,14 +123,11 @@ where res.to_glib() } -unsafe extern "C" fn aggregator_pad_skip_buffer( +unsafe extern "C" fn aggregator_pad_skip_buffer( ptr: *mut gst_base_sys::GstAggregatorPad, aggregator: *mut gst_base_sys::GstAggregator, buffer: *mut gst_sys::GstBuffer, -) -> glib_sys::gboolean -where - T: AggregatorPadImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index abc6c16a5..2bf787100 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -23,7 +23,7 @@ use BaseParse; use BaseParseClass; use BaseParseFrame; -pub trait BaseParseImpl: BaseParseImplExt + ElementImpl + Send + Sync + 'static { +pub trait BaseParseImpl: BaseParseImplExt + ElementImpl { fn start(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage> { self.parent_start(element) } @@ -83,10 +83,10 @@ pub trait BaseParseImplExt { ) -> Option; } -impl BaseParseImplExt for T { +impl BaseParseImplExt for T { fn parent_start(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass; (*parent_class) @@ -107,7 +107,7 @@ impl BaseParseImplExt for T { fn parent_stop(&self, element: &BaseParse) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass; (*parent_class) @@ -132,7 +132,7 @@ impl BaseParseImplExt for T { caps: &gst::Caps, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass; (*parent_class) @@ -157,7 +157,7 @@ impl BaseParseImplExt for T { frame: BaseParseFrame, ) -> Result<(gst::FlowSuccess, u32), gst::FlowError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass; let mut skipsize = 0; @@ -187,7 +187,7 @@ impl BaseParseImplExt for T { dest_format: gst::Format, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass; let src_val = src_val.into(); @@ -215,7 +215,7 @@ impl BaseParseImplExt for T { } } -unsafe impl IsSubclassable for BaseParseClass +unsafe impl IsSubclassable for BaseParseClass where ::Instance: PanicPoison, { @@ -232,11 +232,10 @@ where } } -unsafe extern "C" fn base_parse_start( +unsafe extern "C" fn base_parse_start( ptr: *mut gst_base_sys::GstBaseParse, ) -> glib_sys::gboolean where - T: BaseParseImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -255,11 +254,10 @@ where .to_glib() } -unsafe extern "C" fn base_parse_stop( +unsafe extern "C" fn base_parse_stop( ptr: *mut gst_base_sys::GstBaseParse, ) -> glib_sys::gboolean where - T: BaseParseImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -278,12 +276,11 @@ where .to_glib() } -unsafe extern "C" fn base_parse_set_sink_caps( +unsafe extern "C" fn base_parse_set_sink_caps( ptr: *mut gst_base_sys::GstBaseParse, caps: *mut gst_sys::GstCaps, ) -> glib_sys::gboolean where - T: BaseParseImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -303,13 +300,12 @@ where .to_glib() } -unsafe extern "C" fn base_parse_handle_frame( +unsafe extern "C" fn base_parse_handle_frame( ptr: *mut gst_base_sys::GstBaseParse, frame: *mut gst_base_sys::GstBaseParseFrame, skipsize: *mut i32, ) -> gst_sys::GstFlowReturn where - T: BaseParseImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -331,7 +327,7 @@ where .to_glib() } -unsafe extern "C" fn base_parse_convert( +unsafe extern "C" fn base_parse_convert( ptr: *mut gst_base_sys::GstBaseParse, source_format: gst_sys::GstFormat, source_value: i64, @@ -339,7 +335,6 @@ unsafe extern "C" fn base_parse_convert( dest_value: *mut i64, ) -> glib_sys::gboolean where - T: BaseParseImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index 134830458..5a0c2ba07 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -21,7 +21,7 @@ use std::ptr; use BaseSink; use BaseSinkClass; -pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl + Send + Sync + 'static { +pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl { fn start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { self.parent_start(element) } @@ -139,10 +139,10 @@ pub trait BaseSinkImplExt { fn parent_unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage>; } -impl BaseSinkImplExt for T { +impl BaseSinkImplExt for T { fn parent_start(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -163,7 +163,7 @@ impl BaseSinkImplExt for T { fn parent_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -188,7 +188,7 @@ impl BaseSinkImplExt for T { buffer: &gst::Buffer, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -207,7 +207,7 @@ impl BaseSinkImplExt for T { buffer: &gst::Buffer, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -224,7 +224,7 @@ impl BaseSinkImplExt for T { list: &gst::BufferList, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -248,7 +248,7 @@ impl BaseSinkImplExt for T { list: &gst::BufferList, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -268,7 +268,7 @@ impl BaseSinkImplExt for T { fn parent_query(&self, element: &BaseSink, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -280,7 +280,7 @@ impl BaseSinkImplExt for T { fn parent_event(&self, element: &BaseSink, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -292,7 +292,7 @@ impl BaseSinkImplExt for T { fn parent_get_caps(&self, element: &BaseSink, filter: Option<&gst::Caps>) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; @@ -309,7 +309,7 @@ impl BaseSinkImplExt for T { caps: &gst::Caps, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -327,7 +327,7 @@ impl BaseSinkImplExt for T { fn parent_fixate(&self, element: &BaseSink, caps: gst::Caps) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; @@ -340,7 +340,7 @@ impl BaseSinkImplExt for T { fn parent_unlock(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -361,7 +361,7 @@ impl BaseSinkImplExt for T { fn parent_unlock_stop(&self, element: &BaseSink) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass; (*parent_class) @@ -381,7 +381,7 @@ impl BaseSinkImplExt for T { } } -unsafe impl IsSubclassable for BaseSinkClass +unsafe impl IsSubclassable for BaseSinkClass where ::Instance: PanicPoison, { @@ -406,11 +406,10 @@ where } } -unsafe extern "C" fn base_sink_start( +unsafe extern "C" fn base_sink_start( ptr: *mut gst_base_sys::GstBaseSink, ) -> glib_sys::gboolean where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -429,11 +428,10 @@ where .to_glib() } -unsafe extern "C" fn base_sink_stop( +unsafe extern "C" fn base_sink_stop( ptr: *mut gst_base_sys::GstBaseSink, ) -> glib_sys::gboolean where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -452,12 +450,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_render( +unsafe extern "C" fn base_sink_render( ptr: *mut gst_base_sys::GstBaseSink, buffer: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -471,12 +468,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_prepare( +unsafe extern "C" fn base_sink_prepare( ptr: *mut gst_base_sys::GstBaseSink, buffer: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -490,12 +486,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_render_list( +unsafe extern "C" fn base_sink_render_list( ptr: *mut gst_base_sys::GstBaseSink, list: *mut gst_sys::GstBufferList, ) -> gst_sys::GstFlowReturn where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -509,12 +504,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_prepare_list( +unsafe extern "C" fn base_sink_prepare_list( ptr: *mut gst_base_sys::GstBaseSink, list: *mut gst_sys::GstBufferList, ) -> gst_sys::GstFlowReturn where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -528,12 +522,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_query( +unsafe extern "C" fn base_sink_query( ptr: *mut gst_base_sys::GstBaseSink, query_ptr: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -547,12 +540,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_event( +unsafe extern "C" fn base_sink_event( ptr: *mut gst_base_sys::GstBaseSink, event_ptr: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -565,12 +557,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_get_caps( +unsafe extern "C" fn base_sink_get_caps( ptr: *mut gst_base_sys::GstBaseSink, filter: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -585,12 +576,11 @@ where .unwrap_or(ptr::null_mut()) } -unsafe extern "C" fn base_sink_set_caps( +unsafe extern "C" fn base_sink_set_caps( ptr: *mut gst_base_sys::GstBaseSink, caps: *mut gst_sys::GstCaps, ) -> glib_sys::gboolean where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -610,12 +600,11 @@ where .to_glib() } -unsafe extern "C" fn base_sink_fixate( +unsafe extern "C" fn base_sink_fixate( ptr: *mut gst_base_sys::GstBaseSink, caps: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -629,11 +618,10 @@ where .into_ptr() } -unsafe extern "C" fn base_sink_unlock( +unsafe extern "C" fn base_sink_unlock( ptr: *mut gst_base_sys::GstBaseSink, ) -> glib_sys::gboolean where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -652,11 +640,10 @@ where .to_glib() } -unsafe extern "C" fn base_sink_unlock_stop( +unsafe extern "C" fn base_sink_unlock_stop( ptr: *mut gst_base_sys::GstBaseSink, ) -> glib_sys::gboolean where - T: BaseSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 195acc98e..be999ef66 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -28,7 +28,7 @@ pub enum CreateSuccess { NewBuffer(gst::Buffer), } -pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl + Send + Sync + 'static { +pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl { fn start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { self.parent_start(element) } @@ -180,10 +180,10 @@ pub trait BaseSrcImplExt { fn parent_unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage>; } -impl BaseSrcImplExt for T { +impl BaseSrcImplExt for T { fn parent_start(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -204,7 +204,7 @@ impl BaseSrcImplExt for T { fn parent_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -225,7 +225,7 @@ impl BaseSrcImplExt for T { fn parent_is_seekable(&self, element: &BaseSrc) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -237,7 +237,7 @@ impl BaseSrcImplExt for T { fn parent_get_size(&self, element: &BaseSrc) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -260,7 +260,7 @@ impl BaseSrcImplExt for T { buffer: &gst::BufferRef, ) -> (gst::ClockTime, gst::ClockTime) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -291,7 +291,7 @@ impl BaseSrcImplExt for T { buffer: &mut gst::BufferRef, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -316,7 +316,7 @@ impl BaseSrcImplExt for T { length: u32, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -348,7 +348,7 @@ impl BaseSrcImplExt for T { length: u32, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -427,7 +427,7 @@ impl BaseSrcImplExt for T { fn parent_do_seek(&self, element: &BaseSrc, segment: &mut gst::Segment) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -439,7 +439,7 @@ impl BaseSrcImplExt for T { fn parent_query(&self, element: &BaseSrc, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -451,7 +451,7 @@ impl BaseSrcImplExt for T { fn parent_event(&self, element: &BaseSrc, event: &gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -463,7 +463,7 @@ impl BaseSrcImplExt for T { fn parent_get_caps(&self, element: &BaseSrc, filter: Option<&gst::Caps>) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; @@ -476,7 +476,7 @@ impl BaseSrcImplExt for T { fn parent_negotiate(&self, element: &BaseSrc) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -498,7 +498,7 @@ impl BaseSrcImplExt for T { caps: &gst::Caps, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -516,7 +516,7 @@ impl BaseSrcImplExt for T { fn parent_fixate(&self, element: &BaseSrc, caps: gst::Caps) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; @@ -529,7 +529,7 @@ impl BaseSrcImplExt for T { fn parent_unlock(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -550,7 +550,7 @@ impl BaseSrcImplExt for T { fn parent_unlock_stop(&self, element: &BaseSrc) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass; (*parent_class) @@ -570,7 +570,7 @@ impl BaseSrcImplExt for T { } } -unsafe impl IsSubclassable for BaseSrcClass +unsafe impl IsSubclassable for BaseSrcClass where ::Instance: PanicPoison, { @@ -599,11 +599,10 @@ where } } -unsafe extern "C" fn base_src_start( +unsafe extern "C" fn base_src_start( ptr: *mut gst_base_sys::GstBaseSrc, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -622,11 +621,10 @@ where .to_glib() } -unsafe extern "C" fn base_src_stop( +unsafe extern "C" fn base_src_stop( ptr: *mut gst_base_sys::GstBaseSrc, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -645,11 +643,10 @@ where .to_glib() } -unsafe extern "C" fn base_src_is_seekable( +unsafe extern "C" fn base_src_is_seekable( ptr: *mut gst_base_sys::GstBaseSrc, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -662,12 +659,11 @@ where .to_glib() } -unsafe extern "C" fn base_src_get_size( +unsafe extern "C" fn base_src_get_size( ptr: *mut gst_base_sys::GstBaseSrc, size: *mut u64, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -686,13 +682,12 @@ where .to_glib() } -unsafe extern "C" fn base_src_get_times( +unsafe extern "C" fn base_src_get_times( ptr: *mut gst_base_sys::GstBaseSrc, buffer: *mut gst_sys::GstBuffer, start: *mut gst_sys::GstClockTime, stop: *mut gst_sys::GstClockTime, ) where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -710,14 +705,13 @@ unsafe extern "C" fn base_src_get_times( }); } -unsafe extern "C" fn base_src_fill( +unsafe extern "C" fn base_src_fill( ptr: *mut gst_base_sys::GstBaseSrc, offset: u64, length: u32, buffer: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -731,14 +725,13 @@ where .to_glib() } -unsafe extern "C" fn base_src_alloc( +unsafe extern "C" fn base_src_alloc( ptr: *mut gst_base_sys::GstBaseSrc, offset: u64, length: u32, buffer_ptr: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -760,14 +753,13 @@ where .to_glib() } -unsafe extern "C" fn base_src_create( +unsafe extern "C" fn base_src_create( ptr: *mut gst_base_sys::GstBaseSrc, offset: u64, length: u32, buffer_ptr: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -845,12 +837,11 @@ where .to_glib() } -unsafe extern "C" fn base_src_do_seek( +unsafe extern "C" fn base_src_do_seek( ptr: *mut gst_base_sys::GstBaseSrc, segment: *mut gst_sys::GstSegment, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -867,12 +858,11 @@ where .to_glib() } -unsafe extern "C" fn base_src_query( +unsafe extern "C" fn base_src_query( ptr: *mut gst_base_sys::GstBaseSrc, query_ptr: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -886,12 +876,11 @@ where .to_glib() } -unsafe extern "C" fn base_src_event( +unsafe extern "C" fn base_src_event( ptr: *mut gst_base_sys::GstBaseSrc, event_ptr: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -904,12 +893,11 @@ where .to_glib() } -unsafe extern "C" fn base_src_get_caps( +unsafe extern "C" fn base_src_get_caps( ptr: *mut gst_base_sys::GstBaseSrc, filter: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -924,11 +912,10 @@ where .unwrap_or(ptr::null_mut()) } -unsafe extern "C" fn base_src_negotiate( +unsafe extern "C" fn base_src_negotiate( ptr: *mut gst_base_sys::GstBaseSrc, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -947,12 +934,11 @@ where .to_glib() } -unsafe extern "C" fn base_src_set_caps( +unsafe extern "C" fn base_src_set_caps( ptr: *mut gst_base_sys::GstBaseSrc, caps: *mut gst_sys::GstCaps, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -972,12 +958,11 @@ where .to_glib() } -unsafe extern "C" fn base_src_fixate( +unsafe extern "C" fn base_src_fixate( ptr: *mut gst_base_sys::GstBaseSrc, caps: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -991,11 +976,10 @@ where .into_ptr() } -unsafe extern "C" fn base_src_unlock( +unsafe extern "C" fn base_src_unlock( ptr: *mut gst_base_sys::GstBaseSrc, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1014,11 +998,10 @@ where .to_glib() } -unsafe extern "C" fn base_src_unlock_stop( +unsafe extern "C" fn base_src_unlock_stop( ptr: *mut gst_base_sys::GstBaseSrc, ) -> glib_sys::gboolean where - T: BaseSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 1de1b2a3d..62b58492f 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -23,7 +23,7 @@ use std::ptr; use BaseTransform; use BaseTransformClass; -pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl + Send + Sync + 'static { +pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl { fn start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> { self.parent_start(element) } @@ -297,10 +297,10 @@ pub trait BaseTransformImplExt { ::ParentType: IsA; } -impl BaseTransformImplExt for T { +impl BaseTransformImplExt for T { fn parent_start(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -321,7 +321,7 @@ impl BaseTransformImplExt for T { fn parent_stop(&self, element: &BaseTransform) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -348,7 +348,7 @@ impl BaseTransformImplExt for T { filter: Option<&gst::Caps>, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -373,7 +373,7 @@ impl BaseTransformImplExt for T { othercaps: gst::Caps, ) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; match (*parent_class).fixate_caps { @@ -395,7 +395,7 @@ impl BaseTransformImplExt for T { outcaps: &gst::Caps, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -422,7 +422,7 @@ impl BaseTransformImplExt for T { caps: &gst::Caps, ) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -445,7 +445,7 @@ impl BaseTransformImplExt for T { query: &mut gst::QueryRef, ) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -470,7 +470,7 @@ impl BaseTransformImplExt for T { othercaps: &gst::Caps, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -497,7 +497,7 @@ impl BaseTransformImplExt for T { fn parent_get_unit_size(&self, element: &BaseTransform, caps: &gst::Caps) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class).get_unit_size.unwrap_or_else(|| { @@ -529,7 +529,7 @@ impl BaseTransformImplExt for T { fn parent_sink_event(&self, element: &BaseTransform, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -541,7 +541,7 @@ impl BaseTransformImplExt for T { fn parent_src_event(&self, element: &BaseTransform, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -557,7 +557,7 @@ impl BaseTransformImplExt for T { inbuf: &gst::BufferRef, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -593,7 +593,7 @@ impl BaseTransformImplExt for T { outbuf: &mut gst::BufferRef, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -625,7 +625,7 @@ impl BaseTransformImplExt for T { buf: &mut gst::BufferRef, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { @@ -653,7 +653,7 @@ impl BaseTransformImplExt for T { buf: &gst::Buffer, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { @@ -683,7 +683,7 @@ impl BaseTransformImplExt for T { outbuf: &mut gst::BufferRef, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; if let Some(ref f) = (*parent_class).copy_metadata { @@ -710,7 +710,7 @@ impl BaseTransformImplExt for T { inbuf: &'a gst::BufferRef, ) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; (*parent_class) @@ -729,7 +729,7 @@ impl BaseTransformImplExt for T { fn parent_before_transform(&self, element: &BaseTransform, inbuf: &gst::BufferRef) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; if let Some(ref f) = (*parent_class).before_transform { @@ -745,7 +745,7 @@ impl BaseTransformImplExt for T { inbuf: gst::Buffer, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class) @@ -766,7 +766,7 @@ impl BaseTransformImplExt for T { element: &BaseTransform, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass; let f = (*parent_class) @@ -827,7 +827,7 @@ pub enum BaseTransformMode { Both, } -unsafe impl IsSubclassable for BaseTransformClass +unsafe impl IsSubclassable for BaseTransformClass where ::Instance: PanicPoison, { @@ -857,7 +857,7 @@ where } pub unsafe trait BaseTransformClassSubclassExt: Sized + 'static { - fn configure( + fn configure( &mut self, mode: BaseTransformMode, passthrough_on_same_caps: bool, @@ -890,7 +890,7 @@ pub unsafe trait BaseTransformClassSubclassExt: Sized + 'static { unsafe impl BaseTransformClassSubclassExt for T where - T::Type: ObjectSubclass + BaseTransformImpl, + T::Type: BaseTransformImpl, ::Instance: PanicPoison, { } @@ -908,11 +908,10 @@ pub enum PrepareOutputBufferSuccess { InputBuffer, } -unsafe extern "C" fn base_transform_start( +unsafe extern "C" fn base_transform_start( ptr: *mut gst_base_sys::GstBaseTransform, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -931,11 +930,10 @@ where .to_glib() } -unsafe extern "C" fn base_transform_stop( +unsafe extern "C" fn base_transform_stop( ptr: *mut gst_base_sys::GstBaseTransform, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -954,14 +952,13 @@ where .to_glib() } -unsafe extern "C" fn base_transform_transform_caps( +unsafe extern "C" fn base_transform_transform_caps( ptr: *mut gst_base_sys::GstBaseTransform, direction: gst_sys::GstPadDirection, caps: *mut gst_sys::GstCaps, filter: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -982,14 +979,13 @@ where .unwrap_or(std::ptr::null_mut()) } -unsafe extern "C" fn base_transform_fixate_caps( +unsafe extern "C" fn base_transform_fixate_caps( ptr: *mut gst_base_sys::GstBaseTransform, direction: gst_sys::GstPadDirection, caps: *mut gst_sys::GstCaps, othercaps: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1007,13 +1003,12 @@ where .into_ptr() } -unsafe extern "C" fn base_transform_set_caps( +unsafe extern "C" fn base_transform_set_caps( ptr: *mut gst_base_sys::GstBaseTransform, incaps: *mut gst_sys::GstCaps, outcaps: *mut gst_sys::GstCaps, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1032,13 +1027,12 @@ where .to_glib() } -unsafe extern "C" fn base_transform_accept_caps( +unsafe extern "C" fn base_transform_accept_caps( ptr: *mut gst_base_sys::GstBaseTransform, direction: gst_sys::GstPadDirection, caps: *mut gst_sys::GstCaps, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1051,13 +1045,12 @@ where .to_glib() } -unsafe extern "C" fn base_transform_query( +unsafe extern "C" fn base_transform_query( ptr: *mut gst_base_sys::GstBaseTransform, direction: gst_sys::GstPadDirection, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1075,7 +1068,7 @@ where .to_glib() } -unsafe extern "C" fn base_transform_transform_size( +unsafe extern "C" fn base_transform_transform_size( ptr: *mut gst_base_sys::GstBaseTransform, direction: gst_sys::GstPadDirection, caps: *mut gst_sys::GstCaps, @@ -1084,7 +1077,6 @@ unsafe extern "C" fn base_transform_transform_size( othersize: *mut usize, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1109,13 +1101,12 @@ where .to_glib() } -unsafe extern "C" fn base_transform_get_unit_size( +unsafe extern "C" fn base_transform_get_unit_size( ptr: *mut gst_base_sys::GstBaseTransform, caps: *mut gst_sys::GstCaps, size: *mut usize, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1134,13 +1125,12 @@ where .to_glib() } -unsafe extern "C" fn base_transform_prepare_output_buffer( +unsafe extern "C" fn base_transform_prepare_output_buffer( ptr: *mut gst_base_sys::GstBaseTransform, inbuf: *mut gst_sys::GstBuffer, outbuf: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1166,12 +1156,11 @@ where .to_glib() } -unsafe extern "C" fn base_transform_sink_event( +unsafe extern "C" fn base_transform_sink_event( ptr: *mut gst_base_sys::GstBaseTransform, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1184,12 +1173,11 @@ where .to_glib() } -unsafe extern "C" fn base_transform_src_event( +unsafe extern "C" fn base_transform_src_event( ptr: *mut gst_base_sys::GstBaseTransform, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1202,13 +1190,12 @@ where .to_glib() } -unsafe extern "C" fn base_transform_transform( +unsafe extern "C" fn base_transform_transform( ptr: *mut gst_base_sys::GstBaseTransform, inbuf: *mut gst_sys::GstBuffer, outbuf: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1226,12 +1213,11 @@ where .to_glib() } -unsafe extern "C" fn base_transform_transform_ip( +unsafe extern "C" fn base_transform_transform_ip( ptr: *mut gst_base_sys::GstBaseTransform, buf: *mut *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1253,14 +1239,13 @@ where .to_glib() } -unsafe extern "C" fn base_transform_transform_meta( +unsafe extern "C" fn base_transform_transform_meta( ptr: *mut gst_base_sys::GstBaseTransform, outbuf: *mut gst_sys::GstBuffer, meta: *mut gst_sys::GstMeta, inbuf: *mut gst_sys::GstBuffer, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1280,13 +1265,12 @@ where .to_glib() } -unsafe extern "C" fn base_transform_copy_metadata( +unsafe extern "C" fn base_transform_copy_metadata( ptr: *mut gst_base_sys::GstBaseTransform, inbuf: *mut gst_sys::GstBuffer, outbuf: *mut gst_sys::GstBuffer, ) -> glib_sys::gboolean where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1319,11 +1303,10 @@ where .to_glib() } -unsafe extern "C" fn base_transform_before_transform( +unsafe extern "C" fn base_transform_before_transform( ptr: *mut gst_base_sys::GstBaseTransform, inbuf: *mut gst_sys::GstBuffer, ) where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1335,13 +1318,12 @@ unsafe extern "C" fn base_transform_before_transform( }) } -unsafe extern "C" fn base_transform_submit_input_buffer( +unsafe extern "C" fn base_transform_submit_input_buffer( ptr: *mut gst_base_sys::GstBaseTransform, is_discont: glib_sys::gboolean, buf: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -1355,12 +1337,11 @@ where .to_glib() } -unsafe extern "C" fn base_transform_generate_output( +unsafe extern "C" fn base_transform_generate_output( ptr: *mut gst_base_sys::GstBaseTransform, buf: *mut *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: BaseTransformImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index 9dbb117b8..b56ed3704 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -21,7 +21,7 @@ use super::base_src::BaseSrcImpl; use PushSrc; use PushSrcClass; -pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl + Send + Sync + 'static { +pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl { fn fill( &self, element: &PushSrc, @@ -51,14 +51,14 @@ pub trait PushSrcImplExt { fn parent_create(&self, element: &PushSrc) -> Result; } -impl PushSrcImplExt for T { +impl PushSrcImplExt for T { fn parent_fill( &self, element: &PushSrc, buffer: &mut gst::BufferRef, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstPushSrcClass; (*parent_class) @@ -73,7 +73,7 @@ impl PushSrcImplExt for T { fn parent_alloc(&self, element: &PushSrc) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstPushSrcClass; (*parent_class) @@ -94,7 +94,7 @@ impl PushSrcImplExt for T { fn parent_create(&self, element: &PushSrc) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_base_sys::GstPushSrcClass; (*parent_class) @@ -114,7 +114,7 @@ impl PushSrcImplExt for T { } } -unsafe impl IsSubclassable for PushSrcClass +unsafe impl IsSubclassable for PushSrcClass where ::Instance: PanicPoison, { @@ -129,12 +129,11 @@ where } } -unsafe extern "C" fn push_src_fill( +unsafe extern "C" fn push_src_fill( ptr: *mut gst_base_sys::GstPushSrc, buffer: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: PushSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -148,12 +147,11 @@ where .to_glib() } -unsafe extern "C" fn push_src_alloc( +unsafe extern "C" fn push_src_alloc( ptr: *mut gst_base_sys::GstPushSrc, buffer_ptr: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: PushSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -175,12 +173,11 @@ where .to_glib() } -unsafe extern "C" fn push_src_create( +unsafe extern "C" fn push_src_create( ptr: *mut gst_base_sys::GstPushSrc, buffer_ptr: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: PushSrcImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs index 536f85b6a..f990ea1b6 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs @@ -16,7 +16,7 @@ use std::mem; use RTSPClient; use RTSPClientClass; -pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync + 'static { +pub trait RTSPClientImpl: RTSPClientImplExt + ObjectImpl + Send + Sync { fn create_sdp(&self, client: &RTSPClient, media: &::RTSPMedia) -> Option { self.parent_create_sdp(client, media) } @@ -336,14 +336,14 @@ pub trait RTSPClientImplExt { ) -> gst_rtsp::RTSPStatusCode; } -impl RTSPClientImplExt for T { +impl RTSPClientImplExt for T { fn parent_create_sdp( &self, client: &RTSPClient, media: &::RTSPMedia, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; let f = (*parent_class) @@ -362,7 +362,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; let f = (*parent_class).configure_client_media.expect( @@ -386,7 +386,7 @@ impl RTSPClientImplExt for T { fn parent_params_set(&self, client: &RTSPClient, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; let f = (*parent_class) @@ -399,7 +399,7 @@ impl RTSPClientImplExt for T { fn parent_params_get(&self, client: &RTSPClient, ctx: &::RTSPContext) -> gst_rtsp::RTSPResult { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; let f = (*parent_class) @@ -416,7 +416,7 @@ impl RTSPClientImplExt for T { url: &gst_rtsp::RTSPUrl, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; let f = (*parent_class) @@ -429,7 +429,7 @@ impl RTSPClientImplExt for T { fn parent_closed(&self, client: &RTSPClient) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).closed { @@ -440,7 +440,7 @@ impl RTSPClientImplExt for T { fn parent_new_session(&self, client: &RTSPClient, session: &::RTSPSession) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).new_session { @@ -451,7 +451,7 @@ impl RTSPClientImplExt for T { fn parent_options_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).options_request { @@ -462,7 +462,7 @@ impl RTSPClientImplExt for T { fn parent_describe_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).describe_request { @@ -473,7 +473,7 @@ impl RTSPClientImplExt for T { fn parent_setup_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).setup_request { @@ -484,7 +484,7 @@ impl RTSPClientImplExt for T { fn parent_play_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).play_request { @@ -495,7 +495,7 @@ impl RTSPClientImplExt for T { fn parent_pause_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pause_request { @@ -506,7 +506,7 @@ impl RTSPClientImplExt for T { fn parent_teardown_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).teardown_request { @@ -517,7 +517,7 @@ impl RTSPClientImplExt for T { fn parent_set_parameter_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).set_parameter_request { @@ -528,7 +528,7 @@ impl RTSPClientImplExt for T { fn parent_get_parameter_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).get_parameter_request { @@ -539,7 +539,7 @@ impl RTSPClientImplExt for T { fn parent_announce_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).announce_request { @@ -550,7 +550,7 @@ impl RTSPClientImplExt for T { fn parent_record_request(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).record_request { @@ -561,7 +561,7 @@ impl RTSPClientImplExt for T { fn parent_handle_response(&self, client: &RTSPClient, ctx: &::RTSPContext) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).handle_response { @@ -581,7 +581,7 @@ impl RTSPClientImplExt for T { sdp: &gst_sdp::SDPMessageRef, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; let f = (*parent_class) @@ -608,7 +608,7 @@ impl RTSPClientImplExt for T { arr: &[String], ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).check_requirements { @@ -629,7 +629,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_options_request { @@ -646,7 +646,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_describe_request { @@ -663,7 +663,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_setup_request { @@ -680,7 +680,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_play_request { @@ -697,7 +697,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_pause_request { @@ -714,7 +714,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_teardown_request { @@ -731,7 +731,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_set_parameter_request { @@ -748,7 +748,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_get_parameter_request { @@ -765,7 +765,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_announce_request { @@ -782,7 +782,7 @@ impl RTSPClientImplExt for T { ctx: &::RTSPContext, ) -> gst_rtsp::RTSPStatusCode { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_record_request { @@ -793,7 +793,7 @@ impl RTSPClientImplExt for T { } } } -unsafe impl IsSubclassable for RTSPClientClass { +unsafe impl IsSubclassable for RTSPClientClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { @@ -832,13 +832,10 @@ unsafe impl IsSubclassable for RTSPClient } } -unsafe extern "C" fn client_create_sdp( +unsafe extern "C" fn client_create_sdp( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, media: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> *mut gst_sdp_sys::GstSDPMessage -where - T: RTSPClientImpl, -{ +) -> *mut gst_sdp_sys::GstSDPMessage { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -849,15 +846,12 @@ where ptr as *mut _ } -unsafe extern "C" fn client_configure_client_media( +unsafe extern "C" fn client_configure_client_media( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, media: *mut gst_rtsp_server_sys::GstRTSPMedia, stream: *mut gst_rtsp_server_sys::GstRTSPStream, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> glib_sys::gboolean -where - T: RTSPClientImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -876,13 +870,10 @@ where } } -unsafe extern "C" fn client_params_set( +unsafe extern "C" fn client_params_set( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPResult -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPResult { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -890,13 +881,10 @@ where imp.params_set(&wrap, &from_glib_borrow(ctx)).to_glib() } -unsafe extern "C" fn client_params_get( +unsafe extern "C" fn client_params_get( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPResult -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPResult { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -904,13 +892,10 @@ where imp.params_get(&wrap, &from_glib_borrow(ctx)).to_glib() } -unsafe extern "C" fn client_make_path_from_uri( +unsafe extern "C" fn client_make_path_from_uri( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, url: *const gst_rtsp_sys::GstRTSPUrl, -) -> *mut std::os::raw::c_char -where - T: RTSPClientImpl, -{ +) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -919,10 +904,9 @@ where .to_glib_full() } -unsafe extern "C" fn client_closed(ptr: *mut gst_rtsp_server_sys::GstRTSPClient) -where - T: RTSPClientImpl, -{ +unsafe extern "C" fn client_closed( + ptr: *mut gst_rtsp_server_sys::GstRTSPClient, +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -930,12 +914,10 @@ where imp.closed(&wrap); } -unsafe extern "C" fn client_new_session( +unsafe extern "C" fn client_new_session( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, session: *mut gst_rtsp_server_sys::GstRTSPSession, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -943,12 +925,10 @@ unsafe extern "C" fn client_new_session( imp.new_session(&wrap, &from_glib_borrow(session)); } -unsafe extern "C" fn client_options_request( +unsafe extern "C" fn client_options_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -956,12 +936,10 @@ unsafe extern "C" fn client_options_request( imp.options_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_describe_request( +unsafe extern "C" fn client_describe_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -969,12 +947,10 @@ unsafe extern "C" fn client_describe_request( imp.describe_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_setup_request( +unsafe extern "C" fn client_setup_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -982,12 +958,10 @@ unsafe extern "C" fn client_setup_request( imp.setup_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_play_request( +unsafe extern "C" fn client_play_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -995,12 +969,10 @@ unsafe extern "C" fn client_play_request( imp.play_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_pause_request( +unsafe extern "C" fn client_pause_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1008,12 +980,10 @@ unsafe extern "C" fn client_pause_request( imp.pause_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_teardown_request( +unsafe extern "C" fn client_teardown_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1021,12 +991,10 @@ unsafe extern "C" fn client_teardown_request( imp.teardown_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_set_parameter_request( +unsafe extern "C" fn client_set_parameter_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1034,12 +1002,10 @@ unsafe extern "C" fn client_set_parameter_request( imp.set_parameter_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_get_parameter_request( +unsafe extern "C" fn client_get_parameter_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1047,12 +1013,10 @@ unsafe extern "C" fn client_get_parameter_request( imp.get_parameter_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_announce_request( +unsafe extern "C" fn client_announce_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1060,12 +1024,10 @@ unsafe extern "C" fn client_announce_request( imp.announce_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_record_request( +unsafe extern "C" fn client_record_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1073,12 +1035,10 @@ unsafe extern "C" fn client_record_request( imp.record_request(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_handle_response( +unsafe extern "C" fn client_handle_response( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) where - T: RTSPClientImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1086,15 +1046,12 @@ unsafe extern "C" fn client_handle_response( imp.handle_response(&wrap, &from_glib_borrow(ctx)); } -unsafe extern "C" fn client_handle_sdp( +unsafe extern "C" fn client_handle_sdp( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, media: *mut gst_rtsp_server_sys::GstRTSPMedia, sdp: *mut gst_sdp_sys::GstSDPMessage, -) -> glib_sys::gboolean -where - T: RTSPClientImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1113,14 +1070,11 @@ where } } -unsafe extern "C" fn client_check_requirements( +unsafe extern "C" fn client_check_requirements( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, arr: *mut *mut std::os::raw::c_char, -) -> *mut std::os::raw::c_char -where - T: RTSPClientImpl, -{ +) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1133,13 +1087,10 @@ where .to_glib_full() } -unsafe extern "C" fn client_pre_options_request( +unsafe extern "C" fn client_pre_options_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1148,13 +1099,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_describe_request( +unsafe extern "C" fn client_pre_describe_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1163,13 +1111,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_setup_request( +unsafe extern "C" fn client_pre_setup_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1178,13 +1123,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_play_request( +unsafe extern "C" fn client_pre_play_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1193,13 +1135,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_pause_request( +unsafe extern "C" fn client_pre_pause_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1208,13 +1147,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_teardown_request( +unsafe extern "C" fn client_pre_teardown_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1223,13 +1159,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_set_parameter_request( +unsafe extern "C" fn client_pre_set_parameter_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1238,13 +1171,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_get_parameter_request( +unsafe extern "C" fn client_pre_get_parameter_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1253,13 +1183,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_announce_request( +unsafe extern "C" fn client_pre_announce_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -1268,13 +1195,10 @@ where .to_glib() } -unsafe extern "C" fn client_pre_record_request( +unsafe extern "C" fn client_pre_record_request( ptr: *mut gst_rtsp_server_sys::GstRTSPClient, ctx: *mut gst_rtsp_server_sys::GstRTSPContext, -) -> gst_rtsp_sys::GstRTSPStatusCode -where - T: RTSPClientImpl, -{ +) -> gst_rtsp_sys::GstRTSPStatusCode { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs index 8384153a8..674f299ea 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs @@ -33,7 +33,7 @@ impl SDPInfo { } } -pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync + 'static { +pub trait RTSPMediaImpl: RTSPMediaImplExt + ObjectImpl + Send + Sync { fn handle_message(&self, media: &RTSPMedia, message: &gst::MessageRef) -> bool { self.parent_handle_message(media, message) } @@ -157,10 +157,10 @@ pub trait RTSPMediaImplExt { ) -> Result<(), gst::LoggableError>; } -impl RTSPMediaImplExt for T { +impl RTSPMediaImplExt for T { fn parent_handle_message(&self, media: &RTSPMedia, message: &gst::MessageRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).handle_message { @@ -177,7 +177,7 @@ impl RTSPMediaImplExt for T { thread: &RTSPThread, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).prepare { @@ -194,7 +194,7 @@ impl RTSPMediaImplExt for T { fn parent_unprepare(&self, media: &RTSPMedia) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepare { @@ -211,7 +211,7 @@ impl RTSPMediaImplExt for T { fn parent_suspend(&self, media: &RTSPMedia) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).suspend { @@ -228,7 +228,7 @@ impl RTSPMediaImplExt for T { fn parent_unsuspend(&self, media: &RTSPMedia) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).unsuspend { @@ -249,7 +249,7 @@ impl RTSPMediaImplExt for T { unsafe { use std::mem; - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).query_position { @@ -269,7 +269,7 @@ impl RTSPMediaImplExt for T { unsafe { use std::mem; - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).query_stop { @@ -287,7 +287,7 @@ impl RTSPMediaImplExt for T { fn parent_create_rtpbin(&self, media: &RTSPMedia) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; let f = (*parent_class) @@ -304,7 +304,7 @@ impl RTSPMediaImplExt for T { rtpbin: &gst::Element, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).setup_rtpbin { @@ -340,7 +340,7 @@ impl RTSPMediaImplExt for T { info: &SDPInfo, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; let f = (*parent_class) @@ -361,7 +361,7 @@ impl RTSPMediaImplExt for T { fn parent_new_stream(&self, media: &RTSPMedia, stream: &::RTSPStream) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_stream { @@ -372,7 +372,7 @@ impl RTSPMediaImplExt for T { fn parent_removed_stream(&self, media: &RTSPMedia, stream: &::RTSPStream) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).removed_stream { @@ -383,7 +383,7 @@ impl RTSPMediaImplExt for T { fn parent_prepared(&self, media: &RTSPMedia) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).prepared { @@ -394,7 +394,7 @@ impl RTSPMediaImplExt for T { fn parent_unprepared(&self, media: &RTSPMedia) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepared { @@ -405,7 +405,7 @@ impl RTSPMediaImplExt for T { fn parent_target_state(&self, media: &RTSPMedia, state: gst::State) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).target_state { @@ -416,7 +416,7 @@ impl RTSPMediaImplExt for T { fn parent_new_state(&self, media: &RTSPMedia, state: gst::State) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_state { @@ -431,7 +431,7 @@ impl RTSPMediaImplExt for T { sdp: &gst_sdp::SDPMessageRef, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaClass; let f = (*parent_class) @@ -449,7 +449,7 @@ impl RTSPMediaImplExt for T { } } } -unsafe impl IsSubclassable for RTSPMediaClass { +unsafe impl IsSubclassable for RTSPMediaClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { @@ -475,13 +475,10 @@ unsafe impl IsSubclassable for RTSPMediaCl } } -unsafe extern "C" fn media_handle_message( +unsafe extern "C" fn media_handle_message( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, message: *mut gst_sys::GstMessage, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -490,13 +487,10 @@ where .to_glib() } -unsafe extern "C" fn media_prepare( +unsafe extern "C" fn media_prepare( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, thread: *mut gst_rtsp_server_sys::GstRTSPThread, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -510,12 +504,9 @@ where } } -unsafe extern "C" fn media_unprepare( +unsafe extern "C" fn media_unprepare( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -529,12 +520,9 @@ where } } -unsafe extern "C" fn media_suspend( +unsafe extern "C" fn media_suspend( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -548,12 +536,9 @@ where } } -unsafe extern "C" fn media_unsuspend( +unsafe extern "C" fn media_unsuspend( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -567,13 +552,10 @@ where } } -unsafe extern "C" fn media_query_position( +unsafe extern "C" fn media_query_position( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, position: *mut i64, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -587,13 +569,10 @@ where } } -unsafe extern "C" fn media_query_stop( +unsafe extern "C" fn media_query_stop( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, stop: *mut i64, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -607,12 +586,9 @@ where } } -unsafe extern "C" fn media_create_rtpbin( +unsafe extern "C" fn media_create_rtpbin( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> *mut gst_sys::GstElement -where - T: RTSPMediaImpl, -{ +) -> *mut gst_sys::GstElement { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -626,13 +602,10 @@ where res } -unsafe extern "C" fn media_setup_rtpbin( +unsafe extern "C" fn media_setup_rtpbin( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, rtpbin: *mut gst_sys::GstElement, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -657,14 +630,11 @@ where res } -unsafe extern "C" fn media_setup_sdp( +unsafe extern "C" fn media_setup_sdp( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, sdp: *mut gst_sdp_sys::GstSDPMessage, info: *mut gst_rtsp_server_sys::GstSDPInfo, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -682,12 +652,10 @@ where } } -unsafe extern "C" fn media_new_stream( +unsafe extern "C" fn media_new_stream( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, stream: *mut gst_rtsp_server_sys::GstRTSPStream, -) where - T: RTSPMediaImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -695,12 +663,10 @@ unsafe extern "C" fn media_new_stream( imp.new_stream(&wrap, &from_glib_borrow(stream)); } -unsafe extern "C" fn media_removed_stream( +unsafe extern "C" fn media_removed_stream( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, stream: *mut gst_rtsp_server_sys::GstRTSPStream, -) where - T: RTSPMediaImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -708,10 +674,7 @@ unsafe extern "C" fn media_removed_stream( imp.removed_stream(&wrap, &from_glib_borrow(stream)); } -unsafe extern "C" fn media_prepared(ptr: *mut gst_rtsp_server_sys::GstRTSPMedia) -where - T: RTSPMediaImpl, -{ +unsafe extern "C" fn media_prepared(ptr: *mut gst_rtsp_server_sys::GstRTSPMedia) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -719,11 +682,9 @@ where imp.prepared(&wrap); } -unsafe extern "C" fn media_unprepared( +unsafe extern "C" fn media_unprepared( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, -) where - T: RTSPMediaImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -731,12 +692,10 @@ unsafe extern "C" fn media_unprepared( imp.unprepared(&wrap); } -unsafe extern "C" fn media_target_state( +unsafe extern "C" fn media_target_state( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, state: gst_sys::GstState, -) where - T: RTSPMediaImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -744,12 +703,10 @@ unsafe extern "C" fn media_target_state( imp.target_state(&wrap, from_glib(state)); } -unsafe extern "C" fn media_new_state( +unsafe extern "C" fn media_new_state( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, state: gst_sys::GstState, -) where - T: RTSPMediaImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -757,13 +714,10 @@ unsafe extern "C" fn media_new_state( imp.new_state(&wrap, from_glib(state)); } -unsafe extern "C" fn media_handle_sdp( +unsafe extern "C" fn media_handle_sdp( ptr: *mut gst_rtsp_server_sys::GstRTSPMedia, sdp: *mut gst_sdp_sys::GstSDPMessage, -) -> glib_sys::gboolean -where - T: RTSPMediaImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index dc7e2a738..46e3e738e 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -18,9 +18,7 @@ use RTSPMediaFactoryClass; use std::mem::transmute; -pub trait RTSPMediaFactoryImpl: - RTSPMediaFactoryImplExt + ObjectImpl + Send + Sync + 'static -{ +pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sync { fn gen_key( &self, factory: &RTSPMediaFactory, @@ -97,14 +95,14 @@ pub trait RTSPMediaFactoryImplExt { fn parent_media_configure(&self, factory: &RTSPMediaFactory, media: &::RTSPMedia); } -impl RTSPMediaFactoryImplExt for T { +impl RTSPMediaFactoryImplExt for T { fn parent_gen_key( &self, factory: &RTSPMediaFactory, url: &gst_rtsp::RTSPUrl, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; (*parent_class) @@ -120,7 +118,7 @@ impl RTSPMediaFactoryImplExt for T { url: &gst_rtsp::RTSPUrl, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; (*parent_class) @@ -136,7 +134,7 @@ impl RTSPMediaFactoryImplExt for T { url: &gst_rtsp::RTSPUrl, ) -> Option<::RTSPMedia> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; (*parent_class) @@ -152,7 +150,7 @@ impl RTSPMediaFactoryImplExt for T { media: &::RTSPMedia, ) -> Option { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; (*parent_class) @@ -173,7 +171,7 @@ impl RTSPMediaFactoryImplExt for T { fn parent_configure(&self, factory: &RTSPMediaFactory, media: &::RTSPMedia) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).configure { @@ -184,7 +182,7 @@ impl RTSPMediaFactoryImplExt for T { fn parent_media_constructed(&self, factory: &RTSPMediaFactory, media: &::RTSPMedia) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_constructed { @@ -195,7 +193,7 @@ impl RTSPMediaFactoryImplExt for T { fn parent_media_configure(&self, factory: &RTSPMediaFactory, media: &::RTSPMedia) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_configure { @@ -204,7 +202,7 @@ impl RTSPMediaFactoryImplExt for T { } } } -unsafe impl IsSubclassable for RTSPMediaFactoryClass { +unsafe impl IsSubclassable for RTSPMediaFactoryClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { @@ -221,13 +219,10 @@ unsafe impl IsSubclassable for RTSP } } -unsafe extern "C" fn factory_gen_key( +unsafe extern "C" fn factory_gen_key( ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, url: *const gst_rtsp_sys::GstRTSPUrl, -) -> *mut std::os::raw::c_char -where - T: RTSPMediaFactoryImpl, -{ +) -> *mut std::os::raw::c_char { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -235,13 +230,10 @@ where imp.gen_key(&wrap, &from_glib_borrow(url)).to_glib_full() } -unsafe extern "C" fn factory_create_element( +unsafe extern "C" fn factory_create_element( ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, url: *const gst_rtsp_sys::GstRTSPUrl, -) -> *mut gst_sys::GstElement -where - T: RTSPMediaFactoryImpl, -{ +) -> *mut gst_sys::GstElement { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -253,13 +245,10 @@ where element } -unsafe extern "C" fn factory_construct( +unsafe extern "C" fn factory_construct( ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, url: *const gst_rtsp_sys::GstRTSPUrl, -) -> *mut gst_rtsp_server_sys::GstRTSPMedia -where - T: RTSPMediaFactoryImpl, -{ +) -> *mut gst_rtsp_server_sys::GstRTSPMedia { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -267,13 +256,10 @@ where imp.construct(&wrap, &from_glib_borrow(url)).to_glib_full() } -unsafe extern "C" fn factory_create_pipeline( +unsafe extern "C" fn factory_create_pipeline( ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, media: *mut gst_rtsp_server_sys::GstRTSPMedia, -) -> *mut gst_sys::GstElement -where - T: RTSPMediaFactoryImpl, -{ +) -> *mut gst_sys::GstElement { use once_cell::sync::Lazy; static PIPELINE_QUARK: Lazy = @@ -300,12 +286,10 @@ where pipeline as *mut _ } -unsafe extern "C" fn factory_configure( +unsafe extern "C" fn factory_configure( ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, media: *mut gst_rtsp_server_sys::GstRTSPMedia, -) where - T: RTSPMediaFactoryImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -313,12 +297,10 @@ unsafe extern "C" fn factory_configure( imp.configure(&wrap, &from_glib_borrow(media)); } -unsafe extern "C" fn factory_media_constructed( +unsafe extern "C" fn factory_media_constructed( ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, media: *mut gst_rtsp_server_sys::GstRTSPMedia, -) where - T: RTSPMediaFactoryImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -326,12 +308,10 @@ unsafe extern "C" fn factory_media_constructed( imp.media_constructed(&wrap, &from_glib_borrow(media)); } -unsafe extern "C" fn factory_media_configure( +unsafe extern "C" fn factory_media_configure( ptr: *mut gst_rtsp_server_sys::GstRTSPMediaFactory, media: *mut gst_rtsp_server_sys::GstRTSPMedia, -) where - T: RTSPMediaFactoryImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs index 78fb024f2..7df648f10 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs @@ -14,7 +14,7 @@ use glib::translate::*; use RTSPServer; use RTSPServerClass; -pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync + 'static { +pub trait RTSPServerImpl: RTSPServerImplExt + ObjectImpl + Send + Sync { fn create_client(&self, server: &RTSPServer) -> Option<::RTSPClient> { self.parent_create_client(server) } @@ -30,10 +30,10 @@ pub trait RTSPServerImplExt { fn parent_client_connected(&self, server: &RTSPServer, client: &::RTSPClient); } -impl RTSPServerImplExt for T { +impl RTSPServerImplExt for T { fn parent_create_client(&self, server: &RTSPServer) -> Option<::RTSPClient> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPServerClass; let f = (*parent_class) @@ -45,7 +45,7 @@ impl RTSPServerImplExt for T { fn parent_client_connected(&self, server: &RTSPServer, client: &::RTSPClient) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_rtsp_server_sys::GstRTSPServerClass; if let Some(f) = (*parent_class).client_connected { @@ -54,7 +54,7 @@ impl RTSPServerImplExt for T { } } } -unsafe impl IsSubclassable for RTSPServerClass { +unsafe impl IsSubclassable for RTSPServerClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { @@ -65,12 +65,9 @@ unsafe impl IsSubclassable for RTSPServer } } -unsafe extern "C" fn server_create_client( +unsafe extern "C" fn server_create_client( ptr: *mut gst_rtsp_server_sys::GstRTSPServer, -) -> *mut gst_rtsp_server_sys::GstRTSPClient -where - T: RTSPServerImpl, -{ +) -> *mut gst_rtsp_server_sys::GstRTSPClient { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -78,12 +75,10 @@ where imp.create_client(&wrap).to_glib_full() } -unsafe extern "C" fn server_client_connected( +unsafe extern "C" fn server_client_connected( ptr: *mut gst_rtsp_server_sys::GstRTSPServer, client: *mut gst_rtsp_server_sys::GstRTSPClient, -) where - T: RTSPServerImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index 76cb77354..a948447cb 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -24,7 +24,7 @@ use VideoCodecFrame; use VideoDecoder; use VideoDecoderClass; -pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl + Send + Sync + 'static { +pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl { fn open(&self, element: &VideoDecoder) -> Result<(), gst::ErrorMessage> { self.parent_open(element) } @@ -180,10 +180,10 @@ pub trait VideoDecoderImplExt { ) -> Result<(), gst::ErrorMessage>; } -impl VideoDecoderImplExt for T { +impl VideoDecoderImplExt for T { fn parent_open(&self, element: &VideoDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -204,7 +204,7 @@ impl VideoDecoderImplExt for T { fn parent_close(&self, element: &VideoDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -225,7 +225,7 @@ impl VideoDecoderImplExt for T { fn parent_start(&self, element: &VideoDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -246,7 +246,7 @@ impl VideoDecoderImplExt for T { fn parent_stop(&self, element: &VideoDecoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -267,7 +267,7 @@ impl VideoDecoderImplExt for T { fn parent_finish(&self, element: &VideoDecoder) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -280,7 +280,7 @@ impl VideoDecoderImplExt for T { fn parent_drain(&self, element: &VideoDecoder) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -297,7 +297,7 @@ impl VideoDecoderImplExt for T { state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -321,7 +321,7 @@ impl VideoDecoderImplExt for T { at_eos: bool, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -345,7 +345,7 @@ impl VideoDecoderImplExt for T { frame: VideoCodecFrame, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -360,7 +360,7 @@ impl VideoDecoderImplExt for T { fn parent_flush(&self, element: &VideoDecoder) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -372,7 +372,7 @@ impl VideoDecoderImplExt for T { fn parent_negotiate(&self, element: &VideoDecoder) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -390,7 +390,7 @@ impl VideoDecoderImplExt for T { fn parent_get_caps(&self, element: &VideoDecoder, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -402,7 +402,7 @@ impl VideoDecoderImplExt for T { fn parent_sink_event(&self, element: &VideoDecoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; let f = (*parent_class) @@ -414,7 +414,7 @@ impl VideoDecoderImplExt for T { fn parent_sink_query(&self, element: &VideoDecoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; let f = (*parent_class) @@ -426,7 +426,7 @@ impl VideoDecoderImplExt for T { fn parent_src_event(&self, element: &VideoDecoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; let f = (*parent_class) @@ -438,7 +438,7 @@ impl VideoDecoderImplExt for T { fn parent_src_query(&self, element: &VideoDecoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; let f = (*parent_class) @@ -454,7 +454,7 @@ impl VideoDecoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -479,7 +479,7 @@ impl VideoDecoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoDecoderClass; (*parent_class) @@ -499,7 +499,7 @@ impl VideoDecoderImplExt for T { } } -unsafe impl IsSubclassable for VideoDecoderClass +unsafe impl IsSubclassable for VideoDecoderClass where ::Instance: PanicPoison, { @@ -529,11 +529,10 @@ where } } -unsafe extern "C" fn video_decoder_open( +unsafe extern "C" fn video_decoder_open( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -552,11 +551,10 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_close( +unsafe extern "C" fn video_decoder_close( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -575,11 +573,10 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_start( +unsafe extern "C" fn video_decoder_start( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -598,11 +595,10 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_stop( +unsafe extern "C" fn video_decoder_stop( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -621,11 +617,10 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_finish( +unsafe extern "C" fn video_decoder_finish( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> gst_sys::GstFlowReturn where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -638,11 +633,10 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_drain( +unsafe extern "C" fn video_decoder_drain( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> gst_sys::GstFlowReturn where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -655,12 +649,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_set_format( +unsafe extern "C" fn video_decoder_set_format( ptr: *mut gst_video_sys::GstVideoDecoder, state: *mut gst_video_sys::GstVideoCodecState, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -681,14 +674,13 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_parse( +unsafe extern "C" fn video_decoder_parse( ptr: *mut gst_video_sys::GstVideoDecoder, frame: *mut gst_video_sys::GstVideoCodecFrame, adapter: *mut gst_base_sys::GstAdapter, at_eos: glib_sys::gboolean, ) -> gst_sys::GstFlowReturn where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -705,12 +697,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_handle_frame( +unsafe extern "C" fn video_decoder_handle_frame( ptr: *mut gst_video_sys::GstVideoDecoder, frame: *mut gst_video_sys::GstVideoCodecFrame, ) -> gst_sys::GstFlowReturn where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -724,11 +715,10 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_flush( +unsafe extern "C" fn video_decoder_flush( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -741,11 +731,10 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_negotiate( +unsafe extern "C" fn video_decoder_negotiate( ptr: *mut gst_video_sys::GstVideoDecoder, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -764,12 +753,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_getcaps( +unsafe extern "C" fn video_decoder_getcaps( ptr: *mut gst_video_sys::GstVideoDecoder, filter: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -788,12 +776,11 @@ where .to_glib_full() } -unsafe extern "C" fn video_decoder_sink_event( +unsafe extern "C" fn video_decoder_sink_event( ptr: *mut gst_video_sys::GstVideoDecoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -806,12 +793,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_sink_query( +unsafe extern "C" fn video_decoder_sink_query( ptr: *mut gst_video_sys::GstVideoDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -824,12 +810,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_src_event( +unsafe extern "C" fn video_decoder_src_event( ptr: *mut gst_video_sys::GstVideoDecoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -842,12 +827,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_src_query( +unsafe extern "C" fn video_decoder_src_query( ptr: *mut gst_video_sys::GstVideoDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -860,12 +844,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_propose_allocation( +unsafe extern "C" fn video_decoder_propose_allocation( ptr: *mut gst_video_sys::GstVideoDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -885,12 +868,11 @@ where .to_glib() } -unsafe extern "C" fn video_decoder_decide_allocation( +unsafe extern "C" fn video_decoder_decide_allocation( ptr: *mut gst_video_sys::GstVideoDecoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoDecoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 0d8a0c85a..4325e18eb 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -23,7 +23,7 @@ use VideoCodecFrame; use VideoEncoder; use VideoEncoderClass; -pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl + Send + Sync + 'static { +pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl { fn open(&self, element: &VideoEncoder) -> Result<(), gst::ErrorMessage> { self.parent_open(element) } @@ -155,10 +155,10 @@ pub trait VideoEncoderImplExt { ) -> Result<(), gst::ErrorMessage>; } -impl VideoEncoderImplExt for T { +impl VideoEncoderImplExt for T { fn parent_open(&self, element: &VideoEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -179,7 +179,7 @@ impl VideoEncoderImplExt for T { fn parent_close(&self, element: &VideoEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -200,7 +200,7 @@ impl VideoEncoderImplExt for T { fn parent_start(&self, element: &VideoEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -221,7 +221,7 @@ impl VideoEncoderImplExt for T { fn parent_stop(&self, element: &VideoEncoder) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -242,7 +242,7 @@ impl VideoEncoderImplExt for T { fn parent_finish(&self, element: &VideoEncoder) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -259,7 +259,7 @@ impl VideoEncoderImplExt for T { state: &VideoCodecState<'static, Readable>, ) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -281,7 +281,7 @@ impl VideoEncoderImplExt for T { frame: VideoCodecFrame, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -296,7 +296,7 @@ impl VideoEncoderImplExt for T { fn parent_flush(&self, element: &VideoEncoder) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -308,7 +308,7 @@ impl VideoEncoderImplExt for T { fn parent_negotiate(&self, element: &VideoEncoder) -> Result<(), gst::LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -326,7 +326,7 @@ impl VideoEncoderImplExt for T { fn parent_get_caps(&self, element: &VideoEncoder, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -338,7 +338,7 @@ impl VideoEncoderImplExt for T { fn parent_sink_event(&self, element: &VideoEncoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; let f = (*parent_class) @@ -350,7 +350,7 @@ impl VideoEncoderImplExt for T { fn parent_sink_query(&self, element: &VideoEncoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; let f = (*parent_class) @@ -362,7 +362,7 @@ impl VideoEncoderImplExt for T { fn parent_src_event(&self, element: &VideoEncoder, event: gst::Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; let f = (*parent_class) @@ -374,7 +374,7 @@ impl VideoEncoderImplExt for T { fn parent_src_query(&self, element: &VideoEncoder, query: &mut gst::QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; let f = (*parent_class) @@ -390,7 +390,7 @@ impl VideoEncoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -415,7 +415,7 @@ impl VideoEncoderImplExt for T { query: &mut gst::QueryRef, ) -> Result<(), gst::ErrorMessage> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoEncoderClass; (*parent_class) @@ -435,7 +435,7 @@ impl VideoEncoderImplExt for T { } } -unsafe impl IsSubclassable for VideoEncoderClass +unsafe impl IsSubclassable for VideoEncoderClass where ::Instance: PanicPoison, { @@ -463,11 +463,10 @@ where } } -unsafe extern "C" fn video_encoder_open( +unsafe extern "C" fn video_encoder_open( ptr: *mut gst_video_sys::GstVideoEncoder, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -486,11 +485,10 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_close( +unsafe extern "C" fn video_encoder_close( ptr: *mut gst_video_sys::GstVideoEncoder, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -509,11 +507,10 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_start( +unsafe extern "C" fn video_encoder_start( ptr: *mut gst_video_sys::GstVideoEncoder, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -532,11 +529,10 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_stop( +unsafe extern "C" fn video_encoder_stop( ptr: *mut gst_video_sys::GstVideoEncoder, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -555,11 +551,10 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_finish( +unsafe extern "C" fn video_encoder_finish( ptr: *mut gst_video_sys::GstVideoEncoder, ) -> gst_sys::GstFlowReturn where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -572,12 +567,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_set_format( +unsafe extern "C" fn video_encoder_set_format( ptr: *mut gst_video_sys::GstVideoEncoder, state: *mut gst_video_sys::GstVideoCodecState, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -598,12 +592,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_handle_frame( +unsafe extern "C" fn video_encoder_handle_frame( ptr: *mut gst_video_sys::GstVideoEncoder, frame: *mut gst_video_sys::GstVideoCodecFrame, ) -> gst_sys::GstFlowReturn where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -617,11 +610,10 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_flush( +unsafe extern "C" fn video_encoder_flush( ptr: *mut gst_video_sys::GstVideoEncoder, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -634,11 +626,10 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_negotiate( +unsafe extern "C" fn video_encoder_negotiate( ptr: *mut gst_video_sys::GstVideoEncoder, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -657,12 +648,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_getcaps( +unsafe extern "C" fn video_encoder_getcaps( ptr: *mut gst_video_sys::GstVideoEncoder, filter: *mut gst_sys::GstCaps, ) -> *mut gst_sys::GstCaps where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -681,12 +671,11 @@ where .to_glib_full() } -unsafe extern "C" fn video_encoder_sink_event( +unsafe extern "C" fn video_encoder_sink_event( ptr: *mut gst_video_sys::GstVideoEncoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -699,12 +688,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_sink_query( +unsafe extern "C" fn video_encoder_sink_query( ptr: *mut gst_video_sys::GstVideoEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -717,12 +705,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_src_event( +unsafe extern "C" fn video_encoder_src_event( ptr: *mut gst_video_sys::GstVideoEncoder, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -735,12 +722,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_src_query( +unsafe extern "C" fn video_encoder_src_query( ptr: *mut gst_video_sys::GstVideoEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -753,12 +739,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_propose_allocation( +unsafe extern "C" fn video_encoder_propose_allocation( ptr: *mut gst_video_sys::GstVideoEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -778,12 +763,11 @@ where .to_glib() } -unsafe extern "C" fn video_encoder_decide_allocation( +unsafe extern "C" fn video_encoder_decide_allocation( ptr: *mut gst_video_sys::GstVideoEncoder, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: VideoEncoderImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer-video/src/subclass/video_sink.rs b/gstreamer-video/src/subclass/video_sink.rs index 0dad9a58a..ac00c1e92 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -19,9 +19,7 @@ use gst_base::subclass::prelude::*; use VideoSink; use VideoSinkClass; -pub trait VideoSinkImpl: - VideoSinkImplExt + BaseSinkImpl + ElementImpl + Send + Sync + 'static -{ +pub trait VideoSinkImpl: VideoSinkImplExt + BaseSinkImpl + ElementImpl { fn show_frame( &self, element: &VideoSink, @@ -39,14 +37,14 @@ pub trait VideoSinkImplExt { ) -> Result; } -impl VideoSinkImplExt for T { +impl VideoSinkImplExt for T { fn parent_show_frame( &self, element: &VideoSink, buffer: &gst::Buffer, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_video_sys::GstVideoSinkClass; (*parent_class) @@ -60,7 +58,7 @@ impl VideoSinkImplExt for T { } } -unsafe impl IsSubclassable for VideoSinkClass +unsafe impl IsSubclassable for VideoSinkClass where ::Instance: PanicPoison, { @@ -73,12 +71,11 @@ where } } -unsafe extern "C" fn video_sink_show_frame( +unsafe extern "C" fn video_sink_show_frame( ptr: *mut gst_video_sys::GstVideoSink, buffer: *mut gst_sys::GstBuffer, ) -> gst_sys::GstFlowReturn where - T: VideoSinkImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer/src/subclass/bin.rs b/gstreamer/src/subclass/bin.rs index 159d29e0d..a56563788 100644 --- a/gstreamer/src/subclass/bin.rs +++ b/gstreamer/src/subclass/bin.rs @@ -20,7 +20,7 @@ use Element; use LoggableError; use Message; -pub trait BinImpl: BinImplExt + ElementImpl + Send + Sync + 'static { +pub trait BinImpl: BinImplExt + ElementImpl { fn add_element(&self, bin: &Bin, element: &Element) -> Result<(), LoggableError> { self.parent_add_element(bin, element) } @@ -42,10 +42,10 @@ pub trait BinImplExt { fn parent_handle_message(&self, bin: &Bin, message: Message); } -impl BinImplExt for T { +impl BinImplExt for T { fn parent_add_element(&self, bin: &Bin, element: &Element) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstBinClass; let f = (*parent_class).add_element.ok_or_else(|| { gst_loggable_error!(::CAT_RUST, "Parent function `add_element` is not defined") @@ -60,7 +60,7 @@ impl BinImplExt for T { fn parent_remove_element(&self, bin: &Bin, element: &Element) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstBinClass; let f = (*parent_class).remove_element.ok_or_else(|| { gst_loggable_error!( @@ -78,7 +78,7 @@ impl BinImplExt for T { fn parent_handle_message(&self, bin: &Bin, message: Message) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstBinClass; if let Some(ref f) = (*parent_class).handle_message { f(bin.to_glib_none().0, message.into_ptr()); @@ -87,7 +87,7 @@ impl BinImplExt for T { } } -unsafe impl IsSubclassable for BinClass +unsafe impl IsSubclassable for BinClass where ::Instance: PanicPoison, { @@ -102,12 +102,11 @@ where } } -unsafe extern "C" fn bin_add_element( +unsafe extern "C" fn bin_add_element( ptr: *mut gst_sys::GstBin, element: *mut gst_sys::GstElement, ) -> glib_sys::gboolean where - T: BinImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -126,12 +125,11 @@ where .to_glib() } -unsafe extern "C" fn bin_remove_element( +unsafe extern "C" fn bin_remove_element( ptr: *mut gst_sys::GstBin, element: *mut gst_sys::GstElement, ) -> glib_sys::gboolean where - T: BinImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -157,11 +155,10 @@ where .to_glib() } -unsafe extern "C" fn bin_handle_message( +unsafe extern "C" fn bin_handle_message( ptr: *mut gst_sys::GstBin, message: *mut gst_sys::GstMessage, ) where - T: BinImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); diff --git a/gstreamer/src/subclass/child_proxy.rs b/gstreamer/src/subclass/child_proxy.rs index 51387cbda..853f5eab0 100644 --- a/gstreamer/src/subclass/child_proxy.rs +++ b/gstreamer/src/subclass/child_proxy.rs @@ -18,7 +18,7 @@ use libc; use ChildProxy; -pub trait ChildProxyImpl: super::element::ElementImpl + Send + Sync + 'static { +pub trait ChildProxyImpl: ObjectImpl + Send + Sync { fn get_child_by_name(&self, object: &ChildProxy, name: &str) -> Option { unsafe { let type_ = gst_sys::gst_child_proxy_get_type(); @@ -44,7 +44,7 @@ pub trait ChildProxyImpl: super::element::ElementImpl + Send + Sync + 'static { fn child_removed(&self, _object: &ChildProxy, _child: &glib::Object, _name: &str) {} } -unsafe impl IsImplementable for ChildProxy { +unsafe impl IsImplementable for ChildProxy { unsafe extern "C" fn interface_init( iface: glib_sys::gpointer, _iface_data: glib_sys::gpointer, @@ -59,13 +59,10 @@ unsafe impl IsImplementable for ChildProx } } -unsafe extern "C" fn child_proxy_get_child_by_name( +unsafe extern "C" fn child_proxy_get_child_by_name( child_proxy: *mut gst_sys::GstChildProxy, name: *const libc::c_char, -) -> *mut gobject_sys::GObject -where - T: ChildProxyImpl, -{ +) -> *mut gobject_sys::GObject { let instance = &*(child_proxy as *mut T::Instance); let imp = instance.get_impl(); @@ -76,13 +73,10 @@ where .to_glib_full() } -unsafe extern "C" fn child_proxy_get_child_by_index( +unsafe extern "C" fn child_proxy_get_child_by_index( child_proxy: *mut gst_sys::GstChildProxy, index: u32, -) -> *mut gobject_sys::GObject -where - T: ChildProxyImpl, -{ +) -> *mut gobject_sys::GObject { let instance = &*(child_proxy as *mut T::Instance); let imp = instance.get_impl(); @@ -90,25 +84,20 @@ where .to_glib_full() } -unsafe extern "C" fn child_proxy_get_children_count( +unsafe extern "C" fn child_proxy_get_children_count( child_proxy: *mut gst_sys::GstChildProxy, -) -> u32 -where - T: ChildProxyImpl, -{ +) -> u32 { let instance = &*(child_proxy as *mut T::Instance); let imp = instance.get_impl(); imp.get_children_count(&from_glib_borrow(child_proxy)) } -unsafe extern "C" fn child_proxy_child_added( +unsafe extern "C" fn child_proxy_child_added( child_proxy: *mut gst_sys::GstChildProxy, child: *mut gobject_sys::GObject, name: *const libc::c_char, -) where - T: ChildProxyImpl, -{ +) { let instance = &*(child_proxy as *mut T::Instance); let imp = instance.get_impl(); @@ -119,13 +108,11 @@ unsafe extern "C" fn child_proxy_child_added( ) } -unsafe extern "C" fn child_proxy_child_removed( +unsafe extern "C" fn child_proxy_child_removed( child_proxy: *mut gst_sys::GstChildProxy, child: *mut gobject_sys::GObject, name: *const libc::c_char, -) where - T: ChildProxyImpl, -{ +) { let instance = &*(child_proxy as *mut T::Instance); let imp = instance.get_impl(); diff --git a/gstreamer/src/subclass/clock.rs b/gstreamer/src/subclass/clock.rs index 076e29665..7c98cd885 100644 --- a/gstreamer/src/subclass/clock.rs +++ b/gstreamer/src/subclass/clock.rs @@ -22,7 +22,7 @@ use ClockSuccess; use ClockTime; use ClockTimeDiff; -pub trait ClockImpl: ClockImplExt + ObjectImpl + Send + Sync + 'static { +pub trait ClockImpl: ClockImplExt + ObjectImpl + Send + Sync { fn change_resolution( &self, clock: &Clock, @@ -85,7 +85,7 @@ pub trait ClockImplExt { ::ParentType: IsA; } -impl ClockImplExt for T { +impl ClockImplExt for T { fn parent_change_resolution( &self, clock: &Clock, @@ -93,7 +93,7 @@ impl ClockImplExt for T { new_resolution: ClockTime, ) -> ClockTime { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstClockClass; if let Some(func) = (*parent_class).change_resolution { @@ -110,7 +110,7 @@ impl ClockImplExt for T { fn parent_get_resolution(&self, clock: &Clock) -> ClockTime { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstClockClass; from_glib( @@ -124,7 +124,7 @@ impl ClockImplExt for T { fn parent_get_internal_time(&self, clock: &Clock) -> ClockTime { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstClockClass; from_glib( @@ -142,7 +142,7 @@ impl ClockImplExt for T { id: &ClockId, ) -> (Result, ClockTimeDiff) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstClockClass; let mut jitter = 0; @@ -167,7 +167,7 @@ impl ClockImplExt for T { fn parent_wait_async(&self, clock: &Clock, id: &ClockId) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstClockClass; ClockReturn::from_glib( (*parent_class) @@ -186,7 +186,7 @@ impl ClockImplExt for T { fn parent_unschedule(&self, clock: &Clock, id: &ClockId) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstClockClass; if let Some(func) = (*parent_class).unschedule { func( @@ -233,7 +233,7 @@ impl ClockImplExt for T { } } -unsafe impl IsSubclassable for ClockClass { +unsafe impl IsSubclassable for ClockClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); @@ -249,14 +249,11 @@ unsafe impl IsSubclassable for ClockClass { } } -unsafe extern "C" fn clock_change_resolution( +unsafe extern "C" fn clock_change_resolution( ptr: *mut gst_sys::GstClock, old_resolution: gst_sys::GstClockTime, new_resolution: gst_sys::GstClockTime, -) -> gst_sys::GstClockTime -where - T: ClockImpl, -{ +) -> gst_sys::GstClockTime { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -265,12 +262,9 @@ where .to_glib() } -unsafe extern "C" fn clock_get_resolution( +unsafe extern "C" fn clock_get_resolution( ptr: *mut gst_sys::GstClock, -) -> gst_sys::GstClockTime -where - T: ClockImpl, -{ +) -> gst_sys::GstClockTime { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -278,12 +272,9 @@ where imp.get_resolution(&wrap).to_glib() } -unsafe extern "C" fn clock_get_internal_time( +unsafe extern "C" fn clock_get_internal_time( ptr: *mut gst_sys::GstClock, -) -> gst_sys::GstClockTime -where - T: ClockImpl, -{ +) -> gst_sys::GstClockTime { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -291,14 +282,11 @@ where imp.get_internal_time(&wrap).to_glib() } -unsafe extern "C" fn clock_wait( +unsafe extern "C" fn clock_wait( ptr: *mut gst_sys::GstClock, id: *mut gst_sys::GstClockEntry, jitter: *mut gst_sys::GstClockTimeDiff, -) -> gst_sys::GstClockReturn -where - T: ClockImpl, -{ +) -> gst_sys::GstClockReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -311,13 +299,10 @@ where ClockReturn::from(res).to_glib() } -unsafe extern "C" fn clock_wait_async( +unsafe extern "C" fn clock_wait_async( ptr: *mut gst_sys::GstClock, id: *mut gst_sys::GstClockEntry, -) -> gst_sys::GstClockReturn -where - T: ClockImpl, -{ +) -> gst_sys::GstClockReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -325,12 +310,10 @@ where ClockReturn::from(imp.wait_async(&wrap, &from_glib_borrow(id as gst_sys::GstClockID))).to_glib() } -unsafe extern "C" fn clock_unschedule( +unsafe extern "C" fn clock_unschedule( ptr: *mut gst_sys::GstClock, id: *mut gst_sys::GstClockEntry, -) where - T: ClockImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer/src/subclass/device.rs b/gstreamer/src/subclass/device.rs index 250235167..f26864f01 100644 --- a/gstreamer/src/subclass/device.rs +++ b/gstreamer/src/subclass/device.rs @@ -20,7 +20,7 @@ use LoggableError; use std::ptr; -pub trait DeviceImpl: DeviceImplExt + ObjectImpl + Send + Sync + 'static { +pub trait DeviceImpl: DeviceImplExt + ObjectImpl + Send + Sync { fn create_element( &self, device: &Device, @@ -48,14 +48,14 @@ pub trait DeviceImplExt { ) -> Result<(), LoggableError>; } -impl DeviceImplExt for T { +impl DeviceImplExt for T { fn parent_create_element( &self, device: &Device, name: Option<&str>, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstDeviceClass; if let Some(f) = (*parent_class).create_element { let ptr = f(device.to_glib_none().0, name.to_glib_none().0); @@ -82,7 +82,7 @@ impl DeviceImplExt for T { element: &Element, ) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstDeviceClass; let f = (*parent_class).reconfigure_element.ok_or_else(|| { gst_loggable_error!( @@ -99,7 +99,7 @@ impl DeviceImplExt for T { } } -unsafe impl IsSubclassable for DeviceClass { +unsafe impl IsSubclassable for DeviceClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { @@ -110,13 +110,10 @@ unsafe impl IsSubclassable for DeviceClass { } } -unsafe extern "C" fn device_create_element( +unsafe extern "C" fn device_create_element( ptr: *mut gst_sys::GstDevice, name: *const libc::c_char, -) -> *mut gst_sys::GstElement -where - T: DeviceImpl, -{ +) -> *mut gst_sys::GstElement { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -144,13 +141,10 @@ where } } -unsafe extern "C" fn device_reconfigure_element( +unsafe extern "C" fn device_reconfigure_element( ptr: *mut gst_sys::GstDevice, element: *mut gst_sys::GstElement, -) -> glib_sys::gboolean -where - T: DeviceImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer/src/subclass/device_provider.rs b/gstreamer/src/subclass/device_provider.rs index 1cabf023f..95511159a 100644 --- a/gstreamer/src/subclass/device_provider.rs +++ b/gstreamer/src/subclass/device_provider.rs @@ -18,7 +18,7 @@ use DeviceProvider; use DeviceProviderClass; use LoggableError; -pub trait DeviceProviderImpl: DeviceProviderImplExt + ObjectImpl + Send + Sync + 'static { +pub trait DeviceProviderImpl: DeviceProviderImplExt + ObjectImpl + Send + Sync { fn probe(&self, device_provider: &DeviceProvider) -> Vec { self.parent_probe(device_provider) } @@ -40,10 +40,10 @@ pub trait DeviceProviderImplExt { fn parent_stop(&self, device_provider: &DeviceProvider); } -impl DeviceProviderImplExt for T { +impl DeviceProviderImplExt for T { fn parent_probe(&self, device_provider: &DeviceProvider) -> Vec { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstDeviceProviderClass; if let Some(f) = (*parent_class).probe { @@ -56,7 +56,7 @@ impl DeviceProviderImplExt for T { fn parent_start(&self, device_provider: &DeviceProvider) -> Result<(), LoggableError> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstDeviceProviderClass; let f = (*parent_class).start.ok_or_else(|| { @@ -72,7 +72,7 @@ impl DeviceProviderImplExt for T { fn parent_stop(&self, device_provider: &DeviceProvider) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstDeviceProviderClass; if let Some(f) = (*parent_class).stop { @@ -114,7 +114,7 @@ pub unsafe trait DeviceProviderClassSubclassExt: Sized + 'static { unsafe impl DeviceProviderClassSubclassExt for DeviceProviderClass {} -unsafe impl IsSubclassable for DeviceProviderClass { +unsafe impl IsSubclassable for DeviceProviderClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); unsafe { @@ -126,12 +126,9 @@ unsafe impl IsSubclassable for Device } } -unsafe extern "C" fn device_provider_probe( +unsafe extern "C" fn device_provider_probe( ptr: *mut gst_sys::GstDeviceProvider, -) -> *mut glib_sys::GList -where - T: DeviceProviderImpl, -{ +) -> *mut glib_sys::GList { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -139,12 +136,9 @@ where imp.probe(&wrap).to_glib_full() } -unsafe extern "C" fn device_provider_start( +unsafe extern "C" fn device_provider_start( ptr: *mut gst_sys::GstDeviceProvider, -) -> glib_sys::gboolean -where - T: DeviceProviderImpl, -{ +) -> glib_sys::gboolean { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -159,10 +153,9 @@ where .to_glib() } -unsafe extern "C" fn device_provider_stop(ptr: *mut gst_sys::GstDeviceProvider) -where - T: DeviceProviderImpl, -{ +unsafe extern "C" fn device_provider_stop( + ptr: *mut gst_sys::GstDeviceProvider, +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 1987f5f1f..21ff67a45 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -28,7 +28,7 @@ use StateChangeError; use StateChangeReturn; use StateChangeSuccess; -pub trait ElementImpl: ElementImplExt + ObjectImpl + Send + Sync + 'static { +pub trait ElementImpl: ElementImplExt + ObjectImpl + Send + Sync { fn change_state( &self, element: &::Element, @@ -124,7 +124,7 @@ pub trait ElementImplExt { ) -> R; } -impl ElementImplExt for T +impl ElementImplExt for T where T::Instance: PanicPoison, { @@ -134,7 +134,7 @@ where transition: StateChange, ) -> Result { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; let f = (*parent_class) @@ -153,7 +153,7 @@ where caps: Option<&::Caps>, ) -> Option<::Pad> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) @@ -172,7 +172,7 @@ where fn parent_release_pad(&self, element: &::Element, pad: &::Pad) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) @@ -184,7 +184,7 @@ where fn parent_send_event(&self, element: &::Element, event: Event) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) @@ -196,7 +196,7 @@ where fn parent_query(&self, element: &::Element, query: &mut QueryRef) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) @@ -208,7 +208,7 @@ where fn parent_set_context(&self, element: &::Element, context: &::Context) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) @@ -220,7 +220,7 @@ where fn parent_set_clock(&self, element: &::Element, clock: Option<&::Clock>) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) @@ -232,7 +232,7 @@ where fn parent_provide_clock(&self, element: &::Element) -> Option<::Clock> { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; (*parent_class) @@ -244,7 +244,7 @@ where fn parent_post_message(&self, element: &::Element, msg: ::Message) -> bool { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstElementClass; if let Some(f) = (*parent_class).post_message { @@ -338,7 +338,7 @@ pub unsafe trait ElementClassSubclassExt: Sized + 'static { unsafe impl ElementClassSubclassExt for ElementClass {} -unsafe impl IsSubclassable for ElementClass +unsafe impl IsSubclassable for ElementClass where ::Instance: PanicPoison, { @@ -360,12 +360,11 @@ where } } -unsafe extern "C" fn element_change_state( +unsafe extern "C" fn element_change_state( ptr: *mut gst_sys::GstElement, transition: gst_sys::GstStateChange, ) -> gst_sys::GstStateChangeReturn where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -388,14 +387,13 @@ where .to_glib() } -unsafe extern "C" fn element_request_new_pad( +unsafe extern "C" fn element_request_new_pad( ptr: *mut gst_sys::GstElement, templ: *mut gst_sys::GstPadTemplate, name: *const libc::c_char, caps: *const gst_sys::GstCaps, ) -> *mut gst_sys::GstPad where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -426,11 +424,10 @@ where pad.to_glib_none().0 } -unsafe extern "C" fn element_release_pad( +unsafe extern "C" fn element_release_pad( ptr: *mut gst_sys::GstElement, pad: *mut gst_sys::GstPad, ) where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -448,12 +445,11 @@ unsafe extern "C" fn element_release_pad( }) } -unsafe extern "C" fn element_send_event( +unsafe extern "C" fn element_send_event( ptr: *mut gst_sys::GstElement, event: *mut gst_sys::GstEvent, ) -> glib_sys::gboolean where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -466,12 +462,11 @@ where .to_glib() } -unsafe extern "C" fn element_query( +unsafe extern "C" fn element_query( ptr: *mut gst_sys::GstElement, query: *mut gst_sys::GstQuery, ) -> glib_sys::gboolean where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -485,11 +480,10 @@ where .to_glib() } -unsafe extern "C" fn element_set_context( +unsafe extern "C" fn element_set_context( ptr: *mut gst_sys::GstElement, context: *mut gst_sys::GstContext, ) where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -501,12 +495,11 @@ unsafe extern "C" fn element_set_context( }) } -unsafe extern "C" fn element_set_clock( +unsafe extern "C" fn element_set_clock( ptr: *mut gst_sys::GstElement, clock: *mut gst_sys::GstClock, ) -> glib_sys::gboolean where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -521,11 +514,10 @@ where .to_glib() } -unsafe extern "C" fn element_provide_clock( +unsafe extern "C" fn element_provide_clock( ptr: *mut gst_sys::GstElement, ) -> *mut gst_sys::GstClock where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -538,12 +530,11 @@ where .to_glib_full() } -unsafe extern "C" fn element_post_message( +unsafe extern "C" fn element_post_message( ptr: *mut gst_sys::GstElement, msg: *mut gst_sys::GstMessage, ) -> glib_sys::gboolean where - T: ElementImpl, T::Instance: PanicPoison, { let instance = &*(ptr as *mut T::Instance); @@ -679,8 +670,6 @@ mod tests { } impl ObjectImpl for TestElement { - glib_object_impl!(); - fn constructed(&self, obj: &glib::Object) { self.parent_constructed(obj); diff --git a/gstreamer/src/subclass/ghost_pad.rs b/gstreamer/src/subclass/ghost_pad.rs index 6726e6058..2d0dc1f16 100644 --- a/gstreamer/src/subclass/ghost_pad.rs +++ b/gstreamer/src/subclass/ghost_pad.rs @@ -13,9 +13,9 @@ use glib::subclass::prelude::*; use GhostPadClass; -pub trait GhostPadImpl: PadImpl + Send + Sync + 'static {} +pub trait GhostPadImpl: PadImpl {} -unsafe impl IsSubclassable for GhostPadClass { +unsafe impl IsSubclassable for GhostPadClass { fn override_vfuncs(&mut self) { <::PadClass as IsSubclassable>::override_vfuncs(self); unsafe { diff --git a/gstreamer/src/subclass/pad.rs b/gstreamer/src/subclass/pad.rs index 45d6e9046..250070e57 100644 --- a/gstreamer/src/subclass/pad.rs +++ b/gstreamer/src/subclass/pad.rs @@ -16,7 +16,7 @@ use glib::subclass::prelude::*; use Pad; use PadClass; -pub trait PadImpl: PadImplExt + ObjectImpl + Send + Sync + 'static { +pub trait PadImpl: PadImplExt + ObjectImpl + Send + Sync { fn linked(&self, pad: &Pad, peer: &Pad) { self.parent_linked(pad, peer) } @@ -32,10 +32,10 @@ pub trait PadImplExt { fn parent_unlinked(&self, pad: &Pad, peer: &Pad); } -impl PadImplExt for T { +impl PadImplExt for T { fn parent_linked(&self, pad: &Pad, peer: &Pad) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstPadClass; (*parent_class) @@ -47,7 +47,7 @@ impl PadImplExt for T { fn parent_unlinked(&self, pad: &Pad, peer: &Pad) { unsafe { - let data = self.get_type_data(); + let data = T::type_data(); let parent_class = data.as_ref().get_parent_class() as *mut gst_sys::GstPadClass; (*parent_class) @@ -58,7 +58,7 @@ impl PadImplExt for T { } } -unsafe impl IsSubclassable for PadClass { +unsafe impl IsSubclassable for PadClass { fn override_vfuncs(&mut self) { >::override_vfuncs(self); @@ -70,12 +70,7 @@ unsafe impl IsSubclassable for PadClass { } } -unsafe extern "C" fn pad_linked( - ptr: *mut gst_sys::GstPad, - peer: *mut gst_sys::GstPad, -) where - T: PadImpl, -{ +unsafe extern "C" fn pad_linked(ptr: *mut gst_sys::GstPad, peer: *mut gst_sys::GstPad) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -83,12 +78,10 @@ unsafe extern "C" fn pad_linked( imp.linked(&wrap, &from_glib_borrow(peer)) } -unsafe extern "C" fn pad_unlinked( +unsafe extern "C" fn pad_unlinked( ptr: *mut gst_sys::GstPad, peer: *mut gst_sys::GstPad, -) where - T: PadImpl, -{ +) { let instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed = from_glib_borrow(ptr); @@ -125,9 +118,7 @@ mod tests { } } - impl ObjectImpl for TestPad { - glib_object_impl!(); - } + impl ObjectImpl for TestPad {} impl PadImpl for TestPad { fn linked(&self, pad: &Pad, peer: &Pad) { diff --git a/gstreamer/src/subclass/pipeline.rs b/gstreamer/src/subclass/pipeline.rs index cb61bed03..bdba50e85 100644 --- a/gstreamer/src/subclass/pipeline.rs +++ b/gstreamer/src/subclass/pipeline.rs @@ -13,9 +13,9 @@ use glib::subclass::prelude::*; use PipelineClass; -pub trait PipelineImpl: BinImpl + Send + Sync + 'static {} +pub trait PipelineImpl: BinImpl {} -unsafe impl IsSubclassable for PipelineClass +unsafe impl IsSubclassable for PipelineClass where ::Instance: PanicPoison, { diff --git a/gstreamer/src/subclass/preset.rs b/gstreamer/src/subclass/preset.rs index ba54aea3f..ee3a54bf5 100644 --- a/gstreamer/src/subclass/preset.rs +++ b/gstreamer/src/subclass/preset.rs @@ -12,9 +12,9 @@ use glib::subclass::prelude::*; use Preset; -pub trait PresetImpl: super::element::ElementImpl + Send + Sync + 'static {} +pub trait PresetImpl: super::element::ElementImpl {} -unsafe impl IsImplementable for Preset { +unsafe impl IsImplementable for Preset { unsafe extern "C" fn interface_init( _iface: glib_sys::gpointer, _iface_data: glib_sys::gpointer, diff --git a/gstreamer/src/subclass/system_clock.rs b/gstreamer/src/subclass/system_clock.rs index 557d68892..381713acf 100644 --- a/gstreamer/src/subclass/system_clock.rs +++ b/gstreamer/src/subclass/system_clock.rs @@ -13,9 +13,9 @@ use glib::subclass::prelude::*; use SystemClockClass; -pub trait SystemClockImpl: ClockImpl + Send + Sync + 'static {} +pub trait SystemClockImpl: ClockImpl {} -unsafe impl IsSubclassable for SystemClockClass { +unsafe impl IsSubclassable for SystemClockClass { fn override_vfuncs(&mut self) { <::ClockClass as IsSubclassable>::override_vfuncs(self); unsafe { diff --git a/gstreamer/src/subclass/tag_setter.rs b/gstreamer/src/subclass/tag_setter.rs index dac7515cf..8f8cb0757 100644 --- a/gstreamer/src/subclass/tag_setter.rs +++ b/gstreamer/src/subclass/tag_setter.rs @@ -12,9 +12,9 @@ use glib::subclass::prelude::*; use TagSetter; -pub trait TagSetterImpl: super::element::ElementImpl + Send + Sync + 'static {} +pub trait TagSetterImpl: super::element::ElementImpl {} -unsafe impl IsImplementable for TagSetter { +unsafe impl IsImplementable for TagSetter { unsafe extern "C" fn interface_init( _iface: glib_sys::gpointer, _iface_data: glib_sys::gpointer, diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index 890282d83..d37c66da8 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -20,14 +20,14 @@ use libc; use URIHandler; use URIType; -pub trait URIHandlerImpl: super::element::ElementImpl + Send + Sync + 'static { +pub trait URIHandlerImpl: super::element::ElementImpl { fn get_uri(&self, element: &URIHandler) -> Option; fn set_uri(&self, element: &URIHandler, uri: &str) -> Result<(), glib::Error>; fn get_uri_type() -> URIType; fn get_protocols() -> Vec; } -unsafe impl IsImplementable for URIHandler { +unsafe impl IsImplementable for URIHandler { unsafe extern "C" fn interface_init( iface: glib_sys::gpointer, _iface_data: glib_sys::gpointer, @@ -52,46 +52,34 @@ unsafe impl IsImplementable for URIHandle } } -unsafe extern "C" fn uri_handler_get_type( +unsafe extern "C" fn uri_handler_get_type( _type_: glib_sys::GType, -) -> gst_sys::GstURIType -where - T: URIHandlerImpl, -{ +) -> gst_sys::GstURIType { ::get_uri_type().to_glib() } -unsafe extern "C" fn uri_handler_get_protocols( +unsafe extern "C" fn uri_handler_get_protocols( _type_: glib_sys::GType, -) -> *const *const libc::c_char -where - T: URIHandlerImpl, -{ +) -> *const *const libc::c_char { let data = ::type_data(); data.as_ref() .get_interface_data(URIHandler::static_type().to_glib()) as *const _ } -unsafe extern "C" fn uri_handler_get_uri( +unsafe extern "C" fn uri_handler_get_uri( uri_handler: *mut gst_sys::GstURIHandler, -) -> *mut libc::c_char -where - T: URIHandlerImpl, -{ +) -> *mut libc::c_char { let instance = &*(uri_handler as *mut T::Instance); let imp = instance.get_impl(); imp.get_uri(&from_glib_borrow(uri_handler)).to_glib_full() } -unsafe extern "C" fn uri_handler_set_uri( +unsafe extern "C" fn uri_handler_set_uri( uri_handler: *mut gst_sys::GstURIHandler, uri: *const libc::c_char, err: *mut *mut glib_sys::GError, -) -> glib_sys::gboolean -where - T: URIHandlerImpl, -{ +) -> glib_sys::gboolean { let instance = &*(uri_handler as *mut T::Instance); let imp = instance.get_impl();