gst-qa-report.c \
gst-qa-scenario.c \
gst-qa-override.c \
+ gst-qa-override-registry.c \
gst-qa-monitor-preload.c
noinst_HEADERS =
GST_DEBUG_OBJECT (monitor, "Wrapping element %s", GST_ELEMENT_NAME (element));
element_monitor =
- gst_qa_monitor_factory_create (element,
- GST_QA_MONITOR_GET_RUNNER (monitor), GST_QA_MONITOR_CAST (monitor));
+ GST_QA_ELEMENT_MONITOR_CAST (gst_qa_monitor_factory_create
+ (GST_OBJECT_CAST (element), GST_QA_MONITOR_GET_RUNNER (monitor),
+ GST_QA_MONITOR_CAST (monitor)));
g_return_if_fail (element_monitor != NULL);
GST_QA_MONITOR_LOCK (monitor);
static void
gst_qa_element_monitor_wrap_pad (GstQaElementMonitor * monitor, GstPad * pad);
static gboolean gst_qa_element_monitor_do_setup (GstQaMonitor * monitor);
+static GstElement *gst_qa_element_monitor_get_element (GstQaMonitor * monitor);
static void
_qa_element_pad_added (GstElement * element, GstPad * pad,
gobject_class->dispose = gst_qa_element_monitor_dispose;
monitor_klass->setup = gst_qa_element_monitor_do_setup;
+ monitor_klass->get_element = gst_qa_element_monitor_get_element;
}
static void
return monitor;
}
+static GstElement *
+gst_qa_element_monitor_get_element (GstQaMonitor * monitor)
+{
+ return GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor);
+}
+
static void
gst_qa_element_monitor_inspect (GstQaElementMonitor * monitor)
{
#include "gst-qa-monitor-factory.h"
#include "gst-qa-bin-monitor.h"
+#include "gst-qa-pad-monitor.h"
+#include "gst-qa-override-registry.h"
-GstQaElementMonitor *
-gst_qa_monitor_factory_create (GstElement * element, GstQaRunner * runner,
+GstQaMonitor *
+gst_qa_monitor_factory_create (GstObject * target, GstQaRunner * runner,
GstQaMonitor * parent)
{
- g_return_val_if_fail (element != NULL, NULL);
+ GstQaMonitor *monitor = NULL;
+ g_return_val_if_fail (target != NULL, NULL);
- if (GST_IS_BIN (element)) {
- return
- GST_QA_ELEMENT_MONITOR_CAST (gst_qa_bin_monitor_new (GST_BIN_CAST
- (element), runner, parent));
+ if (GST_IS_PAD (target)) {
+ monitor =
+ GST_QA_MONITOR_CAST (gst_qa_pad_monitor_new (GST_PAD_CAST (target),
+ runner, GST_QA_ELEMENT_MONITOR_CAST (parent)));
+ } else if (GST_IS_BIN (target)) {
+ monitor =
+ GST_QA_MONITOR_CAST (gst_qa_bin_monitor_new (GST_BIN_CAST
+ (target), runner, parent));
+ } else if (GST_IS_ELEMENT (target)) {
+ monitor =
+ GST_QA_MONITOR_CAST (gst_qa_element_monitor_new (GST_ELEMENT_CAST
+ (target), runner, parent));
}
- return gst_qa_element_monitor_new (element, runner, parent);
+ g_return_val_if_fail (target != NULL, NULL);
+ gst_qa_override_registry_attach_overrides (monitor);
+ return monitor;
}
#include <glib-object.h>
#include <gst/gst.h>
-#include "gst-qa-element-monitor.h"
+#include "gst-qa-monitor.h"
#include "gst-qa-runner.h"
G_BEGIN_DECLS
-GstQaElementMonitor * gst_qa_monitor_factory_create (GstElement * element, GstQaRunner * runner, GstQaMonitor * parent);
+GstQaMonitor * gst_qa_monitor_factory_create (GstObject * target, GstQaRunner * runner, GstQaMonitor * parent);
G_END_DECLS
GstQaMonitor *monitor = GST_QA_MONITOR_CAST (object);
g_mutex_clear (&monitor->mutex);
+ g_queue_clear (&monitor->overrides);
if (monitor->target)
g_object_weak_unref (G_OBJECT (monitor->target),
{
g_mutex_init (&monitor->mutex);
+ g_queue_init (&monitor->overrides);
}
/**
return GST_QA_MONITOR_GET_CLASS (monitor)->setup (monitor);
}
+const gchar *
+gst_qa_monitor_get_element_name (GstQaMonitor * monitor)
+{
+ GstQaMonitorClass *klass = GST_QA_MONITOR_GET_CLASS (monitor);
+ GstElement *element = NULL;
+
+ if (klass->get_element)
+ element = klass->get_element (monitor);
+
+ if (element)
+ return GST_ELEMENT_NAME (element);
+ return NULL;
+}
+
+void
+gst_qa_monitor_attach_override (GstQaMonitor * monitor,
+ GstQaOverride * override)
+{
+ GST_QA_MONITOR_LOCK (monitor);
+ g_queue_push_tail (&monitor->overrides, override);
+ GST_QA_MONITOR_UNLOCK (monitor);
+}
+
static void
gst_qa_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
#include <gst/gst.h>
#include "gst-qa-report.h"
#include "gst-qa-runner.h"
+#include "gst-qa-override.h"
G_BEGIN_DECLS
GstQaRunner *runner;
+ GQueue overrides;
+
/*< private >*/
GHashTable *reports;
};
GObjectClass parent_class;
gboolean (* setup) (GstQaMonitor * monitor);
+ GstElement *(* get_element) (GstQaMonitor * monitor);
};
/* normal GObject stuff */
GType gst_qa_monitor_get_type (void);
+void gst_qa_monitor_attach_override (GstQaMonitor * monitor,
+ GstQaOverride * override);
+
+const gchar * gst_qa_monitor_get_element_name (GstQaMonitor * monitor);
+
G_END_DECLS
#endif /* __GST_QA_MONITOR_H__ */
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-qa-override-registry.c - QA Override Registry
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+
+#include "gst-qa-override-registry.h"
+
+typedef struct
+{
+ gchar *name;
+ GstQaOverride *override;
+} GstQaOverrideRegistryNameEntry;
+
+static GMutex _gst_qa_override_registry_mutex;
+static GstQaOverrideRegistry *_registry_default;
+
+#define GST_QA_OVERRIDE_REGISTRY_LOCK(r) g_mutex_lock (&r->mutex)
+#define GST_QA_OVERRIDE_REGISTRY_UNLOCK(r) g_mutex_unlock (&r->mutex)
+
+static GstQaOverrideRegistry *
+gst_qa_override_registry_new (void)
+{
+ GstQaOverrideRegistry *reg = g_slice_new0 (GstQaOverrideRegistry);
+
+ g_mutex_init (®->mutex);
+ g_queue_init (®->name_overrides);
+
+ return reg;
+}
+
+GstQaOverrideRegistry *
+gst_qa_override_registry_get (void)
+{
+ g_mutex_lock (&_gst_qa_override_registry_mutex);
+ if (G_UNLIKELY (!_registry_default)) {
+ _registry_default = gst_qa_override_registry_new ();
+ }
+ g_mutex_unlock (&_gst_qa_override_registry_mutex);
+
+ return _registry_default;
+}
+
+void
+gst_qa_override_register_by_name (const gchar * name, GstQaOverride * override)
+{
+ GstQaOverrideRegistry *registry = gst_qa_override_registry_get ();
+ GstQaOverrideRegistryNameEntry *entry =
+ g_slice_new (GstQaOverrideRegistryNameEntry);
+
+ GST_QA_OVERRIDE_REGISTRY_LOCK (registry);
+ entry->name = g_strdup (name);
+ entry->override = override;
+ g_queue_push_tail (®istry->name_overrides, entry);
+ GST_QA_OVERRIDE_REGISTRY_UNLOCK (registry);
+}
+
+static void
+gst_qa_override_registry_attach_name_overrides_unlocked (GstQaOverrideRegistry *
+ registry, GstQaMonitor * monitor)
+{
+ GstQaOverrideRegistryNameEntry *entry;
+ GList *iter;
+ const gchar *name;
+
+ name = gst_qa_monitor_get_element_name (monitor);
+ for (iter = registry->name_overrides.head; iter; iter = g_list_next (iter)) {
+ entry = iter->data;
+ if (strcmp (name, entry->name) == 0) {
+ gst_qa_monitor_attach_override (monitor, entry->override);
+ }
+ }
+}
+
+void
+gst_qa_override_registry_attach_overrides (GstQaMonitor * monitor)
+{
+ GstQaOverrideRegistry *reg = gst_qa_override_registry_get ();
+
+ GST_QA_OVERRIDE_REGISTRY_LOCK (reg);
+ gst_qa_override_registry_attach_name_overrides_unlocked (reg, monitor);
+ GST_QA_OVERRIDE_REGISTRY_UNLOCK (reg);
+}
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
+ *
+ * gst-qa-override-registry.h - QA Override registry
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_QA_OVERRIDE_REGISTRY_H__
+#define __GST_QA_OVERRIDE_REGISTRY_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+#include "gst-qa-report.h"
+#include "gst-qa-monitor.h"
+#include "gst-qa-override.h"
+
+G_BEGIN_DECLS
+
+typedef struct {
+ GMutex mutex;
+
+ GQueue name_overrides;
+} GstQaOverrideRegistry;
+
+GstQaOverrideRegistry * gst_qa_override_registry_get (void);
+
+void gst_qa_override_register_by_name (const gchar * name, GstQaOverride * override);
+
+void gst_qa_override_registry_attach_overrides (GstQaMonitor * monitor);
+
+G_END_DECLS
+
+#endif /* __GST_QA_OVERRIDE_REGISTRY_H__ */
+
}
static gboolean gst_qa_pad_monitor_do_setup (GstQaMonitor * monitor);
+static GstElement *gst_qa_pad_monitor_get_element (GstQaMonitor * monitor);
/* This was copied from gstpad.c and might need
* updating whenever it changes in core */
gobject_class->dispose = gst_qa_pad_monitor_dispose;
monitor_klass->setup = gst_qa_pad_monitor_do_setup;
+ monitor_klass->get_element = gst_qa_pad_monitor_get_element;
}
static void
return monitor;
}
+static GstElement *
+gst_qa_pad_monitor_get_element (GstQaMonitor * monitor)
+{
+ GstPad *pad = GST_QA_PAD_MONITOR_GET_PAD (monitor);
+
+ return GST_PAD_PARENT (pad);
+}
+
static gboolean
gst_qa_pad_monitor_timestamp_is_in_received_range (GstQaPadMonitor * monitor,
GstClockTime ts)
G_BEGIN_DECLS
+/* forward declaratin */
+typedef struct _GstQaElementMonitor GstQaElementMonitor;
+
#define GST_TYPE_QA_PAD_MONITOR (gst_qa_pad_monitor_get_type ())
#define GST_IS_QA_PAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_PAD_MONITOR))
#define GST_IS_QA_PAD_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_PAD_MONITOR))
typedef struct _GstQaPadMonitor GstQaPadMonitor;
typedef struct _GstQaPadMonitorClass GstQaPadMonitorClass;
+
/**
* GstQaPadMonitor:
*
#include "gst-qa-runner.h"
#include "gst-qa-report.h"
#include "gst-qa-monitor-factory.h"
+#include "gst-qa-element-monitor.h"
#include "gst-qa-scenario.h"
/**
GST_INFO_OBJECT (runner, "Starting QA Runner setup");
runner->monitor =
- gst_qa_monitor_factory_create (runner->pipeline, runner, NULL);
+ gst_qa_monitor_factory_create (GST_OBJECT_CAST (runner->pipeline), runner,
+ NULL);
if (runner->monitor == NULL) {
GST_WARNING_OBJECT (runner, "Setup failed");
return FALSE;
G_BEGIN_DECLS
/* forward declaration */
-typedef struct _GstQaElementMonitor GstQaElementMonitor;
+typedef struct _GstQaMonitor GstQaMonitor;
typedef struct _GstQaScenario GstQaScenario;
#define GST_TYPE_QA_RUNNER (gst_qa_runner_get_type ())
/*< private >*/
GstElement *pipeline;
- GstQaElementMonitor *monitor;
+ GstQaMonitor *monitor;
GstQaScenario *scenario;
GSList *reports;