mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
validate: Allow overrides for scenario issues
This commit is contained in:
parent
1bd6b2767f
commit
6da09fb919
4 changed files with 70 additions and 6 deletions
|
@ -247,3 +247,33 @@ gst_validate_override_registry_preload (void)
|
|||
GST_INFO ("%d overrides loaded", nloaded);
|
||||
return nloaded;
|
||||
}
|
||||
|
||||
GList *gst_validate_override_registry_get_override_for_names
|
||||
(GstValidateOverrideRegistry * reg, const gchar * name, ...)
|
||||
{
|
||||
GList *iter;
|
||||
GList *ret = NULL;
|
||||
|
||||
if (name) {
|
||||
va_list varargs;
|
||||
GstValidateOverrideRegistryNameEntry *entry;
|
||||
|
||||
va_start (varargs, name);
|
||||
|
||||
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (reg);
|
||||
while (name) {
|
||||
for (iter = reg->name_overrides.head; iter; iter = g_list_next (iter)) {
|
||||
entry = iter->data;
|
||||
if ((g_strcmp0 (name, entry->name)) == 0) {
|
||||
ret = g_list_prepend (ret, entry->override);
|
||||
}
|
||||
}
|
||||
name = va_arg (varargs, gchar *);
|
||||
}
|
||||
GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (reg);
|
||||
|
||||
va_end (varargs);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,9 @@ typedef struct {
|
|||
|
||||
GstValidateOverrideRegistry * gst_validate_override_registry_get (void);
|
||||
|
||||
GList *
|
||||
gst_validate_override_registry_get_override_for_names (GstValidateOverrideRegistry *reg,
|
||||
const gchar *name, ...);
|
||||
void gst_validate_override_register_by_name (const gchar * name, GstValidateOverride * override);
|
||||
void gst_validate_override_register_by_type (GType gtype, GstValidateOverride * override);
|
||||
void gst_validate_override_register_by_klass (const gchar * klass, GstValidateOverride * override);
|
||||
|
|
|
@ -64,10 +64,12 @@ GstValidateReportLevel
|
|||
gst_validate_override_get_severity (GstValidateOverride * override,
|
||||
GstValidateIssueId issue_id, GstValidateReportLevel default_level)
|
||||
{
|
||||
GstValidateReportLevel level;
|
||||
GstValidateReportLevel *level = NULL;
|
||||
|
||||
if (g_hash_table_lookup_extended (override->level_override,
|
||||
(gpointer) issue_id, NULL, (gpointer *) & level)) {
|
||||
return level;
|
||||
(gpointer) issue_id, NULL, (gpointer) & level)) {
|
||||
|
||||
return GPOINTER_TO_INT (level);
|
||||
}
|
||||
return default_level;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "gst-validate-reporter.h"
|
||||
#include "gst-validate-report.h"
|
||||
#include "gst-validate-utils.h"
|
||||
#include <gst/validate/gst-validate-override.h>
|
||||
#include <gst/validate/gst-validate-override-registry.h>
|
||||
|
||||
#define GST_VALIDATE_SCENARIO_GET_PRIVATE(o) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenarioPrivate))
|
||||
|
@ -61,9 +63,6 @@ static void gst_validate_scenario_dispose (GObject * object);
|
|||
static void gst_validate_scenario_finalize (GObject * object);
|
||||
static GRegex *clean_action_str;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GstValidateScenario, gst_validate_scenario,
|
||||
G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL));
|
||||
|
||||
typedef struct _GstValidateActionType
|
||||
{
|
||||
GstValidateExecuteAction execute;
|
||||
|
@ -102,6 +101,8 @@ struct _GstValidateScenarioPrivate
|
|||
|
||||
gboolean changing_state;
|
||||
GstState target_state;
|
||||
|
||||
GList *overrides;
|
||||
};
|
||||
|
||||
typedef struct KeyFileGroupName
|
||||
|
@ -110,6 +111,30 @@ typedef struct KeyFileGroupName
|
|||
gchar *group_name;
|
||||
} KeyFileGroupName;
|
||||
|
||||
static void
|
||||
gst_validate_scenario_intercept_report (GstValidateReporter * reporter,
|
||||
GstValidateReport * report)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
for (tmp = GST_VALIDATE_SCENARIO (reporter)->priv->overrides; tmp;
|
||||
tmp = tmp->next) {
|
||||
report->level =
|
||||
gst_validate_override_get_severity (tmp->data,
|
||||
gst_validate_issue_get_id (report->issue), report->level);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_reporter_iface_init (GstValidateReporterInterface * iface)
|
||||
{
|
||||
iface->intercept_report = gst_validate_scenario_intercept_report;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GstValidateScenario, gst_validate_scenario,
|
||||
G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER,
|
||||
_reporter_iface_init));
|
||||
|
||||
GType _gst_validate_action_type;
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstValidateAction, gst_validate_action);
|
||||
|
@ -1609,6 +1634,10 @@ gst_validate_scenario_factory_create (GstValidateRunner *
|
|||
"\n=========================================\n", scenario_name,
|
||||
GST_OBJECT_NAME (pipeline));
|
||||
|
||||
scenario->priv->overrides =
|
||||
gst_validate_override_registry_get_override_for_names
|
||||
(gst_validate_override_registry_get (), "scenarios", NULL);
|
||||
|
||||
return scenario;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue