Commit e2970db8 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Failure to post a message is an error, so return a Result instead of a bool

parent 6d8cfa5d
......@@ -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]
......
......@@ -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")
}
}
......
......@@ -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<Clock>;
......@@ -373,9 +373,9 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> 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")
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment