2 * Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
4 * gst-qa-runner.c - QA Runner class
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "gst-qa-runner.h"
23 #include "gst-qa-report.h"
24 #include "gst-qa-monitor-factory.h"
25 #include "gst-qa-override-registry.h"
28 * SECTION:gst-qa-runner
29 * @short_description: Class that runs Gst QA tests for a pipeline
34 GST_DEBUG_CATEGORY_STATIC (gst_qa_runner_debug);
35 #define GST_CAT_DEFAULT gst_qa_runner_debug
38 GST_DEBUG_CATEGORY_INIT (gst_qa_runner_debug, "qa_runner", 0, "QA Runner");
39 #define gst_qa_runner_parent_class parent_class
40 G_DEFINE_TYPE_WITH_CODE (GstQaRunner, gst_qa_runner, G_TYPE_OBJECT, _do_init);
50 static guint _signals[LAST_SIGNAL] = { 0 };
53 gst_qa_runner_dispose (GObject * object)
55 GstQaRunner *runner = GST_QA_RUNNER_CAST (object);
57 g_slist_free_full (runner->reports, (GDestroyNotify) gst_qa_report_unref);
59 G_OBJECT_CLASS (parent_class)->dispose (object);
63 gst_qa_runner_class_init (GstQaRunnerClass * klass)
65 GObjectClass *gobject_class;
67 gobject_class = G_OBJECT_CLASS (klass);
69 gobject_class->dispose = gst_qa_runner_dispose;
71 /* init the report system (can be called multiple times) */
72 gst_qa_report_init ();
74 /* Ensure we load overrides before any use of a monitor */
75 gst_qa_override_registry_preload ();
77 _signals[REPORT_ADDED_SIGNAL] =
78 g_signal_new ("report-added", G_TYPE_FROM_CLASS (klass),
79 G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1,
84 gst_qa_runner_init (GstQaRunner * runner)
86 runner->setup = FALSE;
93 gst_qa_runner_new (void)
95 return g_object_new (GST_TYPE_QA_RUNNER, NULL);
99 gst_qa_runner_add_report (GstQaRunner * runner, GstQaReport * report)
101 runner->reports = g_slist_prepend (runner->reports, report);
103 g_signal_emit (runner, _signals[REPORT_ADDED_SIGNAL], 0, report);
107 gst_qa_runner_get_reports_count (GstQaRunner * runner)
109 g_return_val_if_fail (runner != NULL, 0);
110 return g_slist_length (runner->reports);
114 gst_qa_runner_get_reports (GstQaRunner * runner)
116 /* TODO should we need locking or put in htte docs to always call this
117 * after pipeline ends? */
118 return runner->reports;