validate:override-registry: Make use of gst_validate_element_has_klass

Summary:
+ Fix a minor mixup bug between klass_overrides and name_overrides

Depends on D205

Reviewers: Mathieu_Du

Differential Revision: http://phabricator.freedesktop.org/D206
This commit is contained in:
Thibault Saunier 2015-05-26 12:04:02 +02:00
parent 40d00e8614
commit 38df412a54

View file

@ -31,8 +31,8 @@
#include "gst-validate-report.h" #include "gst-validate-report.h"
#include "gst-validate-utils.h" #include "gst-validate-utils.h"
#include "gst-validate-monitor.h"
#include "gst-validate-internal.h" #include "gst-validate-internal.h"
#include "gst-validate-monitor.h"
#include "gst-validate-override.h" #include "gst-validate-override.h"
#include "gst-validate-override-registry.h" #include "gst-validate-override-registry.h"
@ -49,7 +49,7 @@ typedef struct
} GstValidateOverrideRegistryGTypeEntry; } GstValidateOverrideRegistryGTypeEntry;
static GMutex _gst_validate_override_registry_mutex; static GMutex _gst_validate_override_registry_mutex;
static GstValidateOverrideRegistry *_registry_default; static GstValidateOverrideRegistry *_registry_default = NULL;
#define GST_VALIDATE_OVERRIDE_REGISTRY_LOCK(r) g_mutex_lock (&r->mutex) #define GST_VALIDATE_OVERRIDE_REGISTRY_LOCK(r) g_mutex_lock (&r->mutex)
#define GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK(r) g_mutex_unlock (&r->mutex) #define GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK(r) g_mutex_unlock (&r->mutex)
@ -173,23 +173,16 @@ static void
GstValidateOverrideRegistryNameEntry *entry; GstValidateOverrideRegistryNameEntry *entry;
GList *iter; GList *iter;
GstElement *element; GstElement *element;
GstElementClass *klass;
const gchar *klassname;
element = gst_validate_monitor_get_element (monitor); element = gst_validate_monitor_get_element (monitor);
if (!element) if (!element)
return; return;
klass = GST_ELEMENT_GET_CLASS (element); for (iter = registry->klass_overrides.head; iter; iter = g_list_next (iter)) {
klassname =
gst_element_class_get_metadata (klass, GST_ELEMENT_METADATA_KLASS);
for (iter = registry->name_overrides.head; iter; iter = g_list_next (iter)) {
entry = iter->data; entry = iter->data;
/* TODO It would be more correct to split it before comparing */ if (gst_validate_element_has_klass (element, entry->name)) {
if (strstr (klassname, entry->name) != NULL) {
gst_validate_monitor_attach_override (monitor, entry->override); gst_validate_monitor_attach_override (monitor, entry->override);
} }
} }