ges: Mark more method as returning BoolError

This commit is contained in:
Thibault Saunier 2018-11-04 15:30:58 -03:00
parent 25e0baf483
commit 6570d67828
5 changed files with 91 additions and 29 deletions

View file

@ -41,12 +41,10 @@ generate = [
"GES.Edge", "GES.Edge",
"GES.Effect", "GES.Effect",
"GES.TrackType", "GES.TrackType",
"GES.Pipeline",
"GES.BaseEffect", "GES.BaseEffect",
"GES.TimelineElement", "GES.TimelineElement",
"GES.Group", "GES.Group",
"GES.TrackElement", "GES.TrackElement",
"GES.Track",
"GES.Layer", "GES.Layer",
"GES.Clip", "GES.Clip",
"GES.UriClip", "GES.UriClip",
@ -95,6 +93,32 @@ status = "generate"
[object.function.return] [object.function.return]
nullable = false nullable = false
[[object.function]]
name = "load_from_uri"
[object.function.return]
bool_return_is_error = "Failed to load from uri"
[[object.function]]
name = "add_layer"
[object.function.return]
bool_return_is_error = "Failed to add layer"
[[object.function]]
name = "remove_layer"
[object.function.return]
bool_return_is_error = "Failed to remove layer"
[[object.function]]
name = "add_track"
[object.function.return]
bool_return_is_error = "Failed to add track"
[[object.function]]
name = "move_layer"
[object.function.return]
bool_return_is_error = "Failed to move layer"
[[object]] [[object]]
name = "GES.Container" name = "GES.Container"
status = "generate" status = "generate"
@ -106,5 +130,43 @@ trait_name = "GESContainerExt"
[[object.function]] [[object.function]]
name = "remove" name = "remove"
[object.function.return]
bool_return_is_error = "Failed to remove element"
[[object.function]]
name = "edit"
[object.function.return]
bool_return_is_error = "Failed to edit container"
[[object]]
name = "GES.Pipeline"
status = "generate"
trait_name = "PipelineExt"
[[object.function]]
name = "set_render_settings"
[object.function.return]
bool_return_is_error = "Failed to set render settings"
[[object.function]]
name = "set_mode"
[object.function.return]
bool_return_is_error = "Failed to set mode"
[[object.function]]
name = "save_thumbnail"
[object.function.return]
bool_return_is_error = "Failed to save thumbnail"
[[object]]
name = "GES.Track"
status = "generate"
trait_name = "TrackExt"
[[object.function]]
name = "add_element"
[object.function.return]
bool_return_is_error = "Failed to add element"
[[object.function]]
name = "remove_element"
[object.function.return] [object.function.return]
bool_return_is_error = "Failed to remove element" bool_return_is_error = "Failed to remove element"

View file

@ -43,7 +43,7 @@ impl Container {
pub trait GESContainerExt { pub trait GESContainerExt {
fn add<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError>; fn add<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError>;
fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> bool; fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError>;
fn get_children(&self, recursive: bool) -> Vec<TimelineElement>; fn get_children(&self, recursive: bool) -> Vec<TimelineElement>;
@ -67,9 +67,9 @@ impl<O: IsA<Container> + IsA<glib::object::Object>> GESContainerExt for O {
} }
} }
fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> bool { fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_container_edit(self.to_glib_none().0, layers.to_glib_none().0, new_layer_priority, mode.to_glib(), edge.to_glib(), position)) glib::error::BoolError::from_glib(ffi::ges_container_edit(self.to_glib_none().0, layers.to_glib_none().0, new_layer_priority, mode.to_glib(), edge.to_glib(), position), "Failed to edit container")
} }
} }

View file

@ -68,9 +68,9 @@ pub trait PipelineExt {
fn save_thumbnail(&self, width: i32, height: i32, format: &str, location: &str) -> Result<(), Error>; fn save_thumbnail(&self, width: i32, height: i32, format: &str, location: &str) -> Result<(), Error>;
fn set_mode(&self, mode: PipelineFlags) -> bool; fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError>;
fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> bool; fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError>;
fn set_timeline(&self, timeline: &Timeline) -> bool; fn set_timeline(&self, timeline: &Timeline) -> bool;
@ -156,15 +156,15 @@ impl<O: IsA<Pipeline> + IsA<glib::object::Object>> PipelineExt for O {
} }
} }
fn set_mode(&self, mode: PipelineFlags) -> bool { fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_pipeline_set_mode(self.to_glib_none().0, mode.to_glib())) glib::error::BoolError::from_glib(ffi::ges_pipeline_set_mode(self.to_glib_none().0, mode.to_glib()), "Failed to set mode")
} }
} }
fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> bool { fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_pipeline_set_render_settings(self.to_glib_none().0, output_uri.to_glib_none().0, profile.to_glib_none().0)) glib::error::BoolError::from_glib(ffi::ges_pipeline_set_render_settings(self.to_glib_none().0, output_uri.to_glib_none().0, profile.to_glib_none().0), "Failed to set render settings")
} }
} }

