From 8dda8def6e7ebd282718f04c0758e02715a70a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Thu, 13 May 2021 14:54:41 +0200 Subject: [PATCH] Manual try_from_glib shortcuts + unsafe --- gstreamer-app/src/app_src.rs | 4 ++-- gstreamer-audio/src/audio_decoder.rs | 6 +++--- gstreamer-audio/src/audio_encoder.rs | 2 +- gstreamer-audio/src/subclass/audio_decoder.rs | 2 +- gstreamer-audio/src/subclass/audio_encoder.rs | 2 +- gstreamer-base/src/aggregator.rs | 4 ++-- gstreamer-base/src/base_parse.rs | 2 +- gstreamer-base/src/flow_combiner.rs | 4 ++-- gstreamer-base/src/subclass/aggregator.rs | 10 +++++----- gstreamer-base/src/subclass/aggregator_pad.rs | 2 +- gstreamer-base/src/subclass/base_parse.rs | 2 +- gstreamer-base/src/subclass/base_sink.rs | 8 ++++---- gstreamer-base/src/subclass/base_src.rs | 2 +- gstreamer-base/src/subclass/base_transform.rs | 8 ++++---- gstreamer-base/src/subclass/push_src.rs | 2 +- gstreamer-check/src/harness.rs | 15 +++++---------- gstreamer-video/src/subclass/video_decoder.rs | 8 ++++---- gstreamer-video/src/subclass/video_encoder.rs | 4 ++-- gstreamer-video/src/subclass/video_filter.rs | 6 +++--- gstreamer-video/src/subclass/video_sink.rs | 2 +- gstreamer-video/src/video_decoder.rs | 18 ++++++++---------- gstreamer-video/src/video_encoder.rs | 6 +++--- gstreamer/src/clock.rs | 9 +++------ gstreamer/src/pad.rs | 10 +++++----- gstreamer/src/proxy_pad.rs | 4 ++-- gstreamer/src/subclass/clock.rs | 4 ++-- gstreamer/src/subclass/element.rs | 2 +- 27 files changed, 69 insertions(+), 79 deletions(-) diff --git a/gstreamer-app/src/app_src.rs b/gstreamer-app/src/app_src.rs index 7cd2304a4..ddc755e30 100644 --- a/gstreamer-app/src/app_src.rs +++ b/gstreamer-app/src/app_src.rs @@ -210,7 +210,7 @@ impl AppSrc { #[doc(alias = "gst_app_src_push_buffer")] pub fn push_buffer(&self, buffer: gst::Buffer) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_app_src_push_buffer( + try_from_glib(ffi::gst_app_src_push_buffer( self.to_glib_none().0, buffer.into_ptr(), )) @@ -225,7 +225,7 @@ impl AppSrc { list: gst::BufferList, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_app_src_push_buffer_list( + try_from_glib(ffi::gst_app_src_push_buffer_list( self.to_glib_none().0, list.into_ptr(), )) diff --git a/gstreamer-audio/src/audio_decoder.rs b/gstreamer-audio/src/audio_decoder.rs index 091ded81f..2a22db7a1 100644 --- a/gstreamer-audio/src/audio_decoder.rs +++ b/gstreamer-audio/src/audio_decoder.rs @@ -66,7 +66,7 @@ impl> AudioDecoderExtManual for O { frames: i32, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_audio_decoder_finish_frame( + try_from_glib(ffi::gst_audio_decoder_finish_frame( self.as_ref().to_glib_none().0, buffer.map(|b| b.into_ptr()).unwrap_or(ptr::null_mut()), frames, @@ -82,7 +82,7 @@ impl> AudioDecoderExtManual for O { buffer: Option, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_audio_decoder_finish_subframe( + try_from_glib(ffi::gst_audio_decoder_finish_subframe( self.as_ref().to_glib_none().0, buffer.map(|b| b.into_ptr()).unwrap_or(ptr::null_mut()), )) @@ -160,7 +160,7 @@ impl> AudioDecoderExtManual for O { line: u32, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(_gst_audio_decoder_error( + try_from_glib(_gst_audio_decoder_error( self.as_ref().to_glib_none().0, weight, T::domain().into_glib(), diff --git a/gstreamer-audio/src/audio_encoder.rs b/gstreamer-audio/src/audio_encoder.rs index 5a1762bee..01a991c7b 100644 --- a/gstreamer-audio/src/audio_encoder.rs +++ b/gstreamer-audio/src/audio_encoder.rs @@ -36,7 +36,7 @@ impl> AudioEncoderExtManual for O { frames: i32, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_audio_encoder_finish_frame( + try_from_glib(ffi::gst_audio_encoder_finish_frame( self.as_ref().to_glib_none().0, buffer.map(|b| b.into_ptr()).unwrap_or(ptr::null_mut()), frames, diff --git a/gstreamer-audio/src/subclass/audio_decoder.rs b/gstreamer-audio/src/subclass/audio_decoder.rs index 7c3f4035d..5ff79b351 100644 --- a/gstreamer-audio/src/subclass/audio_decoder.rs +++ b/gstreamer-audio/src/subclass/audio_decoder.rs @@ -324,7 +324,7 @@ impl AudioDecoderImplExt for T { (*parent_class) .handle_frame .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buffer .map(|buffer| buffer.as_mut_ptr() as *mut *mut gst::ffi::GstBuffer) diff --git a/gstreamer-audio/src/subclass/audio_encoder.rs b/gstreamer-audio/src/subclass/audio_encoder.rs index b05e8ce71..3c94590de 100644 --- a/gstreamer-audio/src/subclass/audio_encoder.rs +++ b/gstreamer-audio/src/subclass/audio_encoder.rs @@ -279,7 +279,7 @@ impl AudioEncoderImplExt for T { (*parent_class) .handle_frame .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buffer .map(|buffer| buffer.as_mut_ptr() as *mut *mut gst::ffi::GstBuffer) diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index f7dddd4c8..23aebfb1c 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -105,7 +105,7 @@ impl> AggregatorExtManual for O { fn finish_buffer(&self, buffer: gst::Buffer) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_aggregator_finish_buffer( + try_from_glib(ffi::gst_aggregator_finish_buffer( self.as_ref().to_glib_none().0, buffer.into_ptr(), )) @@ -119,7 +119,7 @@ impl> AggregatorExtManual for O { bufferlist: gst::BufferList, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_aggregator_finish_buffer_list( + try_from_glib(ffi::gst_aggregator_finish_buffer_list( self.as_ref().to_glib_none().0, bufferlist.into_ptr(), )) diff --git a/gstreamer-base/src/base_parse.rs b/gstreamer-base/src/base_parse.rs index b5a9411fb..b1b9e9197 100644 --- a/gstreamer-base/src/base_parse.rs +++ b/gstreamer-base/src/base_parse.rs @@ -132,7 +132,7 @@ impl> BaseParseExtManual for O { size: u32, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_base_parse_finish_frame( + try_from_glib(ffi::gst_base_parse_finish_frame( self.as_ref().to_glib_none().0, frame.to_glib_none().0, i32::try_from(size).expect("size higher than i32::MAX"), diff --git a/gstreamer-base/src/flow_combiner.rs b/gstreamer-base/src/flow_combiner.rs index d686f473c..4c6bfe6ee 100644 --- a/gstreamer-base/src/flow_combiner.rs +++ b/gstreamer-base/src/flow_combiner.rs @@ -73,7 +73,7 @@ impl FlowCombiner { ) -> Result { let fret: gst::FlowReturn = fret.into(); unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_flow_combiner_update_flow( + try_from_glib(ffi::gst_flow_combiner_update_flow( self.to_glib_none().0, fret.into_glib(), )) @@ -88,7 +88,7 @@ impl FlowCombiner { ) -> Result { let fret: gst::FlowReturn = fret.into(); unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_flow_combiner_update_pad_flow( + try_from_glib(ffi::gst_flow_combiner_update_pad_flow( self.to_glib_none().0, pad.as_ref().to_glib_none().0, fret.into_glib(), diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index fd9fad008..b21d86384 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -288,7 +288,7 @@ impl AggregatorImplExt for T { (*parent_class) .flush .map(|f| { - gst::FlowSuccess::try_from_glib(f(aggregator + try_from_glib(f(aggregator .unsafe_cast_ref::() .to_glib_none() .0)) @@ -328,7 +328,7 @@ impl AggregatorImplExt for T { let f = (*parent_class) .finish_buffer .expect("Missing parent function `finish_buffer`"); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( aggregator.unsafe_cast_ref::().to_glib_none().0, buffer.into_ptr(), )) @@ -348,7 +348,7 @@ impl AggregatorImplExt for T { let f = (*parent_class) .finish_buffer_list .expect("Missing parent function `finish_buffer_list`"); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( aggregator.unsafe_cast_ref::().to_glib_none().0, buffer_list.into_ptr(), )) @@ -389,7 +389,7 @@ impl AggregatorImplExt for T { let f = (*parent_class) .sink_event_pre_queue .expect("Missing parent function `sink_event_pre_queue`"); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( aggregator.unsafe_cast_ref::().to_glib_none().0, aggregator_pad.to_glib_none().0, event.into_ptr(), @@ -502,7 +502,7 @@ impl AggregatorImplExt for T { let f = (*parent_class) .aggregate .expect("Missing parent function `aggregate`"); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( aggregator.unsafe_cast_ref::().to_glib_none().0, timeout.into_glib(), )) diff --git a/gstreamer-base/src/subclass/aggregator_pad.rs b/gstreamer-base/src/subclass/aggregator_pad.rs index bca29675b..aefe8c647 100644 --- a/gstreamer-base/src/subclass/aggregator_pad.rs +++ b/gstreamer-base/src/subclass/aggregator_pad.rs @@ -54,7 +54,7 @@ impl AggregatorPadImplExt for T { (*parent_class) .flush .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( aggregator_pad .unsafe_cast_ref::() .to_glib_none() diff --git a/gstreamer-base/src/subclass/base_parse.rs b/gstreamer-base/src/subclass/base_parse.rs index 4ceefa7eb..e66778f63 100644 --- a/gstreamer-base/src/subclass/base_parse.rs +++ b/gstreamer-base/src/subclass/base_parse.rs @@ -152,7 +152,7 @@ impl BaseParseImplExt for T { (*parent_class) .handle_frame .map(|f| { - let res = gst::FlowSuccess::try_from_glib(f( + let res = try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, frame.to_glib_none().0, &mut skipsize, diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index 540c5b8dc..f2fe76762 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -179,7 +179,7 @@ impl BaseSinkImplExt for T { (*parent_class) .render .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buffer.to_glib_none().0, )) @@ -199,7 +199,7 @@ impl BaseSinkImplExt for T { (*parent_class) .prepare .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buffer.to_glib_none().0, )) @@ -219,7 +219,7 @@ impl BaseSinkImplExt for T { (*parent_class) .render_list .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, list.to_glib_none().0, )) @@ -244,7 +244,7 @@ impl BaseSinkImplExt for T { (*parent_class) .prepare_list .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, list.to_glib_none().0, )) diff --git a/gstreamer-base/src/subclass/base_src.rs b/gstreamer-base/src/subclass/base_src.rs index 3a13a1640..cc04468c9 100644 --- a/gstreamer-base/src/subclass/base_src.rs +++ b/gstreamer-base/src/subclass/base_src.rs @@ -284,7 +284,7 @@ impl BaseSrcImplExt for T { (*parent_class) .fill .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, offset, length, diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index 8f89a7afc..554e579e9 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -601,7 +601,7 @@ impl BaseTransformImplExt for T { (*parent_class) .transform .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, inbuf.to_glib_none().0, outbuf.as_mut_ptr(), @@ -642,7 +642,7 @@ impl BaseTransformImplExt for T { } }); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buf.as_mut_ptr() as *mut _, )) @@ -673,7 +673,7 @@ impl BaseTransformImplExt for T { // FIXME: Wrong signature in FFI let buf: *mut gst::ffi::GstBuffer = buf.to_glib_none().0; - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buf as *mut _, )) @@ -755,7 +755,7 @@ impl BaseTransformImplExt for T { .submit_input_buffer .expect("Missing parent function `submit_input_buffer`"); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, is_discont.into_glib(), inbuf.into_ptr(), diff --git a/gstreamer-base/src/subclass/push_src.rs b/gstreamer-base/src/subclass/push_src.rs index b339ef487..adf75e343 100644 --- a/gstreamer-base/src/subclass/push_src.rs +++ b/gstreamer-base/src/subclass/push_src.rs @@ -51,7 +51,7 @@ impl PushSrcImplExt for T { (*parent_class) .fill .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buffer.as_mut_ptr(), )) diff --git a/gstreamer-check/src/harness.rs b/gstreamer-check/src/harness.rs index a596e80a9..ef8dd948a 100644 --- a/gstreamer-check/src/harness.rs +++ b/gstreamer-check/src/harness.rs @@ -301,12 +301,7 @@ impl Harness { #[doc(alias = "gst_harness_push")] pub fn push(&mut self, buffer: gst::Buffer) -> Result { - unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_harness_push( - self.0.as_ptr(), - buffer.into_ptr(), - )) - } + unsafe { try_from_glib(ffi::gst_harness_push(self.0.as_ptr(), buffer.into_ptr())) } } #[doc(alias = "gst_harness_push_and_pull")] @@ -332,12 +327,12 @@ impl Harness { #[doc(alias = "gst_harness_push_from_src")] pub fn push_from_src(&mut self) -> Result { - unsafe { gst::FlowSuccess::try_from_glib(ffi::gst_harness_push_from_src(self.0.as_ptr())) } + unsafe { try_from_glib(ffi::gst_harness_push_from_src(self.0.as_ptr())) } } #[doc(alias = "gst_harness_push_to_sink")] pub fn push_to_sink(&mut self) -> Result { - unsafe { gst::FlowSuccess::try_from_glib(ffi::gst_harness_push_to_sink(self.0.as_ptr())) } + unsafe { try_from_glib(ffi::gst_harness_push_to_sink(self.0.as_ptr())) } } #[doc(alias = "gst_harness_push_upstream_event")] @@ -457,7 +452,7 @@ impl Harness { #[doc(alias = "gst_harness_sink_push_many")] pub fn sink_push_many(&mut self, pushes: u32) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_harness_sink_push_many( + try_from_glib(ffi::gst_harness_sink_push_many( self.0.as_ptr(), pushes as i32, )) @@ -471,7 +466,7 @@ impl Harness { pushes: u32, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_harness_src_crank_and_push_many( + try_from_glib(ffi::gst_harness_src_crank_and_push_many( self.0.as_ptr(), cranks as i32, pushes as i32, diff --git a/gstreamer-video/src/subclass/video_decoder.rs b/gstreamer-video/src/subclass/video_decoder.rs index ef02a0074..3f0111ff3 100644 --- a/gstreamer-video/src/subclass/video_decoder.rs +++ b/gstreamer-video/src/subclass/video_decoder.rs @@ -269,7 +269,7 @@ impl VideoDecoderImplExt for T { (*parent_class) .finish .map(|f| { - gst::FlowSuccess::try_from_glib(f(element + try_from_glib(f(element .unsafe_cast_ref::() .to_glib_none() .0)) @@ -285,7 +285,7 @@ impl VideoDecoderImplExt for T { (*parent_class) .drain .map(|f| { - gst::FlowSuccess::try_from_glib(f(element + try_from_glib(f(element .unsafe_cast_ref::() .to_glib_none() .0)) @@ -331,7 +331,7 @@ impl VideoDecoderImplExt for T { (*parent_class) .parse .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, frame.to_glib_none().0, adapter.to_glib_none().0, @@ -353,7 +353,7 @@ impl VideoDecoderImplExt for T { (*parent_class) .handle_frame .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, frame.to_glib_none().0, )) diff --git a/gstreamer-video/src/subclass/video_encoder.rs b/gstreamer-video/src/subclass/video_encoder.rs index ff87d39b7..1a336113e 100644 --- a/gstreamer-video/src/subclass/video_encoder.rs +++ b/gstreamer-video/src/subclass/video_encoder.rs @@ -245,7 +245,7 @@ impl VideoEncoderImplExt for T { (*parent_class) .finish .map(|f| { - gst::FlowSuccess::try_from_glib(f(element + try_from_glib(f(element .unsafe_cast_ref::() .to_glib_none() .0)) @@ -289,7 +289,7 @@ impl VideoEncoderImplExt for T { (*parent_class) .handle_frame .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, frame.to_glib_none().0, )) diff --git a/gstreamer-video/src/subclass/video_filter.rs b/gstreamer-video/src/subclass/video_filter.rs index 90178b261..de73c4920 100644 --- a/gstreamer-video/src/subclass/video_filter.rs +++ b/gstreamer-video/src/subclass/video_filter.rs @@ -120,7 +120,7 @@ impl VideoFilterImplExt for T { (*parent_class) .transform_frame .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, mut_override(inframe.as_ptr()), outframe.as_mut_ptr(), @@ -167,7 +167,7 @@ impl VideoFilterImplExt for T { } }); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, frame.as_mut_ptr(), )) @@ -199,7 +199,7 @@ impl VideoFilterImplExt for T { } }); - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.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 21f1c8736..c7c19eec2 100644 --- a/gstreamer-video/src/subclass/video_sink.rs +++ b/gstreamer-video/src/subclass/video_sink.rs @@ -37,7 +37,7 @@ impl VideoSinkImplExt for T { (*parent_class) .show_frame .map(|f| { - gst::FlowSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, buffer.to_glib_none().0, )) diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index 7276ef2ef..1defc97c9 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -102,13 +102,11 @@ impl> VideoDecoderExtManual for O { ) -> Result { unsafe { let params_ptr = params.to_glib_none().0 as *mut _; - gst::FlowSuccess::try_from_glib( - ffi::gst_video_decoder_allocate_output_frame_with_params( - self.as_ref().to_glib_none().0, - frame.to_glib_none().0, - params_ptr, - ), - ) + try_from_glib(ffi::gst_video_decoder_allocate_output_frame_with_params( + self.as_ref().to_glib_none().0, + frame.to_glib_none().0, + params_ptr, + )) } } @@ -129,7 +127,7 @@ impl> VideoDecoderExtManual for O { #[doc(alias = "gst_video_decoder_finish_frame")] fn finish_frame(&self, frame: VideoCodecFrame) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_video_decoder_finish_frame( + try_from_glib(ffi::gst_video_decoder_finish_frame( self.as_ref().to_glib_none().0, frame.into_ptr(), )) @@ -146,7 +144,7 @@ impl> VideoDecoderExtManual for O { #[doc(alias = "gst_video_decoder_drop_frame")] fn drop_frame(&self, frame: VideoCodecFrame) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_video_decoder_drop_frame( + try_from_glib(ffi::gst_video_decoder_drop_frame( self.as_ref().to_glib_none().0, frame.into_ptr(), )) @@ -330,7 +328,7 @@ impl> VideoDecoderExtManual for O { line: u32, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(_gst_video_decoder_error( + try_from_glib(_gst_video_decoder_error( self.as_ref().to_glib_none().0, weight, T::domain().into_glib(), diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index d7f54d9d0..d1bee4a66 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -76,7 +76,7 @@ impl> VideoEncoderExtManual for O { size: usize, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_video_encoder_allocate_output_frame( + try_from_glib(ffi::gst_video_encoder_allocate_output_frame( self.as_ref().to_glib_none().0, frame.to_glib_none().0, size, @@ -102,7 +102,7 @@ impl> VideoEncoderExtManual for O { frame: Option, ) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_video_encoder_finish_frame( + try_from_glib(ffi::gst_video_encoder_finish_frame( self.as_ref().to_glib_none().0, frame.map(|f| f.into_ptr()).unwrap_or(ptr::null_mut()), )) @@ -113,7 +113,7 @@ impl> VideoEncoderExtManual for O { #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result { unsafe { - gst::FlowSuccess::try_from_glib(ffi::gst_video_encoder_finish_subframe( + try_from_glib(ffi::gst_video_encoder_finish_subframe( self.as_ref().to_glib_none().0, frame.to_glib_none().0, )) diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 2455dfadd..55efefb85 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -48,10 +48,7 @@ impl ClockId { pub fn wait(&self) -> (Result, ClockTimeDiff) { unsafe { let mut jitter = 0; - let res = ClockSuccess::try_from_glib(ffi::gst_clock_id_wait( - self.to_glib_none().0, - &mut jitter, - )); + let res = try_from_glib(ffi::gst_clock_id_wait(self.to_glib_none().0, &mut jitter)); (res, jitter) } } @@ -169,7 +166,7 @@ impl SingleShotClockId { let func: Box> = Box::new(Some(func)); unsafe { - ClockSuccess::try_from_glib(ffi::gst_clock_id_wait_async( + try_from_glib(ffi::gst_clock_id_wait_async( self.to_glib_none().0, Some(trampoline::), Box::into_raw(func) as gpointer, @@ -273,7 +270,7 @@ impl PeriodicClockId { let func: Box = Box::new(func); unsafe { - ClockSuccess::try_from_glib(ffi::gst_clock_id_wait_async( + try_from_glib(ffi::gst_clock_id_wait_async( self.to_glib_none().0, Some(trampoline::), Box::into_raw(func) as gpointer, diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index a8c7c9d5e..4788bcace 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -317,7 +317,7 @@ impl> PadExtManual for O { fn chain(&self, buffer: Buffer) -> Result { unsafe { - FlowSuccess::try_from_glib(ffi::gst_pad_chain( + try_from_glib(ffi::gst_pad_chain( self.as_ref().to_glib_none().0, buffer.into_ptr(), )) @@ -326,7 +326,7 @@ impl> PadExtManual for O { fn push(&self, buffer: Buffer) -> Result { unsafe { - FlowSuccess::try_from_glib(ffi::gst_pad_push( + try_from_glib(ffi::gst_pad_push( self.as_ref().to_glib_none().0, buffer.into_ptr(), )) @@ -335,7 +335,7 @@ impl> PadExtManual for O { fn chain_list(&self, list: BufferList) -> Result { unsafe { - FlowSuccess::try_from_glib(ffi::gst_pad_chain_list( + try_from_glib(ffi::gst_pad_chain_list( self.as_ref().to_glib_none().0, list.into_ptr(), )) @@ -344,7 +344,7 @@ impl> PadExtManual for O { fn push_list(&self, list: BufferList) -> Result { unsafe { - FlowSuccess::try_from_glib(ffi::gst_pad_push_list( + try_from_glib(ffi::gst_pad_push_list( self.as_ref().to_glib_none().0, list.into_ptr(), )) @@ -1035,7 +1035,7 @@ unsafe fn create_probe_info<'a>( info: *mut ffi::GstPadProbeInfo, ) -> (PadProbeInfo<'a>, Option) { let mut data_type = None; - let flow_res = FlowSuccess::try_from_glib((*info).ABI.abi.flow_ret); + let flow_res = try_from_glib((*info).ABI.abi.flow_ret); let info = PadProbeInfo { mask: from_glib((*info).type_), id: Some(PadProbeId(NonZeroU64::new_unchecked((*info).id as u64))), diff --git a/gstreamer/src/proxy_pad.rs b/gstreamer/src/proxy_pad.rs index e8b472112..0966c77d8 100644 --- a/gstreamer/src/proxy_pad.rs +++ b/gstreamer/src/proxy_pad.rs @@ -50,7 +50,7 @@ impl> ProxyPadExtManual for O { ) -> Result { skip_assert_initialized!(); unsafe { - FlowSuccess::try_from_glib(ffi::gst_proxy_pad_chain_default( + try_from_glib(ffi::gst_proxy_pad_chain_default( self.as_ptr() as *mut ffi::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, buffer.into_ptr(), @@ -65,7 +65,7 @@ impl> ProxyPadExtManual for O { ) -> Result { skip_assert_initialized!(); unsafe { - FlowSuccess::try_from_glib(ffi::gst_proxy_pad_chain_list_default( + try_from_glib(ffi::gst_proxy_pad_chain_list_default( self.as_ptr() as *mut ffi::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, list.into_ptr(), diff --git a/gstreamer/src/subclass/clock.rs b/gstreamer/src/subclass/clock.rs index 3af1637cf..892330bc2 100644 --- a/gstreamer/src/subclass/clock.rs +++ b/gstreamer/src/subclass/clock.rs @@ -141,7 +141,7 @@ impl ClockImplExt for T { let mut jitter = 0; ( - ClockSuccess::try_from_glib( + try_from_glib( (*parent_class) .wait .map(|f| { @@ -166,7 +166,7 @@ impl ClockImplExt for T { unsafe { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstClockClass; - ClockSuccess::try_from_glib( + try_from_glib( (*parent_class) .wait_async .map(|f| { diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index eaf7367ec..cdc305c66 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -170,7 +170,7 @@ impl ElementImplExt for T { let f = (*parent_class) .change_state .expect("Missing parent function `change_state`"); - StateChangeSuccess::try_from_glib(f( + try_from_glib(f( element.unsafe_cast_ref::().to_glib_none().0, transition.into_glib(), ))