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>
This commit is contained in:
Thibault Saunier 2020-12-15 17:58:51 -03:00
parent 373071a743
commit 920c12390f
2 changed files with 26 additions and 3 deletions

View file

@ -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;
}

View file

@ -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