2013-07-09 19:08:30 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
|
|
|
|
*
|
|
|
|
* gst-qa-runner.c - QA Runner class
|
|
|
|
*
|
|
|
|
* 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 "gst-qa-runner.h"
|
2013-07-18 00:21:53 +00:00
|
|
|
#include "gst-qa-report.h"
|
2013-07-09 20:38:47 +00:00
|
|
|
#include "gst-qa-monitor-factory.h"
|
2013-07-30 09:20:43 +00:00
|
|
|
#include "gst-qa-override-registry.h"
|
qa: Add a GstQaScenario class making it possible to execute scenarios
A scenario correspond to a suite of action to execute on a pipeline,
for the time being, we only support seeking the pipeline, but in the
future we can imagine doing some queries, setting pipeline state, etc...
The scenario can be loaded thanks to the GST_QA_SCENARIO environment
variable, making it usable with any existant application, in case, the
application can be used interactively, the user should either, not load
any scenario or let the application run without interacting with it.
2013-07-20 04:18:13 +00:00
|
|
|
#include "gst-qa-scenario.h"
|
2013-07-09 19:08:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:gst-qa-runner
|
|
|
|
* @short_description: Class that runs Gst QA tests for a pipeline
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
*/
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_qa_runner_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_qa_runner_debug
|
|
|
|
|
|
|
|
#define _do_init \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_qa_runner_debug, "qa_runner", 0, "QA Runner");
|
|
|
|
#define gst_qa_runner_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstQaRunner, gst_qa_runner, G_TYPE_OBJECT, _do_init);
|
|
|
|
|
2013-07-18 00:21:53 +00:00
|
|
|
/* signals */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
REPORT_ADDED_SIGNAL,
|
|
|
|
/* add more above */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint _signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2013-07-09 19:08:30 +00:00
|
|
|
static void
|
|
|
|
gst_qa_runner_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstQaRunner *runner = GST_QA_RUNNER_CAST (object);
|
|
|
|
|
2013-07-17 23:56:52 +00:00
|
|
|
g_slist_free_full (runner->reports, (GDestroyNotify) gst_qa_report_unref);
|
2013-07-12 05:10:06 +00:00
|
|
|
|
qa: Add a GstQaScenario class making it possible to execute scenarios
A scenario correspond to a suite of action to execute on a pipeline,
for the time being, we only support seeking the pipeline, but in the
future we can imagine doing some queries, setting pipeline state, etc...
The scenario can be loaded thanks to the GST_QA_SCENARIO environment
variable, making it usable with any existant application, in case, the
application can be used interactively, the user should either, not load
any scenario or let the application run without interacting with it.
2013-07-20 04:18:13 +00:00
|
|
|
if (runner->scenario)
|
|
|
|
g_object_unref (runner->scenario);
|
|
|
|
|
2013-07-09 19:08:30 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_qa_runner_class_init (GstQaRunnerClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
gobject_class->dispose = gst_qa_runner_dispose;
|
2013-07-15 13:15:06 +00:00
|
|
|
|
|
|
|
/* init the report system (can be called multiple times) */
|
|
|
|
gst_qa_report_init ();
|
2013-07-18 00:21:53 +00:00
|
|
|
|
2013-07-30 09:20:43 +00:00
|
|
|
/* Ensure we load overrides before any use of a monitor */
|
|
|
|
gst_qa_override_registry_preload ();
|
|
|
|
|
2013-07-18 00:21:53 +00:00
|
|
|
_signals[REPORT_ADDED_SIGNAL] =
|
|
|
|
g_signal_new ("report-added", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1,
|
|
|
|
GST_TYPE_QA_REPORT);
|
2013-07-09 19:08:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_qa_runner_init (GstQaRunner * runner)
|
|
|
|
{
|
|
|
|
runner->setup = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_qa_runner_new:
|
|
|
|
*/
|
|
|
|
GstQaRunner *
|
2013-08-07 19:10:57 +00:00
|
|
|
gst_qa_runner_new (void)
|
2013-07-09 19:08:30 +00:00
|
|
|
{
|
2013-08-07 19:10:57 +00:00
|
|
|
return g_object_new (GST_TYPE_QA_RUNNER, NULL);
|
2013-07-09 19:08:30 +00:00
|
|
|
}
|
2013-07-12 05:10:06 +00:00
|
|
|
|
|
|
|
void
|
2013-07-17 00:15:09 +00:00
|
|
|
gst_qa_runner_add_report (GstQaRunner * runner, GstQaReport * report)
|
2013-07-12 05:10:06 +00:00
|
|
|
{
|
2013-07-17 00:15:09 +00:00
|
|
|
runner->reports = g_slist_prepend (runner->reports, report);
|
2013-07-18 00:21:53 +00:00
|
|
|
|
|
|
|
g_signal_emit (runner, _signals[REPORT_ADDED_SIGNAL], 0, report);
|
2013-07-12 05:10:06 +00:00
|
|
|
}
|
|
|
|
|
2013-07-30 19:20:49 +00:00
|
|
|
guint
|
|
|
|
gst_qa_runner_get_reports_count (GstQaRunner * runner)
|
2013-07-12 05:10:06 +00:00
|
|
|
{
|
2013-08-07 19:10:57 +00:00
|
|
|
g_return_val_if_fail (runner != NULL, 0);
|
2013-07-30 19:20:49 +00:00
|
|
|
return g_slist_length (runner->reports);
|
|
|
|
}
|
2013-07-12 05:10:06 +00:00
|
|
|
|
2013-07-30 19:20:49 +00:00
|
|
|
GSList *
|
|
|
|
gst_qa_runner_get_reports (GstQaRunner * runner)
|
|
|
|
{
|
|
|
|
/* TODO should we need locking or put in htte docs to always call this
|
|
|
|
* after pipeline ends? */
|
|
|
|
return runner->reports;
|
2013-07-12 05:10:06 +00:00
|
|
|
}
|