View file

@ -70,9 +70,9 @@ impl Default for Timeline {
} }
pub trait TimelineExt { pub trait TimelineExt {
fn add_layer(&self, layer: &Layer) -> bool; fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>;
fn add_track<P: IsA<Track>>(&self, track: &P) -> bool; fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError>;
fn append_layer(&self) -> Layer; fn append_layer(&self) -> Layer;
@ -104,11 +104,11 @@ pub trait TimelineExt {
fn load_from_uri(&self, uri: &str) -> Result<(), Error>; fn load_from_uri(&self, uri: &str) -> Result<(), Error>;
fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> bool; fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> Result<(), glib::error::BoolError>;
fn paste_element<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement>; fn paste_element<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement>;
fn remove_layer(&self, layer: &Layer) -> bool; fn remove_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>;
fn remove_track<P: IsA<Track>>(&self, track: &P) -> bool; fn remove_track<P: IsA<Track>>(&self, track: &P) -> bool;
@ -146,15 +146,15 @@ pub trait TimelineExt {
} }
impl<O: IsA<Timeline> + IsA<glib::object::Object>> TimelineExt for O { impl<O: IsA<Timeline> + IsA<glib::object::Object>> TimelineExt for O {
fn add_layer(&self, layer: &Layer) -> bool { fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_add_layer(self.to_glib_none().0, layer.to_glib_none().0)) glib::error::BoolError::from_glib(ffi::ges_timeline_add_layer(self.to_glib_none().0, layer.to_glib_none().0), "Failed to add layer")
} }
} }
fn add_track<P: IsA<Track>>(&self, track: &P) -> bool { fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_add_track(self.to_glib_none().0, track.to_glib_full())) glib::error::BoolError::from_glib(ffi::ges_timeline_add_track(self.to_glib_none().0, track.to_glib_full()), "Failed to add track")
} }
} }
@ -250,9 +250,9 @@ impl<O: IsA<Timeline> + IsA<glib::object::Object>> TimelineExt for O {
} }
} }
fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> bool { fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_move_layer(self.to_glib_none().0, layer.to_glib_none().0, new_layer_priority)) glib::error::BoolError::from_glib(ffi::ges_timeline_move_layer(self.to_glib_none().0, layer.to_glib_none().0, new_layer_priority), "Failed to move layer")
} }
} }
@ -262,9 +262,9 @@ impl<O: IsA<Timeline> + IsA<glib::object::Object>> TimelineExt for O {
} }
} }
fn remove_layer(&self, layer: &Layer) -> bool { fn remove_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_timeline_remove_layer(self.to_glib_none().0, layer.to_glib_none().0)) glib::error::BoolError::from_glib(ffi::ges_timeline_remove_layer(self.to_glib_none().0, layer.to_glib_none().0), "Failed to remove layer")
} }
} }

View file

@ -44,7 +44,7 @@ impl Track {
} }
pub trait TrackExt { pub trait TrackExt {
fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> bool; fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError>;
fn commit(&self) -> bool; fn commit(&self) -> bool;
@ -56,7 +56,7 @@ pub trait TrackExt {
fn get_timeline(&self) -> Option<Timeline>; fn get_timeline(&self) -> Option<Timeline>;
fn remove_element<P: IsA<TrackElement>>(&self, object: &P) -> bool; fn remove_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError>;
//fn set_create_element_for_gap_func(&self, func: /*Unknown conversion*//*Unimplemented*/CreateElementForGapFunc); //fn set_create_element_for_gap_func(&self, func: /*Unknown conversion*//*Unimplemented*/CreateElementForGapFunc);
@ -92,9 +92,9 @@ pub trait TrackExt {
} }
impl<O: IsA<Track> + IsA<glib::object::Object>> TrackExt for O { impl<O: IsA<Track> + IsA<glib::object::Object>> TrackExt for O {
fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> bool { fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_track_add_element(self.to_glib_none().0, object.to_glib_none().0)) glib::error::BoolError::from_glib(ffi::ges_track_add_element(self.to_glib_none().0, object.to_glib_none().0), "Failed to add element")
} }
} }
@ -128,9 +128,9 @@ impl<O: IsA<Track> + IsA<glib::object::Object>> TrackExt for O {
} }
} }
fn remove_element<P: IsA<TrackElement>>(&self, object: &P) -> bool { fn remove_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
from_glib(ffi::ges_track_remove_element(self.to_glib_none().0, object.to_glib_none().0)) glib::error::BoolError::from_glib(ffi::ges_track_remove_element(self.to_glib_none().0, object.to_glib_none().0), "Failed to remove element")
} }
} }