From 226070d2163d31cd959198ac17bcf0c3932e89f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Fri, 4 Jan 2019 13:15:58 +0100 Subject: [PATCH] BoolError: update to new build macros See https://github.com/gtk-rs/glib/pull/419 --- gstreamer-audio/src/audio_channel_position.rs | 20 +++++++++---------- gstreamer-check/src/harness.rs | 8 ++++---- gstreamer-editing-services/src/lib.rs | 4 ++-- .../src/timeline_element.rs | 2 +- gstreamer-pbutils/src/encoding_profile.rs | 2 +- gstreamer-pbutils/src/functions.rs | 4 ++-- gstreamer-player/src/player.rs | 2 +- gstreamer-video/src/video_frame.rs | 8 ++++---- .../src/video_overlay_composition.rs | 2 +- gstreamer/src/bin.rs | 4 ++-- gstreamer/src/buffer.rs | 2 +- gstreamer/src/buffer_pool.rs | 2 +- gstreamer/src/child_proxy.rs | 2 +- gstreamer/src/clock.rs | 4 ++-- gstreamer/src/element.rs | 6 +++--- gstreamer/src/pad.rs | 2 +- gstreamer/src/typefind.rs | 2 +- 17 files changed, 38 insertions(+), 38 deletions(-) diff --git a/gstreamer-audio/src/audio_channel_position.rs b/gstreamer-audio/src/audio_channel_position.rs index 9a6b4625f..ef3c54684 100644 --- a/gstreamer-audio/src/audio_channel_position.rs +++ b/gstreamer-audio/src/audio_channel_position.rs @@ -65,7 +65,7 @@ impl AudioChannelPosition { assert_initialized_main_thread!(); if positions.len() > 64 { - return Err(glib::BoolError("Invalid number of channels")); + return Err(glib_bool_error!("Invalid number of channels")); } let len = positions.len(); @@ -85,7 +85,7 @@ impl AudioChannelPosition { } Ok(()) } else { - Err(glib::BoolError( + Err(glib_bool_error!( "Couldn't convert channel positions to mask", )) } @@ -97,7 +97,7 @@ impl AudioChannelPosition { assert_initialized_main_thread!(); if positions.len() > 64 { - return Err(glib::BoolError("Invalid number of channels")); + return Err(glib_bool_error!("Invalid number of channels")); } let len = positions.len(); @@ -123,7 +123,7 @@ impl AudioChannelPosition { } Ok(()) } else { - Err(glib::BoolError( + Err(glib_bool_error!( "Couldn't convert channel positions to mask", )) } @@ -174,7 +174,7 @@ pub fn buffer_reorder_channels( assert_initialized_main_thread!(); if from.len() != to.len() || from.len() > 64 { - return Err(glib::BoolError("Invalid number of channels")); + return Err(glib_bool_error!("Invalid number of channels")); } let from_len = from.len(); @@ -209,7 +209,7 @@ pub fn buffer_reorder_channels( if valid { Ok(()) } else { - Err(glib::BoolError("Failed to reorder channels")) + Err(glib_bool_error!("Failed to reorder channels")) } } @@ -223,7 +223,7 @@ pub fn reorder_channels( assert_initialized_main_thread!(); if from.len() != to.len() || from.len() > 64 { - return Err(glib::BoolError("Invalid number of channels")); + return Err(glib_bool_error!("Invalid number of channels")); } let from_len = from.len(); @@ -259,7 +259,7 @@ pub fn reorder_channels( if valid { Ok(()) } else { - Err(glib::BoolError("Failed to reorder channels")) + Err(glib_bool_error!("Failed to reorder channels")) } } @@ -271,7 +271,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::BoolError("Invalid number of channels")); + return Err(glib_bool_error!("Invalid number of channels")); } let from_len = from.len(); @@ -309,6 +309,6 @@ pub fn get_channel_reorder_map( } Ok(()) } else { - Err(glib::BoolError("Failed to reorder channels")) + Err(glib_bool_error!("Failed to reorder channels")) } } diff --git a/gstreamer-check/src/harness.rs b/gstreamer-check/src/harness.rs index 6b168c43b..0a97ea89f 100644 --- a/gstreamer-check/src/harness.rs +++ b/gstreamer-check/src/harness.rs @@ -180,7 +180,7 @@ impl Harness { pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> Result<(), glib::BoolError> { unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits), "Failed to crank multiple clock waits", ) @@ -189,7 +189,7 @@ impl Harness { pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> { unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_harness_crank_single_clock_wait(self.0.as_ptr()), "Failed to crank single clock wait", ) @@ -378,7 +378,7 @@ impl Harness { pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> { unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()), "Failed to set time", ) @@ -502,7 +502,7 @@ impl Harness { timeout: u32, ) -> Result<(), glib::BoolError> { unsafe { - glib::error::BoolError::from_glib( + 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-editing-services/src/lib.rs b/gstreamer-editing-services/src/lib.rs index ffb62175d..0c0e3e62e 100644 --- a/gstreamer-editing-services/src/lib.rs +++ b/gstreamer-editing-services/src/lib.rs @@ -35,14 +35,14 @@ pub use glib::{ pub fn init() -> Result<(), BoolError> { if gst::init().is_err() { - return Err(BoolError("Could not initialize GStreamer.")); + return Err(glib_bool_error!("Could not initialize GStreamer.")); } unsafe { if from_glib(ffi::ges_init()) { Ok(()) } else { - Err(BoolError("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 930eff1c7..05ff1b44d 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::BoolError("Child property not found")); + return Err(glib_bool_error!("Child property not found")); } let value = value.to_value(); diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index dccc4372b..c6ce4720a 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -213,7 +213,7 @@ impl EncodingContainerProfile { profile: &P, ) -> Result<(), glib::error::BoolError> { unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_encoding_container_profile_add_profile( self.to_glib_none().0, profile.to_glib_full(), diff --git a/gstreamer-pbutils/src/functions.rs b/gstreamer-pbutils/src/functions.rs index f0575addc..156668709 100644 --- a/gstreamer-pbutils/src/functions.rs +++ b/gstreamer-pbutils/src/functions.rs @@ -28,7 +28,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::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), codec_tag.to_glib_none().0, @@ -45,7 +45,7 @@ pub fn pb_utils_add_codec_description_to_tag_list( ) -> Result<(), glib::BoolError> { assert_initialized_main_thread!(); unsafe { - glib::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_pb_utils_add_codec_description_to_tag_list( taglist.as_mut_ptr(), ptr::null_mut(), diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index 99090b2a3..09e24ba7c 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -44,7 +44,7 @@ impl Player { pub fn set_config(&self, config: ::PlayerConfig) -> Result<(), glib::error::BoolError> { unsafe { - glib::error::BoolError::from_glib( + 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-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 32fbbaaac..b1c85e138 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::BoolError("Failed to copy video frame")) + Err(glib_bool_error!("Failed to copy video frame")) } } } @@ -73,7 +73,7 @@ impl VideoFrame { if res { Ok(()) } else { - Err(glib::BoolError("Failed to copy video frame plane")) + Err(glib_bool_error!("Failed to copy video frame plane")) } } } @@ -425,7 +425,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { if res { Ok(()) } else { - Err(glib::BoolError("Failed to copy video frame")) + Err(glib_bool_error!("Failed to copy video frame")) } } } @@ -442,7 +442,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { if res { Ok(()) } else { - Err(glib::BoolError("Failed to copy video frame plane")) + Err(glib_bool_error!("Failed to copy video frame plane")) } } } diff --git a/gstreamer-video/src/video_overlay_composition.rs b/gstreamer-video/src/video_overlay_composition.rs index 6dad3d440..cc1f51517 100644 --- a/gstreamer-video/src/video_overlay_composition.rs +++ b/gstreamer-video/src/video_overlay_composition.rs @@ -235,7 +235,7 @@ impl VideoOverlayCompositionRef { frame: &mut ::VideoFrameRef<&mut gst::BufferRef>, ) -> Result<(), glib::BoolError> { unsafe { - glib::BoolError::from_glib( + 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/src/bin.rs b/gstreamer/src/bin.rs index 7170c0047..29199aa94 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -46,7 +46,7 @@ impl> GstBinExtManual for O { let ret: bool = from_glib(ffi::gst_bin_add(self.to_glib_none().0, e.to_glib_none().0)); if !ret { - return Err(glib::BoolError("Failed to add elements")); + return Err(glib_bool_error!("Failed to add elements")); } } } @@ -62,7 +62,7 @@ impl> GstBinExtManual for O { e.to_glib_none().0, )); if !ret { - return Err(glib::BoolError("Failed to add elements")); + return Err(glib_bool_error!("Failed to add elements")); } } } diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index a3e0be964..49c1b2b98 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -226,7 +226,7 @@ impl BufferRef { ) -> Result<(), glib::BoolError> { let size_real = size.unwrap_or(usize::MAX); unsafe { - glib::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_buffer_copy_into( dest.as_mut_ptr(), self.as_mut_ptr(), diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index 69d960149..5daaff7a0 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -248,7 +248,7 @@ impl> BufferPoolExtManual for O { fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError> { unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_buffer_pool_set_config(self.to_glib_none().0, config.0.into_ptr()), "Failed to set config", ) diff --git a/gstreamer/src/child_proxy.rs b/gstreamer/src/child_proxy.rs index 137166151..b46ef0754 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::BoolError("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 e72399b91..1104ad304 100644 --- a/gstreamer/src/clock.rs +++ b/gstreamer/src/clock.rs @@ -206,7 +206,7 @@ impl> ClockExtManual for O { if res { Ok(()) } else { - Err(glib::BoolError("Failed to reinit periodic clock id")) + Err(glib_bool_error!("Failed to reinit periodic clock id")) } } } @@ -230,7 +230,7 @@ impl> ClockExtManual for O { if res { Ok(()) } else { - Err(glib::BoolError("Failed to reinit single shot clock id")) + Err(glib_bool_error!("Failed to reinit single shot clock id")) } } } diff --git a/gstreamer/src/element.rs b/gstreamer/src/element.rs index 74e419aa3..1610bfff5 100644 --- a/gstreamer/src/element.rs +++ b/gstreamer/src/element.rs @@ -48,7 +48,7 @@ impl Element { e2.to_glib_none().0, )); if !ret { - return Err(glib::BoolError("Failed to link elements")); + return Err(glib_bool_error!("Failed to link elements")); } } } @@ -528,7 +528,7 @@ impl> ElementExtManual for O { assert_eq!(stop.get_format(), start.get_format()); unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_element_seek( self.to_glib_none().0, rate, @@ -551,7 +551,7 @@ impl> ElementExtManual for O { ) -> Result<(), glib::error::BoolError> { let seek_pos = seek_pos.into(); unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_element_seek_simple( self.to_glib_none().0, seek_pos.get_format().to_glib(), diff --git a/gstreamer/src/pad.rs b/gstreamer/src/pad.rs index 019fda616..a2e16d322 100644 --- a/gstreamer/src/pad.rs +++ b/gstreamer/src/pad.rs @@ -627,7 +627,7 @@ impl> PadExtManual for O { fn start_task(&self, func: F) -> Result<(), glib::BoolError> { unsafe { - glib::error::BoolError::from_glib( + glib_result_from_gboolean!( ffi::gst_pad_start_task( self.to_glib_none().0, Some(trampoline_pad_task), diff --git a/gstreamer/src/typefind.rs b/gstreamer/src/typefind.rs index 1fe00ce8a..f8bb4e586 100644 --- a/gstreamer/src/typefind.rs +++ b/gstreamer/src/typefind.rs @@ -70,7 +70,7 @@ impl<'a> TypeFind<'a> { Some(type_find_closure_drop), ); - glib::error::BoolError::from_glib(res, "Failed to register typefind factory") + glib_result_from_gboolean!(res, "Failed to register typefind factory") } }