From 5fccc0bc8247bfe2aae6772d9976f339ff3ba887 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 30 Oct 2024 21:47:01 -0300 Subject: [PATCH] validate: action: Expose the .report_error() method Part-of: --- gstreamer-validate/src/action.rs | 12 +++++++++++- gstreamer-validate/src/action_type.rs | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gstreamer-validate/src/action.rs b/gstreamer-validate/src/action.rs index 35b0b3d98..fa3e52cad 100644 --- a/gstreamer-validate/src/action.rs +++ b/gstreamer-validate/src/action.rs @@ -72,10 +72,20 @@ impl Action { } } + pub fn report_error(&self, error_message: &str) { + if let Some(scenario) = self.scenario() { + scenario.upcast_ref::().report_action( + self, + glib::Quark::from_str("scenario::execution-error"), + error_message, + ) + } + } + #[doc(alias = "gst_validate_execute_action")] pub fn execute(self) -> Result { unsafe { - let action: *mut ffi::GstValidateAction = self.to_glib_full(); + let action: *mut ffi::GstValidateAction = self.into_glib_ptr(); let action_type = ffi::gst_validate_get_action_type((*action).type_); let res = ffi::gst_validate_execute_action(action_type, action); diff --git a/gstreamer-validate/src/action_type.rs b/gstreamer-validate/src/action_type.rs index 38121c68e..0fd84fc2a 100644 --- a/gstreamer-validate/src/action_type.rs +++ b/gstreamer-validate/src/action_type.rs @@ -339,7 +339,6 @@ impl<'a> ActionTypeBuilder<'a> { glib::Quark::from_str("scenario::execution-error"), err, ); - return ffi::GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED; }