summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2020-12-15 17:58:51 -0300
committerThibault Saunier <tsaunier@igalia.com>2020-12-15 17:58:51 -0300
commit920c12390f48b3da46e1eabc1032e84018dd464c (patch)
treedaff713d2f085ba4ff1c27fe652f51c01d25911e
parent373071a743215620ecee5a5ceb146ab3f293f13f (diff)
validate: Add an API to get the bin monitor scenario
This is useful for applications that use Validate directly. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/233>
-rw-r--r--validate/gst/validate/gst-validate-bin-monitor.c20
-rw-r--r--validate/gst/validate/gst-validate-bin-monitor.h9
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 2264fa2..ab2c82c 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 184b5e2..300161d 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