From e2970db84c71bb5d9d72ec992ad9821d38db7828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 20 Dec 2017 18:07:28 +0200 Subject: [PATCH] Failure to post a message is an error, so return a Result instead of a bool --- Gir_Gst.toml | 9 +++++++++ gstreamer/src/auto/bus.rs | 5 +++-- gstreamer/src/auto/element.rs | 6 +++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Gir_Gst.toml b/Gir_Gst.toml index c0e36571f..8a719cf19 100644 --- a/Gir_Gst.toml +++ b/Gir_Gst.toml @@ -147,6 +147,10 @@ trait = false name = "message" concurrency = "send" + [[object.function]] + name = "post" + [object.function.return] + bool_return_is_error = "Failed to post message" [[object]] name = "Gst.Structure" @@ -277,6 +281,11 @@ status = "generate" [object.function.return] bool_return_is_error = "Failed to link pads" + [[object.function]] + name = "post_message" + [object.function.return] + bool_return_is_error = "Failed to post message" + [[object.function]] name = "seek" [object.function.return] diff --git a/gstreamer/src/auto/bus.rs b/gstreamer/src/auto/bus.rs index d89a8c911..70db0640e 100644 --- a/gstreamer/src/auto/bus.rs +++ b/gstreamer/src/auto/bus.rs @@ -5,6 +5,7 @@ use ClockTime; use Message; use Object; use ffi; +use glib; use glib::signal::SignalHandlerId; use glib::signal::connect; use glib::translate::*; @@ -79,9 +80,9 @@ impl Bus { } } - pub fn post(&self, message: &Message) -> bool { + pub fn post(&self, message: &Message) -> Result<(), glib::error::BoolError> { unsafe { - from_glib(ffi::gst_bus_post(self.to_glib_none().0, message.to_glib_full())) + glib::error::BoolError::from_glib(ffi::gst_bus_post(self.to_glib_none().0, message.to_glib_full()), "Failed to post message") } } diff --git a/gstreamer/src/auto/element.rs b/gstreamer/src/auto/element.rs index af72eabbb..134891759 100644 --- a/gstreamer/src/auto/element.rs +++ b/gstreamer/src/auto/element.rs @@ -132,7 +132,7 @@ pub trait ElementExt { fn no_more_pads(&self); - fn post_message(&self, message: &Message) -> bool; + fn post_message(&self, message: &Message) -> Result<(), glib::error::BoolError>; fn provide_clock(&self) -> Option; @@ -373,9 +373,9 @@ impl + IsA> ElementExt for O { } } - fn post_message(&self, message: &Message) -> bool { + fn post_message(&self, message: &Message) -> Result<(), glib::error::BoolError> { unsafe { - from_glib(ffi::gst_element_post_message(self.to_glib_none().0, message.to_glib_full())) + glib::error::BoolError::from_glib(ffi::gst_element_post_message(self.to_glib_none().0, message.to_glib_full()), "Failed to post message") } }