From 920c12390f48b3da46e1eabc1032e84018dd464c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 15 Dec 2020 17:58:51 -0300 Subject: [PATCH] validate: Add an API to get the bin monitor scenario This is useful for applications that use Validate directly. Part-of: --- .../gst/validate/gst-validate-bin-monitor.c | 20 ++++++++++++++++++- .../gst/validate/gst-validate-bin-monitor.h | 9 +++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/validate/gst/validate/gst-validate-bin-monitor.c b/validate/gst/validate/gst-validate-bin-monitor.c index 2264fa282c..ab2c82c2a0 100644 --- a/validate/gst/validate/gst-validate-bin-monitor.c +++ b/validate/gst/validate/gst-validate-bin-monitor.c @@ -150,7 +150,7 @@ gst_validate_bin_monitor_dispose (GObject * object) if (monitor->scenario) { gst_validate_reporter_purge_reports (GST_VALIDATE_REPORTER (monitor->scenario)); - gst_object_unref (monitor->scenario); + gst_clear_object (&monitor->scenario); } g_list_free_full (monitor->element_monitors, purge_and_unref_reporter); @@ -350,3 +350,21 @@ _validate_bin_element_removed (GstBin * bin, GstElement * element, GST_ELEMENT_NAME (element), gst_validate_reporter_get_name (GST_VALIDATE_REPORTER (monitor))); } + +/** + * gst_validate_bin_monitor_get_scenario: + * @monitor: A #GstValidateBinMonitor + * + * Returns: (transfer full) (nullable): The #GstValidateScenario being executed + * under @monitor watch + * + * Since: 1.20 + */ +GstValidateScenario * +gst_validate_bin_monitor_get_scenario (GstValidateBinMonitor * monitor) +{ + if (monitor->scenario) + return gst_object_ref (monitor->scenario); + + return NULL; +} diff --git a/validate/gst/validate/gst-validate-bin-monitor.h b/validate/gst/validate/gst-validate-bin-monitor.h index 184b5e26e4..300161d360 100644 --- a/validate/gst/validate/gst-validate-bin-monitor.h +++ b/validate/gst/validate/gst-validate-bin-monitor.h @@ -77,8 +77,13 @@ struct _GstValidateBinMonitorClass { GST_VALIDATE_API GType gst_validate_bin_monitor_get_type (void); -GST_VALIDATE_API -GstValidateBinMonitor * gst_validate_bin_monitor_new (GstBin * bin, GstValidateRunner * runner, GstValidateMonitor * parent); +GST_VALIDATE_API GstValidateBinMonitor * +gst_validate_bin_monitor_new (GstBin * bin, + GstValidateRunner * runner, + GstValidateMonitor * parent); + +GST_VALIDATE_API GstValidateScenario * +gst_validate_bin_monitor_get_scenario (GstValidateBinMonitor * monitor); G_END_DECLS