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

Use new bool_return_is_error configuration for various functions

And ignore some wrong bindings.
parent 6b4e3e9b
......@@ -12,19 +12,13 @@ external_libraries = [
]
generate = [
"Gst.Object",
"Gst.Bus",
"Gst.Clock",
"Gst.ClockTime",
"Gst.Element",
"Gst.Bin",
"Gst.Pipeline",
"Gst.State",
"Gst.StateChangeReturn",
"Gst.StateChange",
"Gst.SeekFlags",
"Gst.SeekType",
"Gst.Pad",
"Gst.FlowReturn",
"Gst.PadDirection",
"Gst.PadTemplate",
......@@ -39,3 +33,148 @@ manual = [
"GLib.Error",
#"Gst.Message",
]
[[object]]
name = "Gst.Bin"
status = "generate"
[[object.function]]
name = "add"
[object.function.return]
bool_return_is_error = "Failed to add element"
[[object.function]]
name = "remove"
[object.function.return]
bool_return_is_error = "Failed to remove element"
[[object.function]]
name = "recalculate_latency"
[object.function.return]
bool_return_is_error = "Failed to recalculate latency"
[[object.function]]
name = "sync_children_states"
[object.function.return]
bool_return_is_error = "Failed to sync children states"
[[object]]
name = "Gst.Bus"
status = "generate"
[[object.function]]
name = "remove_watch"
# Needs manual bindings and GSource support in glib-rs
ignore = true
[[object]]
name = "Gst.Clock"
status = "generate"
[[object.function]]
name = "set_master"
[object.function.return]
bool_return_is_error = "Failed to set master clock"
[[object.function]]
name = "wait_for_sync"
[object.function.return]
bool_return_is_error = "Timed out waiting for sync"
[[object]]
name = "Gst.Element"
status = "generate"
[[object.function]]
name = "add_pad"
[object.function.return]
bool_return_is_error = "Failed to add pad"
[[object.function]]
name = "remove_pad"
[object.function.return]
bool_return_is_error = "Failed to remove pad"
[[object.function]]
name = "link"
[object.function.return]
bool_return_is_error = "Failed to link elements"
[[object.function]]
name = "link_pads"
[object.function.return]
bool_return_is_error = "Failed to link pads"
[[object.function]]
name = "seek"
[object.function.return]
bool_return_is_error = "Failed to seek"
[[object.function]]
name = "seek_simple"
[object.function.return]
bool_return_is_error = "Failed to seek"
[[object.function]]
name = "set_clock"
[object.function.return]
bool_return_is_error = "Failed to set clock"
[[object.function]]
name = "sync_state_with_parent"
[object.function.return]
bool_return_is_error = "Failed to sync state with parent"
[[object]]
name = "Gst.Object"
status = "generate"
[[object.function]]
name = "set_name"
[object.function.return]
bool_return_is_error = "Failed to set object name"
[[object.function]]
name = "set_parent"
[object.function.return]
bool_return_is_error = "Failed to set parent object"
[[object.function]]
name = "sync_values"
[object.function.return]
bool_return_is_error = "Failed to sync values"
[[object]]
name = "Gst.Pad"
status = "generate"
[[object.function]]
name = "link_maybe_ghosting"
[object.function.return]
bool_return_is_error = "Failed to link pad, possibly ghosting"
[[object.function]]
name = "unlink"
[object.function.return]
bool_return_is_error = "Failed to unlink pad"
[[object.function]]
name = "pause_task"
[object.function.return]
bool_return_is_error = "Failed to pause pad task"
[[object.function]]
name = "stop_task"
[object.function.return]
bool_return_is_error = "Failed to stop pad task"
[[object.function]]
name = "set_active"
[object.function.return]
bool_return_is_error = "Failed to activate pad"
[[object]]
name = "Gst.*"
status = "generate"
[[object.function]]
name = "update_registry"
[object.function.return]
bool_return_is_error = "Failed to update registry"
[[object.function]]
name = "util_dump_mem"
ignore = true
......@@ -36,7 +36,7 @@ impl Bin {
}
pub trait BinExt {
fn add<P: IsA<Element>>(&self, element: &P) -> bool;
fn add<P: IsA<Element>>(&self, element: &P) -> Result<(), glib::error::BoolError>;
//fn add_many<P: IsA<Element>>(&self, element_1: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
......@@ -63,9 +63,9 @@ pub trait BinExt {
//fn iterate_sources(&self) -> /*Ignored*/Option<Iterator>;
fn recalculate_latency(&self) -> bool;
fn recalculate_latency(&self) -> Result<(), glib::error::BoolError>;
fn remove<P: IsA<Element>>(&self, element: &P) -> bool;
fn remove<P: IsA<Element>>(&self, element: &P) -> Result<(), glib::error::BoolError>;
//fn remove_many<P: IsA<Element>>(&self, element_1: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
......@@ -73,7 +73,7 @@ pub trait BinExt {
//fn set_suppressed_flags(&self, flags: /*Ignored*/ElementFlags);
#[cfg(feature = "v1_6")]
fn sync_children_states(&self) -> bool;
fn sync_children_states(&self) -> Result<(), glib::error::BoolError>;
fn get_property_async_handling(&self) -> bool;
......@@ -97,9 +97,9 @@ pub trait BinExt {
}
impl<O: IsA<Bin> + IsA<glib::object::Object>> BinExt for O {
fn add<P: IsA<Element>>(&self, element: &P) -> bool {
fn add<P: IsA<Element>>(&self, element: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_bin_add(self.to_glib_none().0, element.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_bin_add(self.to_glib_none().0, element.to_glib_none().0), "Failed to add element")
}
}
......@@ -160,15 +160,15 @@ impl<O: IsA<Bin> + IsA<glib::object::Object>> BinExt for O {
// unsafe { TODO: call ffi::gst_bin_iterate_sources() }
//}
fn recalculate_latency(&self) -> bool {
fn recalculate_latency(&self) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_bin_recalculate_latency(self.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_bin_recalculate_latency(self.to_glib_none().0), "Failed to recalculate latency")
}
}
fn remove<P: IsA<Element>>(&self, element: &P) -> bool {
fn remove<P: IsA<Element>>(&self, element: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_bin_remove(self.to_glib_none().0, element.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_bin_remove(self.to_glib_none().0, element.to_glib_none().0), "Failed to remove element")
}
}
......@@ -182,9 +182,9 @@ impl<O: IsA<Bin> + IsA<glib::object::Object>> BinExt for O {
//}
#[cfg(feature = "v1_6")]
fn sync_children_states(&self) -> bool {
fn sync_children_states(&self) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_bin_sync_children_states(self.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_bin_sync_children_states(self.to_glib_none().0), "Failed to sync children states")
}
}
......
......@@ -53,9 +53,6 @@ pub trait BusExt {
fn remove_signal_watch(&self);
#[cfg(feature = "v1_6")]
fn remove_watch(&self) -> bool;
fn set_flushing(&self, flushing: bool);
//fn set_sync_handler<'a, P: Into<Option<&'a /*Unimplemented*/BusSyncHandler>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
......@@ -144,13 +141,6 @@ impl<O: IsA<Bus>> BusExt for O {
}
}
#[cfg(feature = "v1_6")]
fn remove_watch(&self) -> bool {
unsafe {
from_glib(ffi::gst_bus_remove_watch(self.to_glib_none().0))
}
}
fn set_flushing(&self, flushing: bool) {
unsafe {
ffi::gst_bus_set_flushing(self.to_glib_none().0, flushing.to_glib());
......
......@@ -94,7 +94,7 @@ pub trait ClockExt {
fn set_calibration(&self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime);
fn set_master<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, master: Q) -> bool;
fn set_master<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, master: Q) -> Result<(), glib::error::BoolError>;
fn set_resolution(&self, resolution: ClockTime) -> ClockTime;
......@@ -111,7 +111,7 @@ pub trait ClockExt {
fn unadjust_with_calibration(&self, external_target: ClockTime, cinternal: ClockTime, cexternal: ClockTime, cnum: ClockTime, cdenom: ClockTime) -> ClockTime;
#[cfg(feature = "v1_6")]
fn wait_for_sync(&self, timeout: ClockTime) -> bool;
fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError>;
fn get_property_window_size(&self) -> i32;
......@@ -226,11 +226,11 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
}
fn set_master<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, master: Q) -> bool {
fn set_master<'a, P: IsA<Clock> + 'a, Q: Into<Option<&'a P>>>(&self, master: Q) -> Result<(), glib::error::BoolError> {
let master = master.into();
let master = master.to_glib_none();
unsafe {
from_glib(ffi::gst_clock_set_master(self.to_glib_none().0, master.0))
glib::error::BoolError::from_glib(ffi::gst_clock_set_master(self.to_glib_none().0, master.0), "Failed to set master clock")
}
}
......@@ -271,9 +271,9 @@ impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExt for O {
}
#[cfg(feature = "v1_6")]
fn wait_for_sync(&self, timeout: ClockTime) -> bool {
fn wait_for_sync(&self, timeout: ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_clock_wait_for_sync(self.to_glib_none().0, timeout))
glib::error::BoolError::from_glib(ffi::gst_clock_wait_for_sync(self.to_glib_none().0, timeout), "Timed out waiting for sync")
}
}
......
......@@ -69,7 +69,7 @@ impl Element {
pub trait ElementExt {
fn abort_state(&self);
fn add_pad<P: IsA<Pad>>(&self, pad: &P) -> bool;
fn add_pad<P: IsA<Pad>>(&self, pad: &P) -> Result<(), glib::error::BoolError>;
#[cfg(feature = "v1_10")]
fn add_property_deep_notify_watch<'a, P: Into<Option<&'a str>>>(&self, property_name: P, include_value: bool) -> libc::c_ulong;
......@@ -123,13 +123,13 @@ pub trait ElementExt {
//fn iterate_src_pads(&self) -> /*Ignored*/Option<Iterator>;
fn link<P: IsA<Element>>(&self, dest: &P) -> bool;
fn link<P: IsA<Element>>(&self, dest: &P) -> Result<(), glib::error::BoolError>;
//fn link_filtered<'a, P: IsA<Element>, Q: Into<Option<&'a /*Ignored*/Caps>>>(&self, dest: &P, filter: Q) -> bool;
//fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool;
fn link_pads<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R) -> bool;
fn link_pads<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R) -> Result<(), glib::error::BoolError>;
//fn link_pads_filtered<'a, 'b, 'c, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>, S: Into<Option<&'c /*Ignored*/Caps>>>(&self, srcpadname: P, dest: &Q, destpadname: R, filter: S) -> bool;
......@@ -158,16 +158,16 @@ pub trait ElementExt {
fn release_request_pad<P: IsA<Pad>>(&self, pad: &P);
fn remove_pad<P: IsA<Pad>>(&self, pad: &P) -> bool;
fn remove_pad<P: IsA<Pad>>(&self, pad: &P) -> Result<(), glib::error::BoolError>;
#[cfg(feature = "v1_10")]
fn remove_property_notify_watch(&self, watch_id: libc::c_ulong);
//fn request_pad<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b /*Ignored*/Caps>>>(&self, templ: &PadTemplate, name: P, caps: Q) -> Option<Pad>;
fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> bool;
fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> Result<(), glib::error::BoolError>;
fn seek_simple(&self, format: Format, seek_flags: SeekFlags, seek_pos: i64) -> bool;
fn seek_simple(&self, format: Format, seek_flags: SeekFlags, seek_pos: i64) -> Result<(), glib::error::BoolError>;
//fn send_event(&self, event: /*Ignored*/&mut Event) -> bool;
......@@ -175,7 +175,7 @@ pub trait ElementExt {
fn set_bus(&self, bus: &Bus);
fn set_clock<P: IsA<Clock>>(&self, clock: &P) -> bool;
fn set_clock<P: IsA<Clock>>(&self, clock: &P) -> Result<(), glib::error::BoolError>;
//fn set_context(&self, context: /*Ignored*/&mut Context);
......@@ -185,7 +185,7 @@ pub trait ElementExt {
fn set_state(&self, state: State) -> StateChangeReturn;
fn sync_state_with_parent(&self) -> bool;
fn sync_state_with_parent(&self) -> Result<(), glib::error::BoolError>;
fn unlink<P: IsA<Element>>(&self, dest: &P);
......@@ -207,9 +207,9 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
}
}
fn add_pad<P: IsA<Pad>>(&self, pad: &P) -> bool {
fn add_pad<P: IsA<Pad>>(&self, pad: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_element_add_pad(self.to_glib_none().0, pad.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_element_add_pad(self.to_glib_none().0, pad.to_glib_none().0), "Failed to add pad")
}
}
......@@ -348,9 +348,9 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
// unsafe { TODO: call ffi::gst_element_iterate_src_pads() }
//}
fn link<P: IsA<Element>>(&self, dest: &P) -> bool {
fn link<P: IsA<Element>>(&self, dest: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_element_link(self.to_glib_none().0, dest.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_element_link(self.to_glib_none().0, dest.to_glib_none().0), "Failed to link elements")
}
}
......@@ -362,13 +362,13 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
// unsafe { TODO: call ffi::gst_element_link_many() }
//}
fn link_pads<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R) -> bool {
fn link_pads<'a, 'b, P: Into<Option<&'a str>>, Q: IsA<Element>, R: Into<Option<&'b str>>>(&self, srcpadname: P, dest: &Q, destpadname: R) -> Result<(), glib::error::BoolError> {
let srcpadname = srcpadname.into();
let srcpadname = srcpadname.to_glib_none();
let destpadname = destpadname.into();
let destpadname = destpadname.to_glib_none();
unsafe {
from_glib(ffi::gst_element_link_pads(self.to_glib_none().0, srcpadname.0, dest.to_glib_none().0, destpadname.0))
glib::error::BoolError::from_glib(ffi::gst_element_link_pads(self.to_glib_none().0, srcpadname.0, dest.to_glib_none().0, destpadname.0), "Failed to link pads")
}
}
......@@ -445,9 +445,9 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
}
}
fn remove_pad<P: IsA<Pad>>(&self, pad: &P) -> bool {
fn remove_pad<P: IsA<Pad>>(&self, pad: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_element_remove_pad(self.to_glib_none().0, pad.to_glib_full()))
glib::error::BoolError::from_glib(ffi::gst_element_remove_pad(self.to_glib_none().0, pad.to_glib_full()), "Failed to remove pad")
}
}
......@@ -462,15 +462,15 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
// unsafe { TODO: call ffi::gst_element_request_pad() }
//}
fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> bool {
fn seek(&self, rate: f64, format: Format, flags: SeekFlags, start_type: SeekType, start: i64, stop_type: SeekType, stop: i64) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_element_seek(self.to_glib_none().0, rate, format.to_glib(), flags.to_glib(), start_type.to_glib(), start, stop_type.to_glib(), stop))
glib::error::BoolError::from_glib(ffi::gst_element_seek(self.to_glib_none().0, rate, format.to_glib(), flags.to_glib(), start_type.to_glib(), start, stop_type.to_glib(), stop), "Failed to seek")
}
}
fn seek_simple(&self, format: Format, seek_flags: SeekFlags, seek_pos: i64) -> bool {
fn seek_simple(&self, format: Format, seek_flags: SeekFlags, seek_pos: i64) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_element_seek_simple(self.to_glib_none().0, format.to_glib(), seek_flags.to_glib(), seek_pos))
glib::error::BoolError::from_glib(ffi::gst_element_seek_simple(self.to_glib_none().0, format.to_glib(), seek_flags.to_glib(), seek_pos), "Failed to seek")
}
}
......@@ -490,9 +490,9 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
}
}
fn set_clock<P: IsA<Clock>>(&self, clock: &P) -> bool {
fn set_clock<P: IsA<Clock>>(&self, clock: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_element_set_clock(self.to_glib_none().0, clock.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_element_set_clock(self.to_glib_none().0, clock.to_glib_none().0), "Failed to set clock")
}
}
......@@ -518,9 +518,9 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
}
}
fn sync_state_with_parent(&self) -> bool {
fn sync_state_with_parent(&self) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_element_sync_state_with_parent(self.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_element_sync_state_with_parent(self.to_glib_none().0), "Failed to sync state with parent")
}
}
......
......@@ -70,6 +70,8 @@ mod alias;
pub use self::alias::ClockTime;
pub use self::alias::ElementFactoryListType;
pub mod functions;
#[doc(hidden)]
pub mod traits {
pub use super::BinExt;
......
......@@ -4,6 +4,7 @@
use ClockTime;
use Error;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
......@@ -73,13 +74,13 @@ pub trait ObjectExt {
fn set_control_rate(&self, control_rate: ClockTime);
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> bool;
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Result<(), glib::error::BoolError>;
fn set_parent<P: IsA<Object>>(&self, parent: &P) -> bool;
fn set_parent<P: IsA<Object>>(&self, parent: &P) -> Result<(), glib::error::BoolError>;
fn suggest_next_sync(&self) -> ClockTime;
fn sync_values(&self, timestamp: ClockTime) -> bool;
fn sync_values(&self, timestamp: ClockTime) -> Result<(), glib::error::BoolError>;
fn unparent(&self);
......@@ -186,17 +187,17 @@ impl<O: IsA<Object>> ObjectExt for O {
}
}
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> bool {
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Result<(), glib::error::BoolError> {
let name = name.into();
let name = name.to_glib_none();
unsafe {
from_glib(ffi::gst_object_set_name(self.to_glib_none().0, name.0))
glib::error::BoolError::from_glib(ffi::gst_object_set_name(self.to_glib_none().0, name.0), "Failed to set object name")
}
}
fn set_parent<P: IsA<Object>>(&self, parent: &P) -> bool {
fn set_parent<P: IsA<Object>>(&self, parent: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_object_set_parent(self.to_glib_none().0, parent.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_object_set_parent(self.to_glib_none().0, parent.to_glib_none().0), "Failed to set parent object")
}
}
......@@ -206,9 +207,9 @@ impl<O: IsA<Object>> ObjectExt for O {
}
}
fn sync_values(&self, timestamp: ClockTime) -> bool {
fn sync_values(&self, timestamp: ClockTime) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_object_sync_values(self.to_glib_none().0, timestamp))
glib::error::BoolError::from_glib(ffi::gst_object_sync_values(self.to_glib_none().0, timestamp), "Failed to sync values")
}
}
......
......@@ -133,7 +133,7 @@ pub trait PadExt {
//fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: /*Ignored*/PadLinkCheck) -> /*Ignored*/PadLinkReturn;
#[cfg(feature = "v1_10")]
fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> bool;
fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError>;
//#[cfg(feature = "v1_10")]
//fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: /*Ignored*/PadLinkCheck) -> bool;
......@@ -142,7 +142,7 @@ pub trait PadExt {
fn needs_reconfigure(&self) -> bool;
fn pause_task(&self) -> bool;
fn pause_task(&self) -> Result<(), glib::error::BoolError>;
//fn peer_query(&self, query: /*Ignored*/&mut Query) -> bool;
......@@ -190,7 +190,7 @@ pub trait PadExt {
//fn set_activatemode_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activatemode: /*Unknown conversion*//*Unimplemented*/PadActivateModeFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
fn set_active(&self, active: bool) -> bool;
fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError>;
//fn set_chain_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, chain: /*Unknown conversion*//*Unimplemented*/PadChainFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
......@@ -219,12 +219,12 @@ pub trait PadExt {
//fn sticky_events_foreach<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, foreach_func: /*Unknown conversion*//*Unimplemented*/PadStickyEventsForeachFunction, user_data: P);
fn stop_task(&self) -> bool;
fn stop_task(&self) -> Result<(), glib::error::BoolError>;
//#[cfg(feature = "v1_2")]
//fn store_sticky_event(&self, event: /*Ignored*/&mut Event) -> FlowReturn;
fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> bool;
fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError>;
fn use_fixed_caps(&self);
......@@ -417,9 +417,9 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
//}
#[cfg(feature = "v1_10")]
fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> bool {
fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_pad_link_maybe_ghosting(self.to_glib_none().0, sink.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_pad_link_maybe_ghosting(self.to_glib_none().0, sink.to_glib_none().0), "Failed to link pad, possibly ghosting")
}
}
......@@ -440,9 +440,9 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
}
}
fn pause_task(&self) -> bool {
fn pause_task(&self) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_pad_pause_task(self.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_pad_pause_task(self.to_glib_none().0), "Failed to pause pad task")
}
}
......@@ -564,9 +564,9 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
// unsafe { TODO: call ffi::gst_pad_set_activatemode_function_full() }
//}
fn set_active(&self, active: bool) -> bool {
fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_pad_set_active(self.to_glib_none().0, active.to_glib()))
glib::error::BoolError::from_glib(ffi::gst_pad_set_active(self.to_glib_none().0, active.to_glib()), "Failed to activate pad")
}
}
......@@ -625,9 +625,9 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
// unsafe { TODO: call ffi::gst_pad_sticky_events_foreach() }
//}
fn stop_task(&self) -> bool {
fn stop_task(&self) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_pad_stop_task(self.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_pad_stop_task(self.to_glib_none().0), "Failed to stop pad task")
}
}
......@@ -636,9 +636,9 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
// unsafe { TODO: call ffi::gst_pad_store_sticky_event() }
//}
fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> bool {
fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError> {
unsafe {
from_glib(ffi::gst_pad_unlink(self.to_glib_none().0, sinkpad.to_glib_none().0))
glib::error::BoolError::from_glib(ffi::gst_pad_unlink(self.to_glib_none().0, sinkpad.to_glib_none().0), "Failed to unlink pad")
}
}
......
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