forked from mirrors/gstreamer-rs
BoolError: update to new build macros
See https://github.com/gtk-rs/glib/pull/419
This commit is contained in:
parent
3200574d31
commit
226070d216
17 changed files with 38 additions and 38 deletions
|
@ -65,7 +65,7 @@ impl AudioChannelPosition {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
if positions.len() > 64 {
|
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();
|
let len = positions.len();
|
||||||
|
@ -85,7 +85,7 @@ impl AudioChannelPosition {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(glib::BoolError(
|
Err(glib_bool_error!(
|
||||||
"Couldn't convert channel positions to mask",
|
"Couldn't convert channel positions to mask",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ impl AudioChannelPosition {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
if positions.len() > 64 {
|
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();
|
let len = positions.len();
|
||||||
|
@ -123,7 +123,7 @@ impl AudioChannelPosition {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(glib::BoolError(
|
Err(glib_bool_error!(
|
||||||
"Couldn't convert channel positions to mask",
|
"Couldn't convert channel positions to mask",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ pub fn buffer_reorder_channels(
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
if from.len() != to.len() || from.len() > 64 {
|
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();
|
let from_len = from.len();
|
||||||
|
@ -209,7 +209,7 @@ pub fn buffer_reorder_channels(
|
||||||
if valid {
|
if valid {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
if from.len() != to.len() || from.len() > 64 {
|
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();
|
let from_len = from.len();
|
||||||
|
@ -259,7 +259,7 @@ pub fn reorder_channels(
|
||||||
if valid {
|
if valid {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
if from.len() != to.len() || from.len() != reorder_map.len() || from.len() > 64 {
|
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();
|
let from_len = from.len();
|
||||||
|
@ -309,6 +309,6 @@ pub fn get_channel_reorder_map(
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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> {
|
pub fn crank_multiple_clock_waits(&mut self, waits: u32) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits),
|
ffi::gst_harness_crank_multiple_clock_waits(self.0.as_ptr(), waits),
|
||||||
"Failed to crank multiple clock waits",
|
"Failed to crank multiple clock waits",
|
||||||
)
|
)
|
||||||
|
@ -189,7 +189,7 @@ impl Harness {
|
||||||
|
|
||||||
pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> {
|
pub fn crank_single_clock_wait(&mut self) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_harness_crank_single_clock_wait(self.0.as_ptr()),
|
ffi::gst_harness_crank_single_clock_wait(self.0.as_ptr()),
|
||||||
"Failed to crank single clock wait",
|
"Failed to crank single clock wait",
|
||||||
)
|
)
|
||||||
|
@ -378,7 +378,7 @@ impl Harness {
|
||||||
|
|
||||||
pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> {
|
pub fn set_time(&mut self, time: gst::ClockTime) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()),
|
ffi::gst_harness_set_time(self.0.as_ptr(), time.to_glib()),
|
||||||
"Failed to set time",
|
"Failed to set time",
|
||||||
)
|
)
|
||||||
|
@ -502,7 +502,7 @@ impl Harness {
|
||||||
timeout: u32,
|
timeout: u32,
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_harness_wait_for_clock_id_waits(self.0.as_ptr(), waits, timeout),
|
ffi::gst_harness_wait_for_clock_id_waits(self.0.as_ptr(), waits, timeout),
|
||||||
"Failed to wait for clock id waits",
|
"Failed to wait for clock id waits",
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,14 +35,14 @@ pub use glib::{
|
||||||
|
|
||||||
pub fn init() -> Result<(), BoolError> {
|
pub fn init() -> Result<(), BoolError> {
|
||||||
if gst::init().is_err() {
|
if gst::init().is_err() {
|
||||||
return Err(BoolError("Could not initialize GStreamer."));
|
return Err(glib_bool_error!("Could not initialize GStreamer."));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if from_glib(ffi::ges_init()) {
|
if from_glib(ffi::ges_init()) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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(),
|
ptr::null_mut(),
|
||||||
));
|
));
|
||||||
if !found {
|
if !found {
|
||||||
return Err(glib::BoolError("Child property not found"));
|
return Err(glib_bool_error!("Child property not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let value = value.to_value();
|
let value = value.to_value();
|
||||||
|
|
|
@ -213,7 +213,7 @@ impl EncodingContainerProfile {
|
||||||
profile: &P,
|
profile: &P,
|
||||||
) -> Result<(), glib::error::BoolError> {
|
) -> Result<(), glib::error::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_encoding_container_profile_add_profile(
|
ffi::gst_encoding_container_profile_add_profile(
|
||||||
self.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
profile.to_glib_full(),
|
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!();
|
assert_initialized_main_thread!();
|
||||||
let codec_tag = T::tag_name();
|
let codec_tag = T::tag_name();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_pb_utils_add_codec_description_to_tag_list(
|
ffi::gst_pb_utils_add_codec_description_to_tag_list(
|
||||||
taglist.as_mut_ptr(),
|
taglist.as_mut_ptr(),
|
||||||
codec_tag.to_glib_none().0,
|
codec_tag.to_glib_none().0,
|
||||||
|
@ -45,7 +45,7 @@ pub fn pb_utils_add_codec_description_to_tag_list(
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_pb_utils_add_codec_description_to_tag_list(
|
ffi::gst_pb_utils_add_codec_description_to_tag_list(
|
||||||
taglist.as_mut_ptr(),
|
taglist.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl Player {
|
||||||
|
|
||||||
pub fn set_config(&self, config: ::PlayerConfig) -> Result<(), glib::error::BoolError> {
|
pub fn set_config(&self, config: ::PlayerConfig) -> Result<(), glib::error::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_player_set_config(self.to_glib_none().0, config.into_ptr()),
|
ffi::gst_player_set_config(self.to_glib_none().0, config.into_ptr()),
|
||||||
"Failed to set config",
|
"Failed to set config",
|
||||||
)
|
)
|
||||||
|
|
|
@ -56,7 +56,7 @@ impl<T> VideoFrame<T> {
|
||||||
if res {
|
if res {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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 {
|
if res {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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 {
|
if res {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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 {
|
if res {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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>,
|
frame: &mut ::VideoFrameRef<&mut gst::BufferRef>,
|
||||||
) -> Result<(), glib::BoolError> {
|
) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_video_overlay_composition_blend(self.as_mut_ptr(), frame.as_mut_ptr()),
|
ffi::gst_video_overlay_composition_blend(self.as_mut_ptr(), frame.as_mut_ptr()),
|
||||||
"Failed to blend overlay composition",
|
"Failed to blend overlay composition",
|
||||||
)
|
)
|
||||||
|
|
|
@ -46,7 +46,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
||||||
let ret: bool =
|
let ret: bool =
|
||||||
from_glib(ffi::gst_bin_add(self.to_glib_none().0, e.to_glib_none().0));
|
from_glib(ffi::gst_bin_add(self.to_glib_none().0, e.to_glib_none().0));
|
||||||
if !ret {
|
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,
|
e.to_glib_none().0,
|
||||||
));
|
));
|
||||||
if !ret {
|
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> {
|
) -> Result<(), glib::BoolError> {
|
||||||
let size_real = size.unwrap_or(usize::MAX);
|
let size_real = size.unwrap_or(usize::MAX);
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_buffer_copy_into(
|
ffi::gst_buffer_copy_into(
|
||||||
dest.as_mut_ptr(),
|
dest.as_mut_ptr(),
|
||||||
self.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> {
|
fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError> {
|
||||||
unsafe {
|
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()),
|
ffi::gst_buffer_pool_set_config(self.to_glib_none().0, config.0.into_ptr()),
|
||||||
"Failed to set config",
|
"Failed to set config",
|
||||||
)
|
)
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl<O: IsA<ChildProxy>> ChildProxyExtManual for O {
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
));
|
));
|
||||||
if !found {
|
if !found {
|
||||||
return Err(glib::BoolError("Child property not found"));
|
return Err(glib_bool_error!("Child property not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let value = value.to_value();
|
let value = value.to_value();
|
||||||
|
|
|
@ -206,7 +206,7 @@ impl<O: IsA<Clock>> ClockExtManual for O {
|
||||||
if res {
|
if res {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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 {
|
if res {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} 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,
|
e2.to_glib_none().0,
|
||||||
));
|
));
|
||||||
if !ret {
|
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());
|
assert_eq!(stop.get_format(), start.get_format());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_element_seek(
|
ffi::gst_element_seek(
|
||||||
self.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
rate,
|
rate,
|
||||||
|
@ -551,7 +551,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
||||||
) -> Result<(), glib::error::BoolError> {
|
) -> Result<(), glib::error::BoolError> {
|
||||||
let seek_pos = seek_pos.into();
|
let seek_pos = seek_pos.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_element_seek_simple(
|
ffi::gst_element_seek_simple(
|
||||||
self.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
seek_pos.get_format().to_glib(),
|
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> {
|
fn start_task<F: FnMut() + Send + 'static>(&self, func: F) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
glib::error::BoolError::from_glib(
|
glib_result_from_gboolean!(
|
||||||
ffi::gst_pad_start_task(
|
ffi::gst_pad_start_task(
|
||||||
self.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
Some(trampoline_pad_task),
|
Some(trampoline_pad_task),
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl<'a> TypeFind<'a> {
|
||||||
Some(type_find_closure_drop),
|
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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue