From ce1148b474d704863b1fd25e30ce8f59554114a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 18 Dec 2020 00:38:06 +0200 Subject: [PATCH] Update everything for glib macro renamings --- examples/src/bin/rtsp-server-subclass.rs | 23 ++++------- examples/src/bin/subclass.rs | 7 +--- gstreamer-audio/src/audio_buffer.rs | 12 +++--- gstreamer-audio/src/audio_channel_position.rs | 24 +++++------ gstreamer-audio/src/audio_format.rs | 2 +- gstreamer-audio/src/audio_info.rs | 14 +++---- gstreamer-audio/src/audio_meta.rs | 17 ++++---- gstreamer-base/src/adapter.rs | 14 +++---- gstreamer-base/src/base_sink.rs | 2 +- gstreamer-base/src/base_src.rs | 4 +- gstreamer-base/src/flow_combiner.rs | 2 +- gstreamer-base/src/functions.rs | 8 ++-- gstreamer-check/src/harness.rs | 22 +++++----- gstreamer-controller/src/control_point.rs | 2 +- gstreamer-editing-services/src/lib.rs | 4 +- .../src/timeline_element.rs | 2 +- gstreamer-gl/egl/src/gl_display_egl.rs | 2 +- gstreamer-gl/src/gl_video_frame.rs | 6 +-- .../wayland/src/gl_display_wayland.rs | 2 +- gstreamer-gl/x11/src/gl_display_x11.rs | 2 +- gstreamer-pbutils/src/encoding_profile.rs | 2 +- gstreamer-pbutils/src/functions.rs | 10 ++--- gstreamer-player/src/player.rs | 2 +- gstreamer-rtp/src/rtp_buffer.rs | 16 +++----- gstreamer-sdp/src/sdp_media.rs | 4 +- gstreamer-sdp/src/sdp_message.rs | 8 ++-- gstreamer-video/src/video_color_matrix.rs | 2 +- gstreamer-video/src/video_converter.rs | 10 ++--- gstreamer-video/src/video_event.rs | 6 +-- gstreamer-video/src/video_format.rs | 2 +- gstreamer-video/src/video_frame.rs | 24 +++++------ gstreamer-video/src/video_info.rs | 30 ++++++-------- gstreamer-video/src/video_meta.rs | 28 +++++-------- .../src/video_overlay_composition.rs | 8 ++-- gstreamer-video/src/video_time_code.rs | 12 +++--- .../src/video_time_code_interval.rs | 4 +- gstreamer/src/allocator.rs | 2 +- gstreamer/src/bin.rs | 4 +- gstreamer/src/buffer.rs | 16 ++++---- gstreamer/src/buffer_cursor.rs | 4 +- gstreamer/src/buffer_pool.rs | 4 +- gstreamer/src/bus.rs | 4 +- gstreamer/src/caps.rs | 2 +- gstreamer/src/caps_features.rs | 2 +- gstreamer/src/child_proxy.rs | 2 +- gstreamer/src/clock.rs | 12 +++--- gstreamer/src/clock_time.rs | 2 +- gstreamer/src/control_binding.rs | 2 +- gstreamer/src/control_source.rs | 2 +- gstreamer/src/date_time.rs | 40 +++++++++---------- gstreamer/src/date_time_serde.rs | 8 ++-- gstreamer/src/device_monitor.rs | 2 +- gstreamer/src/device_provider.rs | 2 +- gstreamer/src/element.rs | 10 ++--- gstreamer/src/error.rs | 8 ++-- gstreamer/src/ghost_pad.rs | 6 +-- gstreamer/src/memory.rs | 4 +- gstreamer/src/object.rs | 2 +- gstreamer/src/pad.rs | 2 +- gstreamer/src/pad_template.rs | 2 +- gstreamer/src/parse_context.rs | 2 +- gstreamer/src/promise.rs | 2 +- gstreamer/src/segment.rs | 4 +- gstreamer/src/structure.rs | 4 +- gstreamer/src/subclass/element.rs | 4 +- gstreamer/src/subclass/pad.rs | 4 +- gstreamer/src/subclass/plugin_1_12.rs | 2 +- gstreamer/src/subclass/plugin_1_14.rs | 2 +- gstreamer/src/typefind.rs | 2 +- gstreamer/src/value.rs | 4 +- 70 files changed, 234 insertions(+), 279 deletions(-) diff --git a/examples/src/bin/rtsp-server-subclass.rs b/examples/src/bin/rtsp-server-subclass.rs index 44a33e808..c60a7b785 100644 --- a/examples/src/bin/rtsp-server-subclass.rs +++ b/examples/src/bin/rtsp-server-subclass.rs @@ -9,9 +9,6 @@ use gst_rtsp_server::prelude::*; -use glib::glib_object_subclass; -use glib::glib_wrapper; - use anyhow::Error; use derive_more::{Display, Error}; @@ -104,7 +101,7 @@ mod media_factory { type Class = subclass::simple::ClassStruct; // This macro provides some boilerplate - glib_object_subclass!(); + glib::object_subclass!(); // Called when a new instance is to be created. We need to return an instance // of our struct here. @@ -156,7 +153,7 @@ mod media_factory { // This here defines the public interface of our factory and implements // the corresponding traits so that it behaves like any other RTSPMediaFactory - glib_wrapper! { + glib::wrapper! { pub struct Factory(ObjectSubclass) @extends gst_rtsp_server::RTSPMediaFactory; } @@ -174,8 +171,6 @@ mod media_factory { // Our custom media subclass that adds a custom attribute to the SDP returned by DESCRIBE mod media { - use super::*; - use glib::subclass; use glib::subclass::prelude::*; @@ -199,7 +194,7 @@ mod media { type Class = subclass::simple::ClassStruct; // This macro provides some boilerplate - glib_object_subclass!(); + glib::object_subclass!(); // Called when a new instance is to be created. We need to return an instance // of our struct here. @@ -230,7 +225,7 @@ mod media { // This here defines the public interface of our factory and implements // the corresponding traits so that it behaves like any other RTSPMedia - glib_wrapper! { + glib::wrapper! { pub struct Media(ObjectSubclass) @extends gst_rtsp_server::RTSPMedia; } @@ -267,7 +262,7 @@ mod server { type Class = subclass::simple::ClassStruct; // This macro provides some boilerplate - glib_object_subclass!(); + glib::object_subclass!(); // Called when a new instance is to be created. We need to return an instance // of our struct here. @@ -302,7 +297,7 @@ mod server { // This here defines the public interface of our factory and implements // the corresponding traits so that it behaves like any other RTSPServer - glib_wrapper! { + glib::wrapper! { pub struct Server(ObjectSubclass) @extends gst_rtsp_server::RTSPServer; } @@ -320,8 +315,6 @@ mod server { // Our custom RTSP client subclass. mod client { - use super::*; - use glib::subclass; use glib::subclass::prelude::*; @@ -345,7 +338,7 @@ mod client { type Class = subclass::simple::ClassStruct; // This macro provides some boilerplate - glib_object_subclass!(); + glib::object_subclass!(); // Called when a new instance is to be created. We need to return an instance // of our struct here. @@ -368,7 +361,7 @@ mod client { // This here defines the public interface of our factory and implements // the corresponding traits so that it behaves like any other RTSPClient - glib_wrapper! { + glib::wrapper! { pub struct Client(ObjectSubclass) @extends gst_rtsp_server::RTSPClient; } diff --git a/examples/src/bin/subclass.rs b/examples/src/bin/subclass.rs index 2d29435a2..8f5739938 100644 --- a/examples/src/bin/subclass.rs +++ b/examples/src/bin/subclass.rs @@ -6,9 +6,6 @@ // Our filter can only handle F32 mono and acts as a FIR filter. The filter impulse response / // coefficients are provided via Rust API on the filter as a Vec. -use glib::glib_object_subclass; -use glib::glib_wrapper; - use gst::gst_element_error; use gst::gst_info; use gst::gst_trace; @@ -68,7 +65,7 @@ mod fir_filter { type Class = subclass::simple::ClassStruct; // This macro provides some boilerplate - glib_object_subclass!(); + glib::object_subclass!(); // Called when a new instance is to be created. We need to return an instance // of our struct here. @@ -245,7 +242,7 @@ mod fir_filter { // This here defines the public interface of our element and implements // the corresponding traits so that it behaves like any other gst::Element - glib_wrapper! { + glib::wrapper! { pub struct FirFilter(ObjectSubclass) @extends gst_base::BaseTransform, gst::Element, gst::Object; } diff --git a/gstreamer-audio/src/audio_buffer.rs b/gstreamer-audio/src/audio_buffer.rs index 219120aa0..b59996e4f 100644 --- a/gstreamer-audio/src/audio_buffer.rs +++ b/gstreamer-audio/src/audio_buffer.rs @@ -102,7 +102,7 @@ impl AudioBuffer { pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } @@ -213,7 +213,7 @@ impl AudioBuffer { pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } @@ -336,7 +336,7 @@ impl AudioBufferRef { pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } @@ -390,7 +390,7 @@ impl<'a> AudioBufferRef<&'a gst::BufferRef> { )); if !res { - Err(glib::glib_bool_error!("Failed to map AudioBuffer")) + Err(glib::bool_error!("Failed to map AudioBuffer")) } else { let info = crate::AudioInfo::from_glib_none( &audio_buffer.info as *const _ as *mut ffi::GstAudioInfo, @@ -444,7 +444,7 @@ impl<'a> AudioBufferRef<&'a mut gst::BufferRef> { )); if !res { - Err(glib::glib_bool_error!("Failed to map AudioBuffer")) + Err(glib::bool_error!("Failed to map AudioBuffer")) } else { let info = crate::AudioInfo::from_glib_none( &audio_buffer.info as *const _ as *mut ffi::GstAudioInfo, @@ -465,7 +465,7 @@ impl<'a> AudioBufferRef<&'a mut gst::BufferRef> { pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index 01affadec..03c469f1e 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -24,7 +24,7 @@ impl AudioChannelPosition { let len = positions.len(); if len > 64 { - return Err(glib::glib_bool_error!("Invalid number of channels")); + return Err(glib::bool_error!("Invalid number of channels")); } let positions_raw: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { @@ -46,7 +46,7 @@ impl AudioChannelPosition { if valid { Ok(mask.assume_init()) } else { - Err(glib::glib_bool_error!( + Err(glib::bool_error!( "Couldn't convert channel positions to mask" )) } @@ -60,7 +60,7 @@ impl AudioChannelPosition { assert_initialized_main_thread!(); if positions.len() > 64 { - return Err(glib::glib_bool_error!("Invalid number of channels")); + return Err(glib::bool_error!("Invalid number of channels")); } let len = positions.len(); @@ -80,7 +80,7 @@ impl AudioChannelPosition { } Ok(()) } else { - Err(glib::glib_bool_error!( + Err(glib::bool_error!( "Couldn't convert channel positions to mask", )) } @@ -92,7 +92,7 @@ impl AudioChannelPosition { assert_initialized_main_thread!(); if positions.len() > 64 { - return Err(glib::glib_bool_error!("Invalid number of channels")); + return Err(glib::bool_error!("Invalid number of channels")); } let len = positions.len(); @@ -117,7 +117,7 @@ impl AudioChannelPosition { } Ok(()) } else { - Err(glib::glib_bool_error!( + Err(glib::bool_error!( "Couldn't convert channel positions to mask", )) } @@ -168,7 +168,7 @@ pub fn buffer_reorder_channels( assert_initialized_main_thread!(); if from.len() != to.len() || from.len() > 64 { - return Err(glib::glib_bool_error!("Invalid number of channels")); + return Err(glib::bool_error!("Invalid number of channels")); } let from_len = from.len(); @@ -203,7 +203,7 @@ pub fn buffer_reorder_channels( if valid { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to reorder channels")) + Err(glib::bool_error!("Failed to reorder channels")) } } @@ -217,7 +217,7 @@ pub fn reorder_channels( assert_initialized_main_thread!(); if from.len() != to.len() || from.len() > 64 { - return Err(glib::glib_bool_error!("Invalid number of channels")); + return Err(glib::bool_error!("Invalid number of channels")); } let from_len = from.len(); @@ -253,7 +253,7 @@ pub fn reorder_channels( if valid { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to reorder channels")) + Err(glib::bool_error!("Failed to reorder channels")) } } @@ -265,7 +265,7 @@ pub fn get_channel_reorder_map( assert_initialized_main_thread!(); if from.len() != to.len() || from.len() != reorder_map.len() || from.len() > 64 { - return Err(glib::glib_bool_error!("Invalid number of channels")); + return Err(glib::bool_error!("Invalid number of channels")); } let from_len = from.len(); @@ -303,6 +303,6 @@ pub fn get_channel_reorder_map( } Ok(()) } else { - Err(glib::glib_bool_error!("Failed to reorder channels")) + Err(glib::bool_error!("Failed to reorder channels")) } } diff --git a/gstreamer-audio/src/audio_format.rs b/gstreamer-audio/src/audio_format.rs index 4cc82962e..b3a28439f 100644 --- a/gstreamer-audio/src/audio_format.rs +++ b/gstreamer-audio/src/audio_format.rs @@ -140,7 +140,7 @@ impl str::FromStr for crate::AudioFormat { let fmt = Self::from_string(s); if fmt == Self::Unknown { - Err(glib::glib_bool_error!( + Err(glib::bool_error!( "Failed to parse audio format from string" )) } else { diff --git a/gstreamer-audio/src/audio_info.rs b/gstreamer-audio/src/audio_info.rs index 16e0fee86..cddd43735 100644 --- a/gstreamer-audio/src/audio_info.rs +++ b/gstreamer-audio/src/audio_info.rs @@ -41,7 +41,7 @@ impl<'a> AudioInfoBuilder<'a> { let positions = if let Some(p) = self.positions { if p.len() != self.channels as usize || p.len() > 64 { - return Err(glib::glib_bool_error!("Invalid positions length")); + return Err(glib::bool_error!("Invalid positions length")); } let positions: [ffi::GstAudioChannelPosition; 64] = array_init::array_init(|i| { @@ -58,7 +58,7 @@ impl<'a> AudioInfoBuilder<'a> { true.to_glib(), )); if !valid { - return Err(glib::glib_bool_error!("channel positions are invalid")); + return Err(glib::bool_error!("channel positions are invalid")); } Some(positions) @@ -82,7 +82,7 @@ impl<'a> AudioInfoBuilder<'a> { let mut info = info.assume_init(); if info.finfo.is_null() || info.rate <= 0 || info.channels <= 0 { - return Err(glib::glib_bool_error!("Failed to build AudioInfo")); + return Err(glib::bool_error!("Failed to build AudioInfo")); } if let Some(flags) = self.flags { @@ -155,9 +155,7 @@ impl AudioInfo { let positions = array_init::array_init(|i| from_glib(info.position[i])); Ok(AudioInfo(info, positions)) } else { - Err(glib::glib_bool_error!( - "Failed to create AudioInfo from caps" - )) + Err(glib::bool_error!("Failed to create AudioInfo from caps")) } } } @@ -167,9 +165,7 @@ impl AudioInfo { let result = from_glib_full(ffi::gst_audio_info_to_caps(&self.0)); match result { Some(c) => Ok(c), - None => Err(glib::glib_bool_error!( - "Failed to create caps from AudioInfo" - )), + None => Err(glib::bool_error!("Failed to create caps from AudioInfo")), } } } diff --git a/gstreamer-audio/src/audio_meta.rs b/gstreamer-audio/src/audio_meta.rs index 43bf5428e..c2a85d0a3 100644 --- a/gstreamer-audio/src/audio_meta.rs +++ b/gstreamer-audio/src/audio_meta.rs @@ -92,7 +92,7 @@ impl AudioMeta { skip_assert_initialized!(); if !info.is_valid() { - return Err(glib::glib_bool_error!("Invalid audio info")); + return Err(glib::bool_error!("Invalid audio info")); } if info.rate() == 0 @@ -100,20 +100,17 @@ impl AudioMeta { || info.format() == crate::AudioFormat::Unknown || info.format() == crate::AudioFormat::Encoded { - return Err(glib::glib_bool_error!( - "Unsupported audio format {:?}", - info - )); + return Err(glib::bool_error!("Unsupported audio format {:?}", info)); } if !offsets.is_empty() && info.layout() != crate::AudioLayout::NonInterleaved { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Channel offsets only supported for non-interleaved audio" )); } if !offsets.is_empty() && offsets.len() != info.channels() as usize { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Number of channel offsets different than number of channels ({} != {})", offsets.len(), info.channels() @@ -139,7 +136,7 @@ impl AudioMeta { && !(other_offset + plane_size <= offset || offset + plane_size <= other_offset) { - return Err(glib::glib_bool_error!("Overlapping audio channel offsets: offset {} for channel {} and offset {} for channel {} with a plane size of {}", offset, i, other_offset, j, plane_size)); + return Err(glib::bool_error!("Overlapping audio channel offsets: offset {} for channel {} and offset {} for channel {} with a plane size of {}", offset, i, other_offset, j, plane_size)); } } } @@ -148,7 +145,7 @@ impl AudioMeta { }; if max_offset + plane_size > buffer.get_size() { - return Err(glib::glib_bool_error!("Audio channel offsets out of bounds: max offset {} with plane size {} and buffer size {}", max_offset, plane_size, buffer.get_size())); + return Err(glib::bool_error!("Audio channel offsets out of bounds: max offset {} with plane size {} and buffer size {}", max_offset, plane_size, buffer.get_size())); } } @@ -165,7 +162,7 @@ impl AudioMeta { ); if meta.is_null() { - return Err(glib::glib_bool_error!("Failed to add audio meta")); + return Err(glib::bool_error!("Failed to add audio meta")); } Ok(Self::from_mut_ptr(buffer, meta)) diff --git a/gstreamer-base/src/adapter.rs b/gstreamer-base/src/adapter.rs index b0cbf9c8a..f9328a3c9 100644 --- a/gstreamer-base/src/adapter.rs +++ b/gstreamer-base/src/adapter.rs @@ -66,7 +66,7 @@ impl Adapter { unsafe { Option::<_>::from_glib_full(ffi::gst_adapter_get_buffer(self.to_glib_none().0, nbytes)) - .ok_or_else(|| glib::glib_bool_error!("Failed to get buffer")) + .ok_or_else(|| glib::bool_error!("Failed to get buffer")) } } @@ -79,7 +79,7 @@ impl Adapter { self.to_glib_none().0, nbytes, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to get buffer")) + .ok_or_else(|| glib::bool_error!("Failed to get buffer")) } } @@ -92,7 +92,7 @@ impl Adapter { self.to_glib_none().0, nbytes, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to get buffer list")) + .ok_or_else(|| glib::bool_error!("Failed to get buffer list")) } } @@ -173,7 +173,7 @@ impl Adapter { unsafe { Option::<_>::from_glib_full(ffi::gst_adapter_take_buffer(self.to_glib_none().0, nbytes)) - .ok_or_else(|| glib::glib_bool_error!("Failed to take buffer")) + .ok_or_else(|| glib::bool_error!("Failed to take buffer")) } } @@ -186,7 +186,7 @@ impl Adapter { self.to_glib_none().0, nbytes, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to take buffer")) + .ok_or_else(|| glib::bool_error!("Failed to take buffer")) } } @@ -199,7 +199,7 @@ impl Adapter { self.to_glib_none().0, nbytes, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to take buffer list")) + .ok_or_else(|| glib::bool_error!("Failed to take buffer list")) } } @@ -395,7 +395,7 @@ impl UniqueAdapter { unsafe { let ptr = ffi::gst_adapter_map(self.0.to_glib_none().0, nbytes); if ptr.is_null() { - Err(glib::glib_bool_error!("size bytes are not available")) + Err(glib::bool_error!("size bytes are not available")) } else { Ok(UniqueAdapterMap( self, diff --git a/gstreamer-base/src/base_sink.rs b/gstreamer-base/src/base_sink.rs index 312a0f9f1..9edbe2968 100644 --- a/gstreamer-base/src/base_sink.rs +++ b/gstreamer-base/src/base_sink.rs @@ -105,7 +105,7 @@ impl> BaseSinkExtManual for O { from_glib(max_latency), )) } else { - Err(glib::glib_bool_error!("Failed to query latency")) + Err(glib::bool_error!("Failed to query latency")) } } } diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index 8fedf8167..1a29d7bbd 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -90,7 +90,7 @@ impl> BaseSrcExtManual for O { from_glib(max_latency), )) } else { - Err(glib::glib_bool_error!("Failed to query latency")) + Err(glib::bool_error!("Failed to query latency")) } } } @@ -107,7 +107,7 @@ impl> BaseSrcExtManual for O { if ret { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to configure new segment")) + Err(glib::bool_error!("Failed to configure new segment")) } } } diff --git a/gstreamer-base/src/flow_combiner.rs b/gstreamer-base/src/flow_combiner.rs index e75168f1a..873853651 100644 --- a/gstreamer-base/src/flow_combiner.rs +++ b/gstreamer-base/src/flow_combiner.rs @@ -3,7 +3,7 @@ use glib::object::IsA; use glib::translate::*; -glib::glib_wrapper! { +glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct FlowCombiner(Shared); diff --git a/gstreamer-base/src/functions.rs b/gstreamer-base/src/functions.rs index 889b36bf6..638ef3b46 100644 --- a/gstreamer-base/src/functions.rs +++ b/gstreamer-base/src/functions.rs @@ -20,7 +20,7 @@ pub fn type_find_helper_for_data, R: AsRef<[u8]>>( prob.as_mut_ptr(), ); if ret.is_null() { - Err(glib::glib_bool_error!("No type could be found")) + Err(glib::bool_error!("No type could be found")) } else { Ok((from_glib_full(ret), from_glib(prob.assume_init()))) } @@ -47,7 +47,7 @@ pub fn type_find_helper_for_data_with_extension, R: AsRef<[u prob.as_mut_ptr(), ); if ret.is_null() { - Err(glib::glib_bool_error!("No type could be found")) + Err(glib::bool_error!("No type could be found")) } else { Ok((from_glib_full(ret), from_glib(prob.assume_init()))) } @@ -67,7 +67,7 @@ pub fn type_find_helper_for_buffer>( prob.as_mut_ptr(), ); if ret.is_null() { - Err(glib::glib_bool_error!("No type could be found")) + Err(glib::bool_error!("No type could be found")) } else { Ok((from_glib_full(ret), from_glib(prob.assume_init()))) } @@ -91,7 +91,7 @@ pub fn type_find_helper_for_buffer_with_extension>( prob.as_mut_ptr(), ); if ret.is_null() { - Err(glib::glib_bool_error!("No type could be found")) + Err(glib::bool_error!("No type could be found")) } else { Ok((from_glib_full(ret), from_glib(prob.assume_init()))) } diff --git a/gstreamer-check/src/harness.rs b/gstreamer-check/src/harness.rs index 97254b8d4..021cedce5 100644 --- a/gstreamer-check/src/harness.rs +++ b/gstreamer-check/src/harness.rs @@ -157,7 +157,7 @@ impl Harness { pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits), "Failed to crank multiple clock waits", ) @@ -166,7 +166,7 @@ impl Harness { pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_harness_crank_single_clock_wait(self.0.as_ptr()), "Failed to crank single clock wait", ) @@ -176,7 +176,7 @@ impl Harness { pub fn create_buffer(&mut self, size: usize) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_harness_create_buffer(self.0.as_ptr(), size)) - .ok_or_else(|| glib::glib_bool_error!("Failed to create new buffer")) + .ok_or_else(|| glib::bool_error!("Failed to create new buffer")) } } @@ -238,21 +238,21 @@ impl Harness { pub fn pull(&mut self) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_harness_pull(self.0.as_ptr())) - .ok_or_else(|| glib::glib_bool_error!("Failed to pull buffer")) + .ok_or_else(|| glib::bool_error!("Failed to pull buffer")) } } pub fn pull_event(&mut self) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_harness_pull_event(self.0.as_ptr())) - .ok_or_else(|| glib::glib_bool_error!("Failed to pull event")) + .ok_or_else(|| glib::bool_error!("Failed to pull event")) } } pub fn pull_upstream_event(&mut self) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_harness_pull_upstream_event(self.0.as_ptr())) - .ok_or_else(|| glib::glib_bool_error!("Failed to pull event")) + .ok_or_else(|| glib::bool_error!("Failed to pull event")) } } @@ -268,7 +268,7 @@ impl Harness { self.0.as_ptr(), buffer.into_ptr(), )) - .ok_or_else(|| glib::glib_bool_error!("Failed to push and pull buffer")) + .ok_or_else(|| glib::bool_error!("Failed to push and pull buffer")) } } @@ -374,7 +374,7 @@ impl Harness { pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()), "Failed to set time", ) @@ -461,7 +461,7 @@ impl Harness { pub fn take_all_data_as_buffer(&mut self) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_harness_take_all_data_as_buffer(self.0.as_ptr())) - .ok_or_else(|| glib::glib_bool_error!("Failed to take all data as buffer")) + .ok_or_else(|| glib::bool_error!("Failed to take all data as buffer")) } } @@ -470,7 +470,7 @@ impl Harness { pub fn take_all_data_as_bytes(&mut self) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_harness_take_all_data_as_bytes(self.0.as_ptr())) - .ok_or_else(|| glib::glib_bool_error!("Failed to take all data as bytes")) + .ok_or_else(|| glib::bool_error!("Failed to take all data as bytes")) } } @@ -512,7 +512,7 @@ impl Harness { timeout: u32, ) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_harness_wait_for_clock_id_waits(self.0.as_ptr(), waits, timeout), "Failed to wait for clock id waits", ) diff --git a/gstreamer-controller/src/control_point.rs b/gstreamer-controller/src/control_point.rs index 19ab019dd..fa7646bf6 100644 --- a/gstreamer-controller/src/control_point.rs +++ b/gstreamer-controller/src/control_point.rs @@ -2,7 +2,7 @@ use glib::translate::*; -glib::glib_wrapper! { +glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ControlPoint(Boxed); diff --git a/gstreamer-editing-services/src/lib.rs b/gstreamer-editing-services/src/lib.rs index afa9e880f..7bcd0643f 100644 --- a/gstreamer-editing-services/src/lib.rs +++ b/gstreamer-editing-services/src/lib.rs @@ -12,14 +12,14 @@ static GES_INIT: Once = Once::new(); pub fn init() -> Result<(), glib::BoolError> { if gst::init().is_err() { - return Err(glib::glib_bool_error!("Could not initialize GStreamer.")); + return Err(glib::bool_error!("Could not initialize GStreamer.")); } unsafe { if from_glib(ffi::ges_init()) { Ok(()) } else { - Err(glib::glib_bool_error!("Could not initialize GES.")) + Err(glib::bool_error!("Could not initialize GES.")) } } } diff --git a/gstreamer-editing-services/src/timeline_element.rs b/gstreamer-editing-services/src/timeline_element.rs index 763382b65..e07d3a79e 100644 --- a/gstreamer-editing-services/src/timeline_element.rs +++ b/gstreamer-editing-services/src/timeline_element.rs @@ -50,7 +50,7 @@ impl> TimelineElementExtManual for O { ptr::null_mut(), )); if !found { - return Err(glib::glib_bool_error!("Child property not found")); + return Err(glib::bool_error!("Child property not found")); } let value = value.to_value(); diff --git a/gstreamer-gl/egl/src/gl_display_egl.rs b/gstreamer-gl/egl/src/gl_display_egl.rs index 59b53bd22..2d394fdbc 100644 --- a/gstreamer-gl/egl/src/gl_display_egl.rs +++ b/gstreamer-gl/egl/src/gl_display_egl.rs @@ -19,7 +19,7 @@ impl GLDisplayEGL { from_glib_full::<_, Option>(ffi::gst_gl_display_egl_new_with_egl_display( display as gpointer, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to create new EGL GL display")) + .ok_or_else(|| glib::bool_error!("Failed to create new EGL GL display")) } pub unsafe fn get_from_native(display_type: GLDisplayType, display: uintptr_t) -> gpointer { diff --git a/gstreamer-gl/src/gl_video_frame.rs b/gstreamer-gl/src/gl_video_frame.rs index befacef2d..7604a5230 100644 --- a/gstreamer-gl/src/gl_video_frame.rs +++ b/gstreamer-gl/src/gl_video_frame.rs @@ -88,14 +88,14 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> { let n_mem = match buffer_n_gl_memory(buffer) { Some(n) => n, - None => return Err(glib::glib_bool_error!("Memory is not a GstGLMemory")), + None => return Err(glib::bool_error!("Memory is not a GstGLMemory")), }; // FIXME: planes are not memories, in multiview use case, // number of memories = planes * views, but the raw memory is // not exposed in videoframe if n_mem != info.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Number of planes and memories is not matching" )); } @@ -112,7 +112,7 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> { )); if !res { - Err(glib::glib_bool_error!( + Err(glib::bool_error!( "Failed to fill in the values of GstVideoFrame" )) } else { diff --git a/gstreamer-gl/wayland/src/gl_display_wayland.rs b/gstreamer-gl/wayland/src/gl_display_wayland.rs index f5c993470..132bc80dd 100644 --- a/gstreamer-gl/wayland/src/gl_display_wayland.rs +++ b/gstreamer-gl/wayland/src/gl_display_wayland.rs @@ -18,6 +18,6 @@ impl GLDisplayWayland { from_glib_full::<_, Option>(ffi::gst_gl_display_wayland_new_with_display( display as gpointer, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to create new Wayland GL display")) + .ok_or_else(|| glib::bool_error!("Failed to create new Wayland GL display")) } } diff --git a/gstreamer-gl/x11/src/gl_display_x11.rs b/gstreamer-gl/x11/src/gl_display_x11.rs index e5719f07b..d517e780a 100644 --- a/gstreamer-gl/x11/src/gl_display_x11.rs +++ b/gstreamer-gl/x11/src/gl_display_x11.rs @@ -16,6 +16,6 @@ impl GLDisplayX11 { from_glib_full::<_, Option>(ffi::gst_gl_display_x11_new_with_display( display as gpointer, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to create new X11 GL display")) + .ok_or_else(|| glib::bool_error!("Failed to create new X11 GL display")) } } diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index 287add075..2acd4c281 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -227,7 +227,7 @@ impl EncodingContainerProfile { profile: &P, ) -> Result<(), glib::error::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_encoding_container_profile_add_profile( self.to_glib_none().0, profile.as_ref().to_glib_full(), diff --git a/gstreamer-pbutils/src/functions.rs b/gstreamer-pbutils/src/functions.rs index 259cbd196..b9ea8d94b 100644 --- a/gstreamer-pbutils/src/functions.rs +++ b/gstreamer-pbutils/src/functions.rs @@ -18,7 +18,7 @@ pub fn pb_utils_add_codec_description_to_tag_list_for_tag<'a, T: CodecTag<'a>>( assert_initialized_main_thread!(); let codec_tag = T::tag_name(); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), codec_tag.to_glib_none().0, @@ -35,7 +35,7 @@ pub fn pb_utils_add_codec_description_to_tag_list( ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), ptr::null_mut(), @@ -53,7 +53,7 @@ pub fn pb_utils_get_encoder_description( unsafe { match from_glib_full(ffi::gst_pb_utils_get_encoder_description(caps.as_ptr())) { Some(s) => Ok(s), - None => Err(glib::glib_bool_error!("Failed to get encoder description")), + None => Err(glib::bool_error!("Failed to get encoder description")), } } } @@ -65,7 +65,7 @@ pub fn pb_utils_get_decoder_description( unsafe { match from_glib_full(ffi::gst_pb_utils_get_decoder_description(caps.as_ptr())) { Some(s) => Ok(s), - None => Err(glib::glib_bool_error!("Failed to get decoder description")), + None => Err(glib::bool_error!("Failed to get decoder description")), } } } @@ -77,7 +77,7 @@ pub fn pb_utils_get_codec_description( unsafe { match from_glib_full(ffi::gst_pb_utils_get_codec_description(caps.as_ptr())) { Some(s) => Ok(s), - None => Err(glib::glib_bool_error!("Failed to get codec description")), + None => Err(glib::bool_error!("Failed to get codec description")), } } } diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index d3019f6d8..891e6337d 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -35,7 +35,7 @@ impl Player { pub fn set_config(&self, config: crate::PlayerConfig) -> Result<(), glib::error::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_player_set_config(self.to_glib_none().0, config.into_ptr()), "Failed to set config", ) diff --git a/gstreamer-rtp/src/rtp_buffer.rs b/gstreamer-rtp/src/rtp_buffer.rs index 6b19eafac..f04891b4e 100644 --- a/gstreamer-rtp/src/rtp_buffer.rs +++ b/gstreamer-rtp/src/rtp_buffer.rs @@ -49,7 +49,7 @@ impl<'a> RTPBuffer<'a, Readable> { phantom: PhantomData, }) } else { - Err(glib::glib_bool_error!("Failed to map RTP buffer readable")) + Err(glib::bool_error!("Failed to map RTP buffer readable")) } } } @@ -75,7 +75,7 @@ impl<'a> RTPBuffer<'a, Writable> { phantom: PhantomData, }) } else { - Err(glib::glib_bool_error!("Failed to map RTP buffer writable")) + Err(glib::bool_error!("Failed to map RTP buffer writable")) } } } @@ -139,9 +139,7 @@ impl<'a> RTPBuffer<'a, Writable> { if result { Ok(()) } else { - Err(glib::glib_bool_error!( - "Failed to add onebyte header extension" - )) + Err(glib::bool_error!("Failed to add onebyte header extension")) } } } @@ -169,9 +167,7 @@ impl<'a> RTPBuffer<'a, Writable> { if result { Ok(()) } else { - Err(glib::glib_bool_error!( - "Failed to add twobytes header extension" - )) + Err(glib::bool_error!("Failed to add twobytes header extension")) } } } @@ -241,7 +237,7 @@ impl<'a, T> RTPBuffer<'a, T> { let pointer = ffi::gst_rtp_buffer_get_payload(glib::translate::mut_override(&self.rtp_buffer)); if pointer.is_null() { - Err(glib::glib_bool_error!("Failed to get payload data")) + Err(glib::bool_error!("Failed to get payload data")) } else { Ok(slice::from_raw_parts(pointer as *const u8, size as usize)) } @@ -346,7 +342,7 @@ impl RTPBufferExt for gst::Buffer { pad_len, csrc_count, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to allocate new RTP buffer")) + .ok_or_else(|| glib::bool_error!("Failed to allocate new RTP buffer")) } } } diff --git a/gstreamer-sdp/src/sdp_media.rs b/gstreamer-sdp/src/sdp_media.rs index 892ff6a01..77758b6fd 100644 --- a/gstreamer-sdp/src/sdp_media.rs +++ b/gstreamer-sdp/src/sdp_media.rs @@ -14,7 +14,7 @@ use crate::sdp_bandwidth::SDPBandwidth; use crate::sdp_connection::SDPConnection; use crate::sdp_key::SDPKey; -glib::glib_wrapper! { +glib::wrapper! { #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct SDPMedia(Boxed); @@ -160,7 +160,7 @@ impl SDPMediaRef { unsafe { match from_glib_full(ffi::gst_sdp_media_as_text(&self.0)) { Some(s) => Ok(s), - None => Err(glib::glib_bool_error!( + None => Err(glib::bool_error!( "Failed to convert the contents of media to a text string" )), } diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index f65283d71..744dbb330 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -19,7 +19,7 @@ use crate::sdp_origin::SDPOrigin; use crate::sdp_time::SDPTime; use crate::sdp_zone::SDPZone; -glib::glib_wrapper! { +glib::wrapper! { #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct SDPMessage(Boxed); @@ -210,7 +210,7 @@ impl SDPMessageRef { unsafe { match from_glib_full(ffi::gst_sdp_message_as_text(&self.0)) { Some(s) => Ok(s), - None => Err(glib::glib_bool_error!( + None => Err(glib::bool_error!( "Failed to convert the contents of message to a text string" )), } @@ -830,9 +830,7 @@ impl SDPMessageRef { &self.0, )) { Some(s) => Ok(s), - None => Err(glib::glib_bool_error!( - "Failed to create an URI from message" - )), + None => Err(glib::bool_error!("Failed to create an URI from message")), } } } diff --git a/gstreamer-video/src/video_color_matrix.rs b/gstreamer-video/src/video_color_matrix.rs index 99e4ad549..cb5718020 100644 --- a/gstreamer-video/src/video_color_matrix.rs +++ b/gstreamer-video/src/video_color_matrix.rs @@ -10,7 +10,7 @@ impl crate::VideoColorMatrix { unsafe { let mut kr = mem::MaybeUninit::uninit(); let mut kb = mem::MaybeUninit::uninit(); - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_video_color_matrix_get_Kr_Kb( self.to_glib(), kr.as_mut_ptr(), diff --git a/gstreamer-video/src/video_converter.rs b/gstreamer-video/src/video_converter.rs index 3bcfcbbab..a621999f3 100644 --- a/gstreamer-video/src/video_converter.rs +++ b/gstreamer-video/src/video_converter.rs @@ -28,11 +28,11 @@ impl VideoConverter { ) -> Result { assert_initialized_main_thread!(); if in_info.fps() != out_info.fps() { - return Err(glib::glib_bool_error!("Can't do framerate conversion")); + return Err(glib::bool_error!("Can't do framerate conversion")); } if in_info.interlace_mode() != out_info.interlace_mode() { - return Err(glib::glib_bool_error!("Can't do interlacing conversion")); + return Err(glib::bool_error!("Can't do interlacing conversion")); } unsafe { @@ -42,7 +42,7 @@ impl VideoConverter { config.map(|s| s.0.into_ptr()).unwrap_or(ptr::null_mut()), ); if ptr.is_null() { - Err(glib::glib_bool_error!("Failed to create video converter")) + Err(glib::bool_error!("Failed to create video converter")) } else { Ok(VideoConverter(ptr::NonNull::new_unchecked(ptr))) } @@ -130,9 +130,7 @@ impl convert::TryFrom for VideoConverterConfig { if v.get_name() == "GstVideoConverter" { Ok(VideoConverterConfig(v)) } else { - Err(glib::glib_bool_error!( - "Structure is no VideoConverterConfig" - )) + Err(glib::bool_error!("Structure is no VideoConverterConfig")) } } } diff --git a/gstreamer-video/src/video_event.rs b/gstreamer-video/src/video_event.rs index d2e7c064d..5810319e9 100644 --- a/gstreamer-video/src/video_event.rs +++ b/gstreamer-video/src/video_event.rs @@ -169,7 +169,7 @@ impl DownstreamForceKeyUnitEvent { count: count.assume_init(), }) } else { - Err(glib::glib_bool_error!("Failed to parse GstEvent")) + Err(glib::bool_error!("Failed to parse GstEvent")) } } } @@ -258,7 +258,7 @@ impl UpstreamForceKeyUnitEvent { count: count.assume_init(), }) } else { - Err(glib::glib_bool_error!("Failed to parse GstEvent")) + Err(glib::bool_error!("Failed to parse GstEvent")) } } } @@ -334,7 +334,7 @@ impl StillFrameEvent { in_still: from_glib(in_still.assume_init()), }) } else { - Err(glib::glib_bool_error!("Invalid still-frame event")) + Err(glib::bool_error!("Invalid still-frame event")) } } } diff --git a/gstreamer-video/src/video_format.rs b/gstreamer-video/src/video_format.rs index 1c448cb10..61a3a5327 100644 --- a/gstreamer-video/src/video_format.rs +++ b/gstreamer-video/src/video_format.rs @@ -334,7 +334,7 @@ impl str::FromStr for crate::VideoFormat { let fmt = Self::from_string(s); if fmt == Self::Unknown { - Err(glib::glib_bool_error!( + Err(glib::bool_error!( "Failed to parse video format from string" )) } else { diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index db797d062..62ea7ea59 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -56,7 +56,7 @@ impl VideoFrame { if res { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to copy video frame")) + Err(glib::bool_error!("Failed to copy video frame")) } } } @@ -77,7 +77,7 @@ impl VideoFrame { if res { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to copy video frame plane")) + Err(glib::bool_error!("Failed to copy video frame plane")) } } } @@ -140,7 +140,7 @@ impl VideoFrame { pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } @@ -354,7 +354,7 @@ impl VideoFrame { pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } @@ -430,7 +430,7 @@ impl VideoFrameRef { if res { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to copy video frame")) + Err(glib::bool_error!("Failed to copy video frame")) } } } @@ -451,7 +451,7 @@ impl VideoFrameRef { if res { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to copy video frame plane")) + Err(glib::bool_error!("Failed to copy video frame plane")) } } } @@ -510,7 +510,7 @@ impl VideoFrameRef { pub fn plane_data(&self, plane: u32) -> Result<&[u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } @@ -589,7 +589,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { )); if !res { - Err(glib::glib_bool_error!("Failed to map VideoFrame")) + Err(glib::bool_error!("Failed to map VideoFrame")) } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); @@ -623,7 +623,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { )); if !res { - Err(glib::glib_bool_error!("Failed to map VideoFrame")) + Err(glib::bool_error!("Failed to map VideoFrame")) } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); @@ -688,7 +688,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { )); if !res { - Err(glib::glib_bool_error!("Failed to map VideoFrame")) + Err(glib::bool_error!("Failed to map VideoFrame")) } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); @@ -724,7 +724,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { )); if !res { - Err(glib::glib_bool_error!("Failed to map VideoFrame")) + Err(glib::bool_error!("Failed to map VideoFrame")) } else { let frame = frame.assume_init(); let info = crate::VideoInfo(ptr::read(&frame.info)); @@ -744,7 +744,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { pub fn plane_data_mut(&mut self, plane: u32) -> Result<&mut [u8], glib::BoolError> { if plane >= self.n_planes() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Plane index higher than number of planes" )); } diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 0b36519a7..67ad7b3c3 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -144,7 +144,7 @@ impl str::FromStr for crate::VideoColorimetry { if valid { Ok(Self(colorimetry.assume_init())) } else { - Err(glib::glib_bool_error!("Invalid colorimetry info")) + Err(glib::bool_error!("Invalid colorimetry info")) } } } @@ -202,7 +202,7 @@ impl str::FromStr for crate::VideoChromaSite { }; if chroma_site.is_empty() { - Err(glib::glib_bool_error!("Invalid chroma site")) + Err(glib::bool_error!("Invalid chroma site")) } else { Ok(chroma_site) } @@ -233,7 +233,7 @@ impl std::convert::TryFrom for crate::VideoMultiviewF let v2 = unsafe { from_glib(v.to_glib()) }; if let crate::VideoMultiviewFramePacking::__Unknown(_) = v2 { - Err(glib::glib_bool_error!("Invalid frame packing mode")) + Err(glib::bool_error!("Invalid frame packing mode")) } else { Ok(v2) } @@ -370,13 +370,13 @@ impl<'a> VideoInfoBuilder<'a> { } if !res { - return Err(glib::glib_bool_error!("Failed to build VideoInfo")); + return Err(glib::bool_error!("Failed to build VideoInfo")); } let mut info = info.assume_init(); if info.finfo.is_null() || info.width <= 0 || info.height <= 0 { - return Err(glib::glib_bool_error!("Failed to build VideoInfo")); + return Err(glib::bool_error!("Failed to build VideoInfo")); } if let Some(flags) = self.flags { @@ -411,7 +411,7 @@ impl<'a> VideoInfoBuilder<'a> { if let Some(offset) = self.offset { if offset.len() != ((*info.finfo).n_planes as usize) { - return Err(glib::glib_bool_error!("Failed to build VideoInfo")); + return Err(glib::bool_error!("Failed to build VideoInfo")); } let n_planes = (*info.finfo).n_planes as usize; @@ -420,7 +420,7 @@ impl<'a> VideoInfoBuilder<'a> { if let Some(stride) = self.stride { if stride.len() != ((*info.finfo).n_planes as usize) { - return Err(glib::glib_bool_error!("Failed to build VideoInfo")); + return Err(glib::bool_error!("Failed to build VideoInfo")); } let n_planes = (*info.finfo).n_planes as usize; @@ -606,9 +606,7 @@ impl VideoInfo { )) { Ok(VideoInfo(info.assume_init())) } else { - Err(glib::glib_bool_error!( - "Failed to create VideoInfo from caps" - )) + Err(glib::bool_error!("Failed to create VideoInfo from caps")) } } } @@ -618,9 +616,7 @@ impl VideoInfo { let result = from_glib_full(ffi::gst_video_info_to_caps(&self.0 as *const _ as *mut _)); match result { Some(c) => Ok(c), - None => Err(glib::glib_bool_error!( - "Failed to create caps from VideoInfo" - )), + None => Err(glib::bool_error!("Failed to create caps from VideoInfo")), } } } @@ -800,7 +796,7 @@ impl VideoInfo { cfg_if::cfg_if! { if #[cfg(feature = "v1_12")] { unsafe { - glib::glib_result_from_gboolean!(ffi::gst_video_info_align( + glib::result_from_gboolean!(ffi::gst_video_info_align( &mut self.0, &mut align.0, ), "Failed to align VideoInfo") @@ -814,7 +810,7 @@ impl VideoInfo { Ok(()) } else { - glib::glib_result_from_gboolean!(ffi::gst_video_info_align( + glib::result_from_gboolean!(ffi::gst_video_info_align( &mut self.0, &mut align.0, ), "Failed to align VideoInfo") @@ -833,7 +829,7 @@ impl VideoInfo { let mut plane_size = [0; crate::VIDEO_MAX_PLANES]; unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_video_info_align_full(&mut self.0, &mut align.0, plane_size.as_mut_ptr()), "Failed to align VideoInfo" )?; @@ -971,7 +967,7 @@ impl str::FromStr for crate::VideoFieldOrder { let fmt = Self::from_string(s); if fmt == Self::Unknown { - Err(glib::glib_bool_error!( + Err(glib::bool_error!( "Failed to parse video field order from string" )) } else { diff --git a/gstreamer-video/src/video_meta.rs b/gstreamer-video/src/video_meta.rs index 7ea6e254e..1c99d517d 100644 --- a/gstreamer-video/src/video_meta.rs +++ b/gstreamer-video/src/video_meta.rs @@ -23,20 +23,17 @@ impl VideoMeta { skip_assert_initialized!(); if format == crate::VideoFormat::Unknown || format == crate::VideoFormat::Encoded { - return Err(glib::glib_bool_error!( - "Unsupported video format {}", - format - )); + return Err(glib::bool_error!("Unsupported video format {}", format)); } let info = crate::VideoInfo::builder(format, width, height).build()?; if !info.is_valid() { - return Err(glib::glib_bool_error!("Invalid video info")); + return Err(glib::bool_error!("Invalid video info")); } if buffer.get_size() < info.size() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Buffer smaller than required frame size ({} < {})", buffer.get_size(), info.size() @@ -53,7 +50,7 @@ impl VideoMeta { ); if meta.is_null() { - return Err(glib::glib_bool_error!("Failed to add video meta")); + return Err(glib::bool_error!("Failed to add video meta")); } Ok(Self::from_mut_ptr(buffer, meta)) @@ -72,10 +69,7 @@ impl VideoMeta { skip_assert_initialized!(); if format == crate::VideoFormat::Unknown || format == crate::VideoFormat::Encoded { - return Err(glib::glib_bool_error!( - "Unsupported video format {}", - format - )); + return Err(glib::bool_error!("Unsupported video format {}", format)); } let n_planes = offset.len() as u32; @@ -85,11 +79,11 @@ impl VideoMeta { .build()?; if !info.is_valid() { - return Err(glib::glib_bool_error!("Invalid video info")); + return Err(glib::bool_error!("Invalid video info")); } if buffer.get_size() < info.size() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Buffer smaller than required frame size ({} < {})", buffer.get_size(), info.size() @@ -109,7 +103,7 @@ impl VideoMeta { ); if meta.is_null() { - return Err(glib::glib_bool_error!("Failed to add video meta")); + return Err(glib::bool_error!("Failed to add video meta")); } Ok(Self::from_mut_ptr(buffer, meta)) @@ -166,7 +160,7 @@ impl VideoMeta { let mut plane_size = [0; crate::VIDEO_MAX_PLANES]; unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_video_meta_get_plane_size( &self.0 as *const _ as usize as *mut _, &mut plane_size, @@ -184,7 +178,7 @@ impl VideoMeta { let mut plane_height = [0; crate::VIDEO_MAX_PLANES]; unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_video_meta_get_plane_height( &self.0 as *const _ as usize as *mut _, &mut plane_height, @@ -203,7 +197,7 @@ impl VideoMeta { alignment: &crate::VideoAlignment, ) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_video_meta_set_alignment(&mut self.0, alignment.0), "Failed to set alignment on VideoMeta" ) diff --git a/gstreamer-video/src/video_overlay_composition.rs b/gstreamer-video/src/video_overlay_composition.rs index 331c2cfbc..28117872e 100644 --- a/gstreamer-video/src/video_overlay_composition.rs +++ b/gstreamer-video/src/video_overlay_composition.rs @@ -199,7 +199,7 @@ impl VideoOverlayComposition { let first = match iter.next() { None => { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Failed to create VideoOverlayComposition" )) } @@ -228,7 +228,7 @@ impl VideoOverlayCompositionRef { pub fn get_rectangle(&self, idx: u32) -> Result { if idx >= self.n_rectangles() { - return Err(glib::glib_bool_error!("Invalid index")); + return Err(glib::bool_error!("Invalid index")); } unsafe { @@ -237,7 +237,7 @@ impl VideoOverlayCompositionRef { idx, )) { Some(r) => Ok(r), - None => Err(glib::glib_bool_error!("Failed to get rectangle")), + None => Err(glib::bool_error!("Failed to get rectangle")), } } } @@ -251,7 +251,7 @@ impl VideoOverlayCompositionRef { frame: &mut crate::VideoFrameRef<&mut gst::BufferRef>, ) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_video_overlay_composition_blend(self.as_mut_ptr(), frame.as_mut_ptr()), "Failed to blend overlay composition", ) diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index eed72e1e1..5c95e0133 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -84,7 +84,7 @@ impl VideoTimeCode { ); if res == glib::ffi::GFALSE { - Err(glib::glib_bool_error!("Failed to init video time code")) + Err(glib::bool_error!("Failed to init video time code")) } else { Ok(VideoTimeCode(v.assume_init())) } @@ -166,9 +166,7 @@ impl ValidVideoTimeCode { ); match tc.try_into() { Ok(v) => Ok(v), - Err(_) => Err(glib::glib_bool_error!( - "Failed to create new ValidVideoTimeCode" - )), + Err(_) => Err(glib::bool_error!("Failed to create new ValidVideoTimeCode")), } } @@ -203,7 +201,7 @@ impl ValidVideoTimeCode { tc_inter.to_glib_none().0, )) { Some(i) => Ok(i), - None => Err(glib::glib_bool_error!("Failed to add interval")), + None => Err(glib::bool_error!("Failed to add interval")), } } } @@ -230,7 +228,7 @@ impl ValidVideoTimeCode { unsafe { match from_glib_full(ffi::gst_video_time_code_to_date_time(self.to_glib_none().0)) { Some(d) => Ok(d), - None => Err(glib::glib_bool_error!( + None => Err(glib::bool_error!( "Failed to convert VideoTimeCode to date time" )), } @@ -475,7 +473,7 @@ impl str::FromStr for VideoTimeCode { Option::::from_glib_full(ffi::gst_video_time_code_new_from_string( s.to_glib_none().0, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to create VideoTimeCode from string")) + .ok_or_else(|| glib::bool_error!("Failed to create VideoTimeCode from string")) } } } diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index 3d0e12a82..2779f43bf 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -120,9 +120,7 @@ impl str::FromStr for VideoTimeCodeInterval { Option::::from_glib_full(ffi::gst_video_time_code_interval_new_from_string( s.to_glib_none().0, )) - .ok_or_else(|| { - glib::glib_bool_error!("Failed to create VideoTimeCodeInterval from string") - }) + .ok_or_else(|| glib::bool_error!("Failed to create VideoTimeCodeInterval from string")) } } } diff --git a/gstreamer/src/allocator.rs b/gstreamer/src/allocator.rs index 5356e2211..5c9d5b547 100644 --- a/gstreamer/src/allocator.rs +++ b/gstreamer/src/allocator.rs @@ -33,7 +33,7 @@ impl> AllocatorExtManual for O { }, ); if ret.is_null() { - Err(glib::glib_bool_error!("Failed to allocate memory")) + Err(glib::bool_error!("Failed to allocate memory")) } else { Ok(from_glib_full(ret)) } diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 2e339b55e..6da84c972 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -59,7 +59,7 @@ impl> GstBinExtManual for O { fn add_many>(&self, elements: &[&E]) -> Result<(), glib::BoolError> { for e in elements { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_bin_add(self.as_ref().to_glib_none().0, e.as_ref().to_glib_none().0), "Failed to add elements" )?; @@ -72,7 +72,7 @@ impl> GstBinExtManual for O { fn remove_many>(&self, elements: &[&E]) -> Result<(), glib::BoolError> { for e in elements { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_bin_remove( self.as_ref().to_glib_none().0, e.as_ref().to_glib_none().0, diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index 1da1eb4bc..7bf6cf819 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -54,7 +54,7 @@ impl Buffer { size, ptr::null_mut(), )) - .ok_or_else(|| glib::glib_bool_error!("Failed to allocate buffer")) + .ok_or_else(|| glib::bool_error!("Failed to allocate buffer")) } } @@ -183,7 +183,7 @@ impl BufferRef { phantom: PhantomData, }) } else { - Err(glib::glib_bool_error!("Failed to map buffer readable")) + Err(glib::bool_error!("Failed to map buffer readable")) } } } @@ -203,7 +203,7 @@ impl BufferRef { phantom: PhantomData, }) } else { - Err(glib::glib_bool_error!("Failed to map buffer writable")) + Err(glib::bool_error!("Failed to map buffer writable")) } } } @@ -222,7 +222,7 @@ impl BufferRef { offset, size_real, )) - .ok_or_else(|| glib::glib_bool_error!("Failed to copy region of buffer")) + .ok_or_else(|| glib::bool_error!("Failed to copy region of buffer")) } } @@ -235,7 +235,7 @@ impl BufferRef { ) -> Result<(), glib::BoolError> { let size_real = size.unwrap_or(usize::MAX); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_buffer_copy_into( dest.as_mut_ptr(), self.as_mut_ptr(), @@ -292,7 +292,7 @@ impl BufferRef { pub fn copy_deep(&self) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_buffer_copy_deep(self.as_ptr())) - .ok_or_else(|| glib::glib_bool_error!("Failed to deep copy buffer")) + .ok_or_else(|| glib::bool_error!("Failed to deep copy buffer")) } } @@ -593,7 +593,7 @@ impl BufferRef { unsafe { let mem = ffi::gst_buffer_peek_memory(self.as_mut_ptr(), idx); if ffi::gst_mini_object_is_writable(mem as *mut _) == glib::ffi::GFALSE { - Err(glib::glib_bool_error!("Memory not writable")) + Err(glib::bool_error!("Memory not writable")) } else { Ok(MemoryRef::from_mut_ptr(ffi::gst_buffer_peek_memory( self.as_mut_ptr(), @@ -660,7 +660,7 @@ impl BufferRef { pub fn iter_memories_mut(&mut self) -> Result { if !self.is_all_memory_writable() { - Err(glib::glib_bool_error!("Not all memory are writable")) + Err(glib::bool_error!("Not all memory are writable")) } else { Ok(IterMut::new(self)) } diff --git a/gstreamer/src/buffer_cursor.rs b/gstreamer/src/buffer_cursor.rs index 82df0ca97..e8be64f86 100644 --- a/gstreamer/src/buffer_cursor.rs +++ b/gstreamer/src/buffer_cursor.rs @@ -296,7 +296,7 @@ impl BufferCursor { pub(crate) fn new_writable(buffer: Buffer) -> Result, glib::BoolError> { skip_assert_initialized!(); if !buffer.is_writable() || !buffer.is_all_memory_writable() { - return Err(glib::glib_bool_error!("Not all memories are writable")); + return Err(glib::bool_error!("Not all memories are writable")); } let size = buffer.get_size() as u64; @@ -400,7 +400,7 @@ impl<'a> BufferRefCursor<&'a mut BufferRef> { ) -> Result, glib::BoolError> { skip_assert_initialized!(); if !buffer.is_all_memory_writable() { - return Err(glib::glib_bool_error!("Not all memories are writable")); + return Err(glib::bool_error!("Not all memories are writable")); } let size = buffer.get_size() as u64; diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index 9b267d3b6..732411968 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -129,7 +129,7 @@ impl BufferPoolConfig { max_buffers: u32, ) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_buffer_pool_config_validate_params( self.0.to_glib_none().0, caps.to_glib_none().0, @@ -301,7 +301,7 @@ impl> BufferPoolExtManual for O { fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_buffer_pool_set_config( self.as_ref().to_glib_none().0, config.0.into_ptr() diff --git a/gstreamer/src/bus.rs b/gstreamer/src/bus.rs index 1b49e6fdf..040bafa1e 100644 --- a/gstreamer/src/bus.rs +++ b/gstreamer/src/bus.rs @@ -117,7 +117,7 @@ impl Bus { ); if res == 0 { - Err(glib::glib_bool_error!("Bus already has a watch")) + Err(glib::bool_error!("Bus already has a watch")) } else { Ok(from_glib(res)) } @@ -140,7 +140,7 @@ impl Bus { ); if res == 0 { - Err(glib::glib_bool_error!("Bus already has a watch")) + Err(glib::bool_error!("Bus already has a watch")) } else { Ok(from_glib(res)) } diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index a3ec5b5f8..84bebee8e 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -159,7 +159,7 @@ impl str::FromStr for Caps { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::gst_caps_from_string(s.to_glib_none().0)) - .ok_or_else(|| glib::glib_bool_error!("Failed to parse caps from string")) + .ok_or_else(|| glib::bool_error!("Failed to parse caps from string")) } } } diff --git a/gstreamer/src/caps_features.rs b/gstreamer/src/caps_features.rs index 8b4836f27..6c2654847 100644 --- a/gstreamer/src/caps_features.rs +++ b/gstreamer/src/caps_features.rs @@ -122,7 +122,7 @@ impl str::FromStr for CapsFeatures { unsafe { let ptr = ffi::gst_caps_features_from_string(s.to_glib_none().0); if ptr.is_null() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Failed to parse caps features from string" )); } diff --git a/gstreamer/src/child_proxy.rs b/gstreamer/src/child_proxy.rs index de7180b39..92c770352 100644 --- a/gstreamer/src/child_proxy.rs +++ b/gstreamer/src/child_proxy.rs @@ -50,7 +50,7 @@ impl> ChildProxyExtManual for O { ptr::null_mut(), )); if !found { - return Err(glib::glib_bool_error!("Child property not found")); + return Err(glib::bool_error!("Child property not found")); } let value = value.to_value(); diff --git a/gstreamer/src/clock.rs b/gstreamer/src/clock.rs index 3b1723bbd..61b7ccccf 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -25,7 +25,7 @@ use std::pin::Pin; use std::sync::atomic; use std::sync::atomic::AtomicI32; -glib::glib_wrapper! { +glib::wrapper! { #[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct ClockId(Shared); @@ -117,7 +117,7 @@ impl convert::TryFrom for SingleShotClockId { skip_assert_initialized!(); match id.get_type() { ClockEntryType::Single => Ok(SingleShotClockId(id)), - _ => Err(glib::glib_bool_error!("Not a single-shot clock id")), + _ => Err(glib::bool_error!("Not a single-shot clock id")), } } } @@ -225,7 +225,7 @@ impl convert::TryFrom for PeriodicClockId { skip_assert_initialized!(); match id.get_type() { ClockEntryType::Periodic => Ok(PeriodicClockId(id)), - _ => Err(glib::glib_bool_error!("Not a periodic clock id")), + _ => Err(glib::bool_error!("Not a periodic clock id")), } } } @@ -431,7 +431,7 @@ impl> ClockExtManual for O { if res { Ok(()) } else { - Err(glib::glib_bool_error!("Failed to reinit periodic clock id")) + Err(glib::bool_error!("Failed to reinit periodic clock id")) } } } @@ -461,9 +461,7 @@ impl> ClockExtManual for O { if res { Ok(()) } else { - Err(glib::glib_bool_error!( - "Failed to reinit single shot clock id" - )) + Err(glib::bool_error!("Failed to reinit single shot clock id")) } } } diff --git a/gstreamer/src/clock_time.rs b/gstreamer/src/clock_time.rs index c5551ba23..a08d8434b 100644 --- a/gstreamer/src/clock_time.rs +++ b/gstreamer/src/clock_time.rs @@ -246,7 +246,7 @@ impl convert::TryFrom for Duration { t.nanoseconds() .map(Duration::from_nanos) - .ok_or_else(|| glib::glib_bool_error!("Can't convert ClockTime::NONE to Duration")) + .ok_or_else(|| glib::bool_error!("Can't convert ClockTime::NONE to Duration")) } } diff --git a/gstreamer/src/control_binding.rs b/gstreamer/src/control_binding.rs index e1d7c37fd..4fc69421b 100644 --- a/gstreamer/src/control_binding.rs +++ b/gstreamer/src/control_binding.rs @@ -23,7 +23,7 @@ impl> ControlBindingExtManual for O { ) -> Result<(), glib::error::BoolError> { let n_values = values.len() as u32; unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_control_binding_get_g_value_array( self.as_ref().to_glib_none().0, timestamp.to_glib(), diff --git a/gstreamer/src/control_source.rs b/gstreamer/src/control_source.rs index 5eb35ad15..d5cc35925 100644 --- a/gstreamer/src/control_source.rs +++ b/gstreamer/src/control_source.rs @@ -23,7 +23,7 @@ impl> ControlSourceExtManual for O { ) -> Result<(), glib::error::BoolError> { let n_values = values.len() as u32; unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_control_source_get_value_array( self.as_ref().to_glib_none().0, timestamp.to_glib(), diff --git a/gstreamer/src/date_time.rs b/gstreamer/src/date_time.rs index ea282ee10..238f72651 100644 --- a/gstreamer/src/date_time.rs +++ b/gstreamer/src/date_time.rs @@ -21,14 +21,14 @@ fn validate( // Check for valid ranges if year <= 0 || year > 9999 { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Year out of range" )); } if let Some(month) = month { if month <= 0 || month > 12 { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Month out of range" )); } @@ -36,15 +36,13 @@ fn validate( if let Some(day) = day { if day <= 0 || day > 31 { - return Err(glib::glib_bool_error!( - "Can't create DateTime: Day out of range" - )); + return Err(glib::bool_error!("Can't create DateTime: Day out of range")); } } if let Some(hour) = hour { if hour < 0 || hour >= 24 { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Hour out of range" )); } @@ -52,7 +50,7 @@ fn validate( if let Some(minute) = minute { if minute < 0 || minute >= 60 { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Minute out of range" )); } @@ -60,7 +58,7 @@ fn validate( if let Some(seconds) = seconds { if seconds < 0.0 || seconds >= 60.0 { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Seconds out of range" )); } @@ -68,7 +66,7 @@ fn validate( if let Some(tzoffset) = tzoffset { if tzoffset < -12.0 || tzoffset > 12.0 { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Timezone offset out of range" )); } @@ -76,34 +74,34 @@ fn validate( // If day is provided, month also has to be provided if day.is_some() && month.is_none() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Need to provide month if providing day" )); } // If hour is provided, day also has to be provided if hour.is_some() && day.is_none() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Need to provide day if providing hour" )); } // If minutes are provided, hours also need to be provided and the other way around if hour.is_none() && minute.is_some() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Need to provide both hour and minute or neither" )); } if minute.is_some() && hour.is_none() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Can't create DateTime: Need to provide both hour and minute or neither" )); } // If seconds or tzoffset are provided then also hours and minutes must be provided if (seconds.is_some() || tzoffset.is_some()) && (hour.is_none() || minute.is_none()) { - return Err(glib::glib_bool_error!("Can't create DateTime: Need to provide hour and minute if providing seconds or timezone offset")); + return Err(glib::bool_error!("Can't create DateTime: Need to provide hour and minute if providing seconds or timezone offset")); } Ok(()) @@ -149,7 +147,7 @@ impl DateTime { minute.unwrap_or(-1), seconds.unwrap_or(-1.0), )) - .ok_or_else(|| glib::glib_bool_error!("Can't create DateTime")) + .ok_or_else(|| glib::bool_error!("Can't create DateTime")) } } @@ -188,7 +186,7 @@ impl DateTime { minute.unwrap_or(-1), seconds.unwrap_or(-1.0), )) - .ok_or_else(|| glib::glib_bool_error!("Can't create DateTime")) + .ok_or_else(|| glib::bool_error!("Can't create DateTime")) } } @@ -199,7 +197,7 @@ impl DateTime { unsafe { Option::<_>::from_glib_full(ffi::gst_date_time_new_y(year)) - .ok_or_else(|| glib::glib_bool_error!("Can't create DateTime")) + .ok_or_else(|| glib::bool_error!("Can't create DateTime")) } } @@ -210,7 +208,7 @@ impl DateTime { unsafe { Option::<_>::from_glib_full(ffi::gst_date_time_new_ym(year, month)) - .ok_or_else(|| glib::glib_bool_error!("Can't create DateTime")) + .ok_or_else(|| glib::bool_error!("Can't create DateTime")) } } @@ -221,7 +219,7 @@ impl DateTime { unsafe { Option::<_>::from_glib_full(ffi::gst_date_time_new_ymd(year, month, day)) - .ok_or_else(|| glib::glib_bool_error!("Can't create DateTime")) + .ok_or_else(|| glib::bool_error!("Can't create DateTime")) } } @@ -300,7 +298,7 @@ impl DateTime { self.to_g_date_time() .and_then(|d| { d.to_utc() - .ok_or_else(|| glib::glib_bool_error!("Can't convert datetime to UTC")) + .ok_or_else(|| glib::bool_error!("Can't convert datetime to UTC")) }) .map(|d| d.into()) } else { @@ -320,7 +318,7 @@ impl DateTime { .and_then(|d| d.to_g_date_time()) .and_then(|d| { d.to_utc() - .ok_or_else(|| glib::glib_bool_error!("Can't convert datetime to UTC")) + .ok_or_else(|| glib::bool_error!("Can't convert datetime to UTC")) }) .and_then(|d| { DateTime::new( diff --git a/gstreamer/src/date_time_serde.rs b/gstreamer/src/date_time_serde.rs index b9d832645..d50315340 100644 --- a/gstreamer/src/date_time_serde.rs +++ b/gstreamer/src/date_time_serde.rs @@ -114,18 +114,18 @@ impl TryFrom for Date { DateTimeVariants::YMD(y, m, d) => { let month = unsafe { glib::DateMonth::from_glib(m) }; if let glib::DateMonth::__Unknown(_) = month { - return Err(glib::glib_bool_error!("Out of range `month` for `Date`")); + return Err(glib::bool_error!("Out of range `month` for `Date`")); } Ok(Date(glib::Date::new_dmy( d.try_into() - .map_err(|_| glib::glib_bool_error!("Out of range `day` for `Date`"))?, + .map_err(|_| glib::bool_error!("Out of range `day` for `Date`"))?, month, y.try_into() - .map_err(|_| glib::glib_bool_error!("Out of range `year` for `Date`"))?, + .map_err(|_| glib::bool_error!("Out of range `year` for `Date`"))?, ))) } - _ => Err(glib::glib_bool_error!( + _ => Err(glib::bool_error!( "Incompatible variant for `Date` (expecting \"YMD\")" )), } diff --git a/gstreamer/src/device_monitor.rs b/gstreamer/src/device_monitor.rs index 4a7f7e8b5..c72685ff5 100644 --- a/gstreamer/src/device_monitor.rs +++ b/gstreamer/src/device_monitor.rs @@ -83,7 +83,7 @@ impl> DeviceMonitorExtManual for O { filter_id: DeviceMonitorFilterId, ) -> Result<(), glib::error::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_device_monitor_remove_filter( self.as_ref().to_glib_none().0, filter_id.to_glib() diff --git a/gstreamer/src/device_provider.rs b/gstreamer/src/device_provider.rs index 35efc6f2b..d4113bf7f 100644 --- a/gstreamer/src/device_provider.rs +++ b/gstreamer/src/device_provider.rs @@ -19,7 +19,7 @@ impl DeviceProvider { ) -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_device_provider_register( plugin.to_glib_none().0, name.to_glib_none().0, diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 36a858d28..c83a73a03 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -50,7 +50,7 @@ impl Element { skip_assert_initialized!(); for e in elements.windows(2) { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_element_link( e[0].as_ref().to_glib_none().0, e[1].as_ref().to_glib_none().0, @@ -83,7 +83,7 @@ impl Element { ) -> Result<(), glib::error::BoolError> { assert_initialized_main_thread!(); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_element_register( plugin.to_glib_none().0, name.to_glib_none().0, @@ -454,7 +454,7 @@ impl> ElementExtManual for O { fn post_message(&self, message: crate::Message) -> Result<(), glib::error::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_element_post_message(self.as_ref().to_glib_none().0, message.into_ptr()), "Failed to post message" ) @@ -731,7 +731,7 @@ impl> ElementExtManual for O { assert_eq!(stop.get_format(), start.get_format()); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_element_seek( self.as_ref().to_glib_none().0, rate, @@ -754,7 +754,7 @@ impl> ElementExtManual for O { ) -> Result<(), glib::error::BoolError> { let seek_pos = seek_pos.into(); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_element_seek_simple( self.as_ref().to_glib_none().0, seek_pos.get_format().to_glib(), diff --git a/gstreamer/src/error.rs b/gstreamer/src/error.rs index af2a97e9f..0ca311722 100644 --- a/gstreamer/src/error.rs +++ b/gstreamer/src/error.rs @@ -83,12 +83,12 @@ impl ErrorMessage { macro_rules! gst_loggable_error( // Plain strings ($cat:expr, $msg:expr) => { - $crate::LoggableError::new($cat.clone(), $crate::glib::glib_bool_error!($msg)) + $crate::LoggableError::new($cat.clone(), $crate::glib::bool_error!($msg)) }; // Format strings ($cat:expr, $($msg:tt)*) => { { - $crate::LoggableError::new($cat.clone(), $crate::glib::glib_bool_error!($($msg)*)) + $crate::LoggableError::new($cat.clone(), $crate::glib::bool_error!($($msg)*)) }}; ); @@ -96,13 +96,13 @@ macro_rules! gst_loggable_error( macro_rules! gst_result_from_gboolean( // Plain strings ($ffi_bool:expr, $cat:expr, $msg:expr) => { - $crate::glib::glib_result_from_gboolean!($ffi_bool, $msg) + $crate::glib::result_from_gboolean!($ffi_bool, $msg) .map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err)) }; // Format strings ($ffi_bool:expr, $cat:expr, $($msg:tt)*) => { { - $crate::glib::glib_result_from_gboolean!($ffi_bool, $($msg)*) + $crate::glib::result_from_gboolean!($ffi_bool, $($msg)*) .map_err(|bool_err| $crate::LoggableError::new($cat.clone(), bool_err)) }}; ); diff --git a/gstreamer/src/ghost_pad.rs b/gstreamer/src/ghost_pad.rs index 98326b150..25406e9f3 100644 --- a/gstreamer/src/ghost_pad.rs +++ b/gstreamer/src/ghost_pad.rs @@ -25,7 +25,7 @@ impl GhostPad { ) -> Result<(), glib::BoolError> { skip_assert_initialized!(); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_ghost_pad_activate_mode_default( pad.to_glib_none().0 as *mut ffi::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, @@ -45,7 +45,7 @@ impl GhostPad { ) -> Result<(), glib::BoolError> { skip_assert_initialized!(); unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_ghost_pad_internal_activate_mode_default( pad.to_glib_none().0 as *mut ffi::GstPad, parent.map(|p| p.as_ref()).to_glib_none().0, @@ -112,7 +112,7 @@ impl GhostPad { skip_assert_initialized!(); if target.get_direction() != templ.get_property_direction() { - return Err(glib::glib_bool_error!( + return Err(glib::bool_error!( "Template and target have different directions" )); } diff --git a/gstreamer/src/memory.rs b/gstreamer/src/memory.rs index f6ba7b6d8..8b46be129 100644 --- a/gstreamer/src/memory.rs +++ b/gstreamer/src/memory.rs @@ -255,7 +255,7 @@ impl MemoryRef { phantom: PhantomData, }) } else { - Err(glib::glib_bool_error!("Failed to map memory readable")) + Err(glib::bool_error!("Failed to map memory readable")) } } } @@ -275,7 +275,7 @@ impl MemoryRef { phantom: PhantomData, }) } else { - Err(glib::glib_bool_error!("Failed to map memory writable")) + Err(glib::bool_error!("Failed to map memory writable")) } } } diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index 96f9088fc..cdc4757a6 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -110,7 +110,7 @@ impl> GstObjectExtManual for O { ) -> Result<(), glib::error::BoolError> { let n_values = values.len() as u32; unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_object_get_g_value_array( self.as_ref().to_glib_none().0, property_name.to_glib_none().0, diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 0a07179d5..2f972701f 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -745,7 +745,7 @@ impl> PadExtManual for O { fn start_task(&self, func: F) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_pad_start_task( self.as_ref().to_glib_none().0, Some(trampoline_pad_task::), diff --git a/gstreamer/src/pad_template.rs b/gstreamer/src/pad_template.rs index f9d42ba7b..795ffcb5d 100644 --- a/gstreamer/src/pad_template.rs +++ b/gstreamer/src/pad_template.rs @@ -23,7 +23,7 @@ impl PadTemplate { pad_type.to_glib(), ), ) - .ok_or_else(|| glib::glib_bool_error!("Failed to create PadTemplate")) + .ok_or_else(|| glib::bool_error!("Failed to create PadTemplate")) } } } diff --git a/gstreamer/src/parse_context.rs b/gstreamer/src/parse_context.rs index aa2d24274..b79009d94 100644 --- a/gstreamer/src/parse_context.rs +++ b/gstreamer/src/parse_context.rs @@ -2,7 +2,7 @@ use glib::translate::*; -glib::glib_wrapper! { +glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ParseContext(Boxed); diff --git a/gstreamer/src/promise.rs b/gstreamer/src/promise.rs index 4f5f1787b..3c4f56972 100644 --- a/gstreamer/src/promise.rs +++ b/gstreamer/src/promise.rs @@ -10,7 +10,7 @@ use std::pin::Pin; use std::ptr; use std::task::{Context, Poll}; -glib::glib_wrapper! { +glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Promise(Shared); diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 0f1b2b8ad..5b2842655 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -163,7 +163,7 @@ impl FormattedSegment { pub fn offset_running_time(&mut self, offset: i64) -> Result<(), glib::BoolError> { unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_segment_offset_running_time( &mut self.0, self.get_format().to_glib(), @@ -264,7 +264,7 @@ impl FormattedSegment { } unsafe { - glib::glib_result_from_gboolean!( + glib::result_from_gboolean!( ffi::gst_segment_set_running_time( &mut self.0, self.get_format().to_glib(), diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 26c48d7f1..a983d07f4 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -180,9 +180,7 @@ impl str::FromStr for Structure { unsafe { let structure = ffi::gst_structure_from_string(s.to_glib_none().0, ptr::null_mut()); if structure.is_null() { - Err(glib::glib_bool_error!( - "Failed to parse structure from string" - )) + Err(glib::bool_error!("Failed to parse structure from string")) } else { Ok(Self(ptr::NonNull::new_unchecked( structure as *mut StructureRef, diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index dc6d11873..a7cc369e4 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -626,7 +626,7 @@ mod tests { type Instance = crate::subclass::ElementInstanceStruct; type Class = subclass::simple::ClassStruct; - glib::glib_object_subclass!(); + glib::object_subclass!(); fn with_class(klass: &Self::Class) -> Self { let templ = klass.get_pad_template("sink").unwrap(); @@ -735,7 +735,7 @@ mod tests { } } - glib::glib_wrapper! { + glib::wrapper! { pub struct TestElement(ObjectSubclass) @extends Element, crate::Object; } diff --git a/gstreamer/src/subclass/pad.rs b/gstreamer/src/subclass/pad.rs index 5aa6ff530..00f66b56a 100644 --- a/gstreamer/src/subclass/pad.rs +++ b/gstreamer/src/subclass/pad.rs @@ -107,7 +107,7 @@ mod tests { type Instance = subclass::simple::InstanceStruct; type Class = subclass::simple::ClassStruct; - glib::glib_object_subclass!(); + glib::object_subclass!(); fn new() -> Self { Self { @@ -132,7 +132,7 @@ mod tests { } } - glib::glib_wrapper! { + glib::wrapper! { pub struct TestPad(ObjectSubclass) @extends Pad, crate::Object; } diff --git a/gstreamer/src/subclass/plugin_1_12.rs b/gstreamer/src/subclass/plugin_1_12.rs index 2cba39066..d6412543f 100644 --- a/gstreamer/src/subclass/plugin_1_12.rs +++ b/gstreamer/src/subclass/plugin_1_12.rs @@ -41,7 +41,7 @@ macro_rules! gst_plugin_define( pub fn plugin_register_static() -> Result<(), $crate::glib::BoolError> { unsafe { - $crate::glib::glib_result_from_gboolean!( + $crate::glib::result_from_gboolean!( $crate::ffi::gst_plugin_register_static( $crate::subclass::MAJOR_VERSION, $crate::subclass::MINOR_VERSION, diff --git a/gstreamer/src/subclass/plugin_1_14.rs b/gstreamer/src/subclass/plugin_1_14.rs index 4d02d25f0..9511d0850 100644 --- a/gstreamer/src/subclass/plugin_1_14.rs +++ b/gstreamer/src/subclass/plugin_1_14.rs @@ -44,7 +44,7 @@ macro_rules! gst_plugin_define( pub fn plugin_register_static() -> Result<(), $crate::glib::BoolError> { unsafe { - $crate::glib::glib_result_from_gboolean!( + $crate::glib::result_from_gboolean!( $crate::ffi::gst_plugin_register_static( $crate::subclass::MAJOR_VERSION, $crate::subclass::MINOR_VERSION, diff --git a/gstreamer/src/typefind.rs b/gstreamer/src/typefind.rs index 0be5858d3..1a56de348 100644 --- a/gstreamer/src/typefind.rs +++ b/gstreamer/src/typefind.rs @@ -50,7 +50,7 @@ impl TypeFind { Some(type_find_closure_drop::), ); - glib::glib_result_from_gboolean!(res, "Failed to register typefind factory") + glib::result_from_gboolean!(res, "Failed to register typefind factory") } } diff --git a/gstreamer/src/value.rs b/gstreamer/src/value.rs index d4e552597..8a29d4be4 100644 --- a/gstreamer/src/value.rs +++ b/gstreamer/src/value.rs @@ -882,7 +882,7 @@ impl GstValueExt for glib::Value { fn serialize(&self) -> Result { unsafe { Option::<_>::from_glib_full(ffi::gst_value_serialize(self.to_glib_none().0)) - .ok_or_else(|| glib::glib_bool_error!("Failed to serialize value")) + .ok_or_else(|| glib::bool_error!("Failed to serialize value")) } } @@ -900,7 +900,7 @@ impl GstValueExt for glib::Value { if ret { Ok(value) } else { - Err(glib::glib_bool_error!("Failed to deserialize value")) + Err(glib::bool_error!("Failed to deserialize value")) } } }