From 90b8ee20229f14767f14fca38403eece47983be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 23 Oct 2022 22:59:23 +0300 Subject: [PATCH] Move from `imp.instance()` to `imp.obj()` It's doing the same thing and is shorter. --- examples/src/bin/cairo_compositor.rs | 12 +- examples/src/bin/glfilter.rs | 4 +- examples/src/bin/rtsp-server-subclass.rs | 6 +- .../src/subclass/audio_aggregator.rs | 4 +- .../src/subclass/audio_aggregator_pad.rs | 4 +- gstreamer-audio/src/subclass/audio_decoder.rs | 36 ++-- gstreamer-audio/src/subclass/audio_encoder.rs | 34 ++-- gstreamer-audio/src/subclass/audio_sink.rs | 40 +---- gstreamer-audio/src/subclass/audio_src.rs | 40 +---- gstreamer-base/src/subclass/aggregator.rs | 100 +++-------- gstreamer-base/src/subclass/aggregator_pad.rs | 4 +- gstreamer-base/src/subclass/base_parse.rs | 21 +-- gstreamer-base/src/subclass/base_sink.rs | 78 ++------- gstreamer-base/src/subclass/base_src.rs | 101 +++--------- gstreamer-base/src/subclass/base_transform.rs | 74 ++++----- gstreamer-base/src/subclass/push_src.rs | 15 +- gstreamer-gl/src/subclass/gl_base_filter.rs | 6 +- gstreamer-gl/src/subclass/gl_base_src.rs | 17 +- gstreamer-gl/src/subclass/gl_filter.rs | 26 +-- .../src/subclass/audio_visualizer.rs | 10 +- .../src/subclass/play_video_renderer.rs | 2 +- .../src/subclass/player_video_renderer.rs | 2 +- .../src/subclass/rtp_base_depayload.rs | 8 +- .../src/subclass/rtp_base_payload.rs | 14 +- .../src/subclass/rtp_header_extension.rs | 16 +- .../src/subclass/rtsp_client.rs | 156 ++++-------------- .../src/subclass/rtsp_media.rs | 87 ++-------- .../src/subclass/rtsp_media_factory.rs | 14 +- .../src/subclass/rtsp_mount_points.rs | 2 +- .../src/subclass/rtsp_onvif_media_factory.rs | 2 +- .../src/subclass/rtsp_server.rs | 7 +- gstreamer-video/src/subclass/navigation.rs | 10 +- .../src/subclass/video_aggregator.rs | 12 +- .../src/subclass/video_aggregator_pad.rs | 6 +- gstreamer-video/src/subclass/video_decoder.rs | 44 ++--- gstreamer-video/src/subclass/video_encoder.rs | 36 ++-- gstreamer-video/src/subclass/video_filter.rs | 26 +-- gstreamer-video/src/subclass/video_sink.rs | 5 +- gstreamer/src/element.rs | 72 ++++---- gstreamer/src/error.rs | 2 +- gstreamer/src/log.rs | 2 +- gstreamer/src/subclass/bin.rs | 21 +-- gstreamer/src/subclass/buffer_pool.rs | 20 +-- gstreamer/src/subclass/child_proxy.rs | 27 +-- gstreamer/src/subclass/clock.rs | 14 +- gstreamer/src/subclass/device.rs | 4 +- gstreamer/src/subclass/device_provider.rs | 6 +- gstreamer/src/subclass/element.rs | 50 ++---- gstreamer/src/subclass/pad.rs | 4 +- gstreamer/src/subclass/task_pool.rs | 2 +- gstreamer/src/subclass/tracer.rs | 4 +- gstreamer/src/subclass/uri_handler.rs | 12 +- 52 files changed, 403 insertions(+), 918 deletions(-) diff --git a/examples/src/bin/cairo_compositor.rs b/examples/src/bin/cairo_compositor.rs index 309b00732..3ba9b6a1b 100644 --- a/examples/src/bin/cairo_compositor.rs +++ b/examples/src/bin/cairo_compositor.rs @@ -164,14 +164,14 @@ mod cairo_compositor { name: Option<&str>, caps: Option<&gst::Caps>, ) -> Option { - let element = self.instance(); + let element = self.obj(); let pad = self.parent_request_new_pad(templ, name, caps)?; element.child_added(&pad, &pad.name()); Some(pad) } fn release_pad(&self, pad: &gst::Pad) { - let element = self.instance(); + let element = self.obj(); element.child_removed(pad, &pad.name()); self.parent_release_pad(pad); } @@ -239,7 +239,7 @@ mod cairo_compositor { token: &gst_video::subclass::AggregateFramesToken, outbuf: &mut gst::BufferRef, ) -> Result { - let element = self.instance(); + let element = self.obj(); let pads = element.sink_pads(); // Map the output frame writable. @@ -306,12 +306,12 @@ mod cairo_compositor { // This allows accessing the pads and their properties from e.g. gst-launch. impl ChildProxyImpl for CairoCompositor { fn children_count(&self) -> u32 { - let object = self.instance(); + let object = self.obj(); object.num_pads() as u32 } fn child_by_name(&self, name: &str) -> Option { - let object = self.instance(); + let object = self.obj(); object .pads() .into_iter() @@ -320,7 +320,7 @@ mod cairo_compositor { } fn child_by_index(&self, index: u32) -> Option { - let object = self.instance(); + let object = self.obj(); object .pads() .into_iter() diff --git a/examples/src/bin/glfilter.rs b/examples/src/bin/glfilter.rs index ed237ec5b..404b51856 100644 --- a/examples/src/bin/glfilter.rs +++ b/examples/src/bin/glfilter.rs @@ -124,7 +124,7 @@ mod mirror { } impl GLBaseFilterImpl for GLMirrorFilter { fn gl_start(&self) -> Result<(), gst::LoggableError> { - let filter = self.instance(); + let filter = self.obj(); // Create a shader when GL is started, knowing that the OpenGL context is // available. @@ -141,7 +141,7 @@ mod mirror { input: &gst_gl::GLMemory, output: &gst_gl::GLMemory, ) -> Result<(), gst::LoggableError> { - let filter = self.instance(); + let filter = self.obj(); let shader = self.shader.lock().unwrap(); // Use the underlying filter implementation to transform the input texture into diff --git a/examples/src/bin/rtsp-server-subclass.rs b/examples/src/bin/rtsp-server-subclass.rs index b88be20b0..f484c586e 100644 --- a/examples/src/bin/rtsp-server-subclass.rs +++ b/examples/src/bin/rtsp-server-subclass.rs @@ -108,7 +108,7 @@ mod media_factory { fn constructed(&self) { self.parent_constructed(); - let factory = self.instance(); + let factory = self.obj(); // All media created by this factory are our custom media type. This would // not require a media factory subclass and can also be called on the normal // RTSPMediaFactory. @@ -239,7 +239,7 @@ mod server { // Implementation of gst_rtsp_server::RTSPServer virtual methods impl RTSPServerImpl for Server { fn create_client(&self) -> Option { - let server = self.instance(); + let server = self.obj(); let client = super::client::Client::default(); // Duplicated from the default implementation @@ -300,7 +300,7 @@ mod client { // Implementation of gst_rtsp_server::RTSPClient virtual methods impl RTSPClientImpl for Client { fn closed(&self) { - let client = self.instance(); + let client = self.obj(); self.parent_closed(); println!("Client {:?} closed", client); } diff --git a/gstreamer-audio/src/subclass/audio_aggregator.rs b/gstreamer-audio/src/subclass/audio_aggregator.rs index 0b300bafa..892d0f10f 100644 --- a/gstreamer-audio/src/subclass/audio_aggregator.rs +++ b/gstreamer-audio/src/subclass/audio_aggregator.rs @@ -54,7 +54,7 @@ impl AudioAggregatorImplExt for T { .expect("Missing parent function `create_output_buffer`"); from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -80,7 +80,7 @@ impl AudioAggregatorImplExt for T { .expect("Missing parent function `aggregate_one_buffer`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-audio/src/subclass/audio_aggregator_pad.rs b/gstreamer-audio/src/subclass/audio_aggregator_pad.rs index 2c8809b68..421552515 100644 --- a/gstreamer-audio/src/subclass/audio_aggregator_pad.rs +++ b/gstreamer-audio/src/subclass/audio_aggregator_pad.rs @@ -44,7 +44,7 @@ impl AudioAggregatorPadImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioAggregatorPadClass; if let Some(f) = (*parent_class).update_conversion_info { f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0); @@ -65,7 +65,7 @@ impl AudioAggregatorPadImplExt for T { .convert_buffer .expect("Missing parent function `convert_buffer`"); from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index 6fcc166bf..672a9250e 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -144,7 +144,7 @@ impl AudioDecoderImplExt for T { .open .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -169,7 +169,7 @@ impl AudioDecoderImplExt for T { .close .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -194,7 +194,7 @@ impl AudioDecoderImplExt for T { .start .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -219,7 +219,7 @@ impl AudioDecoderImplExt for T { .stop .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -245,7 +245,7 @@ impl AudioDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -269,7 +269,7 @@ impl AudioDecoderImplExt for T { let mut offset = mem::MaybeUninit::uninit(); let mut len = mem::MaybeUninit::uninit(); gst::FlowSuccess::try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -300,7 +300,7 @@ impl AudioDecoderImplExt for T { .handle_frame .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -320,7 +320,7 @@ impl AudioDecoderImplExt for T { if let Some(f) = (*parent_class).pre_push { let mut buffer = buffer.into_glib_ptr(); gst::FlowSuccess::try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -341,7 +341,7 @@ impl AudioDecoderImplExt for T { .flush .map(|f| { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -361,7 +361,7 @@ impl AudioDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0), @@ -381,7 +381,7 @@ impl AudioDecoderImplExt for T { .getcaps .map(|f| { from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -389,7 +389,7 @@ impl AudioDecoderImplExt for T { )) }) .unwrap_or_else(|| { - self.instance() + self.obj() .unsafe_cast_ref::() .proxy_getcaps(None, filter) }) @@ -404,7 +404,7 @@ impl AudioDecoderImplExt for T { .sink_event .expect("Missing parent function `sink_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -421,7 +421,7 @@ impl AudioDecoderImplExt for T { .sink_query .expect("Missing parent function `sink_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -438,7 +438,7 @@ impl AudioDecoderImplExt for T { .src_event .expect("Missing parent function `src_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -455,7 +455,7 @@ impl AudioDecoderImplExt for T { .src_query .expect("Missing parent function `src_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -476,7 +476,7 @@ impl AudioDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -502,7 +502,7 @@ impl AudioDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index cce52af1e..1660a64ff 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -138,7 +138,7 @@ impl AudioEncoderImplExt for T { .open .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -163,7 +163,7 @@ impl AudioEncoderImplExt for T { .close .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -188,7 +188,7 @@ impl AudioEncoderImplExt for T { .start .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -213,7 +213,7 @@ impl AudioEncoderImplExt for T { .stop .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -239,7 +239,7 @@ impl AudioEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -264,7 +264,7 @@ impl AudioEncoderImplExt for T { .handle_frame .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -284,7 +284,7 @@ impl AudioEncoderImplExt for T { if let Some(f) = (*parent_class).pre_push { let mut buffer = buffer.into_glib_ptr(); gst::FlowSuccess::try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -305,7 +305,7 @@ impl AudioEncoderImplExt for T { .flush .map(|f| { f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0) @@ -323,7 +323,7 @@ impl AudioEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0), @@ -343,7 +343,7 @@ impl AudioEncoderImplExt for T { .getcaps .map(|f| { from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -351,7 +351,7 @@ impl AudioEncoderImplExt for T { )) }) .unwrap_or_else(|| { - self.instance() + self.obj() .unsafe_cast_ref::() .proxy_getcaps(None, filter) }) @@ -366,7 +366,7 @@ impl AudioEncoderImplExt for T { .sink_event .expect("Missing parent function `sink_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -383,7 +383,7 @@ impl AudioEncoderImplExt for T { .sink_query .expect("Missing parent function `sink_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -400,7 +400,7 @@ impl AudioEncoderImplExt for T { .src_event .expect("Missing parent function `src_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -417,7 +417,7 @@ impl AudioEncoderImplExt for T { .src_query .expect("Missing parent function `src_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -438,7 +438,7 @@ impl AudioEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -464,7 +464,7 @@ impl AudioEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-audio/src/subclass/audio_sink.rs b/gstreamer-audio/src/subclass/audio_sink.rs index 3ccc50a6c..ea3334ac3 100644 --- a/gstreamer-audio/src/subclass/audio_sink.rs +++ b/gstreamer-audio/src/subclass/audio_sink.rs @@ -60,11 +60,7 @@ impl AudioSinkImplExt for T { Some(f) => f, }; gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Failed to close element using the parent function" ) @@ -79,11 +75,7 @@ impl AudioSinkImplExt for T { Some(f) => f, None => return 0, }; - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0) + f(self.obj().unsafe_cast_ref::().to_glib_none().0) } } @@ -96,11 +88,7 @@ impl AudioSinkImplExt for T { None => return Ok(()), }; gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Failed to open element using the parent function" ) @@ -117,10 +105,7 @@ impl AudioSinkImplExt for T { }; gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, &mut spec.0 ), gst::CAT_RUST, @@ -143,11 +128,7 @@ impl AudioSinkImplExt for T { } }; gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Failed to unprepare element using the parent function" ) @@ -164,10 +145,7 @@ impl AudioSinkImplExt for T { }; let buffer_ptr = buffer.as_ptr() as *const _ as *mut _; let ret = f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer_ptr, buffer.len() as u32, ); @@ -187,11 +165,7 @@ impl AudioSinkImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSinkClass; if let Some(f) = (*parent_class).reset { - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0) + f(self.obj().unsafe_cast_ref::().to_glib_none().0) } } } diff --git a/gstreamer-audio/src/subclass/audio_src.rs b/gstreamer-audio/src/subclass/audio_src.rs index c654559ec..06058ad78 100644 --- a/gstreamer-audio/src/subclass/audio_src.rs +++ b/gstreamer-audio/src/subclass/audio_src.rs @@ -65,11 +65,7 @@ impl AudioSrcImplExt for T { Some(f) => f, }; gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Failed to close element using the parent function" ) @@ -84,11 +80,7 @@ impl AudioSrcImplExt for T { Some(f) => f, None => return 0, }; - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0) + f(self.obj().unsafe_cast_ref::().to_glib_none().0) } } @@ -101,11 +93,7 @@ impl AudioSrcImplExt for T { None => return Ok(()), }; gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Failed to open element using the parent function" ) @@ -122,10 +110,7 @@ impl AudioSrcImplExt for T { }; gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, &mut spec.0 ), gst::CAT_RUST, @@ -148,11 +133,7 @@ impl AudioSrcImplExt for T { } }; gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Failed to unprepare element using the parent function" ) @@ -173,10 +154,7 @@ impl AudioSrcImplExt for T { let buffer_ptr = buffer.as_mut_ptr() as *mut _; let mut timestamp = mem::MaybeUninit::uninit(); let ret = f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer_ptr, buffer.len() as u32, timestamp.as_mut_ptr(), @@ -197,11 +175,7 @@ impl AudioSrcImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstAudioSrcClass; if let Some(f) = (*parent_class).reset { - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0) + f(self.obj().unsafe_cast_ref::().to_glib_none().0) } } } diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index 24e36ac8a..2490dd05a 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -238,7 +238,7 @@ impl AggregatorImplExt for T { .flush .map(|f| { try_from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -258,10 +258,7 @@ impl AggregatorImplExt for T { match (*parent_class).clip { None => Some(buffer), Some(ref func) => from_glib_full(func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, aggregator_pad.to_glib_none().0, buffer.into_glib_ptr(), )), @@ -280,10 +277,7 @@ impl AggregatorImplExt for T { .finish_buffer .expect("Missing parent function `finish_buffer`"); try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer.into_glib_ptr(), )) } @@ -302,10 +296,7 @@ impl AggregatorImplExt for T { .finish_buffer_list .expect("Missing parent function `finish_buffer_list`"); try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer_list.into_glib_ptr(), )) } @@ -319,10 +310,7 @@ impl AggregatorImplExt for T { .sink_event .expect("Missing parent function `sink_event`"); from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, aggregator_pad.to_glib_none().0, event.into_glib_ptr(), )) @@ -343,10 +331,7 @@ impl AggregatorImplExt for T { .sink_event_pre_queue .expect("Missing parent function `sink_event_pre_queue`"); try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, aggregator_pad.to_glib_none().0, event.into_glib_ptr(), )) @@ -361,10 +346,7 @@ impl AggregatorImplExt for T { .sink_query .expect("Missing parent function `sink_query`"); from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, aggregator_pad.to_glib_none().0, query.as_mut_ptr(), )) @@ -385,10 +367,7 @@ impl AggregatorImplExt for T { .sink_query_pre_queue .expect("Missing parent function `sink_query`"); from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, aggregator_pad.to_glib_none().0, query.as_mut_ptr(), )) @@ -403,10 +382,7 @@ impl AggregatorImplExt for T { .src_event .expect("Missing parent function `src_event`"); from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, event.into_glib_ptr(), )) } @@ -420,10 +396,7 @@ impl AggregatorImplExt for T { .src_query .expect("Missing parent function `src_query`"); from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, query.as_mut_ptr(), )) } @@ -441,10 +414,7 @@ impl AggregatorImplExt for T { None => Ok(()), Some(f) => gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, mode.into_glib(), active.into_glib() ), @@ -463,10 +433,7 @@ impl AggregatorImplExt for T { .aggregate .expect("Missing parent function `aggregate`"); try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, timeout.into_glib(), )) } @@ -480,7 +447,7 @@ impl AggregatorImplExt for T { .start .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -505,7 +472,7 @@ impl AggregatorImplExt for T { .stop .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -530,7 +497,7 @@ impl AggregatorImplExt for T { .get_next_time .map(|f| { from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -552,10 +519,7 @@ impl AggregatorImplExt for T { .create_new_pad .expect("Missing parent function `create_new_pad`"); from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, templ.to_glib_none().0, req_name.to_glib_none().0, caps.to_glib_none().0, @@ -573,10 +537,7 @@ impl AggregatorImplExt for T { let mut out_caps = ptr::null_mut(); gst::FlowSuccess::try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.as_mut_ptr(), &mut out_caps, )) @@ -593,10 +554,7 @@ impl AggregatorImplExt for T { .fixate_src_caps .expect("Missing parent function `fixate_src_caps`"); from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.into_glib_ptr(), )) } @@ -611,10 +569,7 @@ impl AggregatorImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.to_glib_none().0 ), gst::CAT_RUST, @@ -639,10 +594,7 @@ impl AggregatorImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, pad.to_glib_none().0, decide_query .as_ref() @@ -670,10 +622,7 @@ impl AggregatorImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, query.as_mut_ptr(), ), gst::CAT_RUST, @@ -694,7 +643,7 @@ impl AggregatorImplExt for T { .negotiate .map(|f| { from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -713,10 +662,7 @@ impl AggregatorImplExt for T { .peek_next_sample .map(|f| { from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, pad.to_glib_none().0, )) }) diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index d9de1ec6f..22796f538 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -33,7 +33,7 @@ impl AggregatorPadImplExt for T { .flush .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -52,7 +52,7 @@ impl AggregatorPadImplExt for T { .skip_buffer .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index 4bc37a5bc..a7bbe2aed 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -67,7 +67,7 @@ impl BaseParseImplExt for T { .start .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -92,7 +92,7 @@ impl BaseParseImplExt for T { .stop .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -118,10 +118,7 @@ impl BaseParseImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.to_glib_none().0, ), gst::CAT_RUST, @@ -144,10 +141,7 @@ impl BaseParseImplExt for T { .handle_frame .map(|f| { let res = try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, frame.to_glib_none().0, &mut skipsize, )); @@ -169,10 +163,7 @@ impl BaseParseImplExt for T { let mut dest_val = mem::MaybeUninit::uninit(); let res = from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, src_val.format().into_glib(), src_val.into_raw_value(), dest_format.into_glib(), @@ -267,7 +258,7 @@ unsafe extern "C" fn base_parse_handle_frame( ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); - let instance = imp.instance(); + let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); let wrap_frame = BaseParseFrame::new(frame, instance); diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index cbdcc6e13..c607d7e5b 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -117,12 +117,7 @@ impl BaseSinkImplExt for T { (*parent_class) .start .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -142,12 +137,7 @@ impl BaseSinkImplExt for T { (*parent_class) .stop .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -168,10 +158,7 @@ impl BaseSinkImplExt for T { .render .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer.to_glib_none().0, )) }) @@ -187,10 +174,7 @@ impl BaseSinkImplExt for T { .prepare .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer.to_glib_none().0, )) }) @@ -209,10 +193,7 @@ impl BaseSinkImplExt for T { .render_list .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, list.to_glib_none().0, )) }) @@ -236,10 +217,7 @@ impl BaseSinkImplExt for T { .prepare_list .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, list.to_glib_none().0, )) }) @@ -260,10 +238,7 @@ impl BaseSinkImplExt for T { .query .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, query.as_mut_ptr(), )) }) @@ -279,10 +254,7 @@ impl BaseSinkImplExt for T { .event .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, event.into_glib_ptr(), )) }) @@ -299,10 +271,7 @@ impl BaseSinkImplExt for T { .get_caps .map(|f| { from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, filter.to_glib_none().0, )) }) @@ -319,10 +288,7 @@ impl BaseSinkImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.to_glib_none().0 ), gst::CAT_RUST, @@ -340,10 +306,7 @@ impl BaseSinkImplExt for T { match (*parent_class).fixate { Some(fixate) => from_glib_full(fixate( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.into_glib_ptr(), )), None => caps, @@ -358,12 +321,7 @@ impl BaseSinkImplExt for T { (*parent_class) .unlock .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -383,12 +341,7 @@ impl BaseSinkImplExt for T { (*parent_class) .unlock_stop .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -413,10 +366,7 @@ impl BaseSinkImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, query.as_mut_ptr(), ), gst::CAT_RUST, diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index aeb18677b..322c084e9 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -176,12 +176,7 @@ impl BaseSrcImplExt for T { (*parent_class) .start .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -201,12 +196,7 @@ impl BaseSrcImplExt for T { (*parent_class) .stop .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -225,13 +215,7 @@ impl BaseSrcImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseSrcClass; (*parent_class) .is_seekable - .map(|f| { - from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - }) + .map(|f| from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0))) .unwrap_or(false) } } @@ -245,10 +229,7 @@ impl BaseSrcImplExt for T { .map(|f| { let mut size = mem::MaybeUninit::uninit(); if from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, size.as_mut_ptr(), )) { Some(size.assume_init()) @@ -273,10 +254,7 @@ impl BaseSrcImplExt for T { let mut start = mem::MaybeUninit::uninit(); let mut stop = mem::MaybeUninit::uninit(); f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer.as_mut_ptr(), start.as_mut_ptr(), stop.as_mut_ptr(), @@ -303,10 +281,7 @@ impl BaseSrcImplExt for T { .fill .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, offset, length, buffer.as_mut_ptr(), @@ -330,10 +305,7 @@ impl BaseSrcImplExt for T { let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer; gst::FlowSuccess::try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, offset, length, buffer_ref, @@ -356,7 +328,7 @@ impl BaseSrcImplExt for T { (*parent_class) .create .map(|f| { - let instance = self.instance(); + let instance = self.obj(); let instance = instance.unsafe_cast_ref::(); let orig_buffer_ptr = buffer .as_mut() @@ -468,10 +440,7 @@ impl BaseSrcImplExt for T { .do_seek .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, segment.to_glib_none_mut().0, )) }) @@ -487,10 +456,7 @@ impl BaseSrcImplExt for T { .query .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, query.as_mut_ptr(), )) }) @@ -506,10 +472,7 @@ impl BaseSrcImplExt for T { .event .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, event.to_glib_none().0, )) }) @@ -526,10 +489,7 @@ impl BaseSrcImplExt for T { .get_caps .map(|f| { from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, filter.to_glib_none().0, )) }) @@ -545,11 +505,7 @@ impl BaseSrcImplExt for T { .negotiate .map(|f| { gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Parent function `negotiate` failed" ) @@ -567,10 +523,7 @@ impl BaseSrcImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.to_glib_none().0 ), gst::CAT_RUST, @@ -588,10 +541,7 @@ impl BaseSrcImplExt for T { match (*parent_class).fixate { Some(fixate) => from_glib_full(fixate( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, caps.into_glib_ptr(), )), None => caps, @@ -606,12 +556,7 @@ impl BaseSrcImplExt for T { (*parent_class) .unlock .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -631,12 +576,7 @@ impl BaseSrcImplExt for T { (*parent_class) .unlock_stop .map(|f| { - if from_glib(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) - { + if from_glib(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) { Ok(()) } else { Err(gst::error_msg!( @@ -661,10 +601,7 @@ impl BaseSrcImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, query.as_mut_ptr(), ), gst::CAT_RUST, @@ -840,7 +777,7 @@ unsafe extern "C" fn base_src_create( ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); - let instance = imp.instance(); + let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); // FIXME: Wrong signature in -sys bindings // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 6090f105a..cfe13f9bd 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -277,7 +277,7 @@ impl BaseTransformImplExt for T { .start .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -302,7 +302,7 @@ impl BaseTransformImplExt for T { .stop .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -332,7 +332,7 @@ impl BaseTransformImplExt for T { .transform_caps .map(|f| { from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -356,7 +356,7 @@ impl BaseTransformImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; match (*parent_class).fixate_caps { Some(f) => from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -382,7 +382,7 @@ impl BaseTransformImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -405,7 +405,7 @@ impl BaseTransformImplExt for T { .accept_caps .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -425,7 +425,7 @@ impl BaseTransformImplExt for T { .query .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -452,7 +452,7 @@ impl BaseTransformImplExt for T { .map(|f| { let mut othersize = mem::MaybeUninit::uninit(); let res: bool = from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -477,11 +477,7 @@ impl BaseTransformImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class).get_unit_size.unwrap_or_else(|| { - if !self - .instance() - .unsafe_cast_ref::() - .is_in_place() - { + if !self.obj().unsafe_cast_ref::().is_in_place() { unimplemented!(concat!( "Missing parent function `get_unit_size`. Required because ", "transform doesn't operate in-place" @@ -495,7 +491,7 @@ impl BaseTransformImplExt for T { let mut size = mem::MaybeUninit::uninit(); if from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -517,7 +513,7 @@ impl BaseTransformImplExt for T { .sink_event .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -536,7 +532,7 @@ impl BaseTransformImplExt for T { .src_event .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -564,7 +560,7 @@ impl BaseTransformImplExt for T { let mut outbuf: *mut gst::ffi::GstBuffer = ptr::null_mut(); // FIXME: Wrong signature in FFI gst::FlowSuccess::try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -595,7 +591,7 @@ impl BaseTransformImplExt for T { .transform .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -604,11 +600,7 @@ impl BaseTransformImplExt for T { )) }) .unwrap_or_else(|| { - if !self - .instance() - .unsafe_cast_ref::() - .is_in_place() - { + if !self.obj().unsafe_cast_ref::().is_in_place() { Err(gst::FlowError::NotSupported) } else { unreachable!(concat!( @@ -627,11 +619,7 @@ impl BaseTransformImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { - if self - .instance() - .unsafe_cast_ref::() - .is_in_place() - { + if self.obj().unsafe_cast_ref::().is_in_place() { panic!(concat!( "Missing parent function `transform_ip`. Required because ", "transform operates in-place" @@ -644,7 +632,7 @@ impl BaseTransformImplExt for T { }); try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -661,11 +649,7 @@ impl BaseTransformImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; let f = (*parent_class).transform_ip.unwrap_or_else(|| { - if self - .instance() - .unsafe_cast_ref::() - .is_in_place() - { + if self.obj().unsafe_cast_ref::().is_in_place() { panic!(concat!( "Missing parent function `transform_ip`. Required because ", "transform operates in-place (passthrough mode)" @@ -681,7 +665,7 @@ impl BaseTransformImplExt for T { // FIXME: Wrong signature in FFI let buf: *mut gst::ffi::GstBuffer = buf.to_glib_none().0; try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -703,7 +687,7 @@ impl BaseTransformImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -733,7 +717,7 @@ impl BaseTransformImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -758,7 +742,7 @@ impl BaseTransformImplExt for T { if let Some(ref f) = (*parent_class).copy_metadata { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -787,7 +771,7 @@ impl BaseTransformImplExt for T { .transform_meta .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -806,7 +790,7 @@ impl BaseTransformImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBaseTransformClass; if let Some(ref f) = (*parent_class).before_transform { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -829,7 +813,7 @@ impl BaseTransformImplExt for T { .expect("Missing parent function `submit_input_buffer`"); try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -849,7 +833,7 @@ impl BaseTransformImplExt for T { let mut outbuf = ptr::null_mut(); gst::FlowSuccess::try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -873,7 +857,7 @@ impl BaseTransformImplExt for T { ::ParentType: IsA, { unsafe { - let instance = self.instance(); + let instance = self.obj(); let ptr: *mut ffi::GstBaseTransform = instance.unsafe_cast_ref::().to_glib_none().0; let sinkpad: Borrowed = from_glib_borrow((*ptr).sinkpad); @@ -890,7 +874,7 @@ impl BaseTransformImplExt for T { ::ParentType: IsA, { unsafe { - let instance = self.instance(); + let instance = self.obj(); let ptr: *mut ffi::GstBaseTransform = instance.unsafe_cast_ref::().to_glib_none().0; let sinkpad: Borrowed = from_glib_borrow((*ptr).sinkpad); @@ -1328,7 +1312,7 @@ unsafe extern "C" fn base_transform_copy_metadata( let imp = instance.imp(); if gst::ffi::gst_mini_object_is_writable(outbuf as *mut _) == glib::ffi::GFALSE { - let instance = imp.instance(); + let instance = imp.obj(); let obj = instance.unsafe_cast_ref::(); gst::warning!(gst::CAT_RUST, obj: obj, "buffer {:?} not writable", outbuf); return glib::ffi::GFALSE; diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index 96a721f83..45a6eb515 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -45,10 +45,7 @@ impl PushSrcImplExt for T { .fill .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer.as_mut_ptr(), )) }) @@ -70,10 +67,7 @@ impl PushSrcImplExt for T { let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer; gst::FlowSuccess::try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer_ref, )) .map(|_| from_glib_full(buffer_ref)) @@ -92,7 +86,7 @@ impl PushSrcImplExt for T { (*parent_class) .create .map(|f| { - let instance = self.instance(); + let instance = self.obj(); let instance = instance.unsafe_cast_ref::(); let orig_buffer_ptr = buffer .as_mut() @@ -322,8 +316,7 @@ unsafe extern "C" fn push_src_create( } Ok(CreateSuccess::NewBufferList(new_buffer_list)) => { if buffer.is_some() - || imp.instance().unsafe_cast_ref::().src_pad().mode() - == gst::PadMode::Pull + || imp.obj().unsafe_cast_ref::().src_pad().mode() == gst::PadMode::Pull { panic!("Buffer lists can only be returned in push mode"); } diff --git a/gstreamer-gl/src/subclass/gl_base_filter.rs b/gstreamer-gl/src/subclass/gl_base_filter.rs index 73c2a4c23..a5ea3f832 100644 --- a/gstreamer-gl/src/subclass/gl_base_filter.rs +++ b/gstreamer-gl/src/subclass/gl_base_filter.rs @@ -43,7 +43,7 @@ impl GLBaseFilterImplExt for T { .map(|f| { result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -68,7 +68,7 @@ impl GLBaseFilterImplExt for T { .map(|f| { result_from_gboolean!( f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0), @@ -87,7 +87,7 @@ impl GLBaseFilterImplExt for T { if let Some(f) = (*parent_class).gl_stop { f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0) diff --git a/gstreamer-gl/src/subclass/gl_base_src.rs b/gstreamer-gl/src/subclass/gl_base_src.rs index 3db370649..f84e4937c 100644 --- a/gstreamer-gl/src/subclass/gl_base_src.rs +++ b/gstreamer-gl/src/subclass/gl_base_src.rs @@ -43,11 +43,7 @@ impl GLBaseSrcImplExt for T { .gl_start .map(|f| { result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), CAT_RUST, "Parent function `gl_start` failed", ) @@ -62,11 +58,7 @@ impl GLBaseSrcImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstGLBaseSrcClass; if let Some(f) = (*parent_class).gl_stop { - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0) + f(self.obj().unsafe_cast_ref::().to_glib_none().0) } } } @@ -81,10 +73,7 @@ impl GLBaseSrcImplExt for T { .map(|f| { result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, mut_override(memory.to_glib_none().0), ), CAT_RUST, diff --git a/gstreamer-gl/src/subclass/gl_filter.rs b/gstreamer-gl/src/subclass/gl_filter.rs index f76c4a226..11b225bee 100644 --- a/gstreamer-gl/src/subclass/gl_filter.rs +++ b/gstreamer-gl/src/subclass/gl_filter.rs @@ -82,10 +82,7 @@ impl GLFilterImplExt for T { .map(|f| { result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, incaps.to_glib_none().0, outcaps.to_glib_none().0, ), @@ -107,10 +104,7 @@ impl GLFilterImplExt for T { .map(|f| { result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, input.to_glib_none().0, output.to_glib_none().0, ), @@ -136,10 +130,7 @@ impl GLFilterImplExt for T { .map(|f| { result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, input.to_glib_none().0, output.to_glib_none().0, ), @@ -160,11 +151,7 @@ impl GLFilterImplExt for T { .init_fbo .map(|f| { result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), CAT_RUST, "Parent function `init_fbo` failed" ) @@ -187,10 +174,7 @@ impl GLFilterImplExt for T { .expect("Missing parent function `transform_internal_caps`"); from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, direction.into_glib(), caps.to_glib_none().0, filter_caps.to_glib_none().0, diff --git a/gstreamer-pbutils/src/subclass/audio_visualizer.rs b/gstreamer-pbutils/src/subclass/audio_visualizer.rs index 5dbd112ef..a0f601c03 100644 --- a/gstreamer-pbutils/src/subclass/audio_visualizer.rs +++ b/gstreamer-pbutils/src/subclass/audio_visualizer.rs @@ -48,7 +48,7 @@ pub trait AudioVisualizerImplExt: ObjectSubclass { impl AudioVisualizerImplExt for T { fn parent_setup(&self, token: &AudioVisualizerSetupToken) -> Result<(), LoggableError> { assert_eq!( - self.instance().as_ptr() as *mut ffi::GstAudioVisualizer, + self.obj().as_ptr() as *mut ffi::GstAudioVisualizer, token.0.as_ptr() as *mut ffi::GstAudioVisualizer ); @@ -60,7 +60,7 @@ impl AudioVisualizerImplExt for T { .map(|f| { result_from_gboolean!( f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0,), @@ -85,7 +85,7 @@ impl AudioVisualizerImplExt for T { .map(|f| { result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -112,7 +112,7 @@ impl AudioVisualizerImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -144,7 +144,7 @@ unsafe extern "C" fn audio_visualizer_setup( let imp = instance.imp(); gst::panic_to_error!(imp, false, { - let instance = imp.instance(); + let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); let token = AudioVisualizerSetupToken(instance); diff --git a/gstreamer-play/src/subclass/play_video_renderer.rs b/gstreamer-play/src/subclass/play_video_renderer.rs index aa72d7c68..b44cfb0d1 100644 --- a/gstreamer-play/src/subclass/play_video_renderer.rs +++ b/gstreamer-play/src/subclass/play_video_renderer.rs @@ -33,7 +33,7 @@ impl PlayVideoRendererImplExt for T { .create_video_sink .expect("no parent \"create_video_sink\" implementation"); let ret = func( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-player/src/subclass/player_video_renderer.rs b/gstreamer-player/src/subclass/player_video_renderer.rs index aedb32337..89a8f3495 100644 --- a/gstreamer-player/src/subclass/player_video_renderer.rs +++ b/gstreamer-player/src/subclass/player_video_renderer.rs @@ -33,7 +33,7 @@ impl PlayerVideoRendererImplExt for T { .create_video_sink .expect("no parent \"create_video_sink\" implementation"); let ret = func( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-rtp/src/subclass/rtp_base_depayload.rs b/gstreamer-rtp/src/subclass/rtp_base_depayload.rs index dd07ac247..4a286f2eb 100644 --- a/gstreamer-rtp/src/subclass/rtp_base_depayload.rs +++ b/gstreamer-rtp/src/subclass/rtp_base_depayload.rs @@ -52,7 +52,7 @@ impl RTPBaseDepayloadImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -74,7 +74,7 @@ impl RTPBaseDepayloadImplExt for T { .handle_event .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -93,7 +93,7 @@ impl RTPBaseDepayloadImplExt for T { .packet_lost .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -117,7 +117,7 @@ impl RTPBaseDepayloadImplExt for T { .expect("no parent \"process\" implementation"); from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-rtp/src/subclass/rtp_base_payload.rs b/gstreamer-rtp/src/subclass/rtp_base_payload.rs index 50ffd1906..56d49bccd 100644 --- a/gstreamer-rtp/src/subclass/rtp_base_payload.rs +++ b/gstreamer-rtp/src/subclass/rtp_base_payload.rs @@ -57,7 +57,7 @@ impl RTPBasePayloadImplExt for T { .get_caps .expect("Missing parent function `get_caps`"); from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -76,7 +76,7 @@ impl RTPBasePayloadImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -88,7 +88,7 @@ impl RTPBasePayloadImplExt for T { }) .unwrap_or_else(|| { // Trigger negotiation as the base class does - self.instance() + self.obj() .unsafe_cast_ref::() .set_outcaps(None) .map_err(|_| gst::loggable_error!(gst::CAT_RUST, "Failed to negotiate")) @@ -107,7 +107,7 @@ impl RTPBasePayloadImplExt for T { .handle_buffer .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -126,7 +126,7 @@ impl RTPBasePayloadImplExt for T { .query .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -146,7 +146,7 @@ impl RTPBasePayloadImplExt for T { .sink_event .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -165,7 +165,7 @@ impl RTPBasePayloadImplExt for T { .src_event .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-rtp/src/subclass/rtp_header_extension.rs b/gstreamer-rtp/src/subclass/rtp_header_extension.rs index c7a6b0d52..8367d0538 100644 --- a/gstreamer-rtp/src/subclass/rtp_header_extension.rs +++ b/gstreamer-rtp/src/subclass/rtp_header_extension.rs @@ -97,7 +97,7 @@ impl RTPHeaderExtensionImplExt for T { .get_supported_flags .expect("no parent \"get_supported_flags\" implementation"); from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -112,7 +112,7 @@ impl RTPHeaderExtensionImplExt for T { .get_max_size .expect("no parent \"get_max_size\" implementation"); f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -136,7 +136,7 @@ impl RTPHeaderExtensionImplExt for T { .expect("no parent \"write\" implementation"); let res = f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -173,7 +173,7 @@ impl RTPHeaderExtensionImplExt for T { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -195,7 +195,7 @@ impl RTPHeaderExtensionImplExt for T { if let Some(f) = (*parent_class).set_non_rtp_sink_caps { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -220,7 +220,7 @@ impl RTPHeaderExtensionImplExt for T { if let Some(f) = (*parent_class).update_non_rtp_src_caps { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -246,7 +246,7 @@ impl RTPHeaderExtensionImplExt for T { if let Some(f) = (*parent_class).set_attributes { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -275,7 +275,7 @@ impl RTPHeaderExtensionImplExt for T { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs index 8f66dfa0e..4b2043eea 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_client.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_client.rs @@ -264,10 +264,7 @@ impl RTSPClientImplExt for T { .expect("No `create_rtpbin` virtual method implementation in parent class"); from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, media.to_glib_none().0, )) } @@ -288,10 +285,7 @@ impl RTSPClientImplExt for T { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, media.to_glib_none().0, stream.to_glib_none().0, ctx.to_glib_none().0 @@ -313,10 +307,7 @@ impl RTSPClientImplExt for T { .expect("No `params_set` virtual method implementation in parent class"); from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } @@ -331,10 +322,7 @@ impl RTSPClientImplExt for T { .expect("No `params_get` virtual method implementation in parent class"); from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } @@ -349,10 +337,7 @@ impl RTSPClientImplExt for T { .expect("No `make_path_from_uri` virtual method implementation in parent class"); from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, url.to_glib_none().0, )) } @@ -363,11 +348,7 @@ impl RTSPClientImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).closed { - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0); + f(self.obj().unsafe_cast_ref::().to_glib_none().0); } } } @@ -378,10 +359,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).new_session { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, session.to_glib_none().0, ); } @@ -394,10 +372,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).options_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -410,10 +385,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).describe_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -426,10 +398,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).setup_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -442,10 +411,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).play_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -458,10 +424,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pause_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -474,10 +437,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).teardown_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -490,10 +450,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).set_parameter_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -506,10 +463,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).get_parameter_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -522,10 +476,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).announce_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -538,10 +489,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).record_request { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -554,10 +502,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).handle_response { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, ); } @@ -582,10 +527,7 @@ impl RTSPClientImplExt for T { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, media.to_glib_none().0, sdp as *const _ as *mut _ @@ -606,10 +548,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).check_requirements { from_glib_full(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, arr.to_glib_none().0, )) @@ -625,10 +564,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_options_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -643,10 +579,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_describe_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -661,10 +594,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_setup_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -679,10 +609,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_play_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -697,10 +624,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_pause_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -715,10 +639,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_teardown_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -736,10 +657,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_set_parameter_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -757,10 +675,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_get_parameter_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -775,10 +690,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_announce_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -793,10 +705,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).pre_record_request { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, )) } else { @@ -817,10 +726,7 @@ impl RTSPClientImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPClientClass; if let Some(f) = (*parent_class).adjust_error_code { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ctx.to_glib_none().0, status_code.into_glib(), )) diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs index d733b2ffe..3f997f8e9 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media.rs @@ -134,10 +134,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).handle_message { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, message.as_ptr() as *mut _, )) } else { @@ -153,10 +150,7 @@ impl RTSPMediaImplExt for T { if let Some(f) = (*parent_class).prepare { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, thread.to_glib_none().0 ), gst::CAT_RUST, @@ -174,11 +168,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepare { gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Parent function `unprepare` failed" ) @@ -194,11 +184,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).suspend { gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Parent function `suspend` failed" ) @@ -214,11 +200,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unsuspend { gst::result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0), + f(self.obj().unsafe_cast_ref::().to_glib_none().0), gst::CAT_RUST, "Parent function `unsuspend` failed" ) @@ -239,10 +221,7 @@ impl RTSPMediaImplExt for T { if let Some(f) = (*parent_class).query_position { let mut position = mem::MaybeUninit::uninit(); if f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, position.as_mut_ptr(), ) == glib::ffi::GFALSE { @@ -265,10 +244,7 @@ impl RTSPMediaImplExt for T { if let Some(f) = (*parent_class).query_stop { let mut stop = mem::MaybeUninit::uninit(); if f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, stop.as_mut_ptr(), ) == glib::ffi::GFALSE { @@ -291,7 +267,7 @@ impl RTSPMediaImplExt for T { .expect("No `create_rtpbin` virtual method implementation in parent class"); from_glib_none(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -310,10 +286,7 @@ impl RTSPMediaImplExt for T { let res = gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, ptr ), gst::CAT_RUST, @@ -348,10 +321,7 @@ impl RTSPMediaImplExt for T { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, sdp as *mut _ as *mut gst_sdp::ffi::GstSDPMessage, info.0.as_ptr() ), @@ -367,10 +337,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_stream { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, stream.to_glib_none().0, ); } @@ -383,10 +350,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).removed_stream { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, stream.to_glib_none().0, ); } @@ -398,11 +362,7 @@ impl RTSPMediaImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).prepared { - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0); + f(self.obj().unsafe_cast_ref::().to_glib_none().0); } } } @@ -412,11 +372,7 @@ impl RTSPMediaImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).unprepared { - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0); + f(self.obj().unsafe_cast_ref::().to_glib_none().0); } } } @@ -427,10 +383,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).target_state { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, state.into_glib(), ); } @@ -443,10 +396,7 @@ impl RTSPMediaImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaClass; if let Some(f) = (*parent_class).new_state { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, state.into_glib(), ); } @@ -463,10 +413,7 @@ impl RTSPMediaImplExt for T { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, sdp as *const _ as *mut gst_sdp::ffi::GstSDPMessage ), gst::CAT_RUST, diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index 50c0c19b4..e6dea271f 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -62,7 +62,7 @@ impl RTSPMediaFactoryImplExt for T { .gen_key .map(|f| { from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -81,7 +81,7 @@ impl RTSPMediaFactoryImplExt for T { .create_element .map(|f| { from_glib_none(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -100,7 +100,7 @@ impl RTSPMediaFactoryImplExt for T { .construct .map(|f| { from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -119,7 +119,7 @@ impl RTSPMediaFactoryImplExt for T { .create_pipeline .map(|f| { let ptr = f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -142,7 +142,7 @@ impl RTSPMediaFactoryImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).configure { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -158,7 +158,7 @@ impl RTSPMediaFactoryImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_constructed { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -174,7 +174,7 @@ impl RTSPMediaFactoryImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPMediaFactoryClass; if let Some(f) = (*parent_class).media_configure { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs b/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs index f81f96f76..9fb3ce767 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_mount_points.rs @@ -26,7 +26,7 @@ impl RTSPMountPointsImplExt for T { .make_path .expect("No `make_path` virtual method implementation in parent class"); from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs index be8e08e5f..69ccefcd9 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_onvif_media_factory.rs @@ -29,7 +29,7 @@ impl RTSPOnvifMediaFactoryImplExt for T { .has_backchannel_support .map(|f| { from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs index 06edd45b4..43965aa19 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_server.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_server.rs @@ -31,7 +31,7 @@ impl RTSPServerImplExt for T { .create_client .expect("No `create_client` virtual method implementation in parent class"); from_glib_full(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -44,10 +44,7 @@ impl RTSPServerImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstRTSPServerClass; if let Some(f) = (*parent_class).client_connected { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, client.to_glib_none().0, ) } diff --git a/gstreamer-video/src/subclass/navigation.rs b/gstreamer-video/src/subclass/navigation.rs index 73b117d76..04441f6e6 100644 --- a/gstreamer-video/src/subclass/navigation.rs +++ b/gstreamer-video/src/subclass/navigation.rs @@ -44,10 +44,7 @@ impl NavigationImplExt for T { }; func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, structure.into_glib_ptr(), ); } @@ -67,10 +64,7 @@ impl NavigationImplExt for T { }; func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, event.into_glib_ptr(), ); } diff --git a/gstreamer-video/src/subclass/video_aggregator.rs b/gstreamer-video/src/subclass/video_aggregator.rs index 65b7f6122..bec769914 100644 --- a/gstreamer-video/src/subclass/video_aggregator.rs +++ b/gstreamer-video/src/subclass/video_aggregator.rs @@ -61,7 +61,7 @@ impl VideoAggregatorImplExt for T { .expect("Missing parent function `update_caps`"); Option::<_>::from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -79,7 +79,7 @@ impl VideoAggregatorImplExt for T { outbuf: &mut gst::BufferRef, ) -> Result { assert_eq!( - self.instance().as_ptr() as *mut ffi::GstVideoAggregator, + self.obj().as_ptr() as *mut ffi::GstVideoAggregator, token.0.as_ptr() as *mut ffi::GstVideoAggregator ); @@ -91,7 +91,7 @@ impl VideoAggregatorImplExt for T { .expect("Missing parent function `aggregate_frames`"); try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -111,7 +111,7 @@ impl VideoAggregatorImplExt for T { let mut buffer = ptr::null_mut(); try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -136,7 +136,7 @@ impl VideoAggregatorImplExt for T { let mut at_least_one_alpha = glib::ffi::GFALSE; f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -196,7 +196,7 @@ unsafe extern "C" fn video_aggregator_aggregate_frames( let imp = instance.imp(); gst::panic_to_error!(imp, gst::FlowReturn::Error, { - let instance = imp.instance(); + let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); let token = AggregateFramesToken(instance); diff --git a/gstreamer-video/src/subclass/video_aggregator_pad.rs b/gstreamer-video/src/subclass/video_aggregator_pad.rs index 187f55ad9..a00069058 100644 --- a/gstreamer-video/src/subclass/video_aggregator_pad.rs +++ b/gstreamer-video/src/subclass/video_aggregator_pad.rs @@ -61,7 +61,7 @@ impl VideoAggregatorPadImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoAggregatorPadClass; if let Some(f) = (*parent_class).update_conversion_info { f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0); @@ -87,7 +87,7 @@ impl VideoAggregatorPadImplExt for T { let mut prepared_frame = mem::MaybeUninit::zeroed(); f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -130,7 +130,7 @@ impl VideoAggregatorPadImplExt for T { }; f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index 0bd15a688..75a63c280 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -179,7 +179,7 @@ impl VideoDecoderImplExt for T { .open .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -204,7 +204,7 @@ impl VideoDecoderImplExt for T { .close .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -229,7 +229,7 @@ impl VideoDecoderImplExt for T { .start .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -254,7 +254,7 @@ impl VideoDecoderImplExt for T { .stop .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -279,7 +279,7 @@ impl VideoDecoderImplExt for T { .finish .map(|f| { try_from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -296,7 +296,7 @@ impl VideoDecoderImplExt for T { .drain .map(|f| { try_from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -317,7 +317,7 @@ impl VideoDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -344,7 +344,7 @@ impl VideoDecoderImplExt for T { .parse .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -368,7 +368,7 @@ impl VideoDecoderImplExt for T { .handle_frame .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -387,7 +387,7 @@ impl VideoDecoderImplExt for T { .flush .map(|f| { from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -405,7 +405,7 @@ impl VideoDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0), @@ -425,7 +425,7 @@ impl VideoDecoderImplExt for T { .getcaps .map(|f| { from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -433,7 +433,7 @@ impl VideoDecoderImplExt for T { )) }) .unwrap_or_else(|| { - self.instance() + self.obj() .unsafe_cast_ref::() .proxy_getcaps(None, filter) }) @@ -448,7 +448,7 @@ impl VideoDecoderImplExt for T { .sink_event .expect("Missing parent function `sink_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -465,7 +465,7 @@ impl VideoDecoderImplExt for T { .sink_query .expect("Missing parent function `sink_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -482,7 +482,7 @@ impl VideoDecoderImplExt for T { .src_event .expect("Missing parent function `src_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -499,7 +499,7 @@ impl VideoDecoderImplExt for T { .src_query .expect("Missing parent function `src_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -520,7 +520,7 @@ impl VideoDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -546,7 +546,7 @@ impl VideoDecoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -574,7 +574,7 @@ impl VideoDecoderImplExt for T { .handle_missing_data .map(|f| { from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -736,7 +736,7 @@ unsafe extern "C" fn video_decoder_parse( let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); ffi::gst_video_codec_frame_ref(frame); - let instance = imp.instance(); + let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); let wrap_frame = VideoCodecFrame::new(frame, instance); let wrap_adapter: Borrowed = from_glib_borrow(adapter); @@ -754,7 +754,7 @@ unsafe extern "C" fn video_decoder_handle_frame( ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); - let instance = imp.instance(); + let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); let wrap_frame = VideoCodecFrame::new(frame, instance); diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index 76349fd33..1b084e0d4 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -139,7 +139,7 @@ impl VideoEncoderImplExt for T { .open .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -164,7 +164,7 @@ impl VideoEncoderImplExt for T { .close .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -189,7 +189,7 @@ impl VideoEncoderImplExt for T { .start .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -214,7 +214,7 @@ impl VideoEncoderImplExt for T { .stop .map(|f| { if from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -239,7 +239,7 @@ impl VideoEncoderImplExt for T { .finish .map(|f| { try_from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -260,7 +260,7 @@ impl VideoEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -285,7 +285,7 @@ impl VideoEncoderImplExt for T { .handle_frame .map(|f| { try_from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -304,7 +304,7 @@ impl VideoEncoderImplExt for T { .flush .map(|f| { from_glib(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -322,7 +322,7 @@ impl VideoEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0), @@ -342,7 +342,7 @@ impl VideoEncoderImplExt for T { .getcaps .map(|f| { from_glib_full(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -350,7 +350,7 @@ impl VideoEncoderImplExt for T { )) }) .unwrap_or_else(|| { - self.instance() + self.obj() .unsafe_cast_ref::() .proxy_getcaps(None, filter) }) @@ -365,7 +365,7 @@ impl VideoEncoderImplExt for T { .sink_event .expect("Missing parent function `sink_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -382,7 +382,7 @@ impl VideoEncoderImplExt for T { .sink_query .expect("Missing parent function `sink_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -399,7 +399,7 @@ impl VideoEncoderImplExt for T { .src_event .expect("Missing parent function `src_event`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -416,7 +416,7 @@ impl VideoEncoderImplExt for T { .src_query .expect("Missing parent function `src_query`"); from_glib(f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -437,7 +437,7 @@ impl VideoEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -463,7 +463,7 @@ impl VideoEncoderImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -609,7 +609,7 @@ unsafe extern "C" fn video_encoder_handle_frame( ) -> gst::ffi::GstFlowReturn { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); - let instance = imp.instance(); + let instance = imp.obj(); let instance = instance.unsafe_cast_ref::(); let wrap_frame = VideoCodecFrame::new(frame, instance); diff --git a/gstreamer-video/src/subclass/video_filter.rs b/gstreamer-video/src/subclass/video_filter.rs index 8ca414459..a23731831 100644 --- a/gstreamer-video/src/subclass/video_filter.rs +++ b/gstreamer-video/src/subclass/video_filter.rs @@ -85,10 +85,7 @@ impl VideoFilterImplExt for T { .map(|f| { gst::result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, incaps.to_glib_none().0, mut_override(in_info.to_glib_none().0), outcaps.to_glib_none().0, @@ -114,17 +111,14 @@ impl VideoFilterImplExt for T { .transform_frame .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, mut_override(inframe.as_ptr()), outframe.as_mut_ptr(), )) }) .unwrap_or_else(|| { if !self - .instance() + .obj() .unsafe_cast_ref::() .is_in_place() { @@ -147,7 +141,7 @@ impl VideoFilterImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoFilterClass; let f = (*parent_class).transform_frame_ip.unwrap_or_else(|| { if self - .instance() + .obj() .unsafe_cast_ref::() .is_in_place() { @@ -163,10 +157,7 @@ impl VideoFilterImplExt for T { }); try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, frame.as_mut_ptr(), )) } @@ -181,7 +172,7 @@ impl VideoFilterImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoFilterClass; let f = (*parent_class).transform_frame_ip.unwrap_or_else(|| { if self - .instance() + .obj() .unsafe_cast_ref::() .is_in_place() { @@ -198,10 +189,7 @@ impl VideoFilterImplExt for T { }); try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, mut_override(frame.as_ptr()), )) } diff --git a/gstreamer-video/src/subclass/video_sink.rs b/gstreamer-video/src/subclass/video_sink.rs index 2c63612e6..76e672a09 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -26,10 +26,7 @@ impl VideoSinkImplExt for T { .show_frame .map(|f| { try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, buffer.to_glib_none().0, )) }) diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 62a8a5a7f..f5e625d60 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -1519,74 +1519,74 @@ macro_rules! element_info( macro_rules! element_imp_error( ($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($msg), [$debug]); }}; ($imp:expr, $err:expr, ($msg:expr)) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($msg)); }}; ($imp:expr, $err:expr, [$debug:expr]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, [$debug]); }}; ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($($msg)*), [$($debug)*]); }}; ($imp:expr, $err:expr, ($($msg:tt)*)) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($($msg)*)); }}; ($imp:expr, $err:expr, [$($debug:tt)*]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, [$($debug)*]); }}; ($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($msg), [$debug], details: $details); }}; ($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($msg), details: $details); }}; ($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, [$debug], details: $details); }}; ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($($msg)*), [$($debug)*], details: $details); }}; ($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, ($($msg)*), details: $details); }}; ($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_error!(obj, $err, [$($debug)*], details: $details); }}; @@ -1598,74 +1598,74 @@ macro_rules! element_imp_error( macro_rules! element_imp_warning( ($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($msg), [$debug]); }}; ($imp:expr, $err:expr, ($msg:expr)) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($msg)); }}; ($imp:expr, $err:expr, [$debug:expr]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, [$debug]); }}; ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($($msg)*), [$($debug)*]); }}; ($imp:expr, $err:expr, ($($msg:tt)*)) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($($msg)*)); }}; ($imp:expr, $err:expr, [$($debug:tt)*]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, [$($debug)*]); }}; ($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($msg), [$debug], details: $details); }}; ($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($msg), details: $details); }}; ($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, [$debug], details: $details); }}; ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($($msg)*), [$($debug)*], details: $details); }}; ($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, ($($msg)*), details: $details); }}; ($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_warning!(obj, $err, [$($debug)*], details: $details); }}; @@ -1677,74 +1677,74 @@ macro_rules! element_imp_warning( macro_rules! element_imp_info( ($imp:expr, $err:expr, ($msg:expr), [$debug:expr]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($msg), [$debug]); }}; ($imp:expr, $err:expr, ($msg:expr)) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($msg)); }}; ($imp:expr, $err:expr, [$debug:expr]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, [$debug]); }}; ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($($msg)*), [$($debug)*]); }}; ($imp:expr, $err:expr, ($($msg:tt)*)) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($($msg)*)); }}; ($imp:expr, $err:expr, [$($debug:tt)*]) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, [$($debug)*]); }}; ($imp:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($msg), [$debug], details: $details); }}; ($imp:expr, $err:expr, ($msg:expr), details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($msg), details: $details); }}; ($imp:expr, $err:expr, [$debug:expr], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, [$debug], details: $details); }}; ($imp:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($($msg)*), [$($debug)*], details: $details); }}; ($imp:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, ($($msg)*), details: $details); }}; ($imp:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); let obj = obj.dynamic_cast_ref::<$crate::Element>().unwrap(); $crate::element_info!(obj, $err, [$($debug)*], details: $details); }}; diff --git a/gstreamer/src/error.rs b/gstreamer/src/error.rs index 9201b5033..863ff8df9 100644 --- a/gstreamer/src/error.rs +++ b/gstreamer/src/error.rs @@ -149,7 +149,7 @@ impl LoggableError { use glib::subclass::prelude::*; self.category.log( - Some(unsafe { imp.instance().unsafe_cast_ref::() }), + Some(unsafe { imp.obj().unsafe_cast_ref::() }), crate::DebugLevel::Error, self.bool_error.filename, self.bool_error.function, diff --git a/gstreamer/src/log.rs b/gstreamer/src/log.rs index 4d1c78eb1..3e10bbed9 100644 --- a/gstreamer/src/log.rs +++ b/gstreamer/src/log.rs @@ -505,7 +505,7 @@ macro_rules! log_with_level( if $level <= $cat.threshold() { use $crate::glib::Cast; - let obj = $imp.instance(); + let obj = $imp.obj(); #[allow(unused_unsafe)] let obj = unsafe { obj.unsafe_cast_ref::<$crate::glib::Object>() }; $crate::DebugCategory::log_unfiltered($cat.clone(), Some(obj), diff --git a/gstreamer/src/subclass/bin.rs b/gstreamer/src/subclass/bin.rs index 0a615d6ca..3e312bb93 100644 --- a/gstreamer/src/subclass/bin.rs +++ b/gstreamer/src/subclass/bin.rs @@ -52,10 +52,7 @@ impl BinImplExt for T { })?; result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, element.to_glib_none().0 ), crate::CAT_RUST, @@ -76,10 +73,7 @@ impl BinImplExt for T { })?; result_from_gboolean!( f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, element.to_glib_none().0 ), crate::CAT_RUST, @@ -99,11 +93,7 @@ impl BinImplExt for T { ) })?; result_from_gboolean!( - f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0,), + f(self.obj().unsafe_cast_ref::().to_glib_none().0,), crate::CAT_RUST, "Failed to update latency using the parent function" ) @@ -116,10 +106,7 @@ impl BinImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBinClass; if let Some(ref f) = (*parent_class).handle_message { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, message.into_glib_ptr(), ); } diff --git a/gstreamer/src/subclass/buffer_pool.rs b/gstreamer/src/subclass/buffer_pool.rs index 12d55fe61..9fbd34933 100644 --- a/gstreamer/src/subclass/buffer_pool.rs +++ b/gstreamer/src/subclass/buffer_pool.rs @@ -103,7 +103,7 @@ impl BufferPoolImplExt for T { let mut buffer = std::ptr::null_mut(); let result = f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -130,7 +130,7 @@ impl BufferPoolImplExt for T { let mut buffer = std::ptr::null_mut(); let result = f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -151,7 +151,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).free_buffer { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -167,7 +167,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).release_buffer { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -183,7 +183,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).reset_buffer { f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -199,7 +199,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).start { let result = f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0); @@ -217,7 +217,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).stop { let result = f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0); @@ -235,7 +235,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).set_config { let result = f( - self.instance() + self.obj() .unsafe_cast_ref::() .to_glib_none() .0, @@ -255,7 +255,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).flush_start { f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0) @@ -269,7 +269,7 @@ impl BufferPoolImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstBufferPoolClass; if let Some(f) = (*parent_class).flush_stop { f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0) diff --git a/gstreamer/src/subclass/child_proxy.rs b/gstreamer/src/subclass/child_proxy.rs index e33ac335a..94a5eb6e2 100644 --- a/gstreamer/src/subclass/child_proxy.rs +++ b/gstreamer/src/subclass/child_proxy.rs @@ -44,10 +44,7 @@ impl ChildProxyImplExt for T { .get_child_by_name .expect("no parent \"child_by_name\" implementation"); let ret = func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, name.to_glib_none().0, ); from_glib_full(ret) @@ -64,10 +61,7 @@ impl ChildProxyImplExt for T { .get_child_by_index .expect("no parent \"child_by_index\" implementation"); let ret = func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, index, ); from_glib_full(ret) @@ -83,12 +77,7 @@ impl ChildProxyImplExt for T { let func = (*parent_iface) .get_children_count .expect("no parent \"children_count\" implementation"); - func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, - ) + func(self.obj().unsafe_cast_ref::().to_glib_none().0) } } @@ -100,10 +89,7 @@ impl ChildProxyImplExt for T { if let Some(func) = (*parent_iface).child_added { func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, child.to_glib_none().0, name.to_glib_none().0, ); @@ -119,10 +105,7 @@ impl ChildProxyImplExt for T { if let Some(func) = (*parent_iface).child_removed { func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, child.to_glib_none().0, name.to_glib_none().0, ); diff --git a/gstreamer/src/subclass/clock.rs b/gstreamer/src/subclass/clock.rs index eca5d4ac3..1c1d6d405 100644 --- a/gstreamer/src/subclass/clock.rs +++ b/gstreamer/src/subclass/clock.rs @@ -71,7 +71,7 @@ impl ClockImplExt for T { if let Some(func) = (*parent_class).change_resolution { try_from_glib(func( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, old_resolution.into_glib(), new_resolution.into_glib(), )) @@ -90,7 +90,7 @@ impl ClockImplExt for T { try_from_glib( (*parent_class) .get_resolution - .map(|f| f(self.instance().unsafe_cast_ref::().to_glib_none().0)) + .map(|f| f(self.obj().unsafe_cast_ref::().to_glib_none().0)) .unwrap_or(1), ) .expect("undefined resolution") @@ -105,7 +105,7 @@ impl ClockImplExt for T { try_from_glib( (*parent_class) .get_internal_time - .map(|f| f(self.instance().unsafe_cast_ref::().to_glib_none().0)) + .map(|f| f(self.obj().unsafe_cast_ref::().to_glib_none().0)) .unwrap_or(0), ) .expect("undefined internal_time") @@ -124,7 +124,7 @@ impl ClockImplExt for T { .wait .map(|f| { f( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, id.as_ptr() as *mut ffi::GstClockEntry, &mut jitter, ) @@ -145,7 +145,7 @@ impl ClockImplExt for T { .wait_async .map(|f| { f( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, id.as_ptr() as *mut ffi::GstClockEntry, ) }) @@ -160,7 +160,7 @@ impl ClockImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass; if let Some(func) = (*parent_class).unschedule { func( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, id.as_ptr() as *mut ffi::GstClockEntry, ); } @@ -168,7 +168,7 @@ impl ClockImplExt for T { } fn wake_id(&self, id: &ClockId) { - let clock = self.instance(); + let clock = self.obj(); let clock = unsafe { clock.unsafe_cast_ref::() }; cfg_if::cfg_if! { diff --git a/gstreamer/src/subclass/device.rs b/gstreamer/src/subclass/device.rs index 762954ea0..c808dcaad 100644 --- a/gstreamer/src/subclass/device.rs +++ b/gstreamer/src/subclass/device.rs @@ -34,7 +34,7 @@ impl DeviceImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstDeviceClass; if let Some(f) = (*parent_class).create_element { let ptr = f( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, name.to_glib_none().0, ); @@ -66,7 +66,7 @@ impl DeviceImplExt for T { })?; result_from_gboolean!( f( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, element.to_glib_none().0 ), crate::CAT_RUST, diff --git a/gstreamer/src/subclass/device_provider.rs b/gstreamer/src/subclass/device_provider.rs index 5fcac80ee..9a1d31a23 100644 --- a/gstreamer/src/subclass/device_provider.rs +++ b/gstreamer/src/subclass/device_provider.rs @@ -101,7 +101,7 @@ impl DeviceProviderImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstDeviceProviderClass; if let Some(f) = (*parent_class).probe { FromGlibPtrContainer::from_glib_full(f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0)) @@ -120,7 +120,7 @@ impl DeviceProviderImplExt for T { })?; result_from_gboolean!( f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0), @@ -136,7 +136,7 @@ impl DeviceProviderImplExt for T { let parent_class = data.as_ref().parent_class() as *mut ffi::GstDeviceProviderClass; if let Some(f) = (*parent_class).stop { f(self - .instance() + .obj() .unsafe_cast_ref::() .to_glib_none() .0); diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index d69a18a23..0394eff29 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -186,10 +186,7 @@ impl ElementImplExt for T { .change_state .expect("Missing parent function `change_state`"); try_from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, transition.into_glib(), )) } @@ -209,10 +206,7 @@ impl ElementImplExt for T { .request_new_pad .map(|f| { from_glib_none(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, templ.to_glib_none().0, name.to_glib_full(), caps.to_glib_none().0, @@ -231,10 +225,7 @@ impl ElementImplExt for T { .release_pad .map(|f| { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, pad.to_glib_none().0, ) }) @@ -251,10 +242,7 @@ impl ElementImplExt for T { .send_event .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, event.into_glib_ptr(), )) }) @@ -271,10 +259,7 @@ impl ElementImplExt for T { .query .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, query.as_mut_ptr(), )) }) @@ -291,10 +276,7 @@ impl ElementImplExt for T { .set_context .map(|f| { f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, context.to_glib_none().0, ) }) @@ -311,10 +293,7 @@ impl ElementImplExt for T { .set_clock .map(|f| { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, clock.to_glib_none().0, )) }) @@ -330,11 +309,7 @@ impl ElementImplExt for T { (*parent_class) .provide_clock .map(|f| { - from_glib_none(f(self - .instance() - .unsafe_cast_ref::() - .to_glib_none() - .0)) + from_glib_none(f(self.obj().unsafe_cast_ref::().to_glib_none().0)) }) .unwrap_or(None) } @@ -347,10 +322,7 @@ impl ElementImplExt for T { if let Some(f) = (*parent_class).post_message { from_glib(f( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, msg.into_glib_ptr(), )) } else { @@ -398,7 +370,7 @@ impl ElementImplExt for T { fn post_error_message(&self, msg: crate::ErrorMessage) { unsafe { - self.instance() + self.obj() .unsafe_cast_ref::() .post_error_message(msg) } @@ -695,7 +667,7 @@ mod tests { fn constructed(&self) { self.parent_constructed(); - let element = self.instance(); + let element = self.obj(); element.add_pad(&self.sinkpad).unwrap(); element.add_pad(&self.srcpad).unwrap(); } diff --git a/gstreamer/src/subclass/pad.rs b/gstreamer/src/subclass/pad.rs index 823bc6d9b..0972a13c1 100644 --- a/gstreamer/src/subclass/pad.rs +++ b/gstreamer/src/subclass/pad.rs @@ -33,7 +33,7 @@ impl PadImplExt for T { .linked .map(|f| { f( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, peer.to_glib_none().0, ) }) @@ -50,7 +50,7 @@ impl PadImplExt for T { .unlinked .map(|f| { f( - self.instance().unsafe_cast_ref::().to_glib_none().0, + self.obj().unsafe_cast_ref::().to_glib_none().0, peer.to_glib_none().0, ) }) diff --git a/gstreamer/src/subclass/task_pool.rs b/gstreamer/src/subclass/task_pool.rs index c4e0d48f5..9192e658e 100644 --- a/gstreamer/src/subclass/task_pool.rs +++ b/gstreamer/src/subclass/task_pool.rs @@ -326,7 +326,7 @@ mod tests { pool.cleanup(); - let imp = imp::TestPool::from_instance(&pool); + let imp = pool.imp(); assert!(imp.prepared.load(atomic::Ordering::SeqCst)); assert!(imp.cleaned_up.load(atomic::Ordering::SeqCst)); } diff --git a/gstreamer/src/subclass/tracer.rs b/gstreamer/src/subclass/tracer.rs index 15ae6d7cf..f38f3bbc2 100644 --- a/gstreamer/src/subclass/tracer.rs +++ b/gstreamer/src/subclass/tracer.rs @@ -109,7 +109,7 @@ macro_rules! define_tracer_hooks { $($cb_arg: $cb_arg_ty),* ) { let $this = Tracer::from_glib_borrow($this); - let $this = T::from_instance($this.unsafe_cast_ref()); + let $this = T::from_obj($this.unsafe_cast_ref()); $impl } ( @@ -119,7 +119,7 @@ macro_rules! define_tracer_hooks { },)* }; unsafe { - let instance = self.instance(); + let instance = self.obj(); ffi::gst_tracing_register_hook( instance.to_glib_none().0 as *mut ffi::GstTracer, hook_type.as_ptr() as *const _, diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index f9ac05a72..eaef267cd 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -47,12 +47,7 @@ impl URIHandlerImplExt for T { let func = (*parent_iface) .get_uri .expect("no parent \"uri\" implementation"); - let ret = func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, - ); + let ret = func(self.obj().unsafe_cast_ref::().to_glib_none().0); from_glib_full(ret) } } @@ -69,10 +64,7 @@ impl URIHandlerImplExt for T { let mut err = ptr::null_mut(); func( - self.instance() - .unsafe_cast_ref::() - .to_glib_none() - .0, + self.obj().unsafe_cast_ref::().to_glib_none().0, uri.to_glib_none().0, &mut err, );