Commit 226070d2 authored by François Laignel's avatar François Laignel

BoolError: update to new build macros

See https://github.com/gtk-rs/glib/pull/419
parent 3200574d
Pipeline #13963 passed with stages
in 9 minutes and 45 seconds
......@@ -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"))
}
}
......@@ -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",
)
......
......@@ -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."))
}
}
}
......
......@@ -50,7 +50,7 @@ impl<O: IsA<TimelineElement>> 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();
......
......@@ -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(),
......
......@@ -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(),
......
......@@ -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",
)
......
......@@ -56,7 +56,7 @@ impl<T> VideoFrame<T> {
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<T> VideoFrame<T> {
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"))
}
}
}
......
......@@ -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",
)
......
......@@ -46,7 +46,7 @@ impl<O: IsA<Bin>> 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<O: IsA<Bin>> 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"));
}
}
}
......
......@@ -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(),
......
......@@ -248,7 +248,7 @@ impl<O: IsA<BufferPool>> 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",
)
......
......@@ -50,7 +50,7 @@ impl<O: IsA<ChildProxy>> 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();
......
......@@ -206,7 +206,7 @@ impl<O: IsA<Clock>> 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<O: IsA<Clock>> 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"))
}
}
}
......
......@@ -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<O: IsA<Element>> 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<O: IsA<Element>> 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(),
......
......@@ -627,7 +627,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
fn start_task<F: FnMut() + Send + 'static>(&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),
......
......@@ -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")
}
}
......
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