From 4ec7288f568aad5d4cc0a0ec07816e7d80a41966 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 4 Nov 2018 15:30:58 -0300 Subject: [PATCH] ges: Mark more method as returning BoolError --- Gir_GstEditingServices.toml | 66 ++++++++++++++++++- .../src/auto/container.rs | 6 +- .../src/auto/pipeline.rs | 12 ++-- .../src/auto/timeline.rs | 24 +++---- gstreamer-editing-services/src/auto/track.rs | 12 ++-- 5 files changed, 91 insertions(+), 29 deletions(-) diff --git a/Gir_GstEditingServices.toml b/Gir_GstEditingServices.toml index 8526c2a95..266bc1fa1 100644 --- a/Gir_GstEditingServices.toml +++ b/Gir_GstEditingServices.toml @@ -41,12 +41,10 @@ generate = [ "GES.Edge", "GES.Effect", "GES.TrackType", - "GES.Pipeline", "GES.BaseEffect", "GES.TimelineElement", "GES.Group", "GES.TrackElement", - "GES.Track", "GES.Layer", "GES.Clip", "GES.UriClip", @@ -95,6 +93,32 @@ status = "generate" [object.function.return] 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]] name = "GES.Container" status = "generate" @@ -106,5 +130,43 @@ trait_name = "GESContainerExt" [[object.function]] 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] bool_return_is_error = "Failed to remove element" \ No newline at end of file diff --git a/gstreamer-editing-services/src/auto/container.rs b/gstreamer-editing-services/src/auto/container.rs index ed925bdf9..2329747a9 100644 --- a/gstreamer-editing-services/src/auto/container.rs +++ b/gstreamer-editing-services/src/auto/container.rs @@ -43,7 +43,7 @@ impl Container { pub trait GESContainerExt { fn add>(&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; @@ -67,9 +67,9 @@ impl + IsA> 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 { - 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") } } diff --git a/gstreamer-editing-services/src/auto/pipeline.rs b/gstreamer-editing-services/src/auto/pipeline.rs index f1b1417bc..aa8ede30d 100644 --- a/gstreamer-editing-services/src/auto/pipeline.rs +++ b/gstreamer-editing-services/src/auto/pipeline.rs @@ -68,9 +68,9 @@ pub trait PipelineExt { 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>(&self, output_uri: &str, profile: &P) -> bool; + fn set_render_settings>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError>; fn set_timeline(&self, timeline: &Timeline) -> bool; @@ -156,15 +156,15 @@ impl + IsA> PipelineExt for O { } } - fn set_mode(&self, mode: PipelineFlags) -> bool { + fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> { 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>(&self, output_uri: &str, profile: &P) -> bool { + fn set_render_settings>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError> { 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") } } diff --git a/gstreamer-editing-services/src/auto/timeline.rs b/gstreamer-editing-services/src/auto/timeline.rs index 86e2f2926..2d016c936 100644 --- a/gstreamer-editing-services/src/auto/timeline.rs +++ b/gstreamer-editing-services/src/auto/timeline.rs @@ -70,9 +70,9 @@ impl Default for Timeline { } pub trait TimelineExt { - fn add_layer(&self, layer: &Layer) -> bool; + fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>; - fn add_track>(&self, track: &P) -> bool; + fn add_track>(&self, track: &P) -> Result<(), glib::error::BoolError>; fn append_layer(&self) -> Layer; @@ -104,11 +104,11 @@ pub trait TimelineExt { 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>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option; - fn remove_layer(&self, layer: &Layer) -> bool; + fn remove_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>; fn remove_track>(&self, track: &P) -> bool; @@ -146,15 +146,15 @@ pub trait TimelineExt { } impl + IsA> TimelineExt for O { - fn add_layer(&self, layer: &Layer) -> bool { + fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError> { 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>(&self, track: &P) -> bool { + fn add_track>(&self, track: &P) -> Result<(), glib::error::BoolError> { 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 + IsA> 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 { - 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 + IsA> TimelineExt for O { } } - fn remove_layer(&self, layer: &Layer) -> bool { + fn remove_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError> { 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") } } diff --git a/gstreamer-editing-services/src/auto/track.rs b/gstreamer-editing-services/src/auto/track.rs index 95f81764b..b9ba55fb9 100644 --- a/gstreamer-editing-services/src/auto/track.rs +++ b/gstreamer-editing-services/src/auto/track.rs @@ -44,7 +44,7 @@ impl Track { } pub trait TrackExt { - fn add_element>(&self, object: &P) -> bool; + fn add_element>(&self, object: &P) -> Result<(), glib::error::BoolError>; fn commit(&self) -> bool; @@ -56,7 +56,7 @@ pub trait TrackExt { fn get_timeline(&self) -> Option; - fn remove_element>(&self, object: &P) -> bool; + fn remove_element>(&self, object: &P) -> Result<(), glib::error::BoolError>; //fn set_create_element_for_gap_func(&self, func: /*Unknown conversion*//*Unimplemented*/CreateElementForGapFunc); @@ -92,9 +92,9 @@ pub trait TrackExt { } impl + IsA> TrackExt for O { - fn add_element>(&self, object: &P) -> bool { + fn add_element>(&self, object: &P) -> Result<(), glib::error::BoolError> { 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 + IsA> TrackExt for O { } } - fn remove_element>(&self, object: &P) -> bool { + fn remove_element>(&self, object: &P) -> Result<(), glib::error::BoolError> { 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") } }