rename gst-qa -> gst-validate

This commit is contained in:
Thiago Santos 2013-08-14 16:30:39 -03:00
parent ddc95f5b8c
commit 52002376ea
54 changed files with 2987 additions and 2911 deletions

View file

@ -2,8 +2,8 @@
# Run this to generate all the initial makefiles, etc.
DIE=0
package=gst-qa
srcfile=gst/qa/gst-qa.c
package=gst-validate
srcfile=gst/validate/gst-validate.c
# Make sure we have common
if test ! -f common/gst-autogen.sh;
@ -31,7 +31,7 @@ fi
# GNU gettext automake support doesn't get along with git.
# https://bugzilla.gnome.org/show_bug.cgi?id=661128
touch -t 200001010000 po/gst-qa-0.10.pot
touch -t 200001010000 po/gst-validate-0.10.pot
CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc'

View file

@ -2,9 +2,9 @@ AC_PREREQ(2.62)
dnl initialize autoconf
dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
AC_INIT(Gst-QA, 0.0.1.1,
AC_INIT(Gst-Validate, 0.0.1.1,
http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
gst-qa)
gst-validate)
AG_GST_INIT
dnl initialize automake
@ -17,7 +17,7 @@ dnl check if this is a release version
AS_NANO(GST_GIT="no", GST_GIT="yes")
dnl can autoconf find the source ?
AC_CONFIG_SRCDIR([gst/qa/gst-qa.c])
AC_CONFIG_SRCDIR([gst/validate/gst-validate.c])
dnl define the output header for config
AC_CONFIG_HEADERS([config.h])
@ -60,7 +60,7 @@ dnl set up gettext
dnl the version check needs to stay here because autopoint greps for it
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
AG_GST_GETTEXT([gst-qa-$GST_API_VERSION])
AG_GST_GETTEXT([gst-validate-$GST_API_VERSION])
dnl *** check for arguments to configure ***
@ -243,7 +243,7 @@ Makefile
common/Makefile
common/m4/Makefile
gst/Makefile
gst/qa/Makefile
gst/validate/Makefile
data/Makefile
po/Makefile.in
])
@ -257,5 +257,5 @@ Configuration
Prefix : ${prefix}
Compiler : ${CC}
gst-qa configured. Type 'make' to build.
gst-validate configured. Type 'make' to build.
"

View file

@ -1 +1 @@
SUBDIRS = qa
SUBDIRS = validate

View file

@ -1,3 +0,0 @@
gst-qa-0.10
gst-qa-transcoding-0.10
gst-qa-file-check-0.10

View file

@ -1,84 +0,0 @@
libgstqa_@GST_API_VERSION@_la_SOURCES = \
gst-qa-runner.c \
gst-qa-reporter.c \
gst-qa-monitor.c \
gst-qa-element-monitor.c \
gst-qa-bin-monitor.c \
gst-qa-pad-monitor.c \
gst-qa-monitor-factory.c \
gst-qa-report.c \
gst-qa-scenario.c \
gst-qa-override.c \
gst-qa-override-registry.c \
gst-qa-file-checker.c
noinst_HEADERS = \
gettext.h \
gst-qa-bin-monitor.h \
gst-qa-element-monitor.h \
gst-qa-file-checker.h \
gst-qa-i18n-lib.h \
gst-qa-monitor-factory.h \
gst-qa-monitor.h \
gst-qa-override.h \
gst-qa-override-registry.h \
gst-qa-pad-monitor.h \
gst-qa-reporter.h \
gst-qa-report.h \
gst-qa-runner.h \
gst-qa-scenario.h
lib_LTLIBRARIES = \
libgstqa-@GST_API_VERSION@.la \
libgstqa-default-overrides-@GST_API_VERSION@.la \
libgstqa-preload-@GST_API_VERSION@.la
libgstqa_@GST_API_VERSION@_la_CFLAGS = $(GST_ALL_CFLAGS) $(GIO_CFLAGS)
libgstqa_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) \
$(GST_LT_LDFLAGS) $(GIO_LDFLAGS)
libgstqa_@GST_API_VERSION@_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
$(GST_ALL_LIBS) $(GIO_LIBS)
libgstqa_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/qa
libgstqa_@GST_API_VERSION@include_HEADERS = \
qa.h
libgstqa_default_overrides_@GST_API_VERSION@_la_SOURCES = \
gst-qa-default-overrides.c
libgstqa_default_overrides_@GST_API_VERSION@_la_CFLAGS = $(GST_ALL_CFLAGS) $(GIO_CFLAGS)
libgstqa_default_overrides_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) \
$(GST_LT_LDFLAGS) $(GIO_LDFLAGS)
libgstqa_default_overrides_@GST_API_VERSION@_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
$(GST_ALL_LIBS) $(GIO_LIBS)
libgstqa_default_overrides_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/qa
libgstqa_default_overrides_@GST_API_VERSION@include_HEADERS =
libgstqa_preload_@GST_API_VERSION@_la_SOURCES = \
gst-qa-monitor-preload.c
libgstqa_preload_@GST_API_VERSION@_la_CFLAGS = $(GST_ALL_CFLAGS)
libgstqa_preload_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) \
$(GST_LT_LDFLAGS) -lgstqa-@GST_API_VERSION@
libgstqa_preload_@GST_API_VERSION@_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
$(GST_ALL_LIBS) -lgstqa-@GST_API_VERSION@
libgstqa_preload_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/qa
libgstqa_preload_@GST_API_VERSION@include_HEADERS =
bin_PROGRAMS = \
gst-qa-@GST_API_VERSION@ \
gst-qa-transcoding-@GST_API_VERSION@ \
gst-qa-file-check-@GST_API_VERSION@
AM_CFLAGS = $(GST_ALL_CFLAGS) $(GST_PBUTILS_CFLAGS)
LDADD = $(top_builddir)/gst/qa/libgstqa-@GST_API_VERSION@.la $(GST_PBUTILS_LIBS) $(GST_LIBS)
gst_qa_@GST_API_VERSION@_SOURCES = gst-qa.c
gst_qa_transcoding_@GST_API_VERSION@_SOURCES = gst-qa-transcoding.c
gst_qa_file_check_@GST_API_VERSION@_SOURCES = gst-qa-file-check.c
CLEANFILES =

View file

@ -1,83 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-bin-monitor.h - QA BinMonitor 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.
*/
#ifndef __GST_QA_BIN_MONITOR_H__
#define __GST_QA_BIN_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-element-monitor.h"
#include "gst-qa-runner.h"
#include "gst-qa-scenario.h"
G_BEGIN_DECLS
#define GST_TYPE_QA_BIN_MONITOR (gst_qa_bin_monitor_get_type ())
#define GST_IS_QA_BIN_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_BIN_MONITOR))
#define GST_IS_QA_BIN_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_BIN_MONITOR))
#define GST_QA_BIN_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_BIN_MONITOR, GstQaBinMonitorClass))
#define GST_QA_BIN_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_BIN_MONITOR, GstQaBinMonitor))
#define GST_QA_BIN_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_BIN_MONITOR, GstQaBinMonitorClass))
#define GST_QA_BIN_MONITOR_CAST(obj) ((GstQaBinMonitor*)(obj))
#define GST_QA_BIN_MONITOR_CLASS_CAST(klass) ((GstQaBinMonitorClass*)(klass))
#define GST_QA_BIN_MONITOR_GET_BIN(m) (GST_BIN_CAST (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (m)))
typedef struct _GstQaBinMonitor GstQaBinMonitor;
typedef struct _GstQaBinMonitorClass GstQaBinMonitorClass;
/**
* GstQaBinMonitor:
*
* GStreamer QA BinMonitor class.
*
* Class that wraps a #GstBin for QA checks
*/
struct _GstQaBinMonitor {
GstQaElementMonitor parent;
GList *element_monitors;
GstQaScenario *scenario;
/*< private >*/
gulong element_added_id;
};
/**
* GstQaBinMonitorClass:
* @parent_class: parent
*
* GStreamer QA BinMonitor object class.
*/
struct _GstQaBinMonitorClass {
GstQaElementMonitorClass parent_class;
};
/* normal GObject stuff */
GType gst_qa_bin_monitor_get_type (void);
GstQaBinMonitor * gst_qa_bin_monitor_new (GstBin * bin, GstQaRunner * runner, GstQaMonitor * parent);
G_END_DECLS
#endif /* __GST_QA_BIN_MONITOR_H__ */

View file

@ -1,201 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-element-monitor.c - QA ElementMonitor 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-element-monitor.h"
#include "gst-qa-pad-monitor.h"
#include "gst-qa-monitor-factory.h"
#include <string.h>
/**
* SECTION:gst-qa-element-monitor
* @short_description: Class that wraps a #GstElement for QA checks
*
* TODO
*/
GST_DEBUG_CATEGORY_STATIC (gst_qa_element_monitor_debug);
#define GST_CAT_DEFAULT gst_qa_element_monitor_debug
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_qa_element_monitor_debug, "qa_element_monitor", 0, "QA ElementMonitor");
#define gst_qa_element_monitor_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstQaElementMonitor, gst_qa_element_monitor,
GST_TYPE_QA_MONITOR, _do_init);
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,
GstQaElementMonitor * monitor);
static void
gst_qa_element_monitor_dispose (GObject * object)
{
GstQaElementMonitor *monitor = GST_QA_ELEMENT_MONITOR_CAST (object);
if (GST_QA_MONITOR_GET_OBJECT (monitor) && monitor->pad_added_id)
g_signal_handler_disconnect (GST_QA_MONITOR_GET_OBJECT (monitor),
monitor->pad_added_id);
g_list_free_full (monitor->pad_monitors, g_object_unref);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_qa_element_monitor_class_init (GstQaElementMonitorClass * klass)
{
GObjectClass *gobject_class;
GstQaMonitorClass *monitor_klass;
gobject_class = G_OBJECT_CLASS (klass);
monitor_klass = GST_QA_MONITOR_CLASS (klass);
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
gst_qa_element_monitor_init (GstQaElementMonitor * element_monitor)
{
}
/**
* gst_qa_element_monitor_new:
* @element: (transfer-none): a #GstElement to run QA on
*/
GstQaElementMonitor *
gst_qa_element_monitor_new (GstElement * element, GstQaRunner * runner,
GstQaMonitor * parent)
{
GstQaElementMonitor *monitor;
g_return_val_if_fail (element != NULL, NULL);
monitor = g_object_new (GST_TYPE_QA_ELEMENT_MONITOR, "object", element,
"qa-runner", runner, "qa-parent", parent, NULL);
if (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) == NULL) {
g_object_unref (monitor);
return NULL;
}
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)
{
GstElement *element;
GstElementClass *klass;
element = GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor);
klass = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
monitor->is_decoder = strstr (klass->details.klass, "Decoder") != NULL;
monitor->is_encoder = strstr (klass->details.klass, "Encoder") != NULL;
}
static gboolean
gst_qa_element_monitor_do_setup (GstQaMonitor * monitor)
{
GstIterator *iterator;
gboolean done;
GstPad *pad;
GstQaElementMonitor *elem_monitor;
GstElement *element;
if (!GST_IS_ELEMENT (GST_QA_MONITOR_GET_OBJECT (monitor))) {
GST_WARNING_OBJECT (monitor, "Trying to create element monitor with other "
"type of object");
return FALSE;
}
elem_monitor = GST_QA_ELEMENT_MONITOR_CAST (monitor);
GST_DEBUG_OBJECT (monitor, "Setting up monitor for element %" GST_PTR_FORMAT,
GST_QA_MONITOR_GET_OBJECT (monitor));
element = GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor);
gst_qa_element_monitor_inspect (elem_monitor);
elem_monitor->pad_added_id = g_signal_connect (element, "pad-added",
G_CALLBACK (_qa_element_pad_added), monitor);
iterator = gst_element_iterate_pads (element);
done = FALSE;
while (!done) {
switch (gst_iterator_next (iterator, (gpointer *) & pad)) {
case GST_ITERATOR_OK:
gst_qa_element_monitor_wrap_pad (elem_monitor, pad);
gst_object_unref (pad);
break;
case GST_ITERATOR_RESYNC:
/* TODO how to handle this? */
gst_iterator_resync (iterator);
break;
case GST_ITERATOR_ERROR:
done = TRUE;
break;
case GST_ITERATOR_DONE:
done = TRUE;
break;
}
}
gst_iterator_free (iterator);
return TRUE;
}
static void
gst_qa_element_monitor_wrap_pad (GstQaElementMonitor * monitor, GstPad * pad)
{
GstQaPadMonitor *pad_monitor;
GST_DEBUG_OBJECT (monitor, "Wrapping pad %s:%s", GST_DEBUG_PAD_NAME (pad));
pad_monitor =
GST_QA_PAD_MONITOR (gst_qa_monitor_factory_create (GST_OBJECT (pad),
GST_QA_MONITOR_GET_RUNNER (monitor), GST_QA_MONITOR (monitor)));
g_return_if_fail (pad_monitor != NULL);
GST_QA_MONITOR_LOCK (monitor);
monitor->pad_monitors = g_list_prepend (monitor->pad_monitors, pad_monitor);
GST_QA_MONITOR_UNLOCK (monitor);
}
static void
_qa_element_pad_added (GstElement * element, GstPad * pad,
GstQaElementMonitor * monitor)
{
g_return_if_fail (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) == element);
gst_qa_element_monitor_wrap_pad (monitor, pad);
}

View file

@ -1,84 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-element-monitor.h - QA ElementMonitor 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.
*/
#ifndef __GST_QA_ELEMENT_MONITOR_H__
#define __GST_QA_ELEMENT_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-monitor.h"
G_BEGIN_DECLS
#define GST_TYPE_QA_ELEMENT_MONITOR (gst_qa_element_monitor_get_type ())
#define GST_IS_QA_ELEMENT_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_ELEMENT_MONITOR))
#define GST_IS_QA_ELEMENT_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_ELEMENT_MONITOR))
#define GST_QA_ELEMENT_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_ELEMENT_MONITOR, GstQaElementMonitorClass))
#define GST_QA_ELEMENT_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_ELEMENT_MONITOR, GstQaElementMonitor))
#define GST_QA_ELEMENT_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_ELEMENT_MONITOR, GstQaElementMonitorClass))
#define GST_QA_ELEMENT_MONITOR_CAST(obj) ((GstQaElementMonitor*)(obj))
#define GST_QA_ELEMENT_MONITOR_CLASS_CAST(klass) ((GstQaElementMonitorClass*)(klass))
#define GST_QA_ELEMENT_MONITOR_GET_ELEMENT(m) (GST_ELEMENT_CAST (GST_QA_MONITOR_GET_OBJECT (m)))
#define GST_QA_ELEMENT_MONITOR_ELEMENT_IS_DECODER(m) (GST_QA_ELEMENT_MONITOR_CAST (m)->is_decoder)
#define GST_QA_ELEMENT_MONITOR_ELEMENT_IS_ENCODER(m) (GST_QA_ELEMENT_MONITOR_CAST (m)->is_encoder)
typedef struct _GstQaElementMonitor GstQaElementMonitor;
typedef struct _GstQaElementMonitorClass GstQaElementMonitorClass;
/**
* GstQaElementMonitor:
*
* GStreamer QA ElementMonitor class.
*
* Class that wraps a #GstElement for QA checks
*/
struct _GstQaElementMonitor {
GstQaMonitor parent;
/*< private >*/
gulong pad_added_id;
GList *pad_monitors;
gboolean is_decoder;
gboolean is_encoder;
};
/**
* GstQaElementMonitorClass:
* @parent_class: parent
*
* GStreamer QA ElementMonitor object class.
*/
struct _GstQaElementMonitorClass {
GstQaMonitorClass parent_class;
};
/* normal GObject stuff */
GType gst_qa_element_monitor_get_type (void);
GstQaElementMonitor * gst_qa_element_monitor_new (GstElement * element, GstQaRunner * runner, GstQaMonitor * parent);
G_END_DECLS
#endif /* __GST_QA_ELEMENT_MONITOR_H__ */

View file

@ -1,93 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-file-checker.h - QA File conformance check utility functions / structs
*
* 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_FILE_CHECK_H__
#define __GST_QA_FILE_CHECK_H__
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
G_BEGIN_DECLS
#define GST_TYPE_QA_FILE_CHECKER (gst_qa_file_checker_get_type ())
#define GST_IS_QA_FILE_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_FILE_CHECKER))
#define GST_IS_QA_FILE_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_FILE_CHECKER))
#define GST_QA_FILE_CHECKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_FILE_CHECKER, GstQaFileCheckerClass))
#define GST_QA_FILE_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_FILE_CHECKER, GstQaFileChecker))
#define GST_QA_FILE_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_FILE_CHECKER, GstQaFileCheckerClass))
#define GST_QA_FILE_CHECKER_CAST(obj) ((GstQaFileChecker*)(obj))
#define GST_QA_FILE_CHECKER_CLASS_CAST(klass) ((GstQaFileCheckerClass*)(klass))
typedef struct _GstQaFileChecker GstQaFileChecker;
typedef struct _GstQaFileCheckerClass GstQaFileCheckerClass;
/**
* GstQaFileChecker:
*
* GStreamer QA FileChecker class.
*
* Class that wraps a #GObject for QA checks
*/
struct _GstQaFileChecker {
GObject object;
/* <File checking data> */
/* Value for the expected total duration of the file in nanosecs
* Set to GST_CLOCK_TIME_NONE if it shouldn't be tested */
GstClockTime duration;
/* Acceptable tolerance for duration */
GstClockTime duration_tolerance;
/* Expected file_size, set to 0 to skip test */
guint64 file_size;
/* Acceptable tolerance for file_size check */
guint64 file_size_tolerance;
gboolean seekable; /* TODO should we care about disabling this check? */
gboolean test_playback;
gboolean test_reverse_playback;
gchar *uri;
/* Set to NULL to skip check */
GstEncodingProfile *profile;
};
/**
* GstQaFileCheckerClass:
* @parent_class: parent
*
* GStreamer QA FileChecker object class.
*/
struct _GstQaFileCheckerClass {
GObjectClass parent_class;
};
/* normal GObject stuff */
GType gst_qa_file_checker_get_type (void);
gboolean gst_qa_file_checker_run (GstQaFileChecker * fc);
G_END_DECLS
#endif /* __GST_QA_FILE_CHECK_H__ */

View file

@ -1,289 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-element-monitor.c - QA Monitor 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-monitor.h"
/**
* SECTION:gst-qa-monitor
* @short_description: Base class that wraps a #GObject for QA checks
*
* TODO
*/
enum
{
PROP_0,
PROP_OBJECT,
PROP_RUNNER,
PROP_QA_PARENT,
PROP_LAST
};
GST_DEBUG_CATEGORY_STATIC (gst_qa_monitor_debug);
#define GST_CAT_DEFAULT gst_qa_monitor_debug
static gboolean gst_qa_monitor_do_setup (GstQaMonitor * monitor);
static void
gst_qa_monitor_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
gst_qa_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static GObject *gst_qa_monitor_constructor (GType type,
guint n_construct_params, GObjectConstructParam * construct_params);
gboolean gst_qa_monitor_setup (GstQaMonitor * monitor);
static void gst_qa_monitor_intercept_report (GstQaReporter * reporter,
GstQaReport * report);
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_qa_monitor_debug, "qa_monitor", 0, "QA Monitor");\
G_IMPLEMENT_INTERFACE (GST_TYPE_QA_REPORTER, _reporter_iface_init)
static void
_reporter_iface_init (GstQaReporterInterface * iface)
{
iface->intercept_report = gst_qa_monitor_intercept_report;
}
#define gst_qa_monitor_parent_class parent_class
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstQaMonitor, gst_qa_monitor,
G_TYPE_OBJECT, _do_init);
void
_target_freed_cb (GstQaMonitor * monitor, GObject * where_the_object_was)
{
GST_DEBUG_OBJECT (monitor, "Target was freed");
monitor->target = NULL;
}
static void
gst_qa_monitor_dispose (GObject * object)
{
GstQaMonitor *monitor = GST_QA_MONITOR_CAST (object);
g_mutex_clear (&monitor->mutex);
g_mutex_clear (&monitor->overrides_mutex);
g_queue_clear (&monitor->overrides);
if (monitor->target)
g_object_weak_unref (G_OBJECT (monitor->target),
(GWeakNotify) _target_freed_cb, monitor);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_qa_monitor_finalize (GObject * object)
{
gst_qa_reporter_set_name (GST_QA_REPORTER (object), NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_qa_monitor_class_init (GstQaMonitorClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = gst_qa_monitor_get_property;
gobject_class->set_property = gst_qa_monitor_set_property;
gobject_class->dispose = gst_qa_monitor_dispose;
gobject_class->finalize = gst_qa_monitor_finalize;
gobject_class->constructor = gst_qa_monitor_constructor;
klass->setup = gst_qa_monitor_do_setup;
g_object_class_install_property (gobject_class, PROP_OBJECT,
g_param_spec_object ("object", "Object", "The object to be monitored",
GST_TYPE_OBJECT, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_RUNNER,
g_param_spec_object ("qa-runner", "QA Runner", "The QA runner to "
"report errors to", GST_TYPE_QA_RUNNER,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_QA_PARENT,
g_param_spec_object ("qa-parent", "QA parent monitor", "The QA monitor "
"that is the parent of this one", GST_TYPE_QA_MONITOR,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
}
static GObject *
gst_qa_monitor_constructor (GType type, guint n_construct_params,
GObjectConstructParam * construct_params)
{
GstQaMonitor *monitor =
GST_QA_MONITOR_CAST (G_OBJECT_CLASS (parent_class)->constructor (type,
n_construct_params,
construct_params));
gst_qa_monitor_setup (monitor);
return (GObject *) monitor;
}
static void
gst_qa_monitor_init (GstQaMonitor * monitor)
{
g_mutex_init (&monitor->mutex);
g_mutex_init (&monitor->overrides_mutex);
g_queue_init (&monitor->overrides);
}
/**
* gst_qa_monitor_new:
* @element: (transfer-none): a #GObject to run QA on
*/
GstQaMonitor *
gst_qa_monitor_new (GObject * object)
{
GstQaMonitor *monitor = g_object_new (GST_TYPE_QA_MONITOR, "object",
G_TYPE_OBJECT, object, NULL);
if (GST_QA_MONITOR_GET_OBJECT (monitor) == NULL) {
/* setup failed, no use on returning this monitor */
g_object_unref (monitor);
return NULL;
}
return monitor;
}
static gboolean
gst_qa_monitor_do_setup (GstQaMonitor * monitor)
{
/* NOP */
return TRUE;
}
gboolean
gst_qa_monitor_setup (GstQaMonitor * monitor)
{
GST_DEBUG_OBJECT (monitor, "Starting monitor setup");
return GST_QA_MONITOR_GET_CLASS (monitor)->setup (monitor);
}
GstElement *
gst_qa_monitor_get_element (GstQaMonitor * monitor)
{
GstQaMonitorClass *klass = GST_QA_MONITOR_GET_CLASS (monitor);
GstElement *element = NULL;
if (klass->get_element)
element = klass->get_element (monitor);
return element;
}
const gchar *
gst_qa_monitor_get_element_name (GstQaMonitor * monitor)
{
GstElement *element;
element = gst_qa_monitor_get_element (monitor);
if (element)
return GST_ELEMENT_NAME (element);
return NULL;
}
/* Check if any of our overrides wants to change the report severity */
static void
gst_qa_monitor_intercept_report (GstQaReporter * reporter, GstQaReport * report)
{
GList *iter;
GstQaMonitor *monitor = GST_QA_MONITOR_CAST (reporter);
GST_QA_MONITOR_OVERRIDES_LOCK (monitor);
for (iter = monitor->overrides.head; iter; iter = g_list_next (iter)) {
report->level =
gst_qa_override_get_severity (iter->data,
gst_qa_issue_get_id (report->issue), report->level);
}
GST_QA_MONITOR_OVERRIDES_UNLOCK (monitor);
}
void
gst_qa_monitor_attach_override (GstQaMonitor * monitor,
GstQaOverride * override)
{
GST_QA_MONITOR_OVERRIDES_LOCK (monitor);
g_queue_push_tail (&monitor->overrides, override);
GST_QA_MONITOR_OVERRIDES_UNLOCK (monitor);
}
static void
gst_qa_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstQaMonitor *monitor;
monitor = GST_QA_MONITOR_CAST (object);
switch (prop_id) {
case PROP_OBJECT:
g_assert (monitor->target == NULL);
monitor->target = g_value_get_object (value);
g_object_weak_ref (G_OBJECT (monitor->target),
(GWeakNotify) _target_freed_cb, monitor);
if (monitor->target)
gst_qa_reporter_set_name (GST_QA_REPORTER (monitor), g_strdup
(GST_OBJECT_NAME (monitor->target)));
break;
case PROP_RUNNER:
gst_qa_reporter_set_runner (GST_QA_REPORTER (monitor),
g_value_get_object (value));
break;
case PROP_QA_PARENT:
monitor->parent = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_qa_monitor_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstQaMonitor *monitor;
monitor = GST_QA_MONITOR_CAST (object);
switch (prop_id) {
case PROP_OBJECT:
g_value_set_object (value, GST_QA_MONITOR_GET_OBJECT (monitor));
break;
case PROP_RUNNER:
g_value_set_object (value, GST_QA_MONITOR_GET_RUNNER (monitor));
break;
case PROP_QA_PARENT:
g_value_set_object (value, GST_QA_MONITOR_GET_PARENT (monitor));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}

View file

@ -1,109 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-monitor.h - QA Monitor abstract base 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.
*/
#ifndef __GST_QA_MONITOR_H__
#define __GST_QA_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-report.h"
#include "gst-qa-reporter.h"
#include "gst-qa-runner.h"
#include "gst-qa-override.h"
G_BEGIN_DECLS
#define GST_TYPE_QA_MONITOR (gst_qa_monitor_get_type ())
#define GST_IS_QA_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_MONITOR))
#define GST_IS_QA_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_MONITOR))
#define GST_QA_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_MONITOR, GstQaMonitorClass))
#define GST_QA_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_MONITOR, GstQaMonitor))
#define GST_QA_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_MONITOR, GstQaMonitorClass))
#define GST_QA_MONITOR_CAST(obj) ((GstQaMonitor*)(obj))
#define GST_QA_MONITOR_CLASS_CAST(klass) ((GstQaMonitorClass*)(klass))
#define GST_QA_MONITOR_GET_OBJECT(m) (GST_QA_MONITOR_CAST (m)->target)
#define GST_QA_MONITOR_GET_RUNNER(m) (gst_qa_reporter_get_runner (GST_QA_REPORTER_CAST (m)))
#define GST_QA_MONITOR_GET_PARENT(m) (GST_QA_MONITOR_CAST (m)->parent)
#define GST_QA_MONITOR_LOCK(m) (g_mutex_lock (&GST_QA_MONITOR_CAST(m)->mutex))
#define GST_QA_MONITOR_UNLOCK(m) (g_mutex_unlock (&GST_QA_MONITOR_CAST(m)->mutex))
#define GST_QA_MONITOR_OVERRIDES_LOCK(m) g_mutex_lock (&GST_QA_MONITOR_CAST (m)->overrides_mutex)
#define GST_QA_MONITOR_OVERRIDES_UNLOCK(m) g_mutex_unlock (&GST_QA_MONITOR_CAST (m)->overrides_mutex)
#define GST_QA_MONITOR_OVERRIDES(m) (GST_QA_MONITOR_CAST (m)->overrides)
/* #else TODO Implemen no variadic macros, use inline,
* Problem being:
* GST_QA_REPORT_LEVEL_ ## status
* GST_QA_AREA_ ## area ## _ ## subarea
*/
typedef struct _GstQaMonitor GstQaMonitor;
typedef struct _GstQaMonitorClass GstQaMonitorClass;
/**
* GstQaMonitor:
*
* GStreamer QA Monitor class.
*
* Class that wraps a #GObject for QA checks
*/
struct _GstQaMonitor {
GObject object;
GstObject *target;
GMutex mutex;
gchar *target_name;
GstQaMonitor *parent;
GMutex overrides_mutex;
GQueue overrides;
/*< private >*/
GHashTable *reports;
};
/**
* GstQaMonitorClass:
* @parent_class: parent
*
* GStreamer QA Monitor object class.
*/
struct _GstQaMonitorClass {
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);
GstElement * gst_qa_monitor_get_element (GstQaMonitor * monitor);
const gchar * gst_qa_monitor_get_element_name (GstQaMonitor * monitor);
G_END_DECLS
#endif /* __GST_QA_MONITOR_H__ */

View file

@ -1,231 +0,0 @@
/* 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>
#define __USE_GNU
#include <dlfcn.h>
#include "gst-qa-override-registry.h"
typedef struct
{
gchar *name;
GstQaOverride *override;
} GstQaOverrideRegistryNameEntry;
typedef struct
{
GType gtype;
GstQaOverride *override;
} GstQaOverrideRegistryGTypeEntry;
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)
#define GST_QA_OVERRIDE_INIT_SYMBOL "gst_qa_create_overrides"
static GstQaOverrideRegistry *
gst_qa_override_registry_new (void)
{
GstQaOverrideRegistry *reg = g_slice_new0 (GstQaOverrideRegistry);
g_mutex_init (&reg->mutex);
g_queue_init (&reg->name_overrides);
g_queue_init (&reg->gtype_overrides);
g_queue_init (&reg->klass_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 (&registry->name_overrides, entry);
GST_QA_OVERRIDE_REGISTRY_UNLOCK (registry);
}
void
gst_qa_override_register_by_type (GType gtype, GstQaOverride * override)
{
GstQaOverrideRegistry *registry = gst_qa_override_registry_get ();
GstQaOverrideRegistryGTypeEntry *entry =
g_slice_new (GstQaOverrideRegistryGTypeEntry);
GST_QA_OVERRIDE_REGISTRY_LOCK (registry);
entry->gtype = gtype;
entry->override = override;
g_queue_push_tail (&registry->gtype_overrides, entry);
GST_QA_OVERRIDE_REGISTRY_UNLOCK (registry);
}
void
gst_qa_override_register_by_klass (const gchar * klass,
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 (klass);
entry->override = override;
g_queue_push_tail (&registry->klass_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);
}
}
}
static void
gst_qa_override_registry_attach_gtype_overrides_unlocked (GstQaOverrideRegistry
* registry, GstQaMonitor * monitor)
{
GstQaOverrideRegistryGTypeEntry *entry;
GstElement *element;
GList *iter;
element = gst_qa_monitor_get_element (monitor);
if (!element)
return;
for (iter = registry->name_overrides.head; iter; iter = g_list_next (iter)) {
entry = iter->data;
if (G_TYPE_CHECK_INSTANCE_TYPE (element, entry->gtype)) {
gst_qa_monitor_attach_override (monitor, entry->override);
}
}
}
static void
gst_qa_override_registry_attach_klass_overrides_unlocked (GstQaOverrideRegistry
* registry, GstQaMonitor * monitor)
{
GstQaOverrideRegistryNameEntry *entry;
GList *iter;
GstElement *element;
GstElementClass *klass;
element = gst_qa_monitor_get_element (monitor);
if (!element)
return;
klass = GST_ELEMENT_GET_CLASS (element);
for (iter = registry->name_overrides.head; iter; iter = g_list_next (iter)) {
entry = iter->data;
/* TODO It would be more correct to split it before comparing */
if (strstr (klass->details.klass, entry->name) != NULL) {
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_attach_gtype_overrides_unlocked (reg, monitor);
gst_qa_override_registry_attach_klass_overrides_unlocked (reg, monitor);
GST_QA_OVERRIDE_REGISTRY_UNLOCK (reg);
}
int
gst_qa_override_registry_preload (void)
{
gchar **solist, *const *so;
const char *sos, *soerr;
void *sol;
int ret, (*entry) (void), nloaded = 0;
sos = g_getenv ("GST_QA_OVERRIDE");
if (!sos) {
GST_INFO ("No GST_QA_OVERRIDE found, no overrides to load");
return 0;
}
solist = g_strsplit (sos, ",", 0);
for (so = solist; *so; ++so) {
GST_INFO ("Loading overrides from %s", *so);
sol = dlopen (*so, RTLD_LAZY);
if (!sol) {
soerr = dlerror ();
GST_ERROR ("Failed to load %s %s", *so, soerr ? soerr : "no idea why");
continue;
}
entry = dlsym (sol, GST_QA_OVERRIDE_INIT_SYMBOL);
if (entry) {
ret = (*entry) ();
if (ret > 0) {
GST_INFO ("Loaded %d overrides from %s", ret, *so);
nloaded += ret;
} else if (ret < 0) {
GST_WARNING ("Error loading overrides from %s", *so);
} else {
GST_INFO ("Loaded no overrides from %s", *so);
}
} else {
GST_WARNING (GST_QA_OVERRIDE_INIT_SYMBOL " not found in %s", *so);
}
dlclose (sol);
}
g_strfreev (solist);
GST_INFO ("%d overrides loaded", nloaded);
return nloaded;
}

View file

@ -1,79 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-override.h - QA Override that allows customizing QA behavior
*
* 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_H__
#define __GST_QA_OVERRIDE_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-report.h"
G_BEGIN_DECLS
typedef struct _QstQaOverride GstQaOverride;
typedef struct _GstQaMonitor GstQaMonitor;
typedef void (*GstQaOverrideBufferHandler)(GstQaOverride * override,
GstQaMonitor * pad_monitor, GstBuffer * buffer);
typedef void (*GstQaOverrideEventHandler)(GstQaOverride * override,
GstQaMonitor * pad_monitor, GstEvent * event);
typedef void (*GstQaOverrideQueryHandler)(GstQaOverride * override,
GstQaMonitor * pad_monitor, GstQuery * query);
typedef void (*GstQaOverrideGetCapsHandler)(GstQaOverride * override,
GstQaMonitor * pad_monitor, GstCaps * caps);
typedef void (*GstQaOverrideSetCapsHandler)(GstQaOverride * override,
GstQaMonitor * pad_monitor, GstCaps * caps);
struct _QstQaOverride {
GHashTable *level_override;
/* Pad handlers */
GstQaOverrideBufferHandler buffer_handler;
GstQaOverrideEventHandler event_handler;
GstQaOverrideQueryHandler query_handler;
GstQaOverrideBufferHandler buffer_probe_handler;
GstQaOverrideGetCapsHandler getcaps_handler;
GstQaOverrideSetCapsHandler setcaps_handler;
};
GstQaOverride * gst_qa_override_new (void);
void gst_qa_override_free (GstQaOverride * override);
void gst_qa_override_change_severity (GstQaOverride * override, GstQaIssueId issue_id, GstQaReportLevel new_level);
GstQaReportLevel gst_qa_override_get_severity (GstQaOverride * override, GstQaIssueId issue_id, GstQaReportLevel default_level);
void gst_qa_override_event_handler (GstQaOverride * override, GstQaMonitor * monitor, GstEvent * event);
void gst_qa_override_buffer_handler (GstQaOverride * override, GstQaMonitor * monitor, GstBuffer * buffer);
void gst_qa_override_query_handler (GstQaOverride * override, GstQaMonitor * monitor, GstQuery * query);
void gst_qa_override_buffer_probe_handler (GstQaOverride * override, GstQaMonitor * monitor, GstBuffer * buffer);
void gst_qa_override_getcaps_handler (GstQaOverride * override, GstQaMonitor * monitor, GstCaps * caps);
void gst_qa_override_setcaps_handler (GstQaOverride * override, GstQaMonitor * monitor, GstCaps * caps);
void gst_qa_override_set_event_handler (GstQaOverride * override, GstQaOverrideEventHandler handler);
void gst_qa_override_set_buffer_handler (GstQaOverride * override, GstQaOverrideBufferHandler handler);
void gst_qa_override_set_query_handler (GstQaOverride * override, GstQaOverrideQueryHandler handler);
void gst_qa_override_set_buffer_probe_handler (GstQaOverride * override, GstQaOverrideBufferHandler handler);
void gst_qa_override_set_getcaps_handler (GstQaOverride * override, GstQaOverrideGetCapsHandler handler);
void gst_qa_override_set_setcaps_handler (GstQaOverride * override, GstQaOverrideSetCapsHandler handler);
G_END_DECLS
#endif /* __GST_QA_OVERRIDE_H__ */

View file

@ -1,343 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-monitor-report.c - QA report/issues functions
*
* 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include "gst-qa-i18n-lib.h"
#include "gst-qa-report.h"
#include "gst-qa-reporter.h"
#include "gst-qa-monitor.h"
static GstClockTime _gst_qa_report_start_time = 0;
static GstQaDebugFlags _gst_qa_flags = 0;
static GHashTable *_gst_qa_issues = NULL;
G_DEFINE_BOXED_TYPE (GstQaReport, gst_qa_report,
(GBoxedCopyFunc) gst_qa_report_ref, (GBoxedFreeFunc) gst_qa_report_unref);
GstQaIssueId
gst_qa_issue_get_id (GstQaIssue * issue)
{
return issue->issue_id;
}
GstQaIssue *
gst_qa_issue_new (GstQaIssueId issue_id, gchar * summary,
gchar * description, GstQaReportLevel default_level)
{
GstQaIssue *issue = g_slice_new (GstQaIssue);
issue->issue_id = issue_id;
issue->summary = summary;
issue->description = description;
issue->default_level = default_level;
issue->repeat = FALSE;
return issue;
}
static void
gst_qa_issue_free (GstQaIssue * issue)
{
g_free (issue->summary);
g_free (issue->description);
g_slice_free (GstQaIssue, issue);
}
void
gst_qa_issue_register (GstQaIssue * issue)
{
g_return_if_fail (g_hash_table_lookup (_gst_qa_issues,
(gpointer) gst_qa_issue_get_id (issue)) == NULL);
g_hash_table_insert (_gst_qa_issues, (gpointer) gst_qa_issue_get_id (issue),
issue);
}
#define REGISTER_QA_ISSUE(id,sum,desc,lvl) gst_qa_issue_register (gst_qa_issue_new (id, sum, desc, lvl))
static void
gst_qa_report_load_issues (void)
{
g_return_if_fail (_gst_qa_issues == NULL);
_gst_qa_issues = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) gst_qa_issue_free);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_BUFFER_BEFORE_SEGMENT,
_("buffer was received before a segment"),
_("in push mode, a segment event must be received before a buffer"),
GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_BUFFER_IS_OUT_OF_SEGMENT,
_("buffer is out of the segment range"),
_("buffer being pushed is out of the current segment's start-stop "
" range. Meaning it is going to be discarded downstream without "
"any use"), GST_QA_REPORT_LEVEL_ISSUE);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE,
_("buffer timestamp is out of the received buffer timestamps' range"),
_("a buffer leaving an element should have its timestamps in the range "
"of the received buffers timestamps. i.e. If an element received "
"buffers with timestamps from 0s to 10s, it can't push a buffer with "
"with a 11s timestamp, because it doesn't have data for that"),
GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO,
_("first buffer's running time isn't 0"),
_("the first buffer's received running time is expected to be 0"),
GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_WRONG_FLOW_RETURN, _("flow return from pad push doesn't match expected value"), _("flow return from a 1:1 sink/src pad element is as simple as " "returning what downstream returned. For elements that have multiple " "src pads, flow returns should be properly combined"), /* TODO fill me more */
GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_CAPS_IS_MISSING_FIELD,
_("caps is missing a required field for its type"),
_("some caps types are expected to contain a set of basic fields. "
"For example, raw video should have 'width', 'height', 'framerate' "
"and 'pixel-aspect-ratio'"), GST_QA_REPORT_LEVEL_ISSUE);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_CAPS_FIELD_HAS_BAD_TYPE,
_("caps field has an unexpected type"),
_("some common caps fields should always use the same expected types"),
GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_CAPS_EXPECTED_FIELD_NOT_FOUND,
_("caps expected field wasn't present"),
_("a field that should be present in the caps wasn't found. "
"Fields sets on a sink pad caps should be propagated downstream "
"when it makes sense to do so"), GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_GET_CAPS_NOT_PROXYING_FIELDS,
_("getcaps function isn't proxying downstream fields correctly"),
_("elements should set downstream caps restrictions on its caps when "
"replying upstream's getcaps queries to avoid upstream sending data"
" in an unsupported format"), GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_CAPS_FIELD_UNEXPECTED_VALUE,
_("a field in caps has an unexpected value"),
_("fields set on a sink pad should be propagated downstream via "
"set caps"), GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_NEWSEGMENT_NOT_PUSHED,
_("new segment event wasn't propagated downstream"),
_("segments received from upstream should be pushed downstream"),
GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME,
_("a serialized event received should be pushed in the same 'time' "
"as it was received"),
_("serialized events should be pushed in the same order they are "
"received and serialized with buffers. If an event is received after"
" a buffer with timestamp end 'X', it should be pushed right after "
"buffers with timestamp end 'X'"), GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_HAS_WRONG_SEQNUM,
_("events that are part of the same pipeline 'operation' should "
"have the same seqnum"),
_("when events/messages are created from another event/message, "
"they should have their seqnums set to the original event/message "
"seqnum"), GST_QA_REPORT_LEVEL_ISSUE);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_SERIALIZED_OUT_OF_ORDER,
_("a serialized event received should be pushed in the same order "
"as it was received"),
_("serialized events should be pushed in the same order they are "
"received."), GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_NEW_SEGMENT_MISMATCH,
_("a new segment event has different value than the received one"),
_("when receiving a new segment, an element should push an equivalent"
"segment downstream"), GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_FLUSH_START_UNEXPECTED,
_("received an unexpected flush start event"),
NULL, GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_FLUSH_STOP_UNEXPECTED,
_("received an unexpected flush stop event"),
NULL, GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_SEEK_NOT_HANDLED,
_("seek event wasn't handled"), NULL, GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG,
_("position after a seek is wrong"), NULL, GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_STATE_CHANGE_FAILURE,
_("state change failed"), NULL, GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_SIZE_IS_ZERO,
_("resulting file size is 0"), NULL, GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_SIZE_INCORRECT,
_("resulting file size wasn't within the expected values"),
NULL, GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_DURATION_INCORRECT,
_("resulting file duration wasn't within the expected values"),
NULL, GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_SEEKABLE_INCORRECT,
_("resulting file wasn't seekable or not seekable as expected"),
NULL, GST_QA_REPORT_LEVEL_WARNING);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_PROFILE_INCORRECT,
_("resulting file stream profiles didn't match expected values"),
NULL, GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_NOT_FOUND,
_("resulting file could not be found for testing"), NULL,
GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_CHECK_FAILURE,
_("an error occured while checking the file for conformance"), NULL,
GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_PLAYBACK_START_FAILURE,
_("an error occured while starting playback of the test file"), NULL,
GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_FILE_PLAYBACK_ERROR,
_("an error during playback of the file"), NULL,
GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_ALLOCATION_FAILURE,
_("a memory allocation failed during QA run"),
NULL, GST_QA_REPORT_LEVEL_CRITICAL);
REGISTER_QA_ISSUE (GST_QA_ISSUE_ID_MISSING_PLUGIN,
_("a gstreamer plugin is missing and prevented QA from running"),
NULL, GST_QA_REPORT_LEVEL_CRITICAL);
}
void
gst_qa_report_init (void)
{
const gchar *var;
const GDebugKey keys[] = {
{"fatal_criticals", GST_QA_FATAL_CRITICALS},
{"fatal_warnings", GST_QA_FATAL_WARNINGS},
{"fatal_issues", GST_QA_FATAL_ISSUES}
};
if (_gst_qa_report_start_time == 0) {
_gst_qa_report_start_time = gst_util_get_timestamp ();
/* init the debug flags */
var = g_getenv ("GST_QA");
if (var && strlen (var) > 0) {
_gst_qa_flags = g_parse_debug_string (var, keys, 3);
}
gst_qa_report_load_issues ();
}
}
GstQaIssue *
gst_qa_issue_from_id (GstQaIssueId issue_id)
{
return g_hash_table_lookup (_gst_qa_issues, (gpointer) issue_id);
}
/* TODO how are these functions going to work with extensions */
const gchar *
gst_qa_report_level_get_name (GstQaReportLevel level)
{
switch (level) {
case GST_QA_REPORT_LEVEL_CRITICAL:
return "critical";
case GST_QA_REPORT_LEVEL_WARNING:
return "warning";
case GST_QA_REPORT_LEVEL_ISSUE:
return "issue";
case GST_QA_REPORT_LEVEL_IGNORE:
return "ignore";
default:
return "unknown";
}
}
const gchar *
gst_qa_report_area_get_name (GstQaReportArea area)
{
switch (area) {
case GST_QA_AREA_EVENT:
return "event";
case GST_QA_AREA_BUFFER:
return "buffer";
case GST_QA_AREA_QUERY:
return "query";
case GST_QA_AREA_CAPS:
return "caps";
case GST_QA_AREA_SEEK:
return "seek";
case GST_QA_AREA_STATE:
return "state";
case GST_QA_AREA_FILE_CHECK:
return "file-check";
case GST_QA_AREA_RUN_ERROR:
return "run-error";
case GST_QA_AREA_OTHER:
return "other";
default:
g_assert_not_reached ();
return "unknown";
}
}
void
gst_qa_report_check_abort (GstQaReport * report)
{
if ((report->level == GST_QA_REPORT_LEVEL_ISSUE &&
_gst_qa_flags & GST_QA_FATAL_ISSUES) ||
(report->level == GST_QA_REPORT_LEVEL_WARNING &&
_gst_qa_flags & GST_QA_FATAL_WARNINGS) ||
(report->level == GST_QA_REPORT_LEVEL_CRITICAL &&
_gst_qa_flags & GST_QA_FATAL_CRITICALS)) {
g_error ("Fatal report received: %" GST_QA_ERROR_REPORT_PRINT_FORMAT,
GST_QA_REPORT_PRINT_ARGS (report));
}
}
GstQaIssueId
gst_qa_report_get_issue_id (GstQaReport * report)
{
return gst_qa_issue_get_id (report->issue);
}
GstQaReport *
gst_qa_report_new (GstQaIssue * issue, GstQaReporter * reporter,
const gchar * message)
{
GstQaReport *report = g_slice_new0 (GstQaReport);
report->issue = issue;
report->reporter = reporter; /* TODO should we ref? */
report->message = g_strdup (message);
report->timestamp = gst_util_get_timestamp () - _gst_qa_report_start_time;
report->level = issue->default_level;
return report;
}
void
gst_qa_report_unref (GstQaReport * report)
{
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
g_free (report->message);
g_slice_free (GstQaReport, report);
}
}
GstQaReport *
gst_qa_report_ref (GstQaReport * report)
{
g_atomic_int_inc (&report->refcount);
return report;
}
void
gst_qa_report_printf (GstQaReport * report)
{
g_print ("%" GST_QA_ERROR_REPORT_PRINT_FORMAT "\n",
GST_QA_REPORT_PRINT_ARGS (report));
}

View file

@ -1,189 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-monitor-report.h - QA Element report structures and functions
*
* 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_REPORT_H__
#define __GST_QA_REPORT_H__
#include <glib-object.h>
#include <gst/gst.h>
G_BEGIN_DECLS
/* forward declaration */
typedef struct _GstQaReporter GstQaReporter;
GType gst_qa_report_get_type (void);
#define GST_TYPE_QA_REPORT (gst_qa_report_get_type ())
typedef enum {
GST_QA_FATAL_DEFAULT = 0,
GST_QA_FATAL_ISSUES = 1 << 0,
GST_QA_FATAL_WARNINGS = 1 << 1,
GST_QA_FATAL_CRITICALS = 1 << 2
} GstQaDebugFlags;
typedef enum {
GST_QA_REPORT_LEVEL_CRITICAL,
GST_QA_REPORT_LEVEL_WARNING,
GST_QA_REPORT_LEVEL_ISSUE,
GST_QA_REPORT_LEVEL_IGNORE,
GST_QA_REPORT_LEVEL_NUM_ENTRIES,
} GstQaReportLevel;
typedef enum {
GST_QA_AREA_EVENT=1,
GST_QA_AREA_BUFFER,
GST_QA_AREA_QUERY,
GST_QA_AREA_CAPS,
GST_QA_AREA_SEEK,
GST_QA_AREA_STATE,
GST_QA_AREA_FILE_CHECK,
GST_QA_AREA_RUN_ERROR,
GST_QA_AREA_OTHER=100,
} GstQaReportArea;
typedef guintptr GstQaIssueId;
#define GST_QA_ISSUE_ID_UNKNOWN 0
#define GST_QA_ISSUE_ID_SHIFT 16
#define GST_QA_ISSUE_ID_CUSTOM_FIRST (2 << 15)
#define GST_QA_ISSUE_ID_BUFFER_BEFORE_SEGMENT (((GstQaIssueId) GST_QA_AREA_BUFFER) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_BUFFER_IS_OUT_OF_SEGMENT (((GstQaIssueId) GST_QA_AREA_BUFFER) << GST_QA_ISSUE_ID_SHIFT | 2)
#define GST_QA_ISSUE_ID_BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE (((GstQaIssueId) GST_QA_AREA_BUFFER) << GST_QA_ISSUE_ID_SHIFT | 3)
#define GST_QA_ISSUE_ID_FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO (((GstQaIssueId) GST_QA_AREA_BUFFER) << GST_QA_ISSUE_ID_SHIFT | 4)
#define GST_QA_ISSUE_ID_WRONG_FLOW_RETURN (((GstQaIssueId) GST_QA_AREA_BUFFER) << GST_QA_ISSUE_ID_SHIFT | 5)
#define GST_QA_ISSUE_ID_CAPS_IS_MISSING_FIELD (((GstQaIssueId) GST_QA_AREA_CAPS) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_CAPS_FIELD_HAS_BAD_TYPE (((GstQaIssueId) GST_QA_AREA_CAPS) << GST_QA_ISSUE_ID_SHIFT | 2)
#define GST_QA_ISSUE_ID_CAPS_EXPECTED_FIELD_NOT_FOUND (((GstQaIssueId) GST_QA_AREA_CAPS) << GST_QA_ISSUE_ID_SHIFT | 3)
#define GST_QA_ISSUE_ID_GET_CAPS_NOT_PROXYING_FIELDS (((GstQaIssueId) GST_QA_AREA_CAPS) << GST_QA_ISSUE_ID_SHIFT | 4)
#define GST_QA_ISSUE_ID_CAPS_FIELD_UNEXPECTED_VALUE (((GstQaIssueId) GST_QA_AREA_CAPS) << GST_QA_ISSUE_ID_SHIFT | 5)
#define GST_QA_ISSUE_ID_EVENT_NEWSEGMENT_NOT_PUSHED (((GstQaIssueId) GST_QA_AREA_EVENT) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME (((GstQaIssueId) GST_QA_AREA_EVENT) << GST_QA_ISSUE_ID_SHIFT | 2)
#define GST_QA_ISSUE_ID_EVENT_HAS_WRONG_SEQNUM (((GstQaIssueId) GST_QA_AREA_EVENT) << GST_QA_ISSUE_ID_SHIFT | 3)
#define GST_QA_ISSUE_ID_EVENT_SERIALIZED_OUT_OF_ORDER (((GstQaIssueId) GST_QA_AREA_EVENT) << GST_QA_ISSUE_ID_SHIFT | 4)
#define GST_QA_ISSUE_ID_EVENT_NEW_SEGMENT_MISMATCH (((GstQaIssueId) GST_QA_AREA_EVENT) << GST_QA_ISSUE_ID_SHIFT | 5)
#define GST_QA_ISSUE_ID_EVENT_FLUSH_START_UNEXPECTED (((GstQaIssueId) GST_QA_AREA_EVENT) << GST_QA_ISSUE_ID_SHIFT | 6)
#define GST_QA_ISSUE_ID_EVENT_FLUSH_STOP_UNEXPECTED (((GstQaIssueId) GST_QA_AREA_EVENT) << GST_QA_ISSUE_ID_SHIFT | 7)
#define GST_QA_ISSUE_ID_EVENT_SEEK_NOT_HANDLED (((GstQaIssueId) GST_QA_AREA_SEEK) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG (((GstQaIssueId) GST_QA_AREA_SEEK) << GST_QA_ISSUE_ID_SHIFT | 2)
#define GST_QA_ISSUE_ID_STATE_CHANGE_FAILURE (((GstQaIssueId) GST_QA_AREA_STATE) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_FILE_SIZE_IS_ZERO (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_FILE_SIZE_INCORRECT (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 2)
#define GST_QA_ISSUE_ID_FILE_DURATION_INCORRECT (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 3)
#define GST_QA_ISSUE_ID_FILE_SEEKABLE_INCORRECT (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 4)
#define GST_QA_ISSUE_ID_FILE_PROFILE_INCORRECT (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 5)
#define GST_QA_ISSUE_ID_FILE_NOT_FOUND (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 6)
#define GST_QA_ISSUE_ID_FILE_CHECK_FAILURE (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 7)
#define GST_QA_ISSUE_ID_FILE_PLAYBACK_START_FAILURE (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 8)
#define GST_QA_ISSUE_ID_FILE_PLAYBACK_ERROR (((GstQaIssueId) GST_QA_AREA_FILE_CHECK) << GST_QA_ISSUE_ID_SHIFT | 9)
#define GST_QA_ISSUE_ID_ALLOCATION_FAILURE (((GstQaIssueId) GST_QA_AREA_RUN_ERROR) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_MISSING_PLUGIN (((GstQaIssueId) GST_QA_AREA_RUN_ERROR) << GST_QA_ISSUE_ID_SHIFT | 2)
#define GST_QA_ISSUE_ID_AREA(id) ((guintptr)(id >> GST_QA_ISSUE_ID_SHIFT))
typedef struct {
GstQaIssueId issue_id;
/* Summary: one-liner translatable description of the issue */
gchar *summary;
/* description: multi-line translatable description of:
* * what the issue is (and why it's an issue)
* * what the source problem could be
* * pointers to fixing the issue
*/
gchar *description;
/* default_level: The default level of severity for this
* issue. */
GstQaReportLevel default_level;
/* repeat: whether the issue might be triggered
* multiple times but only remembered once */
gboolean repeat;
} GstQaIssue;
#define GST_QA_ISSUE_AREA(i) (GST_QA_ISSUE_ID_AREA (gst_qa_issue_get_id (i)))
typedef struct {
gint refcount;
/* issue: The issue this report corresponds to (to get dsecription, summary,...) */
GstQaIssue *issue;
GstQaReportLevel level;
/* The reporter that reported the issue (to get names, info, ...) */
GstQaReporter *reporter;
/* timestamp: The time at which this issue happened since
* the process start (to stay in sync with gst logging) */
GstClockTime timestamp;
/* message: issue-specific message. Gives more detail on the actual
* issue. Can be NULL */
gchar *message;
} GstQaReport;
#define GST_QA_ISSUE_FORMAT G_GUINTPTR_FORMAT " (%s) : %s(%" G_GUINTPTR_FORMAT "): %s"
#define GST_QA_ISSUE_ARGS(i) gst_qa_issue_get_id (i), gst_qa_report_level_get_name (i->default_level), \
gst_qa_report_area_get_name (GST_QA_ISSUE_AREA (i)), GST_QA_ISSUE_AREA (i), \
i->summary
#define GST_QA_ERROR_REPORT_PRINT_FORMAT GST_TIME_FORMAT " <%s>: %" GST_QA_ISSUE_FORMAT ": %s"
#define GST_QA_REPORT_PRINT_ARGS(r) GST_TIME_ARGS (r->timestamp), \
gst_qa_reporter_get_name (r->reporter), \
GST_QA_ISSUE_ARGS (r->issue), \
r->message
void gst_qa_report_init (void);
GstQaIssue * gst_qa_issue_from_id (GstQaIssueId issue_id);
GstQaIssueId gst_qa_issue_get_id (GstQaIssue * issue);
void gst_qa_issue_register (GstQaIssue * issue);
GstQaIssue * gst_qa_issue_new (GstQaIssueId issue_id, gchar * summary,
gchar * description,
GstQaReportLevel default_level);
GstQaReport * gst_qa_report_new (GstQaIssue * issue,
GstQaReporter * reporter,
const gchar * message);
void gst_qa_report_unref (GstQaReport * report);
GstQaReport * gst_qa_report_ref (GstQaReport * report);
GstQaIssueId gst_qa_report_get_issue_id (GstQaReport * report);
void gst_qa_report_check_abort (GstQaReport * report);
void gst_qa_report_printf (GstQaReport * report);
const gchar * gst_qa_report_level_get_name (GstQaReportLevel level);
const gchar * gst_qa_report_area_get_name (GstQaReportArea area);
const gchar * gst_qa_report_subarea_get_name (GstQaReportArea area, gint subarea);
G_END_DECLS
#endif /* __GST_QA_REPORT_H__ */

View file

@ -1,183 +0,0 @@
/* GStreamer
*
* Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
*
* 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 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-reporter.h"
#include "gst-qa-report.h"
#define REPORTER_PRIVATE "gst-qa-reporter-private"
GST_DEBUG_CATEGORY_STATIC (gst_qa_reporter);
#define GST_CAT_DEFAULT gst_qa_reporter
typedef struct _GstQaReporterPrivate
{
GstQaRunner *runner;
GHashTable *reports;
char *name;
} GstQaReporterPrivate;
static void
gst_qa_reporter_default_init (GstQaReporterInterface * iface)
{
GST_DEBUG_CATEGORY_INIT (gst_qa_reporter, "gstqareporter",
GST_DEBUG_FG_MAGENTA, "gst qa reporter");
g_object_interface_install_property (iface,
g_param_spec_object ("qa-runner", "QA Runner", "The QA runner to "
"report errors to", GST_TYPE_QA_RUNNER,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
}
G_DEFINE_INTERFACE (GstQaReporter, gst_qa_reporter, G_TYPE_OBJECT);
static void
_free_priv (GstQaReporterPrivate * priv)
{
g_hash_table_unref (priv->reports);
g_free (priv->name);
}
static GstQaReporterPrivate *
gst_qa_reporter_get_priv (GstQaReporter * reporter)
{
GstQaReporterPrivate *priv =
g_object_get_data (G_OBJECT (reporter), REPORTER_PRIVATE);
if (priv == NULL) {
priv = g_slice_new0 (GstQaReporterPrivate);
priv->reports = g_hash_table_new_full (g_direct_hash,
g_direct_equal, NULL, (GDestroyNotify) gst_qa_report_unref);
g_object_set_data_full (G_OBJECT (reporter), REPORTER_PRIVATE, priv,
(GDestroyNotify) _free_priv);
}
return priv;
}
static void
gst_qa_reporter_intercept_report (GstQaReporter * reporter,
GstQaReport * report)
{
GstQaReporterInterface *iface = GST_QA_REPORTER_GET_INTERFACE (reporter);
if (iface->intercept_report) {
iface->intercept_report (reporter, report);
}
}
void
gst_qa_report_valist (GstQaReporter * reporter,
GstQaIssueId issue_id, const gchar * format, va_list var_args)
{
GstQaReport *report;
gchar *message;
GstQaIssue *issue;
GstQaReporterPrivate *priv = gst_qa_reporter_get_priv (reporter);
issue = gst_qa_issue_from_id (issue_id);
g_return_if_fail (issue != NULL);
message = g_strdup_vprintf (format, var_args);
report = gst_qa_report_new (issue, reporter, message);
gst_qa_reporter_intercept_report (reporter, report);
if (issue->repeat == FALSE) {
GstQaIssueId issue_id = gst_qa_issue_get_id (issue);
if (g_hash_table_lookup (priv->reports, (gconstpointer) issue_id)) {
GST_DEBUG ("Report \"%" G_GUINTPTR_FORMAT ":%s\" already present",
issue_id, issue->summary);
gst_qa_report_unref (report);
return;
}
g_hash_table_insert (priv->reports, (gpointer) issue_id, report);
}
if (report->level == GST_QA_REPORT_LEVEL_CRITICAL)
GST_ERROR ("<%s>: %s", priv->name, message);
else if (report->level == GST_QA_REPORT_LEVEL_WARNING)
GST_WARNING ("<%s>: %s", priv->name, message);
else if (report->level == GST_QA_REPORT_LEVEL_ISSUE)
GST_LOG ("<%s>: %s", priv->name, message);
else
GST_DEBUG ("<%s>: %s", priv->name, message);
GST_INFO_OBJECT (reporter, "Received error report %" GST_QA_ISSUE_FORMAT
" : %s", GST_QA_ISSUE_ARGS (issue), message);
gst_qa_report_printf (report);
gst_qa_report_check_abort (report);
if (priv->runner) {
gst_qa_runner_add_report (priv->runner, report);
} else {
gst_qa_report_unref (report);
}
g_free (message);
}
void
gst_qa_report (GstQaReporter * reporter, GstQaIssueId issue_id,
const gchar * format, ...)
{
va_list var_args;
va_start (var_args, format);
gst_qa_report_valist (reporter, issue_id, format, var_args);
va_end (var_args);
}
void
gst_qa_reporter_set_name (GstQaReporter * reporter, gchar * name)
{
GstQaReporterPrivate *priv = gst_qa_reporter_get_priv (reporter);
if (priv->name)
g_free (priv->name);
priv->name = name;
}
const gchar *
gst_qa_reporter_get_name (GstQaReporter * reporter)
{
GstQaReporterPrivate *priv = gst_qa_reporter_get_priv (reporter);
return priv->name;
}
GstQaRunner *
gst_qa_reporter_get_runner (GstQaReporter * reporter)
{
GstQaReporterPrivate *priv = gst_qa_reporter_get_priv (reporter);
return priv->runner;
}
void
gst_qa_reporter_set_runner (GstQaReporter * reporter, GstQaRunner * runner)
{
GstQaReporterPrivate *priv = gst_qa_reporter_get_priv (reporter);
priv->runner = runner;
}

View file

@ -1,83 +0,0 @@
/* GStreamer
*
* Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
*
* 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 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_REPORTER_
#define _GST_QA_REPORTER_
#include <glib-object.h>
#include "gst-qa-runner.h"
#include "gst-qa-report.h"
G_BEGIN_DECLS
typedef struct _GstQaReporter GstQaReporter;
typedef struct _GstQaReporterInterface GstQaReporterInterface;
/* GstQaReporter interface declarations */
#define GST_TYPE_QA_REPORTER (gst_qa_reporter_get_type ())
#define GST_QA_REPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_REPORTER, GstQaReporter))
#define GST_IS_QA_REPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_REPORTER))
#define GST_QA_REPORTER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_QA_REPORTER, GstQaReporterInterface))
#define GST_QA_REPORTER_CAST(obj) ((GstQaReporter *) obj)
#ifdef G_HAVE_ISO_VARARGS
#define GST_QA_REPORT(m, issue_id, ...) \
G_STMT_START { \
gst_qa_report (GST_QA_REPORTER (m), issue_id, \
__VA_ARGS__ ); \
} G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define GST_QA_REPORT(m, issue_id, args...) \
G_STMT_START { \
gst_qa_report (GST_QA_REPORTER (m), \
issue_id, ##args ); \
} G_STMT_END
#endif /* G_HAVE_ISO_VARARGS */
#endif /* G_HAVE_GNUC_VARARGS */
GType gst_qa_reporter_get_type (void);
/**
* GstQaReporter:
*/
struct _GstQaReporterInterface
{
GTypeInterface parent;
void (*intercept_report)(GstQaReporter * reporter, GstQaReport * report);
};
void gst_qa_reporter_set_name (GstQaReporter * reporter,
gchar * name);
const gchar * gst_qa_reporter_get_name (GstQaReporter * reporter);
GstQaRunner * gst_qa_reporter_get_runner (GstQaReporter *reporter);
void gst_qa_reporter_init (GstQaReporter * reporter, const gchar *name);
void gst_qa_report (GstQaReporter * reporter, GstQaIssueId issue_id,
const gchar * format, ...);
void gst_qa_report_valist (GstQaReporter * reporter, GstQaIssueId issue_id,
const gchar * format, va_list var_args);
void gst_qa_reporter_set_runner (GstQaReporter * reporter,
GstQaRunner *runner);
G_END_DECLS
#endif /* _GST_QA_REPORTER_ */

View file

@ -1,87 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-runner.h - 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.
*/
#ifndef __GST_QA_RUNNER_H__
#define __GST_QA_RUNNER_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-report.h"
G_BEGIN_DECLS
/* forward declaration */
typedef struct _GstQaScenario GstQaScenario;
#define GST_TYPE_QA_RUNNER (gst_qa_runner_get_type ())
#define GST_IS_QA_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_RUNNER))
#define GST_IS_QA_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_RUNNER))
#define GST_QA_RUNNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_RUNNER, GstQaRunnerClass))
#define GST_QA_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_RUNNER, GstQaRunner))
#define GST_QA_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_RUNNER, GstQaRunnerClass))
#define GST_QA_RUNNER_CAST(obj) ((GstQaRunner*)(obj))
#define GST_QA_RUNNER_CLASS_CAST(klass) ((GstQaRunnerClass*)(klass))
typedef struct _GstQaRunner GstQaRunner;
typedef struct _GstQaRunnerClass GstQaRunnerClass;
/* TODO hide this to be opaque? */
/**
* GstQaRunner:
*
* GStreamer QA Runner class.
*
* Class that manages a QA test run for some pipeline
*/
struct _GstQaRunner {
GObject object;
gboolean setup;
/*< private >*/
GSList *reports;
};
/**
* GstQaRunnerClass:
* @parent_class: parent
*
* GStreamer QA Runner object class.
*/
struct _GstQaRunnerClass {
GObjectClass parent_class;
};
/* normal GObject stuff */
GType gst_qa_runner_get_type (void);
GstQaRunner * gst_qa_runner_new (void);
void gst_qa_runner_add_report (GstQaRunner * runner, GstQaReport * report);
guint gst_qa_runner_get_reports_count (GstQaRunner * runner);
GSList * gst_qa_runner_get_reports (GstQaRunner * runner);
G_END_DECLS
#endif /* __GST_QA_RUNNER_H__ */

View file

@ -1,65 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thibault Saunier <thibault.saunier@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.
*/
#ifndef __GST_QA_SCENARIO_H__
#define __GST_QA_SCENARIO_H__
#include <glib.h>
#include <glib-object.h>
#include "gst-qa-runner.h"
G_BEGIN_DECLS
#define GST_TYPE_QA_SCENARIO (gst_qa_scenario_get_type ())
#define GST_QA_SCENARIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_SCENARIO, GstQaScenario))
#define GST_QA_SCENARIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_SCENARIO, GstQaScenarioClass))
#define GST_IS_QA_SCENARIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_QA_SCENARIO))
#define GST_IS_QA_SCENARIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_QA_SCENARIO))
#define GST_QA_SCENARIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_SCENARIO, GstQaScenarioClass))
typedef struct _GstQaScenario GstQaScenario;
typedef struct _GstQaScenarioClass GstQaScenarioClass;
typedef struct _GstQaScenarioPrivate GstQaScenarioPrivate;
struct _GstQaScenarioClass
{
GObjectClass parent_class;
GMarkupParser content_parser;
};
struct _GstQaScenario
{
GObject parent;
GstQaScenarioPrivate *priv;
};
GType gst_qa_scenario_get_type (void);
GstQaScenario * gst_qa_scenario_factory_create (GstQaRunner *runner,
GstElement *pipeline,
const gchar *scenario_name);
G_END_DECLS
#endif /* __GST_QA_SCENARIOS__ */

View file

@ -1,8 +0,0 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*/
#include <gst/qa/gst-qa-runner.h>
#include <gst/qa/gst-qa-file-checker.h>
#include <gst/qa/gst-qa-monitor-factory.h>

3
validate/gst/validate/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
gst-validate-0.10
gst-validate-transcoding-0.10
gst-validate-file-check-0.10

View file

@ -0,0 +1,84 @@
libgstvalidate_@GST_API_VERSION@_la_SOURCES = \
gst-validate-runner.c \
gst-validate-reporter.c \
gst-validate-monitor.c \
gst-validate-element-monitor.c \
gst-validate-bin-monitor.c \
gst-validate-pad-monitor.c \
gst-validate-monitor-factory.c \
gst-validate-report.c \
gst-validate-scenario.c \
gst-validate-override.c \
gst-validate-override-registry.c \
gst-validate-file-checker.c
noinst_HEADERS = \
gettext.h \
gst-validate-bin-monitor.h \
gst-validate-element-monitor.h \
gst-validate-file-checker.h \
gst-validate-i18n-lib.h \
gst-validate-monitor-factory.h \
gst-validate-monitor.h \
gst-validate-override.h \
gst-validate-override-registry.h \
gst-validate-pad-monitor.h \
gst-validate-reporter.h \
gst-validate-report.h \
gst-validate-runner.h \
gst-validate-scenario.h
lib_LTLIBRARIES = \
libgstvalidate-@GST_API_VERSION@.la \
libgstvalidate-default-overrides-@GST_API_VERSION@.la \
libgstvalidate-preload-@GST_API_VERSION@.la
libgstvalidate_@GST_API_VERSION@_la_CFLAGS = $(GST_ALL_CFLAGS) $(GIO_CFLAGS)
libgstvalidate_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) \
$(GST_LT_LDFLAGS) $(GIO_LDFLAGS)
libgstvalidate_@GST_API_VERSION@_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
$(GST_ALL_LIBS) $(GIO_LIBS)
libgstvalidate_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/validate
libgstvalidate_@GST_API_VERSION@include_HEADERS = \
validate.h
libgstvalidate_default_overrides_@GST_API_VERSION@_la_SOURCES = \
gst-validate-default-overrides.c
libgstvalidate_default_overrides_@GST_API_VERSION@_la_CFLAGS = $(GST_ALL_CFLAGS) $(GIO_CFLAGS)
libgstvalidate_default_overrides_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) \
$(GST_LT_LDFLAGS) $(GIO_LDFLAGS)
libgstvalidate_default_overrides_@GST_API_VERSION@_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
$(GST_ALL_LIBS) $(GIO_LIBS)
libgstvalidate_default_overrides_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/validate
libgstvalidate_default_overrides_@GST_API_VERSION@include_HEADERS =
libgstvalidate_preload_@GST_API_VERSION@_la_SOURCES = \
gst-validate-monitor-preload.c
libgstvalidate_preload_@GST_API_VERSION@_la_CFLAGS = $(GST_ALL_CFLAGS)
libgstvalidate_preload_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) \
$(GST_LT_LDFLAGS) -lgstvalidate-@GST_API_VERSION@
libgstvalidate_preload_@GST_API_VERSION@_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
$(GST_ALL_LIBS) -lgstvalidate-@GST_API_VERSION@
libgstvalidate_preload_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/validate
libgstvalidate_preload_@GST_API_VERSION@include_HEADERS =
bin_PROGRAMS = \
gst-validate-@GST_API_VERSION@ \
gst-validate-transcoding-@GST_API_VERSION@ \
gst-validate-file-check-@GST_API_VERSION@
AM_CFLAGS = $(GST_ALL_CFLAGS) $(GST_PBUTILS_CFLAGS)
LDADD = $(top_builddir)/gst/validate/libgstvalidate-@GST_API_VERSION@.la $(GST_PBUTILS_LIBS) $(GST_LIBS)
gst_validate_@GST_API_VERSION@_SOURCES = gst-validate.c
gst_validate_transcoding_@GST_API_VERSION@_SOURCES = gst-validate-transcoding.c
gst_validate_file_check_@GST_API_VERSION@_SOURCES = gst-validate-file-check.c
CLEANFILES =

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-bin-monitor.c - QA BinMonitor class
* gst-validate-bin-monitor.c - Validate BinMonitor class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -19,39 +19,39 @@
* Boston, MA 02111-1307, USA.
*/
#include "gst-qa-bin-monitor.h"
#include "gst-qa-monitor-factory.h"
#include "gst-validate-bin-monitor.h"
#include "gst-validate-monitor-factory.h"
/**
* SECTION:gst-qa-bin-monitor
* @short_description: Class that wraps a #GstBin for QA checks
* SECTION:gst-validate-bin-monitor
* @short_description: Class that wraps a #GstBin for Validate checks
*
* TODO
*/
GST_DEBUG_CATEGORY_STATIC (gst_qa_bin_monitor_debug);
#define GST_CAT_DEFAULT gst_qa_bin_monitor_debug
GST_DEBUG_CATEGORY_STATIC (gst_validate_bin_monitor_debug);
#define GST_CAT_DEFAULT gst_validate_bin_monitor_debug
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_qa_bin_monitor_debug, "qa_bin_monitor", 0, "QA BinMonitor");
#define gst_qa_bin_monitor_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstQaBinMonitor, gst_qa_bin_monitor,
GST_TYPE_QA_ELEMENT_MONITOR, _do_init);
GST_DEBUG_CATEGORY_INIT (gst_validate_bin_monitor_debug, "qa_bin_monitor", 0, "VALIDATE BinMonitor");
#define gst_validate_bin_monitor_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstValidateBinMonitor, gst_validate_bin_monitor,
GST_TYPE_VALIDATE_ELEMENT_MONITOR, _do_init);
static void
gst_qa_bin_monitor_wrap_element (GstQaBinMonitor * monitor,
gst_validate_bin_monitor_wrap_element (GstValidateBinMonitor * monitor,
GstElement * element);
static gboolean gst_qa_bin_monitor_setup (GstQaMonitor * monitor);
static gboolean gst_validate_bin_monitor_setup (GstValidateMonitor * monitor);
static void
_qa_bin_element_added (GstBin * bin, GstElement * pad,
GstQaBinMonitor * monitor);
GstValidateBinMonitor * monitor);
static void
gst_qa_bin_monitor_dispose (GObject * object)
gst_validate_bin_monitor_dispose (GObject * object)
{
GstQaBinMonitor *monitor = GST_QA_BIN_MONITOR_CAST (object);
GstElement *bin = GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor);
GstValidateBinMonitor *monitor = GST_VALIDATE_BIN_MONITOR_CAST (object);
GstElement *bin = GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor);
if (bin && monitor->element_added_id)
g_signal_handler_disconnect (bin, monitor->element_added_id);
@ -66,69 +66,71 @@ gst_qa_bin_monitor_dispose (GObject * object)
static void
gst_qa_bin_monitor_class_init (GstQaBinMonitorClass * klass)
gst_validate_bin_monitor_class_init (GstValidateBinMonitorClass * klass)
{
GObjectClass *gobject_class;
GstQaMonitorClass *qamonitor_class;
GstValidateMonitorClass *validatemonitor_class;
gobject_class = G_OBJECT_CLASS (klass);
qamonitor_class = GST_QA_MONITOR_CLASS_CAST (klass);
validatemonitor_class = GST_VALIDATE_MONITOR_CLASS_CAST (klass);
gobject_class->dispose = gst_qa_bin_monitor_dispose;
gobject_class->dispose = gst_validate_bin_monitor_dispose;
qamonitor_class->setup = gst_qa_bin_monitor_setup;
validatemonitor_class->setup = gst_validate_bin_monitor_setup;
}
static void
gst_qa_bin_monitor_init (GstQaBinMonitor * bin_monitor)
gst_validate_bin_monitor_init (GstValidateBinMonitor * bin_monitor)
{
}
static void
gst_qa_bin_monitor_create_scenarios (GstQaBinMonitor * monitor)
gst_validate_bin_monitor_create_scenarios (GstValidateBinMonitor * monitor)
{
/* scenarios currently only make sense for pipelines */
if (GST_IS_PIPELINE (GST_QA_MONITOR_GET_OBJECT (monitor))) {
if (GST_IS_PIPELINE (GST_VALIDATE_MONITOR_GET_OBJECT (monitor))) {
const gchar *scenario_name;
if ((scenario_name = g_getenv ("GST_QA_SCENARIO"))) {
if ((scenario_name = g_getenv ("GST_VALIDATE_SCENARIO"))) {
monitor->scenario =
gst_qa_scenario_factory_create (GST_QA_MONITOR_GET_RUNNER (monitor),
GST_ELEMENT_CAST (GST_QA_MONITOR_GET_OBJECT (monitor)),
gst_validate_scenario_factory_create (GST_VALIDATE_MONITOR_GET_RUNNER
(monitor),
GST_ELEMENT_CAST (GST_VALIDATE_MONITOR_GET_OBJECT (monitor)),
scenario_name);
}
}
}
/**
* gst_qa_bin_monitor_new:
* @bin: (transfer-none): a #GstBin to run QA on
* gst_validate_bin_monitor_new:
* @bin: (transfer-none): a #GstBin to run Validate on
*/
GstQaBinMonitor *
gst_qa_bin_monitor_new (GstBin * bin, GstQaRunner * runner,
GstQaMonitor * parent)
GstValidateBinMonitor *
gst_validate_bin_monitor_new (GstBin * bin, GstValidateRunner * runner,
GstValidateMonitor * parent)
{
GstQaBinMonitor *monitor = g_object_new (GST_TYPE_QA_BIN_MONITOR, "object",
GstValidateBinMonitor *monitor =
g_object_new (GST_TYPE_VALIDATE_BIN_MONITOR, "object",
bin, "qa-runner", runner, "qa-parent", parent, NULL);
if (GST_QA_MONITOR_GET_OBJECT (monitor) == NULL) {
if (GST_VALIDATE_MONITOR_GET_OBJECT (monitor) == NULL) {
g_object_unref (monitor);
return NULL;
}
gst_qa_bin_monitor_create_scenarios (monitor);
gst_validate_bin_monitor_create_scenarios (monitor);
return monitor;
}
static gboolean
gst_qa_bin_monitor_setup (GstQaMonitor * monitor)
gst_validate_bin_monitor_setup (GstValidateMonitor * monitor)
{
GstIterator *iterator;
gboolean done;
GstElement *element;
GstQaBinMonitor *bin_monitor = GST_QA_BIN_MONITOR_CAST (monitor);
GstBin *bin = GST_QA_BIN_MONITOR_GET_BIN (bin_monitor);
GstValidateBinMonitor *bin_monitor = GST_VALIDATE_BIN_MONITOR_CAST (monitor);
GstBin *bin = GST_VALIDATE_BIN_MONITOR_GET_BIN (bin_monitor);
if (!GST_IS_BIN (bin)) {
GST_WARNING_OBJECT (monitor, "Trying to create bin monitor with other "
@ -148,7 +150,7 @@ gst_qa_bin_monitor_setup (GstQaMonitor * monitor)
while (!done) {
switch (gst_iterator_next (iterator, (gpointer *) & element)) {
case GST_ITERATOR_OK:
gst_qa_bin_monitor_wrap_element (bin_monitor, element);
gst_validate_bin_monitor_wrap_element (bin_monitor, element);
gst_object_unref (element);
break;
case GST_ITERATOR_RESYNC:
@ -169,29 +171,29 @@ gst_qa_bin_monitor_setup (GstQaMonitor * monitor)
}
static void
gst_qa_bin_monitor_wrap_element (GstQaBinMonitor * monitor,
gst_validate_bin_monitor_wrap_element (GstValidateBinMonitor * monitor,
GstElement * element)
{
GstQaElementMonitor *element_monitor;
GstValidateElementMonitor *element_monitor;
GST_DEBUG_OBJECT (monitor, "Wrapping element %s", GST_ELEMENT_NAME (element));
element_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)));
GST_VALIDATE_ELEMENT_MONITOR_CAST (gst_validate_monitor_factory_create
(GST_OBJECT_CAST (element), GST_VALIDATE_MONITOR_GET_RUNNER (monitor),
GST_VALIDATE_MONITOR_CAST (monitor)));
g_return_if_fail (element_monitor != NULL);
GST_QA_MONITOR_LOCK (monitor);
GST_VALIDATE_MONITOR_LOCK (monitor);
monitor->element_monitors = g_list_prepend (monitor->element_monitors,
element_monitor);
GST_QA_MONITOR_UNLOCK (monitor);
GST_VALIDATE_MONITOR_UNLOCK (monitor);
}
static void
_qa_bin_element_added (GstBin * bin, GstElement * element,
GstQaBinMonitor * monitor)
GstValidateBinMonitor * monitor)
{
g_return_if_fail (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) ==
g_return_if_fail (GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor) ==
GST_ELEMENT_CAST (bin));
gst_qa_bin_monitor_wrap_element (monitor, element);
gst_validate_bin_monitor_wrap_element (monitor, element);
}

View file

@ -0,0 +1,83 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-bin-monitor.h - Validate BinMonitor 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.
*/
#ifndef __GST_VALIDATE_BIN_MONITOR_H__
#define __GST_VALIDATE_BIN_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-element-monitor.h"
#include "gst-validate-runner.h"
#include "gst-validate-scenario.h"
G_BEGIN_DECLS
#define GST_TYPE_VALIDATE_BIN_MONITOR (gst_validate_bin_monitor_get_type ())
#define GST_IS_VALIDATE_BIN_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_BIN_MONITOR))
#define GST_IS_VALIDATE_BIN_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_BIN_MONITOR))
#define GST_VALIDATE_BIN_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_BIN_MONITOR, GstValidateBinMonitorClass))
#define GST_VALIDATE_BIN_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_BIN_MONITOR, GstValidateBinMonitor))
#define GST_VALIDATE_BIN_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_BIN_MONITOR, GstValidateBinMonitorClass))
#define GST_VALIDATE_BIN_MONITOR_CAST(obj) ((GstValidateBinMonitor*)(obj))
#define GST_VALIDATE_BIN_MONITOR_CLASS_CAST(klass) ((GstValidateBinMonitorClass*)(klass))
#define GST_VALIDATE_BIN_MONITOR_GET_BIN(m) (GST_BIN_CAST (GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (m)))
typedef struct _GstValidateBinMonitor GstValidateBinMonitor;
typedef struct _GstValidateBinMonitorClass GstValidateBinMonitorClass;
/**
* GstValidateBinMonitor:
*
* GStreamer Validate BinMonitor class.
*
* Class that wraps a #GstBin for Validate checks
*/
struct _GstValidateBinMonitor {
GstValidateElementMonitor parent;
GList *element_monitors;
GstValidateScenario *scenario;
/*< private >*/
gulong element_added_id;
};
/**
* GstValidateBinMonitorClass:
* @parent_class: parent
*
* GStreamer Validate BinMonitor object class.
*/
struct _GstValidateBinMonitorClass {
GstValidateElementMonitorClass parent_class;
};
/* normal GObject stuff */
GType gst_validate_bin_monitor_get_type (void);
GstValidateBinMonitor * gst_validate_bin_monitor_new (GstBin * bin, GstValidateRunner * runner, GstValidateMonitor * parent);
G_END_DECLS
#endif /* __GST_VALIDATE_BIN_MONITOR_H__ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
*
* gst-qa-default-overrides.c - Test overrides
* gst-validate-default-overrides.c - Test overrides
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -23,20 +23,21 @@
#include "config.h"
#endif
#include <stdio.h>
#include "gst-qa-override.h"
#include "gst-qa-override-registry.h"
#include "gst-qa-report.h"
#include "gst-validate-override.h"
#include "gst-validate-override-registry.h"
#include "gst-validate-report.h"
int
gst_qa_create_overrides (void)
gst_validate_create_overrides (void)
{
GstQaOverride *o;
GstValidateOverride *o;
/* Some random test override. Will moan on:
gst-launch videotestsrc num-buffers=10 ! video/x-raw-yuv ! fakesink */
o = gst_qa_override_new ();
gst_qa_override_change_severity (o, GST_QA_ISSUE_ID_CAPS_IS_MISSING_FIELD,
GST_QA_REPORT_LEVEL_CRITICAL);
gst_qa_override_register_by_name ("capsfilter0", o);
o = gst_validate_override_new ();
gst_validate_override_change_severity (o,
GST_VALIDATE_ISSUE_ID_CAPS_IS_MISSING_FIELD,
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
gst_validate_override_register_by_name ("capsfilter0", o);
return 1;
}

View file

@ -0,0 +1,208 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-element-monitor.c - Validate ElementMonitor 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-validate-element-monitor.h"
#include "gst-validate-pad-monitor.h"
#include "gst-validate-monitor-factory.h"
#include <string.h>
/**
* SECTION:gst-validate-element-monitor
* @short_description: Class that wraps a #GstElement for Validate checks
*
* TODO
*/
GST_DEBUG_CATEGORY_STATIC (gst_validate_element_monitor_debug);
#define GST_CAT_DEFAULT gst_validate_element_monitor_debug
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_validate_element_monitor_debug, "qa_element_monitor", 0, "VALIDATE ElementMonitor");
#define gst_validate_element_monitor_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstValidateElementMonitor,
gst_validate_element_monitor, GST_TYPE_VALIDATE_MONITOR, _do_init);
static void
gst_validate_element_monitor_wrap_pad (GstValidateElementMonitor * monitor,
GstPad * pad);
static gboolean gst_validate_element_monitor_do_setup (GstValidateMonitor *
monitor);
static GstElement *gst_validate_element_monitor_get_element (GstValidateMonitor
* monitor);
static void
_qa_element_pad_added (GstElement * element, GstPad * pad,
GstValidateElementMonitor * monitor);
static void
gst_validate_element_monitor_dispose (GObject * object)
{
GstValidateElementMonitor *monitor =
GST_VALIDATE_ELEMENT_MONITOR_CAST (object);
if (GST_VALIDATE_MONITOR_GET_OBJECT (monitor) && monitor->pad_added_id)
g_signal_handler_disconnect (GST_VALIDATE_MONITOR_GET_OBJECT (monitor),
monitor->pad_added_id);
g_list_free_full (monitor->pad_monitors, g_object_unref);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_validate_element_monitor_class_init (GstValidateElementMonitorClass * klass)
{
GObjectClass *gobject_class;
GstValidateMonitorClass *monitor_klass;
gobject_class = G_OBJECT_CLASS (klass);
monitor_klass = GST_VALIDATE_MONITOR_CLASS (klass);
gobject_class->dispose = gst_validate_element_monitor_dispose;
monitor_klass->setup = gst_validate_element_monitor_do_setup;
monitor_klass->get_element = gst_validate_element_monitor_get_element;
}
static void
gst_validate_element_monitor_init (GstValidateElementMonitor * element_monitor)
{
}
/**
* gst_validate_element_monitor_new:
* @element: (transfer-none): a #GstElement to run Validate on
*/
GstValidateElementMonitor *
gst_validate_element_monitor_new (GstElement * element,
GstValidateRunner * runner, GstValidateMonitor * parent)
{
GstValidateElementMonitor *monitor;
g_return_val_if_fail (element != NULL, NULL);
monitor = g_object_new (GST_TYPE_VALIDATE_ELEMENT_MONITOR, "object", element,
"qa-runner", runner, "qa-parent", parent, NULL);
if (GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor) == NULL) {
g_object_unref (monitor);
return NULL;
}
return monitor;
}
static GstElement *
gst_validate_element_monitor_get_element (GstValidateMonitor * monitor)
{
return GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor);
}
static void
gst_validate_element_monitor_inspect (GstValidateElementMonitor * monitor)
{
GstElement *element;
GstElementClass *klass;
element = GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor);
klass = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
monitor->is_decoder = strstr (klass->details.klass, "Decoder") != NULL;
monitor->is_encoder = strstr (klass->details.klass, "Encoder") != NULL;
}
static gboolean
gst_validate_element_monitor_do_setup (GstValidateMonitor * monitor)
{
GstIterator *iterator;
gboolean done;
GstPad *pad;
GstValidateElementMonitor *elem_monitor;
GstElement *element;
if (!GST_IS_ELEMENT (GST_VALIDATE_MONITOR_GET_OBJECT (monitor))) {
GST_WARNING_OBJECT (monitor, "Trying to create element monitor with other "
"type of object");
return FALSE;
}
elem_monitor = GST_VALIDATE_ELEMENT_MONITOR_CAST (monitor);
GST_DEBUG_OBJECT (monitor, "Setting up monitor for element %" GST_PTR_FORMAT,
GST_VALIDATE_MONITOR_GET_OBJECT (monitor));
element = GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor);
gst_validate_element_monitor_inspect (elem_monitor);
elem_monitor->pad_added_id = g_signal_connect (element, "pad-added",
G_CALLBACK (_qa_element_pad_added), monitor);
iterator = gst_element_iterate_pads (element);
done = FALSE;
while (!done) {
switch (gst_iterator_next (iterator, (gpointer *) & pad)) {
case GST_ITERATOR_OK:
gst_validate_element_monitor_wrap_pad (elem_monitor, pad);
gst_object_unref (pad);
break;
case GST_ITERATOR_RESYNC:
/* TODO how to handle this? */
gst_iterator_resync (iterator);
break;
case GST_ITERATOR_ERROR:
done = TRUE;
break;
case GST_ITERATOR_DONE:
done = TRUE;
break;
}
}
gst_iterator_free (iterator);
return TRUE;
}
static void
gst_validate_element_monitor_wrap_pad (GstValidateElementMonitor * monitor,
GstPad * pad)
{
GstValidatePadMonitor *pad_monitor;
GST_DEBUG_OBJECT (monitor, "Wrapping pad %s:%s", GST_DEBUG_PAD_NAME (pad));
pad_monitor =
GST_VALIDATE_PAD_MONITOR (gst_validate_monitor_factory_create (GST_OBJECT
(pad), GST_VALIDATE_MONITOR_GET_RUNNER (monitor),
GST_VALIDATE_MONITOR (monitor)));
g_return_if_fail (pad_monitor != NULL);
GST_VALIDATE_MONITOR_LOCK (monitor);
monitor->pad_monitors = g_list_prepend (monitor->pad_monitors, pad_monitor);
GST_VALIDATE_MONITOR_UNLOCK (monitor);
}
static void
_qa_element_pad_added (GstElement * element, GstPad * pad,
GstValidateElementMonitor * monitor)
{
g_return_if_fail (GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor) ==
element);
gst_validate_element_monitor_wrap_pad (monitor, pad);
}

View file

@ -0,0 +1,84 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-element-monitor.h - Validate ElementMonitor 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.
*/
#ifndef __GST_VALIDATE_ELEMENT_MONITOR_H__
#define __GST_VALIDATE_ELEMENT_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-monitor.h"
G_BEGIN_DECLS
#define GST_TYPE_VALIDATE_ELEMENT_MONITOR (gst_validate_element_monitor_get_type ())
#define GST_IS_VALIDATE_ELEMENT_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ELEMENT_MONITOR))
#define GST_IS_VALIDATE_ELEMENT_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_ELEMENT_MONITOR))
#define GST_VALIDATE_ELEMENT_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_ELEMENT_MONITOR, GstValidateElementMonitorClass))
#define GST_VALIDATE_ELEMENT_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_ELEMENT_MONITOR, GstValidateElementMonitor))
#define GST_VALIDATE_ELEMENT_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_ELEMENT_MONITOR, GstValidateElementMonitorClass))
#define GST_VALIDATE_ELEMENT_MONITOR_CAST(obj) ((GstValidateElementMonitor*)(obj))
#define GST_VALIDATE_ELEMENT_MONITOR_CLASS_CAST(klass) ((GstValidateElementMonitorClass*)(klass))
#define GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT(m) (GST_ELEMENT_CAST (GST_VALIDATE_MONITOR_GET_OBJECT (m)))
#define GST_VALIDATE_ELEMENT_MONITOR_ELEMENT_IS_DECODER(m) (GST_VALIDATE_ELEMENT_MONITOR_CAST (m)->is_decoder)
#define GST_VALIDATE_ELEMENT_MONITOR_ELEMENT_IS_ENCODER(m) (GST_VALIDATE_ELEMENT_MONITOR_CAST (m)->is_encoder)
typedef struct _GstValidateElementMonitor GstValidateElementMonitor;
typedef struct _GstValidateElementMonitorClass GstValidateElementMonitorClass;
/**
* GstValidateElementMonitor:
*
* GStreamer Validate ElementMonitor class.
*
* Class that wraps a #GstElement for Validate checks
*/
struct _GstValidateElementMonitor {
GstValidateMonitor parent;
/*< private >*/
gulong pad_added_id;
GList *pad_monitors;
gboolean is_decoder;
gboolean is_encoder;
};
/**
* GstValidateElementMonitorClass:
* @parent_class: parent
*
* GStreamer Validate ElementMonitor object class.
*/
struct _GstValidateElementMonitorClass {
GstValidateMonitorClass parent_class;
};
/* normal GObject stuff */
GType gst_validate_element_monitor_get_type (void);
GstValidateElementMonitor * gst_validate_element_monitor_new (GstElement * element, GstValidateRunner * runner, GstValidateMonitor * parent);
G_END_DECLS
#endif /* __GST_VALIDATE_ELEMENT_MONITOR_H__ */

View file

@ -10,7 +10,7 @@
#include <string.h>
#include <gst/gst.h>
#include <gst/qa/qa.h>
#include <gst/validate/validate.h>
#include <gst/pbutils/encoding-profile.h>
static GstEncodingProfile *encoding_profile = NULL;
@ -144,9 +144,9 @@ _parse_encoding_profile (const gchar * option_name, const gchar * value,
int
main (int argc, gchar ** argv)
{
GstQaRunner *runner;
GstValidateRunner *runner;
GOptionContext *ctx;
GstQaFileChecker *fc;
GstValidateFileChecker *fc;
GError *err = NULL;
guint count = -1;
@ -188,7 +188,7 @@ main (int argc, gchar ** argv)
{NULL}
};
ctx = g_option_context_new ("- runs QA transcoding test.");
ctx = g_option_context_new ("- runs Validate transcoding test.");
g_option_context_add_main_entries (ctx, options, NULL);
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
@ -204,7 +204,7 @@ main (int argc, gchar ** argv)
if (argc != 2) {
g_printerr ("%i arguments recived, 1 expected.\n"
"You should run the test using:\n"
" ./gst-qa-file-check-0.10 <uri> [options]\n", argc - 1);
" ./gst-validate-file-check-0.10 <uri> [options]\n", argc - 1);
return 1;
}
@ -212,8 +212,8 @@ main (int argc, gchar ** argv)
duration = (GstClockTime) duration_arg;
/* Create the pipeline */
runner = gst_qa_runner_new ();
fc = g_object_new (GST_TYPE_QA_FILE_CHECKER, "uri",
runner = gst_validate_runner_new ();
fc = g_object_new (GST_TYPE_VALIDATE_FILE_CHECKER, "uri",
argv[1], "profile", encoding_profile, "qa-runner", runner,
"is-seekable", seekable, "test-playback", playback,
"test-reverse-playback", reverse_playback,
@ -222,10 +222,10 @@ main (int argc, gchar ** argv)
"duration-tolerance", (guint64) duration_tolerance, NULL);
g_print ("Starting tests\n");
if (!gst_qa_file_checker_run (fc)) {
if (!gst_validate_file_checker_run (fc)) {
g_print ("Failed file checking\n");
}
count = gst_qa_runner_get_reports_count (runner);
count = gst_validate_runner_get_reports_count (runner);
g_print ("Tests finished, total issues found: %u\n", count);
g_object_unref (fc);

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-file-checker.c - QA File conformance check utility functions / structs
* gst-validate-file-checker.c - Validate File conformance check utility functions / structs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -24,8 +24,8 @@
# include "config.h"
#endif
#include "gst-qa-file-checker.h"
#include "gst-qa-reporter.h"
#include "gst-validate-file-checker.h"
#include "gst-validate-reporter.h"
#include <glib/gstdio.h>
#include <gst/pbutils/pbutils.h>
@ -54,41 +54,41 @@ enum
#define DEFAULT_PLAYBACK FALSE
#define DEFAULT_REVERSE_PLAYBACK FALSE
GST_DEBUG_CATEGORY_STATIC (gst_qa_file_checker_debug);
#define GST_CAT_DEFAULT gst_qa_file_checker_debug
GST_DEBUG_CATEGORY_STATIC (gst_validate_file_checker_debug);
#define GST_CAT_DEFAULT gst_validate_file_checker_debug
static void
gst_qa_file_checker_get_property (GObject * object, guint prop_id,
gst_validate_file_checker_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
gst_qa_file_checker_set_property (GObject * object, guint prop_id,
gst_validate_file_checker_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_qa_file_checker_debug, "qa_file_checker", 0, "QA FileChecker");\
G_IMPLEMENT_INTERFACE (GST_TYPE_QA_REPORTER, _reporter_iface_init)
GST_DEBUG_CATEGORY_INIT (gst_validate_file_checker_debug, "qa_file_checker", 0, "VALIDATE FileChecker");\
G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, _reporter_iface_init)
static void
_reporter_iface_init (GstQaReporterInterface * iface)
_reporter_iface_init (GstValidateReporterInterface * iface)
{
}
#define gst_qa_file_checker_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstQaFileChecker, gst_qa_file_checker,
#define gst_validate_file_checker_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstValidateFileChecker, gst_validate_file_checker,
G_TYPE_OBJECT, _do_init);
static void
gst_qa_file_checker_dispose (GObject * object)
gst_validate_file_checker_dispose (GObject * object)
{
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_qa_file_checker_finalize (GObject * object)
gst_validate_file_checker_finalize (GObject * object)
{
GstQaFileChecker *fc = GST_QA_FILE_CHECKER_CAST (object);
GstValidateFileChecker *fc = GST_VALIDATE_FILE_CHECKER_CAST (object);
gst_qa_reporter_set_name (GST_QA_REPORTER (object), NULL);
gst_validate_reporter_set_name (GST_VALIDATE_REPORTER (object), NULL);
g_free (fc->uri);
if (fc->profile)
@ -98,20 +98,21 @@ gst_qa_file_checker_finalize (GObject * object)
}
static void
gst_qa_file_checker_class_init (GstQaFileCheckerClass * klass)
gst_validate_file_checker_class_init (GstValidateFileCheckerClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = gst_qa_file_checker_get_property;
gobject_class->set_property = gst_qa_file_checker_set_property;
gobject_class->dispose = gst_qa_file_checker_dispose;
gobject_class->finalize = gst_qa_file_checker_finalize;
gobject_class->get_property = gst_validate_file_checker_get_property;
gobject_class->set_property = gst_validate_file_checker_set_property;
gobject_class->dispose = gst_validate_file_checker_dispose;
gobject_class->finalize = gst_validate_file_checker_finalize;
g_object_class_install_property (gobject_class, PROP_RUNNER,
g_param_spec_object ("qa-runner", "QA Runner", "The QA runner to "
"report errors to", GST_TYPE_QA_RUNNER,
g_param_spec_object ("qa-runner", "VALIDATE Runner",
"The Validate runner to " "report errors to",
GST_TYPE_VALIDATE_RUNNER,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_URI,
@ -163,7 +164,7 @@ gst_qa_file_checker_class_init (GstQaFileCheckerClass * klass)
}
static void
gst_qa_file_checker_init (GstQaFileChecker * fc)
gst_validate_file_checker_init (GstValidateFileChecker * fc)
{
fc->uri = NULL;
fc->profile = NULL;
@ -177,16 +178,16 @@ gst_qa_file_checker_init (GstQaFileChecker * fc)
}
static void
gst_qa_file_checker_set_property (GObject * object, guint prop_id,
gst_validate_file_checker_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstQaFileChecker *fc;
GstValidateFileChecker *fc;
fc = GST_QA_FILE_CHECKER_CAST (object);
fc = GST_VALIDATE_FILE_CHECKER_CAST (object);
switch (prop_id) {
case PROP_RUNNER:
gst_qa_reporter_set_runner (GST_QA_REPORTER (fc),
gst_validate_reporter_set_runner (GST_VALIDATE_REPORTER (fc),
g_value_get_object (value));
break;
case PROP_URI:
@ -226,17 +227,17 @@ gst_qa_file_checker_set_property (GObject * object, guint prop_id,
}
static void
gst_qa_file_checker_get_property (GObject * object, guint prop_id,
gst_validate_file_checker_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstQaFileChecker *fc;
GstValidateFileChecker *fc;
fc = GST_QA_FILE_CHECKER_CAST (object);
fc = GST_VALIDATE_FILE_CHECKER_CAST (object);
switch (prop_id) {
case PROP_RUNNER:
g_value_set_object (value,
gst_qa_reporter_get_runner (GST_QA_REPORTER (fc)));
gst_validate_reporter_get_runner (GST_VALIDATE_REPORTER (fc)));
break;
case PROP_URI:
g_value_set_string (value, fc->uri);
@ -272,7 +273,7 @@ gst_qa_file_checker_get_property (GObject * object, guint prop_id,
}
static gboolean
check_file_size (GstQaFileChecker * fc)
check_file_size (GstValidateFileChecker * fc)
{
GStatBuf statbuf;
gchar *filepath;
@ -282,7 +283,7 @@ check_file_size (GstQaFileChecker * fc)
filepath = g_filename_from_uri (fc->uri, NULL, &err);
if (!filepath) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_NOT_FOUND,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_NOT_FOUND,
"Failed to get filepath from uri %s. %s", fc->uri, err->message);
g_error_free (err);
return FALSE;
@ -291,20 +292,20 @@ check_file_size (GstQaFileChecker * fc)
if (g_stat (filepath, &statbuf) == 0) {
size = statbuf.st_size;
} else {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_NOT_FOUND,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_NOT_FOUND,
"Failed to get file stats from uri %s", fc->uri);
ret = FALSE;
goto end;
}
if (size == 0) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_SIZE_IS_ZERO, "File %s has size 0",
fc->uri);
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_SIZE_IS_ZERO,
"File %s has size 0", fc->uri);
ret = FALSE;
} else if (fc->file_size != 0
&& (size < fc->file_size - fc->file_size_tolerance
|| size > fc->file_size + fc->file_size_tolerance)) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_SIZE_INCORRECT,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_SIZE_INCORRECT,
"File %s has size %" G_GUINT64_FORMAT ", it was expected to have %"
G_GUINT64_FORMAT " (+-%" G_GUINT64_FORMAT ")", fc->uri, size,
fc->file_size, fc->file_size_tolerance);
@ -318,7 +319,7 @@ end:
}
static gboolean
check_file_duration (GstQaFileChecker * fc, GstDiscovererInfo * info)
check_file_duration (GstValidateFileChecker * fc, GstDiscovererInfo * info)
{
GstClockTime real_duration;
@ -328,7 +329,7 @@ check_file_duration (GstQaFileChecker * fc, GstDiscovererInfo * info)
real_duration = gst_discoverer_info_get_duration (info);
if (real_duration < fc->duration - fc->duration_tolerance ||
real_duration > fc->duration + fc->duration_tolerance) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_SIZE_INCORRECT,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_SIZE_INCORRECT,
"File %s has duration %" GST_TIME_FORMAT ", it was expected to have %"
GST_TIME_FORMAT " (+-%" GST_TIME_FORMAT ")",
fc->uri, GST_TIME_ARGS (real_duration), GST_TIME_ARGS (fc->duration),
@ -339,13 +340,13 @@ check_file_duration (GstQaFileChecker * fc, GstDiscovererInfo * info)
}
static gboolean
check_seekable (GstQaFileChecker * fc, GstDiscovererInfo * info)
check_seekable (GstValidateFileChecker * fc, GstDiscovererInfo * info)
{
gboolean real_seekable;
real_seekable = gst_discoverer_info_get_seekable (info);
if (real_seekable != fc->seekable) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_SEEKABLE_INCORRECT,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_SEEKABLE_INCORRECT,
"File was expected to %s be seekable, but it %s",
fc->seekable ? "" : "not", real_seekable ? "is" : "isn't");
return FALSE;
@ -377,13 +378,13 @@ G_STMT_START { \
} G_STMT_END
static gboolean
compare_encoding_profile_with_discoverer_stream (GstQaFileChecker * fc,
compare_encoding_profile_with_discoverer_stream (GstValidateFileChecker * fc,
GstEncodingProfile * prof, GstDiscovererStreamInfo * stream, gchar ** msg);
static gboolean
compare_container_profile_with_container_discoverer_stream (GstQaFileChecker *
fc, GstEncodingContainerProfile * prof, GstDiscovererContainerInfo * stream,
gchar ** msg)
compare_container_profile_with_container_discoverer_stream
(GstValidateFileChecker * fc, GstEncodingContainerProfile * prof,
GstDiscovererContainerInfo * stream, gchar ** msg)
{
ExpectedStream *expected_streams = NULL;
GList *container_streams;
@ -475,7 +476,7 @@ end:
}
static gboolean
compare_encoding_profile_with_discoverer_stream (GstQaFileChecker * fc,
compare_encoding_profile_with_discoverer_stream (GstValidateFileChecker * fc,
GstEncodingProfile * prof, GstDiscovererStreamInfo * stream, gchar ** msg)
{
gboolean ret = TRUE;
@ -575,7 +576,7 @@ end:
}
static gboolean
check_encoding_profile (GstQaFileChecker * fc, GstDiscovererInfo * info)
check_encoding_profile (GstValidateFileChecker * fc, GstDiscovererInfo * info)
{
GstEncodingProfile *profile = fc->profile;
GstDiscovererStreamInfo *stream;
@ -589,7 +590,7 @@ check_encoding_profile (GstQaFileChecker * fc, GstDiscovererInfo * info)
if (!compare_encoding_profile_with_discoverer_stream (fc, fc->profile, stream,
&msg)) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_PROFILE_INCORRECT, msg);
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PROFILE_INCORRECT, msg);
g_free (msg);
}
@ -597,9 +598,10 @@ check_encoding_profile (GstQaFileChecker * fc, GstDiscovererInfo * info)
return ret;
}
typedef gboolean (*GstElementConfigureFunc) (GstQaFileChecker *, GstElement *);
typedef gboolean (*GstElementConfigureFunc) (GstValidateFileChecker *,
GstElement *);
static gboolean
check_playback_scenario (GstQaFileChecker * fc,
check_playback_scenario (GstValidateFileChecker * fc,
GstElementConfigureFunc configure_function, const gchar * messages_prefix)
{
GstElement *playbin;
@ -613,8 +615,8 @@ check_playback_scenario (GstQaFileChecker * fc,
audiosink = gst_element_factory_make ("fakesink", "fc-audiosink");
if (!playbin || !videosink || !audiosink) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_MISSING_PLUGIN, "file check requires "
"playbin2 and fakesink to be available");
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_MISSING_PLUGIN,
"file check requires " "playbin2 and fakesink to be available");
}
g_object_set (playbin, "video-sink", videosink, "audio-sink", audiosink,
@ -622,7 +624,7 @@ check_playback_scenario (GstQaFileChecker * fc,
if (gst_element_set_state (playbin,
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_PLAYBACK_START_FAILURE,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_START_FAILURE,
"Failed to " "change pipeline state to playing");
ret = FALSE;
goto end;
@ -645,7 +647,7 @@ check_playback_scenario (GstQaFileChecker * fc,
gchar *debug = NULL;
gst_message_parse_error (msg, &error, &debug);
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_PLAYBACK_ERROR,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR,
"%s - File %s failed " "during playback. Error: %s : %s",
messages_prefix, fc->uri, error->message, debug);
g_error_free (error);
@ -657,7 +659,7 @@ check_playback_scenario (GstQaFileChecker * fc,
}
gst_message_unref (msg);
} else {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_PLAYBACK_ERROR, "%s - "
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR, "%s - "
"File playback finished unexpectedly", messages_prefix);
}
gst_object_unref (bus);
@ -670,7 +672,7 @@ end:
}
static gboolean
check_playback (GstQaFileChecker * fc)
check_playback (GstValidateFileChecker * fc)
{
if (!fc->test_playback)
return TRUE;
@ -678,7 +680,7 @@ check_playback (GstQaFileChecker * fc)
}
static gboolean
send_reverse_seek (GstQaFileChecker * fc, GstElement * pipeline)
send_reverse_seek (GstValidateFileChecker * fc, GstElement * pipeline)
{
gboolean ret;
@ -686,14 +688,14 @@ send_reverse_seek (GstQaFileChecker * fc, GstElement * pipeline)
GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, -1);
if (!ret) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_PLAYBACK_ERROR,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR,
"Reverse playback seek failed");
}
return ret;
}
static gboolean
check_reverse_playback (GstQaFileChecker * fc)
check_reverse_playback (GstValidateFileChecker * fc)
{
if (!fc->test_reverse_playback)
return TRUE;
@ -701,7 +703,7 @@ check_reverse_playback (GstQaFileChecker * fc)
}
gboolean
gst_qa_file_checker_run (GstQaFileChecker * fc)
gst_validate_file_checker_run (GstValidateFileChecker * fc)
{
GError *err = NULL;
GstDiscovererInfo *info;
@ -711,7 +713,7 @@ gst_qa_file_checker_run (GstQaFileChecker * fc)
g_return_val_if_fail (fc->uri != NULL, FALSE);
if (!discoverer) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_ALLOCATION_FAILURE,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_ALLOCATION_FAILURE,
"Failed to create GstDiscoverer");
return FALSE;
}
@ -719,7 +721,7 @@ gst_qa_file_checker_run (GstQaFileChecker * fc)
info = gst_discoverer_discover_uri (discoverer, fc->uri, &err);
if (gst_discoverer_info_get_result (info) != GST_DISCOVERER_OK) {
GST_QA_REPORT (fc, GST_QA_ISSUE_ID_FILE_CHECK_FAILURE,
GST_VALIDATE_REPORT (fc, GST_VALIDATE_ISSUE_ID_FILE_CHECK_FAILURE,
"Discoverer failed to discover the file, result: %d",
gst_discoverer_info_get_result (info));
return FALSE;

View file

@ -0,0 +1,93 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-file-checker.h - Validate File conformance check utility functions / structs
*
* 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_VALIDATE_FILE_CHECK_H__
#define __GST_VALIDATE_FILE_CHECK_H__
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
G_BEGIN_DECLS
#define GST_TYPE_VALIDATE_FILE_CHECKER (gst_validate_file_checker_get_type ())
#define GST_IS_VALIDATE_FILE_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_FILE_CHECKER))
#define GST_IS_VALIDATE_FILE_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_FILE_CHECKER))
#define GST_VALIDATE_FILE_CHECKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_FILE_CHECKER, GstValidateFileCheckerClass))
#define GST_VALIDATE_FILE_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_FILE_CHECKER, GstValidateFileChecker))
#define GST_VALIDATE_FILE_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_FILE_CHECKER, GstValidateFileCheckerClass))
#define GST_VALIDATE_FILE_CHECKER_CAST(obj) ((GstValidateFileChecker*)(obj))
#define GST_VALIDATE_FILE_CHECKER_CLASS_CAST(klass) ((GstValidateFileCheckerClass*)(klass))
typedef struct _GstValidateFileChecker GstValidateFileChecker;
typedef struct _GstValidateFileCheckerClass GstValidateFileCheckerClass;
/**
* GstValidateFileChecker:
*
* GStreamer Validate FileChecker class.
*
* Class that wraps a #GObject for Validate checks
*/
struct _GstValidateFileChecker {
GObject object;
/* <File checking data> */
/* Value for the expected total duration of the file in nanosecs
* Set to GST_CLOCK_TIME_NONE if it shouldn't be tested */
GstClockTime duration;
/* Acceptable tolerance for duration */
GstClockTime duration_tolerance;
/* Expected file_size, set to 0 to skip test */
guint64 file_size;
/* Acceptable tolerance for file_size check */
guint64 file_size_tolerance;
gboolean seekable; /* TODO should we care about disabling this check? */
gboolean test_playback;
gboolean test_reverse_playback;
gchar *uri;
/* Set to NULL to skip check */
GstEncodingProfile *profile;
};
/**
* GstValidateFileCheckerClass:
* @parent_class: parent
*
* GStreamer Validate FileChecker object class.
*/
struct _GstValidateFileCheckerClass {
GObjectClass parent_class;
};
/* normal GObject stuff */
GType gst_validate_file_checker_get_type (void);
gboolean gst_validate_file_checker_run (GstValidateFileChecker * fc);
G_END_DECLS
#endif /* __GST_VALIDATE_FILE_CHECK_H__ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2004 Thomas Vander Stichele <thomas@apestaart.org>
*
* gst-qa-i18n-lib.h: internationalization macros for the GStreamer libraries
* gst-validate-i18n-lib.h: internationalization macros for the GStreamer libraries
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -20,8 +20,8 @@
*/
#ifndef __GST_QA_I18N_LIB_H__
#define __GST_QA_I18N_LIB_H__
#ifndef __GST_VALIDATE_I18N_LIB_H__
#define __GST_VALIDATE_I18N_LIB_H__
#ifndef PACKAGE_NAME
#error You must include config.h before including this header.
@ -44,4 +44,4 @@
#endif
#endif /* __GST_QA_I18N_LIB_H__ */
#endif /* __GST_VALIDATE_I18N_LIB_H__ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-monitor-factory.c - QA Element monitors factory utility functions
* gst-validate-monitor-factory.c - Validate Element monitors factory utility functions
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -19,33 +19,33 @@
* Boston, MA 02111-1307, USA.
*/
#include "gst-qa-monitor-factory.h"
#include "gst-qa-bin-monitor.h"
#include "gst-qa-pad-monitor.h"
#include "gst-qa-override-registry.h"
#include "gst-validate-monitor-factory.h"
#include "gst-validate-bin-monitor.h"
#include "gst-validate-pad-monitor.h"
#include "gst-validate-override-registry.h"
GstQaMonitor *
gst_qa_monitor_factory_create (GstObject * target, GstQaRunner * runner,
GstQaMonitor * parent)
GstValidateMonitor *
gst_validate_monitor_factory_create (GstObject * target,
GstValidateRunner * runner, GstValidateMonitor * parent)
{
GstQaMonitor *monitor = NULL;
GstValidateMonitor *monitor = NULL;
g_return_val_if_fail (target != NULL, NULL);
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)));
GST_VALIDATE_MONITOR_CAST (gst_validate_pad_monitor_new (GST_PAD_CAST
(target), runner, GST_VALIDATE_ELEMENT_MONITOR_CAST (parent)));
} else if (GST_IS_BIN (target)) {
monitor =
GST_QA_MONITOR_CAST (gst_qa_bin_monitor_new (GST_BIN_CAST
GST_VALIDATE_MONITOR_CAST (gst_validate_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));
GST_VALIDATE_MONITOR_CAST (gst_validate_element_monitor_new
(GST_ELEMENT_CAST (target), runner, parent));
}
g_return_val_if_fail (target != NULL, NULL);
gst_qa_override_registry_attach_overrides (monitor);
gst_validate_override_registry_attach_overrides (monitor);
return monitor;
}

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-monitor-factory.h - QA Element monitors factory utility functions
* gst-validate-monitor-factory.h - Validate Element monitors factory utility functions
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -19,19 +19,19 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_QA_MONITOR_FACTORY_H__
#define __GST_QA_MONITOR_FACTORY_H__
#ifndef __GST_VALIDATE_MONITOR_FACTORY_H__
#define __GST_VALIDATE_MONITOR_FACTORY_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-monitor.h"
#include "gst-qa-runner.h"
#include "gst-validate-monitor.h"
#include "gst-validate-runner.h"
G_BEGIN_DECLS
GstQaMonitor * gst_qa_monitor_factory_create (GstObject * target, GstQaRunner * runner, GstQaMonitor * parent);
GstValidateMonitor * gst_validate_monitor_factory_create (GstObject * target, GstValidateRunner * runner, GstValidateMonitor * parent);
G_END_DECLS
#endif /* __GST_QA_MONITOR_FACTORY_H__ */
#endif /* __GST_VALIDATE_MONITOR_FACTORY_H__ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-monitor-preload.c - QA Element monitors preload functions
* gst-validate-monitor-preload.c - Validate Element monitors preload functions
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -21,27 +21,27 @@
#include <gst/gst.h>
#include <string.h>
#include "gst-qa-runner.h"
#include "gst-qa-monitor-factory.h"
#include "gst-validate-runner.h"
#include "gst-validate-monitor-factory.h"
#define __USE_GNU
#include <dlfcn.h>
static GstQaRunner *runner = NULL;
static GstValidateRunner *runner = NULL;
/*
* Functions that wrap object creation so gst-qa can be used
* Functions that wrap object creation so gst-validate can be used
* to monitor 'standard' applications
*/
static void
gst_qa_preload_wrap (GstElement * element)
gst_validate_preload_wrap (GstElement * element)
{
if (runner == NULL)
runner = gst_qa_runner_new ();
runner = gst_validate_runner_new ();
/* the reference to the monitor is lost */
gst_qa_monitor_factory_create (GST_OBJECT_CAST (element), runner, NULL);
gst_validate_monitor_factory_create (GST_OBJECT_CAST (element), runner, NULL);
}
GstElement *
@ -58,7 +58,7 @@ gst_element_factory_make (const gchar * element_name, const gchar * name)
element = gst_element_factory_make_real (element_name, name);
if (GST_IS_PIPELINE (element)) {
gst_qa_preload_wrap (element);
gst_validate_preload_wrap (element);
}
return element;
}
@ -73,7 +73,7 @@ gst_pipeline_new (const gchar * name)
gst_pipeline_new_real = dlsym (RTLD_NEXT, "gst_pipeline_new");
element = gst_pipeline_new_real (name);
gst_qa_preload_wrap (element);
gst_validate_preload_wrap (element);
return element;
}
@ -89,7 +89,7 @@ gst_parse_launchv (const gchar ** argv, GError ** error)
element = gst_parse_launchv_real (argv, error);
if (GST_IS_PIPELINE (element)) {
gst_qa_preload_wrap (element);
gst_validate_preload_wrap (element);
}
return element;
}
@ -107,7 +107,7 @@ gst_parse_launchv_full (const gchar ** argv, GstParseContext * context,
element = gst_parse_launchv_full_real (argv, context, flags, error);
if (GST_IS_PIPELINE (element)) {
gst_qa_preload_wrap (element);
gst_validate_preload_wrap (element);
}
return element;
}
@ -123,7 +123,7 @@ gst_parse_launch (const gchar * pipeline_description, GError ** error)
element = gst_parse_launch_real (pipeline_description, error);
if (GST_IS_PIPELINE (element)) {
gst_qa_preload_wrap (element);
gst_validate_preload_wrap (element);
}
return element;
}
@ -142,7 +142,7 @@ gst_parse_launch_full (const gchar * pipeline_description,
element =
gst_parse_launch_full_real (pipeline_description, context, flags, error);
if (GST_IS_PIPELINE (element)) {
gst_qa_preload_wrap (element);
gst_validate_preload_wrap (element);
}
return element;
}

View file

@ -0,0 +1,294 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-element-monitor.c - Validate Monitor 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-validate-monitor.h"
/**
* SECTION:gst-validate-monitor
* @short_description: Base class that wraps a #GObject for Validate checks
*
* TODO
*/
enum
{
PROP_0,
PROP_OBJECT,
PROP_RUNNER,
PROP_VALIDATE_PARENT,
PROP_LAST
};
GST_DEBUG_CATEGORY_STATIC (gst_validate_monitor_debug);
#define GST_CAT_DEFAULT gst_validate_monitor_debug
static gboolean gst_validate_monitor_do_setup (GstValidateMonitor * monitor);
static void
gst_validate_monitor_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
gst_validate_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static GObject *gst_validate_monitor_constructor (GType type,
guint n_construct_params, GObjectConstructParam * construct_params);
gboolean gst_validate_monitor_setup (GstValidateMonitor * monitor);
static void gst_validate_monitor_intercept_report (GstValidateReporter *
reporter, GstValidateReport * report);
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_validate_monitor_debug, "qa_monitor", 0, "VALIDATE Monitor");\
G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, _reporter_iface_init)
static void
_reporter_iface_init (GstValidateReporterInterface * iface)
{
iface->intercept_report = gst_validate_monitor_intercept_report;
}
#define gst_validate_monitor_parent_class parent_class
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstValidateMonitor, gst_validate_monitor,
G_TYPE_OBJECT, _do_init);
void
_target_freed_cb (GstValidateMonitor * monitor, GObject * where_the_object_was)
{
GST_DEBUG_OBJECT (monitor, "Target was freed");
monitor->target = NULL;
}
static void
gst_validate_monitor_dispose (GObject * object)
{
GstValidateMonitor *monitor = GST_VALIDATE_MONITOR_CAST (object);
g_mutex_clear (&monitor->mutex);
g_mutex_clear (&monitor->overrides_mutex);
g_queue_clear (&monitor->overrides);
if (monitor->target)
g_object_weak_unref (G_OBJECT (monitor->target),
(GWeakNotify) _target_freed_cb, monitor);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_validate_monitor_finalize (GObject * object)
{
gst_validate_reporter_set_name (GST_VALIDATE_REPORTER (object), NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_validate_monitor_class_init (GstValidateMonitorClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = gst_validate_monitor_get_property;
gobject_class->set_property = gst_validate_monitor_set_property;
gobject_class->dispose = gst_validate_monitor_dispose;
gobject_class->finalize = gst_validate_monitor_finalize;
gobject_class->constructor = gst_validate_monitor_constructor;
klass->setup = gst_validate_monitor_do_setup;
g_object_class_install_property (gobject_class, PROP_OBJECT,
g_param_spec_object ("object", "Object", "The object to be monitored",
GST_TYPE_OBJECT, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_RUNNER,
g_param_spec_object ("qa-runner", "VALIDATE Runner",
"The Validate runner to " "report errors to",
GST_TYPE_VALIDATE_RUNNER,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_VALIDATE_PARENT,
g_param_spec_object ("qa-parent", "VALIDATE parent monitor",
"The Validate monitor " "that is the parent of this one",
GST_TYPE_VALIDATE_MONITOR,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
}
static GObject *
gst_validate_monitor_constructor (GType type, guint n_construct_params,
GObjectConstructParam * construct_params)
{
GstValidateMonitor *monitor =
GST_VALIDATE_MONITOR_CAST (G_OBJECT_CLASS (parent_class)->constructor
(type,
n_construct_params,
construct_params));
gst_validate_monitor_setup (monitor);
return (GObject *) monitor;
}
static void
gst_validate_monitor_init (GstValidateMonitor * monitor)
{
g_mutex_init (&monitor->mutex);
g_mutex_init (&monitor->overrides_mutex);
g_queue_init (&monitor->overrides);
}
/**
* gst_validate_monitor_new:
* @element: (transfer-none): a #GObject to run Validate on
*/
GstValidateMonitor *
gst_validate_monitor_new (GObject * object)
{
GstValidateMonitor *monitor =
g_object_new (GST_TYPE_VALIDATE_MONITOR, "object",
G_TYPE_OBJECT, object, NULL);
if (GST_VALIDATE_MONITOR_GET_OBJECT (monitor) == NULL) {
/* setup failed, no use on returning this monitor */
g_object_unref (monitor);
return NULL;
}
return monitor;
}
static gboolean
gst_validate_monitor_do_setup (GstValidateMonitor * monitor)
{
/* NOP */
return TRUE;
}
gboolean
gst_validate_monitor_setup (GstValidateMonitor * monitor)
{
GST_DEBUG_OBJECT (monitor, "Starting monitor setup");
return GST_VALIDATE_MONITOR_GET_CLASS (monitor)->setup (monitor);
}
GstElement *
gst_validate_monitor_get_element (GstValidateMonitor * monitor)
{
GstValidateMonitorClass *klass = GST_VALIDATE_MONITOR_GET_CLASS (monitor);
GstElement *element = NULL;
if (klass->get_element)
element = klass->get_element (monitor);
return element;
}
const gchar *
gst_validate_monitor_get_element_name (GstValidateMonitor * monitor)
{
GstElement *element;
element = gst_validate_monitor_get_element (monitor);
if (element)
return GST_ELEMENT_NAME (element);
return NULL;
}
/* Check if any of our overrides wants to change the report severity */
static void
gst_validate_monitor_intercept_report (GstValidateReporter * reporter,
GstValidateReport * report)
{
GList *iter;
GstValidateMonitor *monitor = GST_VALIDATE_MONITOR_CAST (reporter);
GST_VALIDATE_MONITOR_OVERRIDES_LOCK (monitor);
for (iter = monitor->overrides.head; iter; iter = g_list_next (iter)) {
report->level =
gst_validate_override_get_severity (iter->data,
gst_validate_issue_get_id (report->issue), report->level);
}
GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK (monitor);
}
void
gst_validate_monitor_attach_override (GstValidateMonitor * monitor,
GstValidateOverride * override)
{
GST_VALIDATE_MONITOR_OVERRIDES_LOCK (monitor);
g_queue_push_tail (&monitor->overrides, override);
GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK (monitor);
}
static void
gst_validate_monitor_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstValidateMonitor *monitor;
monitor = GST_VALIDATE_MONITOR_CAST (object);
switch (prop_id) {
case PROP_OBJECT:
g_assert (monitor->target == NULL);
monitor->target = g_value_get_object (value);
g_object_weak_ref (G_OBJECT (monitor->target),
(GWeakNotify) _target_freed_cb, monitor);
if (monitor->target)
gst_validate_reporter_set_name (GST_VALIDATE_REPORTER (monitor),
g_strdup (GST_OBJECT_NAME (monitor->target)));
break;
case PROP_RUNNER:
gst_validate_reporter_set_runner (GST_VALIDATE_REPORTER (monitor),
g_value_get_object (value));
break;
case PROP_VALIDATE_PARENT:
monitor->parent = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_validate_monitor_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstValidateMonitor *monitor;
monitor = GST_VALIDATE_MONITOR_CAST (object);
switch (prop_id) {
case PROP_OBJECT:
g_value_set_object (value, GST_VALIDATE_MONITOR_GET_OBJECT (monitor));
break;
case PROP_RUNNER:
g_value_set_object (value, GST_VALIDATE_MONITOR_GET_RUNNER (monitor));
break;
case PROP_VALIDATE_PARENT:
g_value_set_object (value, GST_VALIDATE_MONITOR_GET_PARENT (monitor));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}

View file

@ -0,0 +1,109 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-monitor.h - Validate Monitor abstract base 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.
*/
#ifndef __GST_VALIDATE_MONITOR_H__
#define __GST_VALIDATE_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-report.h"
#include "gst-validate-reporter.h"
#include "gst-validate-runner.h"
#include "gst-validate-override.h"
G_BEGIN_DECLS
#define GST_TYPE_VALIDATE_MONITOR (gst_validate_monitor_get_type ())
#define GST_IS_VALIDATE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MONITOR))
#define GST_IS_VALIDATE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MONITOR))
#define GST_VALIDATE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MONITOR, GstValidateMonitorClass))
#define GST_VALIDATE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MONITOR, GstValidateMonitor))
#define GST_VALIDATE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MONITOR, GstValidateMonitorClass))
#define GST_VALIDATE_MONITOR_CAST(obj) ((GstValidateMonitor*)(obj))
#define GST_VALIDATE_MONITOR_CLASS_CAST(klass) ((GstValidateMonitorClass*)(klass))
#define GST_VALIDATE_MONITOR_GET_OBJECT(m) (GST_VALIDATE_MONITOR_CAST (m)->target)
#define GST_VALIDATE_MONITOR_GET_RUNNER(m) (gst_validate_reporter_get_runner (GST_VALIDATE_REPORTER_CAST (m)))
#define GST_VALIDATE_MONITOR_GET_PARENT(m) (GST_VALIDATE_MONITOR_CAST (m)->parent)
#define GST_VALIDATE_MONITOR_LOCK(m) (g_mutex_lock (&GST_VALIDATE_MONITOR_CAST(m)->mutex))
#define GST_VALIDATE_MONITOR_UNLOCK(m) (g_mutex_unlock (&GST_VALIDATE_MONITOR_CAST(m)->mutex))
#define GST_VALIDATE_MONITOR_OVERRIDES_LOCK(m) g_mutex_lock (&GST_VALIDATE_MONITOR_CAST (m)->overrides_mutex)
#define GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK(m) g_mutex_unlock (&GST_VALIDATE_MONITOR_CAST (m)->overrides_mutex)
#define GST_VALIDATE_MONITOR_OVERRIDES(m) (GST_VALIDATE_MONITOR_CAST (m)->overrides)
/* #else TODO Implemen no variadic macros, use inline,
* Problem being:
* GST_VALIDATE_REPORT_LEVEL_ ## status
* GST_VALIDATE_AREA_ ## area ## _ ## subarea
*/
typedef struct _GstValidateMonitor GstValidateMonitor;
typedef struct _GstValidateMonitorClass GstValidateMonitorClass;
/**
* GstValidateMonitor:
*
* GStreamer Validate Monitor class.
*
* Class that wraps a #GObject for Validate checks
*/
struct _GstValidateMonitor {
GObject object;
GstObject *target;
GMutex mutex;
gchar *target_name;
GstValidateMonitor *parent;
GMutex overrides_mutex;
GQueue overrides;
/*< private >*/
GHashTable *reports;
};
/**
* GstValidateMonitorClass:
* @parent_class: parent
*
* GStreamer Validate Monitor object class.
*/
struct _GstValidateMonitorClass {
GObjectClass parent_class;
gboolean (* setup) (GstValidateMonitor * monitor);
GstElement *(* get_element) (GstValidateMonitor * monitor);
};
/* normal GObject stuff */
GType gst_validate_monitor_get_type (void);
void gst_validate_monitor_attach_override (GstValidateMonitor * monitor,
GstValidateOverride * override);
GstElement * gst_validate_monitor_get_element (GstValidateMonitor * monitor);
const gchar * gst_validate_monitor_get_element_name (GstValidateMonitor * monitor);
G_END_DECLS
#endif /* __GST_VALIDATE_MONITOR_H__ */

View file

@ -0,0 +1,233 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-override-registry.c - Validate 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>
#define __USE_GNU
#include <dlfcn.h>
#include "gst-validate-override-registry.h"
typedef struct
{
gchar *name;
GstValidateOverride *override;
} GstValidateOverrideRegistryNameEntry;
typedef struct
{
GType gtype;
GstValidateOverride *override;
} GstValidateOverrideRegistryGTypeEntry;
static GMutex _gst_validate_override_registry_mutex;
static GstValidateOverrideRegistry *_registry_default;
#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_INIT_SYMBOL "gst_validate_create_overrides"
static GstValidateOverrideRegistry *
gst_validate_override_registry_new (void)
{
GstValidateOverrideRegistry *reg = g_slice_new0 (GstValidateOverrideRegistry);
g_mutex_init (&reg->mutex);
g_queue_init (&reg->name_overrides);
g_queue_init (&reg->gtype_overrides);
g_queue_init (&reg->klass_overrides);
return reg;
}
GstValidateOverrideRegistry *
gst_validate_override_registry_get (void)
{
g_mutex_lock (&_gst_validate_override_registry_mutex);
if (G_UNLIKELY (!_registry_default)) {
_registry_default = gst_validate_override_registry_new ();
}
g_mutex_unlock (&_gst_validate_override_registry_mutex);
return _registry_default;
}
void
gst_validate_override_register_by_name (const gchar * name,
GstValidateOverride * override)
{
GstValidateOverrideRegistry *registry = gst_validate_override_registry_get ();
GstValidateOverrideRegistryNameEntry *entry =
g_slice_new (GstValidateOverrideRegistryNameEntry);
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry);
entry->name = g_strdup (name);
entry->override = override;
g_queue_push_tail (&registry->name_overrides, entry);
GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (registry);
}
void
gst_validate_override_register_by_type (GType gtype,
GstValidateOverride * override)
{
GstValidateOverrideRegistry *registry = gst_validate_override_registry_get ();
GstValidateOverrideRegistryGTypeEntry *entry =
g_slice_new (GstValidateOverrideRegistryGTypeEntry);
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry);
entry->gtype = gtype;
entry->override = override;
g_queue_push_tail (&registry->gtype_overrides, entry);
GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (registry);
}
void
gst_validate_override_register_by_klass (const gchar * klass,
GstValidateOverride * override)
{
GstValidateOverrideRegistry *registry = gst_validate_override_registry_get ();
GstValidateOverrideRegistryNameEntry *entry =
g_slice_new (GstValidateOverrideRegistryNameEntry);
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry);
entry->name = g_strdup (klass);
entry->override = override;
g_queue_push_tail (&registry->klass_overrides, entry);
GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (registry);
}
static void
gst_validate_override_registry_attach_name_overrides_unlocked
(GstValidateOverrideRegistry * registry, GstValidateMonitor * monitor)
{
GstValidateOverrideRegistryNameEntry *entry;
GList *iter;
const gchar *name;
name = gst_validate_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_validate_monitor_attach_override (monitor, entry->override);
}
}
}
static void
gst_validate_override_registry_attach_gtype_overrides_unlocked
(GstValidateOverrideRegistry * registry, GstValidateMonitor * monitor)
{
GstValidateOverrideRegistryGTypeEntry *entry;
GstElement *element;
GList *iter;
element = gst_validate_monitor_get_element (monitor);
if (!element)
return;
for (iter = registry->name_overrides.head; iter; iter = g_list_next (iter)) {
entry = iter->data;
if (G_TYPE_CHECK_INSTANCE_TYPE (element, entry->gtype)) {
gst_validate_monitor_attach_override (monitor, entry->override);
}
}
}
static void
gst_validate_override_registry_attach_klass_overrides_unlocked
(GstValidateOverrideRegistry * registry, GstValidateMonitor * monitor)
{
GstValidateOverrideRegistryNameEntry *entry;
GList *iter;
GstElement *element;
GstElementClass *klass;
element = gst_validate_monitor_get_element (monitor);
if (!element)
return;
klass = GST_ELEMENT_GET_CLASS (element);
for (iter = registry->name_overrides.head; iter; iter = g_list_next (iter)) {
entry = iter->data;
/* TODO It would be more correct to split it before comparing */
if (strstr (klass->details.klass, entry->name) != NULL) {
gst_validate_monitor_attach_override (monitor, entry->override);
}
}
}
void
gst_validate_override_registry_attach_overrides (GstValidateMonitor * monitor)
{
GstValidateOverrideRegistry *reg = gst_validate_override_registry_get ();
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (reg);
gst_validate_override_registry_attach_name_overrides_unlocked (reg, monitor);
gst_validate_override_registry_attach_gtype_overrides_unlocked (reg, monitor);
gst_validate_override_registry_attach_klass_overrides_unlocked (reg, monitor);
GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (reg);
}
int
gst_validate_override_registry_preload (void)
{
gchar **solist, *const *so;
const char *sos, *soerr;
void *sol;
int ret, (*entry) (void), nloaded = 0;
sos = g_getenv ("GST_VALIDATE_OVERRIDE");
if (!sos) {
GST_INFO ("No GST_VALIDATE_OVERRIDE found, no overrides to load");
return 0;
}
solist = g_strsplit (sos, ",", 0);
for (so = solist; *so; ++so) {
GST_INFO ("Loading overrides from %s", *so);
sol = dlopen (*so, RTLD_LAZY);
if (!sol) {
soerr = dlerror ();
GST_ERROR ("Failed to load %s %s", *so, soerr ? soerr : "no idea why");
continue;
}
entry = dlsym (sol, GST_VALIDATE_OVERRIDE_INIT_SYMBOL);
if (entry) {
ret = (*entry) ();
if (ret > 0) {
GST_INFO ("Loaded %d overrides from %s", ret, *so);
nloaded += ret;
} else if (ret < 0) {
GST_WARNING ("Error loading overrides from %s", *so);
} else {
GST_INFO ("Loaded no overrides from %s", *so);
}
} else {
GST_WARNING (GST_VALIDATE_OVERRIDE_INIT_SYMBOL " not found in %s", *so);
}
dlclose (sol);
}
g_strfreev (solist);
GST_INFO ("%d overrides loaded", nloaded);
return nloaded;
}

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-override-registry.h - QA Override registry
* gst-validate-override-registry.h - Validate Override registry
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -19,14 +19,14 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_QA_OVERRIDE_REGISTRY_H__
#define __GST_QA_OVERRIDE_REGISTRY_H__
#ifndef __GST_VALIDATE_OVERRIDE_REGISTRY_H__
#define __GST_VALIDATE_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"
#include "gst-validate-report.h"
#include "gst-validate-monitor.h"
#include "gst-validate-override.h"
G_BEGIN_DECLS
@ -36,19 +36,19 @@ typedef struct {
GQueue name_overrides;
GQueue gtype_overrides;
GQueue klass_overrides;
} GstQaOverrideRegistry;
} GstValidateOverrideRegistry;
GstQaOverrideRegistry * gst_qa_override_registry_get (void);
GstValidateOverrideRegistry * gst_validate_override_registry_get (void);
void gst_qa_override_register_by_name (const gchar * name, GstQaOverride * override);
void gst_qa_override_register_by_type (GType gtype, GstQaOverride * override);
void gst_qa_override_register_by_klass (const gchar * klass, GstQaOverride * override);
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);
void gst_qa_override_registry_attach_overrides (GstQaMonitor * monitor);
void gst_validate_override_registry_attach_overrides (GstValidateMonitor * monitor);
int gst_qa_override_registry_preload (void);
int gst_validate_override_registry_preload (void);
G_END_DECLS
#endif /* __GST_QA_OVERRIDE_REGISTRY_H__ */
#endif /* __GST_VALIDATE_OVERRIDE_REGISTRY_H__ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-override.c - QA Override that allows customizing QA behavior
* gst-validate-override.c - Validate Override that allows customizing Validate behavior
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -21,12 +21,12 @@
#include <string.h>
#include "gst-qa-override.h"
#include "gst-validate-override.h"
GstQaOverride *
gst_qa_override_new (void)
GstValidateOverride *
gst_validate_override_new (void)
{
GstQaOverride *override = g_slice_new0 (GstQaOverride);
GstValidateOverride *override = g_slice_new0 (GstValidateOverride);
override->level_override = g_hash_table_new (g_direct_hash, g_direct_equal);
@ -34,15 +34,15 @@ gst_qa_override_new (void)
}
void
gst_qa_override_free (GstQaOverride * override)
gst_validate_override_free (GstValidateOverride * override)
{
g_hash_table_unref (override->level_override);
g_slice_free (GstQaOverride, override);
g_slice_free (GstValidateOverride, override);
}
void
gst_qa_override_change_severity (GstQaOverride * override,
GstQaIssueId issue_id, GstQaReportLevel new_level)
gst_validate_override_change_severity (GstValidateOverride * override,
GstValidateIssueId issue_id, GstValidateReportLevel new_level)
{
g_hash_table_insert (override->level_override, (gpointer) issue_id,
(gpointer) new_level);
@ -50,14 +50,14 @@ gst_qa_override_change_severity (GstQaOverride * override,
/*
* Also receives @default_level to preserve a custom level that might have
* been set by a previous GstQaOverride and should not go back to the
* GstQaIssue default
* been set by a previous GstValidateOverride and should not go back to the
* GstValidateIssue default
*/
GstQaReportLevel
gst_qa_override_get_severity (GstQaOverride * override, GstQaIssueId issue_id,
GstQaReportLevel default_level)
GstValidateReportLevel
gst_validate_override_get_severity (GstValidateOverride * override,
GstValidateIssueId issue_id, GstValidateReportLevel default_level)
{
GstQaReportLevel level;
GstValidateReportLevel level;
if (g_hash_table_lookup_extended (override->level_override,
(gpointer) issue_id, NULL, (gpointer *) & level)) {
return level;
@ -66,90 +66,90 @@ gst_qa_override_get_severity (GstQaOverride * override, GstQaIssueId issue_id,
}
void
gst_qa_override_set_event_handler (GstQaOverride * override,
GstQaOverrideEventHandler handler)
gst_validate_override_set_event_handler (GstValidateOverride * override,
GstValidateOverrideEventHandler handler)
{
override->event_handler = handler;
}
void
gst_qa_override_set_buffer_handler (GstQaOverride * override,
GstQaOverrideBufferHandler handler)
gst_validate_override_set_buffer_handler (GstValidateOverride * override,
GstValidateOverrideBufferHandler handler)
{
override->buffer_handler = handler;
}
void
gst_qa_override_set_query_handler (GstQaOverride * override,
GstQaOverrideQueryHandler handler)
gst_validate_override_set_query_handler (GstValidateOverride * override,
GstValidateOverrideQueryHandler handler)
{
override->query_handler = handler;
}
void
gst_qa_override_set_buffer_probe_handler (GstQaOverride * override,
GstQaOverrideBufferHandler handler)
gst_validate_override_set_buffer_probe_handler (GstValidateOverride * override,
GstValidateOverrideBufferHandler handler)
{
override->buffer_probe_handler = handler;
}
void
gst_qa_override_set_getcaps_handler (GstQaOverride * override,
GstQaOverrideGetCapsHandler handler)
gst_validate_override_set_getcaps_handler (GstValidateOverride * override,
GstValidateOverrideGetCapsHandler handler)
{
override->getcaps_handler = handler;
}
void
gst_qa_override_set_setcaps_handler (GstQaOverride * override,
GstQaOverrideSetCapsHandler handler)
gst_validate_override_set_setcaps_handler (GstValidateOverride * override,
GstValidateOverrideSetCapsHandler handler)
{
override->setcaps_handler = handler;
}
void
gst_qa_override_event_handler (GstQaOverride * override, GstQaMonitor * monitor,
GstEvent * event)
gst_validate_override_event_handler (GstValidateOverride * override,
GstValidateMonitor * monitor, GstEvent * event)
{
if (override->event_handler)
override->event_handler (override, monitor, event);
}
void
gst_qa_override_buffer_handler (GstQaOverride * override,
GstQaMonitor * monitor, GstBuffer * buffer)
gst_validate_override_buffer_handler (GstValidateOverride * override,
GstValidateMonitor * monitor, GstBuffer * buffer)
{
if (override->buffer_handler)
override->buffer_handler (override, monitor, buffer);
}
void
gst_qa_override_query_handler (GstQaOverride * override, GstQaMonitor * monitor,
GstQuery * query)
gst_validate_override_query_handler (GstValidateOverride * override,
GstValidateMonitor * monitor, GstQuery * query)
{
if (override->query_handler)
override->query_handler (override, monitor, query);
}
void
gst_qa_override_buffer_probe_handler (GstQaOverride * override,
GstQaMonitor * monitor, GstBuffer * buffer)
gst_validate_override_buffer_probe_handler (GstValidateOverride * override,
GstValidateMonitor * monitor, GstBuffer * buffer)
{
if (override->buffer_probe_handler)
override->buffer_probe_handler (override, monitor, buffer);
}
void
gst_qa_override_getcaps_handler (GstQaOverride * override,
GstQaMonitor * monitor, GstCaps * caps)
gst_validate_override_getcaps_handler (GstValidateOverride * override,
GstValidateMonitor * monitor, GstCaps * caps)
{
if (override->getcaps_handler)
override->getcaps_handler (override, monitor, caps);
}
void
gst_qa_override_setcaps_handler (GstQaOverride * override,
GstQaMonitor * monitor, GstCaps * caps)
gst_validate_override_setcaps_handler (GstValidateOverride * override,
GstValidateMonitor * monitor, GstCaps * caps)
{
if (override->setcaps_handler)
override->setcaps_handler (override, monitor, caps);

View file

@ -0,0 +1,79 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-override.h - Validate Override that allows customizing Validate behavior
*
* 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_VALIDATE_OVERRIDE_H__
#define __GST_VALIDATE_OVERRIDE_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-report.h"
G_BEGIN_DECLS
typedef struct _QstQaOverride GstValidateOverride;
typedef struct _GstValidateMonitor GstValidateMonitor;
typedef void (*GstValidateOverrideBufferHandler)(GstValidateOverride * override,
GstValidateMonitor * pad_monitor, GstBuffer * buffer);
typedef void (*GstValidateOverrideEventHandler)(GstValidateOverride * override,
GstValidateMonitor * pad_monitor, GstEvent * event);
typedef void (*GstValidateOverrideQueryHandler)(GstValidateOverride * override,
GstValidateMonitor * pad_monitor, GstQuery * query);
typedef void (*GstValidateOverrideGetCapsHandler)(GstValidateOverride * override,
GstValidateMonitor * pad_monitor, GstCaps * caps);
typedef void (*GstValidateOverrideSetCapsHandler)(GstValidateOverride * override,
GstValidateMonitor * pad_monitor, GstCaps * caps);
struct _QstQaOverride {
GHashTable *level_override;
/* Pad handlers */
GstValidateOverrideBufferHandler buffer_handler;
GstValidateOverrideEventHandler event_handler;
GstValidateOverrideQueryHandler query_handler;
GstValidateOverrideBufferHandler buffer_probe_handler;
GstValidateOverrideGetCapsHandler getcaps_handler;
GstValidateOverrideSetCapsHandler setcaps_handler;
};
GstValidateOverride * gst_validate_override_new (void);
void gst_validate_override_free (GstValidateOverride * override);
void gst_validate_override_change_severity (GstValidateOverride * override, GstValidateIssueId issue_id, GstValidateReportLevel new_level);
GstValidateReportLevel gst_validate_override_get_severity (GstValidateOverride * override, GstValidateIssueId issue_id, GstValidateReportLevel default_level);
void gst_validate_override_event_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstEvent * event);
void gst_validate_override_buffer_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstBuffer * buffer);
void gst_validate_override_query_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstQuery * query);
void gst_validate_override_buffer_probe_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstBuffer * buffer);
void gst_validate_override_getcaps_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstCaps * caps);
void gst_validate_override_setcaps_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstCaps * caps);
void gst_validate_override_set_event_handler (GstValidateOverride * override, GstValidateOverrideEventHandler handler);
void gst_validate_override_set_buffer_handler (GstValidateOverride * override, GstValidateOverrideBufferHandler handler);
void gst_validate_override_set_query_handler (GstValidateOverride * override, GstValidateOverrideQueryHandler handler);
void gst_validate_override_set_buffer_probe_handler (GstValidateOverride * override, GstValidateOverrideBufferHandler handler);
void gst_validate_override_set_getcaps_handler (GstValidateOverride * override, GstValidateOverrideGetCapsHandler handler);
void gst_validate_override_set_setcaps_handler (GstValidateOverride * override, GstValidateOverrideSetCapsHandler handler);
G_END_DECLS
#endif /* __GST_VALIDATE_OVERRIDE_H__ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-pad-monitor.h - QA PadMonitor class
* gst-validate-pad-monitor.h - Validate PadMonitor class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -19,45 +19,45 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_QA_PAD_MONITOR_H__
#define __GST_QA_PAD_MONITOR_H__
#ifndef __GST_VALIDATE_PAD_MONITOR_H__
#define __GST_VALIDATE_PAD_MONITOR_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-qa-monitor.h"
#include "gst-validate-monitor.h"
G_BEGIN_DECLS
/* forward declaratin */
typedef struct _GstQaElementMonitor GstQaElementMonitor;
typedef struct _GstValidateElementMonitor GstValidateElementMonitor;
#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))
#define GST_QA_PAD_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_QA_PAD_MONITOR, GstQaPadMonitorClass))
#define GST_QA_PAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_QA_PAD_MONITOR, GstQaPadMonitor))
#define GST_QA_PAD_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_QA_PAD_MONITOR, GstQaPadMonitorClass))
#define GST_QA_PAD_MONITOR_CAST(obj) ((GstQaPadMonitor*)(obj))
#define GST_QA_PAD_MONITOR_CLASS_CAST(klass) ((GstQaPadMonitorClass*)(klass))
#define GST_TYPE_VALIDATE_PAD_MONITOR (gst_validate_pad_monitor_get_type ())
#define GST_IS_VALIDATE_PAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_PAD_MONITOR))
#define GST_IS_VALIDATE_PAD_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_PAD_MONITOR))
#define GST_VALIDATE_PAD_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_PAD_MONITOR, GstValidatePadMonitorClass))
#define GST_VALIDATE_PAD_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_PAD_MONITOR, GstValidatePadMonitor))
#define GST_VALIDATE_PAD_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_PAD_MONITOR, GstValidatePadMonitorClass))
#define GST_VALIDATE_PAD_MONITOR_CAST(obj) ((GstValidatePadMonitor*)(obj))
#define GST_VALIDATE_PAD_MONITOR_CLASS_CAST(klass) ((GstValidatePadMonitorClass*)(klass))
#define GST_QA_PAD_MONITOR_GET_PAD(m) (GST_PAD_CAST (GST_QA_MONITOR_GET_OBJECT (m)))
#define GST_VALIDATE_PAD_MONITOR_GET_PAD(m) (GST_PAD_CAST (GST_VALIDATE_MONITOR_GET_OBJECT (m)))
typedef struct _GstQaPadMonitor GstQaPadMonitor;
typedef struct _GstQaPadMonitorClass GstQaPadMonitorClass;
typedef struct _GstValidatePadMonitor GstValidatePadMonitor;
typedef struct _GstValidatePadMonitorClass GstValidatePadMonitorClass;
/**
* GstQaPadMonitor:
* GstValidatePadMonitor:
*
* GStreamer QA PadMonitor class.
* GStreamer Validate PadMonitor class.
*
* Class that wraps a #GstPad for QA checks
* Class that wraps a #GstPad for Validate checks
*/
struct _GstQaPadMonitor {
GstQaMonitor parent;
struct _GstValidatePadMonitor {
GstValidateMonitor parent;
GstQaElementMonitor *element_monitor;
GstValidateElementMonitor *element_monitor;
gboolean setup;
GstPad *pad;
@ -109,21 +109,21 @@ struct _GstQaPadMonitor {
};
/**
* GstQaPadMonitorClass:
* GstValidatePadMonitorClass:
* @parent_class: parent
*
* GStreamer QA PadMonitor object class.
* GStreamer Validate PadMonitor object class.
*/
struct _GstQaPadMonitorClass {
GstQaMonitorClass parent_class;
struct _GstValidatePadMonitorClass {
GstValidateMonitorClass parent_class;
};
/* normal GObject stuff */
GType gst_qa_pad_monitor_get_type (void);
GType gst_validate_pad_monitor_get_type (void);
GstQaPadMonitor * gst_qa_pad_monitor_new (GstPad * pad, GstQaRunner * runner, GstQaElementMonitor *element_monitor);
GstValidatePadMonitor * gst_validate_pad_monitor_new (GstPad * pad, GstValidateRunner * runner, GstValidateElementMonitor *element_monitor);
G_END_DECLS
#endif /* __GST_QA_PAD_MONITOR_H__ */
#endif /* __GST_VALIDATE_PAD_MONITOR_H__ */

View file

@ -0,0 +1,350 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-monitor-report.c - Validate report/issues functions
*
* 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include "gst-validate-i18n-lib.h"
#include "gst-validate-report.h"
#include "gst-validate-reporter.h"
#include "gst-validate-monitor.h"
static GstClockTime _gst_validate_report_start_time = 0;
static GstValidateDebugFlags _gst_validate_flags = 0;
static GHashTable *_gst_validate_issues = NULL;
G_DEFINE_BOXED_TYPE (GstValidateReport, gst_validate_report,
(GBoxedCopyFunc) gst_validate_report_ref,
(GBoxedFreeFunc) gst_validate_report_unref);
GstValidateIssueId
gst_validate_issue_get_id (GstValidateIssue * issue)
{
return issue->issue_id;
}
GstValidateIssue *
gst_validate_issue_new (GstValidateIssueId issue_id, gchar * summary,
gchar * description, GstValidateReportLevel default_level)
{
GstValidateIssue *issue = g_slice_new (GstValidateIssue);
issue->issue_id = issue_id;
issue->summary = summary;
issue->description = description;
issue->default_level = default_level;
issue->repeat = FALSE;
return issue;
}
static void
gst_validate_issue_free (GstValidateIssue * issue)
{
g_free (issue->summary);
g_free (issue->description);
g_slice_free (GstValidateIssue, issue);
}
void
gst_validate_issue_register (GstValidateIssue * issue)
{
g_return_if_fail (g_hash_table_lookup (_gst_validate_issues,
(gpointer) gst_validate_issue_get_id (issue)) == NULL);
g_hash_table_insert (_gst_validate_issues,
(gpointer) gst_validate_issue_get_id (issue), issue);
}
#define REGISTER_VALIDATE_ISSUE(id,sum,desc,lvl) gst_validate_issue_register (gst_validate_issue_new (id, sum, desc, lvl))
static void
gst_validate_report_load_issues (void)
{
g_return_if_fail (_gst_validate_issues == NULL);
_gst_validate_issues = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) gst_validate_issue_free);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_BUFFER_BEFORE_SEGMENT,
_("buffer was received before a segment"),
_("in push mode, a segment event must be received before a buffer"),
GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_BUFFER_IS_OUT_OF_SEGMENT,
_("buffer is out of the segment range"),
_("buffer being pushed is out of the current segment's start-stop "
" range. Meaning it is going to be discarded downstream without "
"any use"), GST_VALIDATE_REPORT_LEVEL_ISSUE);
REGISTER_VALIDATE_ISSUE
(GST_VALIDATE_ISSUE_ID_BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE,
_("buffer timestamp is out of the received buffer timestamps' range"),
_("a buffer leaving an element should have its timestamps in the range "
"of the received buffers timestamps. i.e. If an element received "
"buffers with timestamps from 0s to 10s, it can't push a buffer with "
"with a 11s timestamp, because it doesn't have data for that"),
GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE
(GST_VALIDATE_ISSUE_ID_FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO,
_("first buffer's running time isn't 0"),
_("the first buffer's received running time is expected to be 0"),
GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_WRONG_FLOW_RETURN, _("flow return from pad push doesn't match expected value"), _("flow return from a 1:1 sink/src pad element is as simple as " "returning what downstream returned. For elements that have multiple " "src pads, flow returns should be properly combined"), /* TODO fill me more */
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_CAPS_IS_MISSING_FIELD,
_("caps is missing a required field for its type"),
_("some caps types are expected to contain a set of basic fields. "
"For example, raw video should have 'width', 'height', 'framerate' "
"and 'pixel-aspect-ratio'"), GST_VALIDATE_REPORT_LEVEL_ISSUE);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_CAPS_FIELD_HAS_BAD_TYPE,
_("caps field has an unexpected type"),
_("some common caps fields should always use the same expected types"),
GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_CAPS_EXPECTED_FIELD_NOT_FOUND,
_("caps expected field wasn't present"),
_("a field that should be present in the caps wasn't found. "
"Fields sets on a sink pad caps should be propagated downstream "
"when it makes sense to do so"), GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_GET_CAPS_NOT_PROXYING_FIELDS,
_("getcaps function isn't proxying downstream fields correctly"),
_("elements should set downstream caps restrictions on its caps when "
"replying upstream's getcaps queries to avoid upstream sending data"
" in an unsupported format"), GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_CAPS_FIELD_UNEXPECTED_VALUE,
_("a field in caps has an unexpected value"),
_("fields set on a sink pad should be propagated downstream via "
"set caps"), GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_EVENT_NEWSEGMENT_NOT_PUSHED,
_("new segment event wasn't propagated downstream"),
_("segments received from upstream should be pushed downstream"),
GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE
(GST_VALIDATE_ISSUE_ID_SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME,
_("a serialized event received should be pushed in the same 'time' "
"as it was received"),
_("serialized events should be pushed in the same order they are "
"received and serialized with buffers. If an event is received after"
" a buffer with timestamp end 'X', it should be pushed right after "
"buffers with timestamp end 'X'"), GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_EVENT_HAS_WRONG_SEQNUM,
_("events that are part of the same pipeline 'operation' should "
"have the same seqnum"),
_("when events/messages are created from another event/message, "
"they should have their seqnums set to the original event/message "
"seqnum"), GST_VALIDATE_REPORT_LEVEL_ISSUE);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_EVENT_SERIALIZED_OUT_OF_ORDER,
_("a serialized event received should be pushed in the same order "
"as it was received"),
_("serialized events should be pushed in the same order they are "
"received."), GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_EVENT_NEW_SEGMENT_MISMATCH,
_("a new segment event has different value than the received one"),
_("when receiving a new segment, an element should push an equivalent"
"segment downstream"), GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_START_UNEXPECTED,
_("received an unexpected flush start event"), NULL,
GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_STOP_UNEXPECTED,
_("received an unexpected flush stop event"), NULL,
GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_EVENT_SEEK_NOT_HANDLED,
_("seek event wasn't handled"), NULL, GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE
(GST_VALIDATE_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG,
_("position after a seek is wrong"), NULL,
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_STATE_CHANGE_FAILURE,
_("state change failed"), NULL, GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_SIZE_IS_ZERO,
_("resulting file size is 0"), NULL, GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_SIZE_INCORRECT,
_("resulting file size wasn't within the expected values"),
NULL, GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_DURATION_INCORRECT,
_("resulting file duration wasn't within the expected values"),
NULL, GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_SEEKABLE_INCORRECT,
_("resulting file wasn't seekable or not seekable as expected"),
NULL, GST_VALIDATE_REPORT_LEVEL_WARNING);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_PROFILE_INCORRECT,
_("resulting file stream profiles didn't match expected values"),
NULL, GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_NOT_FOUND,
_("resulting file could not be found for testing"), NULL,
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_CHECK_FAILURE,
_("an error occured while checking the file for conformance"), NULL,
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_START_FAILURE,
_("an error occured while starting playback of the test file"), NULL,
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR,
_("an error during playback of the file"), NULL,
GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_ALLOCATION_FAILURE,
_("a memory allocation failed during Validate run"),
NULL, GST_VALIDATE_REPORT_LEVEL_CRITICAL);
REGISTER_VALIDATE_ISSUE (GST_VALIDATE_ISSUE_ID_MISSING_PLUGIN,
_("a gstreamer plugin is missing and prevented Validate from running"),
NULL, GST_VALIDATE_REPORT_LEVEL_CRITICAL);
}
void
gst_validate_report_init (void)
{
const gchar *var;
const GDebugKey keys[] = {
{"fatal_criticals", GST_VALIDATE_FATAL_CRITICALS},
{"fatal_warnings", GST_VALIDATE_FATAL_WARNINGS},
{"fatal_issues", GST_VALIDATE_FATAL_ISSUES}
};
if (_gst_validate_report_start_time == 0) {
_gst_validate_report_start_time = gst_util_get_timestamp ();
/* init the debug flags */
var = g_getenv ("GST_VALIDATE");
if (var && strlen (var) > 0) {
_gst_validate_flags = g_parse_debug_string (var, keys, 3);
}
gst_validate_report_load_issues ();
}
}
GstValidateIssue *
gst_validate_issue_from_id (GstValidateIssueId issue_id)
{
return g_hash_table_lookup (_gst_validate_issues, (gpointer) issue_id);
}
/* TODO how are these functions going to work with extensions */
const gchar *
gst_validate_report_level_get_name (GstValidateReportLevel level)
{
switch (level) {
case GST_VALIDATE_REPORT_LEVEL_CRITICAL:
return "critical";
case GST_VALIDATE_REPORT_LEVEL_WARNING:
return "warning";
case GST_VALIDATE_REPORT_LEVEL_ISSUE:
return "issue";
case GST_VALIDATE_REPORT_LEVEL_IGNORE:
return "ignore";
default:
return "unknown";
}
}
const gchar *
gst_validate_report_area_get_name (GstValidateReportArea area)
{
switch (area) {
case GST_VALIDATE_AREA_EVENT:
return "event";
case GST_VALIDATE_AREA_BUFFER:
return "buffer";
case GST_VALIDATE_AREA_QUERY:
return "query";
case GST_VALIDATE_AREA_CAPS:
return "caps";
case GST_VALIDATE_AREA_SEEK:
return "seek";
case GST_VALIDATE_AREA_STATE:
return "state";
case GST_VALIDATE_AREA_FILE_CHECK:
return "file-check";
case GST_VALIDATE_AREA_RUN_ERROR:
return "run-error";
case GST_VALIDATE_AREA_OTHER:
return "other";
default:
g_assert_not_reached ();
return "unknown";
}
}
void
gst_validate_report_check_abort (GstValidateReport * report)
{
if ((report->level == GST_VALIDATE_REPORT_LEVEL_ISSUE &&
_gst_validate_flags & GST_VALIDATE_FATAL_ISSUES) ||
(report->level == GST_VALIDATE_REPORT_LEVEL_WARNING &&
_gst_validate_flags & GST_VALIDATE_FATAL_WARNINGS) ||
(report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL &&
_gst_validate_flags & GST_VALIDATE_FATAL_CRITICALS)) {
g_error ("Fatal report received: %" GST_VALIDATE_ERROR_REPORT_PRINT_FORMAT,
GST_VALIDATE_REPORT_PRINT_ARGS (report));
}
}
GstValidateIssueId
gst_validate_report_get_issue_id (GstValidateReport * report)
{
return gst_validate_issue_get_id (report->issue);
}
GstValidateReport *
gst_validate_report_new (GstValidateIssue * issue,
GstValidateReporter * reporter, const gchar * message)
{
GstValidateReport *report = g_slice_new0 (GstValidateReport);
report->issue = issue;
report->reporter = reporter; /* TODO should we ref? */
report->message = g_strdup (message);
report->timestamp =
gst_util_get_timestamp () - _gst_validate_report_start_time;
report->level = issue->default_level;
return report;
}
void
gst_validate_report_unref (GstValidateReport * report)
{
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
g_free (report->message);
g_slice_free (GstValidateReport, report);
}
}
GstValidateReport *
gst_validate_report_ref (GstValidateReport * report)
{
g_atomic_int_inc (&report->refcount);
return report;
}
void
gst_validate_report_printf (GstValidateReport * report)
{
g_print ("%" GST_VALIDATE_ERROR_REPORT_PRINT_FORMAT "\n",
GST_VALIDATE_REPORT_PRINT_ARGS (report));
}

View file

@ -0,0 +1,189 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-monitor-report.h - Validate Element report structures and functions
*
* 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_VALIDATE_REPORT_H__
#define __GST_VALIDATE_REPORT_H__
#include <glib-object.h>
#include <gst/gst.h>
G_BEGIN_DECLS
/* forward declaration */
typedef struct _GstValidateReporter GstValidateReporter;
GType gst_validate_report_get_type (void);
#define GST_TYPE_VALIDATE_REPORT (gst_validate_report_get_type ())
typedef enum {
GST_VALIDATE_FATAL_DEFAULT = 0,
GST_VALIDATE_FATAL_ISSUES = 1 << 0,
GST_VALIDATE_FATAL_WARNINGS = 1 << 1,
GST_VALIDATE_FATAL_CRITICALS = 1 << 2
} GstValidateDebugFlags;
typedef enum {
GST_VALIDATE_REPORT_LEVEL_CRITICAL,
GST_VALIDATE_REPORT_LEVEL_WARNING,
GST_VALIDATE_REPORT_LEVEL_ISSUE,
GST_VALIDATE_REPORT_LEVEL_IGNORE,
GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES,
} GstValidateReportLevel;
typedef enum {
GST_VALIDATE_AREA_EVENT=1,
GST_VALIDATE_AREA_BUFFER,
GST_VALIDATE_AREA_QUERY,
GST_VALIDATE_AREA_CAPS,
GST_VALIDATE_AREA_SEEK,
GST_VALIDATE_AREA_STATE,
GST_VALIDATE_AREA_FILE_CHECK,
GST_VALIDATE_AREA_RUN_ERROR,
GST_VALIDATE_AREA_OTHER=100,
} GstValidateReportArea;
typedef guintptr GstValidateIssueId;
#define GST_VALIDATE_ISSUE_ID_UNKNOWN 0
#define GST_VALIDATE_ISSUE_ID_SHIFT 16
#define GST_VALIDATE_ISSUE_ID_CUSTOM_FIRST (2 << 15)
#define GST_VALIDATE_ISSUE_ID_BUFFER_BEFORE_SEGMENT (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_BUFFER_IS_OUT_OF_SEGMENT (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_WRONG_FLOW_RETURN (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_CAPS_IS_MISSING_FIELD (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_CAPS_FIELD_HAS_BAD_TYPE (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_CAPS_EXPECTED_FIELD_NOT_FOUND (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_GET_CAPS_NOT_PROXYING_FIELDS (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_CAPS_FIELD_UNEXPECTED_VALUE (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_EVENT_NEWSEGMENT_NOT_PUSHED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_EVENT_HAS_WRONG_SEQNUM (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_EVENT_SERIALIZED_OUT_OF_ORDER (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_EVENT_NEW_SEGMENT_MISMATCH (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_START_UNEXPECTED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 6)
#define GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_STOP_UNEXPECTED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 7)
#define GST_VALIDATE_ISSUE_ID_EVENT_SEEK_NOT_HANDLED (((GstValidateIssueId) GST_VALIDATE_AREA_SEEK) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG (((GstValidateIssueId) GST_VALIDATE_AREA_SEEK) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_STATE_CHANGE_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_STATE) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_FILE_SIZE_IS_ZERO (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_FILE_SIZE_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_FILE_DURATION_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_FILE_SEEKABLE_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_FILE_PROFILE_INCORRECT (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_FILE_NOT_FOUND (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 6)
#define GST_VALIDATE_ISSUE_ID_FILE_CHECK_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 7)
#define GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_START_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 8)
#define GST_VALIDATE_ISSUE_ID_FILE_PLAYBACK_ERROR (((GstValidateIssueId) GST_VALIDATE_AREA_FILE_CHECK) << GST_VALIDATE_ISSUE_ID_SHIFT | 9)
#define GST_VALIDATE_ISSUE_ID_ALLOCATION_FAILURE (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_MISSING_PLUGIN (((GstValidateIssueId) GST_VALIDATE_AREA_RUN_ERROR) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)
#define GST_VALIDATE_ISSUE_ID_AREA(id) ((guintptr)(id >> GST_VALIDATE_ISSUE_ID_SHIFT))
typedef struct {
GstValidateIssueId issue_id;
/* Summary: one-liner translatable description of the issue */
gchar *summary;
/* description: multi-line translatable description of:
* * what the issue is (and why it's an issue)
* * what the source problem could be
* * pointers to fixing the issue
*/
gchar *description;
/* default_level: The default level of severity for this
* issue. */
GstValidateReportLevel default_level;
/* repeat: whether the issue might be triggered
* multiple times but only remembered once */
gboolean repeat;
} GstValidateIssue;
#define GST_VALIDATE_ISSUE_AREA(i) (GST_VALIDATE_ISSUE_ID_AREA (gst_validate_issue_get_id (i)))
typedef struct {
gint refcount;
/* issue: The issue this report corresponds to (to get dsecription, summary,...) */
GstValidateIssue *issue;
GstValidateReportLevel level;
/* The reporter that reported the issue (to get names, info, ...) */
GstValidateReporter *reporter;
/* timestamp: The time at which this issue happened since
* the process start (to stay in sync with gst logging) */
GstClockTime timestamp;
/* message: issue-specific message. Gives more detail on the actual
* issue. Can be NULL */
gchar *message;
} GstValidateReport;
#define GST_VALIDATE_ISSUE_FORMAT G_GUINTPTR_FORMAT " (%s) : %s(%" G_GUINTPTR_FORMAT "): %s"
#define GST_VALIDATE_ISSUE_ARGS(i) gst_validate_issue_get_id (i), gst_validate_report_level_get_name (i->default_level), \
gst_validate_report_area_get_name (GST_VALIDATE_ISSUE_AREA (i)), GST_VALIDATE_ISSUE_AREA (i), \
i->summary
#define GST_VALIDATE_ERROR_REPORT_PRINT_FORMAT GST_TIME_FORMAT " <%s>: %" GST_VALIDATE_ISSUE_FORMAT ": %s"
#define GST_VALIDATE_REPORT_PRINT_ARGS(r) GST_TIME_ARGS (r->timestamp), \
gst_validate_reporter_get_name (r->reporter), \
GST_VALIDATE_ISSUE_ARGS (r->issue), \
r->message
void gst_validate_report_init (void);
GstValidateIssue * gst_validate_issue_from_id (GstValidateIssueId issue_id);
GstValidateIssueId gst_validate_issue_get_id (GstValidateIssue * issue);
void gst_validate_issue_register (GstValidateIssue * issue);
GstValidateIssue * gst_validate_issue_new (GstValidateIssueId issue_id, gchar * summary,
gchar * description,
GstValidateReportLevel default_level);
GstValidateReport * gst_validate_report_new (GstValidateIssue * issue,
GstValidateReporter * reporter,
const gchar * message);
void gst_validate_report_unref (GstValidateReport * report);
GstValidateReport * gst_validate_report_ref (GstValidateReport * report);
GstValidateIssueId gst_validate_report_get_issue_id (GstValidateReport * report);
void gst_validate_report_check_abort (GstValidateReport * report);
void gst_validate_report_printf (GstValidateReport * report);
const gchar * gst_validate_report_level_get_name (GstValidateReportLevel level);
const gchar * gst_validate_report_area_get_name (GstValidateReportArea area);
const gchar * gst_validate_report_subarea_get_name (GstValidateReportArea area, gint subarea);
G_END_DECLS
#endif /* __GST_VALIDATE_REPORT_H__ */

View file

@ -0,0 +1,186 @@
/* GStreamer
*
* Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
*
* 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 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-validate-reporter.h"
#include "gst-validate-report.h"
#define REPORTER_PRIVATE "gst-validate-reporter-private"
GST_DEBUG_CATEGORY_STATIC (gst_validate_reporter);
#define GST_CAT_DEFAULT gst_validate_reporter
typedef struct _GstValidateReporterPrivate
{
GstValidateRunner *runner;
GHashTable *reports;
char *name;
} GstValidateReporterPrivate;
static void
gst_validate_reporter_default_init (GstValidateReporterInterface * iface)
{
GST_DEBUG_CATEGORY_INIT (gst_validate_reporter, "gstvalidatereporter",
GST_DEBUG_FG_MAGENTA, "gst qa reporter");
g_object_interface_install_property (iface,
g_param_spec_object ("qa-runner", "VALIDATE Runner",
"The Validate runner to " "report errors to",
GST_TYPE_VALIDATE_RUNNER,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
}
G_DEFINE_INTERFACE (GstValidateReporter, gst_validate_reporter, G_TYPE_OBJECT);
static void
_free_priv (GstValidateReporterPrivate * priv)
{
g_hash_table_unref (priv->reports);
g_free (priv->name);
}
static GstValidateReporterPrivate *
gst_validate_reporter_get_priv (GstValidateReporter * reporter)
{
GstValidateReporterPrivate *priv =
g_object_get_data (G_OBJECT (reporter), REPORTER_PRIVATE);
if (priv == NULL) {
priv = g_slice_new0 (GstValidateReporterPrivate);
priv->reports = g_hash_table_new_full (g_direct_hash,
g_direct_equal, NULL, (GDestroyNotify) gst_validate_report_unref);
g_object_set_data_full (G_OBJECT (reporter), REPORTER_PRIVATE, priv,
(GDestroyNotify) _free_priv);
}
return priv;
}
static void
gst_validate_reporter_intercept_report (GstValidateReporter * reporter,
GstValidateReport * report)
{
GstValidateReporterInterface *iface =
GST_VALIDATE_REPORTER_GET_INTERFACE (reporter);
if (iface->intercept_report) {
iface->intercept_report (reporter, report);
}
}
void
gst_validate_report_valist (GstValidateReporter * reporter,
GstValidateIssueId issue_id, const gchar * format, va_list var_args)
{
GstValidateReport *report;
gchar *message;
GstValidateIssue *issue;
GstValidateReporterPrivate *priv = gst_validate_reporter_get_priv (reporter);
issue = gst_validate_issue_from_id (issue_id);
g_return_if_fail (issue != NULL);
message = g_strdup_vprintf (format, var_args);
report = gst_validate_report_new (issue, reporter, message);
gst_validate_reporter_intercept_report (reporter, report);
if (issue->repeat == FALSE) {
GstValidateIssueId issue_id = gst_validate_issue_get_id (issue);
if (g_hash_table_lookup (priv->reports, (gconstpointer) issue_id)) {
GST_DEBUG ("Report \"%" G_GUINTPTR_FORMAT ":%s\" already present",
issue_id, issue->summary);
gst_validate_report_unref (report);
return;
}
g_hash_table_insert (priv->reports, (gpointer) issue_id, report);
}
if (report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL)
GST_ERROR ("<%s>: %s", priv->name, message);
else if (report->level == GST_VALIDATE_REPORT_LEVEL_WARNING)
GST_WARNING ("<%s>: %s", priv->name, message);
else if (report->level == GST_VALIDATE_REPORT_LEVEL_ISSUE)
GST_LOG ("<%s>: %s", priv->name, message);
else
GST_DEBUG ("<%s>: %s", priv->name, message);
GST_INFO_OBJECT (reporter, "Received error report %" GST_VALIDATE_ISSUE_FORMAT
" : %s", GST_VALIDATE_ISSUE_ARGS (issue), message);
gst_validate_report_printf (report);
gst_validate_report_check_abort (report);
if (priv->runner) {
gst_validate_runner_add_report (priv->runner, report);
} else {
gst_validate_report_unref (report);
}
g_free (message);
}
void
gst_validate_report (GstValidateReporter * reporter,
GstValidateIssueId issue_id, const gchar * format, ...)
{
va_list var_args;
va_start (var_args, format);
gst_validate_report_valist (reporter, issue_id, format, var_args);
va_end (var_args);
}
void
gst_validate_reporter_set_name (GstValidateReporter * reporter, gchar * name)
{
GstValidateReporterPrivate *priv = gst_validate_reporter_get_priv (reporter);
if (priv->name)
g_free (priv->name);
priv->name = name;
}
const gchar *
gst_validate_reporter_get_name (GstValidateReporter * reporter)
{
GstValidateReporterPrivate *priv = gst_validate_reporter_get_priv (reporter);
return priv->name;
}
GstValidateRunner *
gst_validate_reporter_get_runner (GstValidateReporter * reporter)
{
GstValidateReporterPrivate *priv = gst_validate_reporter_get_priv (reporter);
return priv->runner;
}
void
gst_validate_reporter_set_runner (GstValidateReporter * reporter,
GstValidateRunner * runner)
{
GstValidateReporterPrivate *priv = gst_validate_reporter_get_priv (reporter);
priv->runner = runner;
}

View file

@ -0,0 +1,83 @@
/* GStreamer
*
* Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
*
* 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 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_VALIDATE_REPORTER_
#define _GST_VALIDATE_REPORTER_
#include <glib-object.h>
#include "gst-validate-runner.h"
#include "gst-validate-report.h"
G_BEGIN_DECLS
typedef struct _GstValidateReporter GstValidateReporter;
typedef struct _GstValidateReporterInterface GstValidateReporterInterface;
/* GstValidateReporter interface declarations */
#define GST_TYPE_VALIDATE_REPORTER (gst_validate_reporter_get_type ())
#define GST_VALIDATE_REPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_REPORTER, GstValidateReporter))
#define GST_IS_VALIDATE_REPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_REPORTER))
#define GST_VALIDATE_REPORTER_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VALIDATE_REPORTER, GstValidateReporterInterface))
#define GST_VALIDATE_REPORTER_CAST(obj) ((GstValidateReporter *) obj)
#ifdef G_HAVE_ISO_VARARGS
#define GST_VALIDATE_REPORT(m, issue_id, ...) \
G_STMT_START { \
gst_validate_report (GST_VALIDATE_REPORTER (m), issue_id, \
__VA_ARGS__ ); \
} G_STMT_END
#else /* G_HAVE_GNUC_VARARGS */
#ifdef G_HAVE_GNUC_VARARGS
#define GST_VALIDATE_REPORT(m, issue_id, args...) \
G_STMT_START { \
gst_validate_report (GST_VALIDATE_REPORTER (m), \
issue_id, ##args ); \
} G_STMT_END
#endif /* G_HAVE_ISO_VARARGS */
#endif /* G_HAVE_GNUC_VARARGS */
GType gst_validate_reporter_get_type (void);
/**
* GstValidateReporter:
*/
struct _GstValidateReporterInterface
{
GTypeInterface parent;
void (*intercept_report)(GstValidateReporter * reporter, GstValidateReport * report);
};
void gst_validate_reporter_set_name (GstValidateReporter * reporter,
gchar * name);
const gchar * gst_validate_reporter_get_name (GstValidateReporter * reporter);
GstValidateRunner * gst_validate_reporter_get_runner (GstValidateReporter *reporter);
void gst_validate_reporter_init (GstValidateReporter * reporter, const gchar *name);
void gst_validate_report (GstValidateReporter * reporter, GstValidateIssueId issue_id,
const gchar * format, ...);
void gst_validate_report_valist (GstValidateReporter * reporter, GstValidateIssueId issue_id,
const gchar * format, va_list var_args);
void gst_validate_reporter_set_runner (GstValidateReporter * reporter,
GstValidateRunner *runner);
G_END_DECLS
#endif /* _GST_VALIDATE_REPORTER_ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-qa-runner.c - QA Runner class
* gst-validate-runner.c - Validate Runner class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -19,25 +19,26 @@
* Boston, MA 02111-1307, USA.
*/
#include "gst-qa-runner.h"
#include "gst-qa-report.h"
#include "gst-qa-monitor-factory.h"
#include "gst-qa-override-registry.h"
#include "gst-validate-runner.h"
#include "gst-validate-report.h"
#include "gst-validate-monitor-factory.h"
#include "gst-validate-override-registry.h"
/**
* SECTION:gst-qa-runner
* @short_description: Class that runs Gst QA tests for a pipeline
* SECTION:gst-validate-runner
* @short_description: Class that runs Gst Validate tests for a pipeline
*
* TODO
*/
GST_DEBUG_CATEGORY_STATIC (gst_qa_runner_debug);
#define GST_CAT_DEFAULT gst_qa_runner_debug
GST_DEBUG_CATEGORY_STATIC (gst_validate_runner_debug);
#define GST_CAT_DEFAULT gst_validate_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);
GST_DEBUG_CATEGORY_INIT (gst_validate_runner_debug, "qa_runner", 0, "VALIDATE Runner");
#define gst_validate_runner_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstValidateRunner, gst_validate_runner, G_TYPE_OBJECT,
_do_init);
/* signals */
enum
@ -50,53 +51,55 @@ enum
static guint _signals[LAST_SIGNAL] = { 0 };
static void
gst_qa_runner_dispose (GObject * object)
gst_validate_runner_dispose (GObject * object)
{
GstQaRunner *runner = GST_QA_RUNNER_CAST (object);
GstValidateRunner *runner = GST_VALIDATE_RUNNER_CAST (object);
g_slist_free_full (runner->reports, (GDestroyNotify) gst_qa_report_unref);
g_slist_free_full (runner->reports,
(GDestroyNotify) gst_validate_report_unref);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_qa_runner_class_init (GstQaRunnerClass * klass)
gst_validate_runner_class_init (GstValidateRunnerClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = gst_qa_runner_dispose;
gobject_class->dispose = gst_validate_runner_dispose;
/* init the report system (can be called multiple times) */
gst_qa_report_init ();
gst_validate_report_init ();
/* Ensure we load overrides before any use of a monitor */
gst_qa_override_registry_preload ();
gst_validate_override_registry_preload ();
_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);
GST_TYPE_VALIDATE_REPORT);
}
static void
gst_qa_runner_init (GstQaRunner * runner)
gst_validate_runner_init (GstValidateRunner * runner)
{
runner->setup = FALSE;
}
/**
* gst_qa_runner_new:
* gst_validate_runner_new:
*/
GstQaRunner *
gst_qa_runner_new (void)
GstValidateRunner *
gst_validate_runner_new (void)
{
return g_object_new (GST_TYPE_QA_RUNNER, NULL);
return g_object_new (GST_TYPE_VALIDATE_RUNNER, NULL);
}
void
gst_qa_runner_add_report (GstQaRunner * runner, GstQaReport * report)
gst_validate_runner_add_report (GstValidateRunner * runner,
GstValidateReport * report)
{
runner->reports = g_slist_prepend (runner->reports, report);
@ -104,14 +107,14 @@ gst_qa_runner_add_report (GstQaRunner * runner, GstQaReport * report)
}
guint
gst_qa_runner_get_reports_count (GstQaRunner * runner)
gst_validate_runner_get_reports_count (GstValidateRunner * runner)
{
g_return_val_if_fail (runner != NULL, 0);
return g_slist_length (runner->reports);
}
GSList *
gst_qa_runner_get_reports (GstQaRunner * runner)
gst_validate_runner_get_reports (GstValidateRunner * runner)
{
/* TODO should we need locking or put in htte docs to always call this
* after pipeline ends? */

View file

@ -0,0 +1,87 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* gst-validate-runner.h - Validate 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.
*/
#ifndef __GST_VALIDATE_RUNNER_H__
#define __GST_VALIDATE_RUNNER_H__
#include <glib-object.h>
#include <gst/gst.h>
#include "gst-validate-report.h"
G_BEGIN_DECLS
/* forward declaration */
typedef struct _GstValidateScenario GstValidateScenario;
#define GST_TYPE_VALIDATE_RUNNER (gst_validate_runner_get_type ())
#define GST_IS_VALIDATE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_RUNNER))
#define GST_IS_VALIDATE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_RUNNER))
#define GST_VALIDATE_RUNNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_RUNNER, GstValidateRunnerClass))
#define GST_VALIDATE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_RUNNER, GstValidateRunner))
#define GST_VALIDATE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_RUNNER, GstValidateRunnerClass))
#define GST_VALIDATE_RUNNER_CAST(obj) ((GstValidateRunner*)(obj))
#define GST_VALIDATE_RUNNER_CLASS_CAST(klass) ((GstValidateRunnerClass*)(klass))
typedef struct _GstValidateRunner GstValidateRunner;
typedef struct _GstValidateRunnerClass GstValidateRunnerClass;
/* TODO hide this to be opaque? */
/**
* GstValidateRunner:
*
* GStreamer Validate Runner class.
*
* Class that manages a Validate test run for some pipeline
*/
struct _GstValidateRunner {
GObject object;
gboolean setup;
/*< private >*/
GSList *reports;
};
/**
* GstValidateRunnerClass:
* @parent_class: parent
*
* GStreamer Validate Runner object class.
*/
struct _GstValidateRunnerClass {
GObjectClass parent_class;
};
/* normal GObject stuff */
GType gst_validate_runner_get_type (void);
GstValidateRunner * gst_validate_runner_new (void);
void gst_validate_runner_add_report (GstValidateRunner * runner, GstValidateReport * report);
guint gst_validate_runner_get_reports_count (GstValidateRunner * runner);
GSList * gst_validate_runner_get_reports (GstValidateRunner * runner);
G_END_DECLS
#endif /* __GST_VALIDATE_RUNNER_H__ */

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
*
* gst-qa-scenario.c - QA Scenario class
* gst-validate-scenario.c - Validate Scenario class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -27,18 +27,18 @@
#include <gio/gio.h>
#include <string.h>
#include "gst-qa-scenario.h"
#include "gst-qa-reporter.h"
#include "gst-qa-report.h"
#include "gst-validate-scenario.h"
#include "gst-validate-reporter.h"
#include "gst-validate-report.h"
#define GST_QA_SCENARIO_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_QA_SCENARIO, GstQaScenarioPrivate))
#define GST_VALIDATE_SCENARIO_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenarioPrivate))
#define GST_QA_SCENARIO_SUFFIX ".xml"
#define GST_QA_SCENARIO_DIRECTORY "qa-scenario"
#define GST_VALIDATE_SCENARIO_SUFFIX ".xml"
#define GST_VALIDATE_SCENARIO_DIRECTORY "qa-scenario"
GST_DEBUG_CATEGORY_STATIC (gst_qa_scenario);
#define GST_CAT_DEFAULT gst_qa_scenario
GST_DEBUG_CATEGORY_STATIC (gst_validate_scenario);
#define GST_CAT_DEFAULT gst_validate_scenario
#define DEFAULT_SEEK_TOLERANCE (0.1 * GST_SECOND) /* tolerance seek interval
@ -50,13 +50,13 @@ enum
PROP_LAST
};
static void gst_qa_scenario_class_init (GstQaScenarioClass * klass);
static void gst_qa_scenario_init (GstQaScenario * scenario);
static void gst_qa_scenario_dispose (GObject * object);
static void gst_qa_scenario_finalize (GObject * object);
static void gst_validate_scenario_class_init (GstValidateScenarioClass * klass);
static void gst_validate_scenario_init (GstValidateScenario * scenario);
static void gst_validate_scenario_dispose (GObject * object);
static void gst_validate_scenario_finalize (GObject * object);
G_DEFINE_TYPE_WITH_CODE (GstQaScenario, gst_qa_scenario, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GST_TYPE_QA_REPORTER, NULL));
G_DEFINE_TYPE_WITH_CODE (GstValidateScenario, gst_validate_scenario,
G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL));
typedef enum
{
@ -101,10 +101,10 @@ typedef struct _EosInfo
ScenarioAction action;
} EosInfo;
struct _GstQaScenarioPrivate
struct _GstValidateScenarioPrivate
{
GstElement *pipeline;
GstQaRunner *runner;
GstValidateRunner *runner;
GList *seeks;
gint64 seeked_position; /* last seeked position */
@ -248,9 +248,9 @@ _free_scenario_action (ScenarioAction * act)
static inline void
_parse_seek (GMarkupParseContext * context, const gchar * element_name,
const gchar ** attribute_names, const gchar ** attribute_values,
GstQaScenario * scenario, GError ** error)
GstValidateScenario * scenario, GError ** error)
{
GstQaScenarioPrivate *priv = scenario->priv;
GstValidateScenarioPrivate *priv = scenario->priv;
const char *format, *rate, *flags, *start_type, *start, *stop_type, *stop;
const char *playback_time = NULL;
@ -285,9 +285,9 @@ _parse_seek (GMarkupParseContext * context, const gchar * element_name,
static inline void
_parse_pause (GMarkupParseContext * context, const gchar * element_name,
const gchar ** attribute_names, const gchar ** attribute_values,
GstQaScenario * scenario, GError ** error)
GstValidateScenario * scenario, GError ** error)
{
GstQaScenarioPrivate *priv = scenario->priv;
GstValidateScenarioPrivate *priv = scenario->priv;
const char *duration = NULL;
const char *playback_time = NULL;
@ -310,9 +310,9 @@ _parse_pause (GMarkupParseContext * context, const gchar * element_name,
static inline void
_parse_eos (GMarkupParseContext * context, const gchar * element_name,
const gchar ** attribute_names, const gchar ** attribute_values,
GstQaScenario * scenario, GError ** error)
GstValidateScenario * scenario, GError ** error)
{
GstQaScenarioPrivate *priv = scenario->priv;
GstValidateScenarioPrivate *priv = scenario->priv;
const char *playback_time = NULL;
EosInfo *info = _new_eos_info ();
@ -334,8 +334,9 @@ _parse_element_start (GMarkupParseContext * context, const gchar * element_name,
const gchar ** attribute_names, const gchar ** attribute_values,
gpointer udata, GError ** error)
{
GstQaScenario *scenario = udata;
GstQaScenarioPrivate *priv = GST_QA_SCENARIO_GET_PRIVATE (scenario);
GstValidateScenario *scenario = udata;
GstValidateScenarioPrivate *priv =
GST_VALIDATE_SCENARIO_GET_PRIVATE (scenario);
if (strcmp (element_name, "scenario") == 0) {
priv->in_scenario = TRUE;
@ -368,8 +369,9 @@ static void
_parse_element_end (GMarkupParseContext * context, const gchar * element_name,
gpointer udata, GError ** error)
{
GstQaScenario *scenario = udata;
GstQaScenarioPrivate *priv = GST_QA_SCENARIO_GET_PRIVATE (scenario);
GstValidateScenario *scenario = udata;
GstValidateScenarioPrivate *priv =
GST_VALIDATE_SCENARIO_GET_PRIVATE (scenario);
if (strcmp (element_name, "actions") == 0) {
priv->in_actions = FALSE;
@ -379,13 +381,13 @@ _parse_element_end (GMarkupParseContext * context, const gchar * element_name,
}
static gboolean
_pause_action_restore_playing (GstQaScenario * scenario)
_pause_action_restore_playing (GstValidateScenario * scenario)
{
GstElement *pipeline = scenario->priv->pipeline;
if (gst_element_set_state (pipeline, GST_STATE_PLAYING) ==
GST_STATE_CHANGE_FAILURE) {
GST_QA_REPORT (scenario, GST_QA_ISSUE_ID_STATE_CHANGE_FAILURE,
GST_VALIDATE_REPORT (scenario, GST_VALIDATE_ISSUE_ID_STATE_CHANGE_FAILURE,
"Failed to set state to playing");
}
@ -393,9 +395,9 @@ _pause_action_restore_playing (GstQaScenario * scenario)
}
static void
_execute_action (GstQaScenario * scenario, ScenarioAction * act)
_execute_action (GstValidateScenario * scenario, ScenarioAction * act)
{
GstQaScenarioPrivate *priv = scenario->priv;
GstValidateScenarioPrivate *priv = scenario->priv;
GstElement *pipeline = scenario->priv->pipeline;
if (act->type == SCENARIO_ACTION_SEEK) {
@ -407,7 +409,8 @@ _execute_action (GstQaScenario * scenario, ScenarioAction * act)
seek->format, seek->flags,
seek->start_type, seek->start,
seek->stop_type, seek->stop) == FALSE) {
GST_QA_REPORT (scenario, GST_QA_ISSUE_ID_EVENT_SEEK_NOT_HANDLED,
GST_VALIDATE_REPORT (scenario,
GST_VALIDATE_ISSUE_ID_EVENT_SEEK_NOT_HANDLED,
"Could not seek to position %" GST_TIME_FORMAT,
GST_TIME_ARGS (priv->seeked_position));
}
@ -421,7 +424,7 @@ _execute_action (GstQaScenario * scenario, ScenarioAction * act)
if (gst_element_set_state (pipeline, GST_STATE_PAUSED) ==
GST_STATE_CHANGE_FAILURE) {
GST_QA_REPORT (scenario, GST_QA_ISSUE_ID_STATE_CHANGE_FAILURE,
GST_VALIDATE_REPORT (scenario, GST_VALIDATE_ISSUE_ID_STATE_CHANGE_FAILURE,
"Failed to set state to paused");
}
g_timeout_add (pause->duration / GST_MSECOND,
@ -433,12 +436,12 @@ _execute_action (GstQaScenario * scenario, ScenarioAction * act)
}
static gboolean
get_position (GstQaScenario * scenario)
get_position (GstValidateScenario * scenario)
{
GList *tmp;
gint64 position;
GstFormat format = GST_FORMAT_TIME;
GstQaScenarioPrivate *priv = scenario->priv;
GstValidateScenarioPrivate *priv = scenario->priv;
GstElement *pipeline = scenario->priv->pipeline;
gst_element_query_position (pipeline, &format, &position);
@ -453,7 +456,8 @@ get_position (GstQaScenario * scenario)
/* TODO what about non flushing seeks? */
/* TODO why is this inside the action time if ? */
if (GST_CLOCK_TIME_IS_VALID (priv->seeked_position))
GST_QA_REPORT (scenario, GST_QA_ISSUE_ID_EVENT_SEEK_NOT_HANDLED,
GST_VALIDATE_REPORT (scenario,
GST_VALIDATE_ISSUE_ID_EVENT_SEEK_NOT_HANDLED,
"Previous seek to %" GST_TIME_FORMAT " was not handled",
GST_TIME_ARGS (priv->seeked_position));
@ -469,9 +473,10 @@ get_position (GstQaScenario * scenario)
}
static gboolean
async_done_cb (GstBus * bus, GstMessage * message, GstQaScenario * scenario)
async_done_cb (GstBus * bus, GstMessage * message,
GstValidateScenario * scenario)
{
GstQaScenarioPrivate *priv = scenario->priv;
GstValidateScenarioPrivate *priv = scenario->priv;
if (GST_CLOCK_TIME_IS_VALID (priv->seeked_position)) {
gint64 position;
@ -482,10 +487,10 @@ async_done_cb (GstBus * bus, GstMessage * message, GstQaScenario * scenario)
position < (MAX (0,
((gint64) (priv->seeked_position - priv->seek_pos_tol))))) {
GST_QA_REPORT (scenario, GST_QA_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG,
"Seeked position %" GST_TIME_FORMAT
"not in the expected range [%" GST_TIME_FORMAT " -- %"
GST_TIME_FORMAT, GST_TIME_ARGS (position),
GST_VALIDATE_REPORT (scenario,
GST_VALIDATE_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG,
"Seeked position %" GST_TIME_FORMAT "not in the expected range [%"
GST_TIME_FORMAT " -- %" GST_TIME_FORMAT, GST_TIME_ARGS (position),
GST_TIME_ARGS (((MAX (0,
((gint64) (priv->seeked_position -
priv->seek_pos_tol)))))),
@ -498,7 +503,8 @@ async_done_cb (GstBus * bus, GstMessage * message, GstQaScenario * scenario)
}
static gboolean
_load_scenario_file (GstQaScenario * scenario, const gchar * scenario_file)
_load_scenario_file (GstValidateScenario * scenario,
const gchar * scenario_file)
{
gsize xmlsize;
GFile *file = NULL;
@ -506,7 +512,8 @@ _load_scenario_file (GstQaScenario * scenario, const gchar * scenario_file)
gboolean ret = TRUE;
gchar *xmlcontent = NULL;
GMarkupParseContext *parsecontext = NULL;
GstQaScenarioClass *self_class = GST_QA_SCENARIO_GET_CLASS (scenario);
GstValidateScenarioClass *self_class =
GST_VALIDATE_SCENARIO_GET_CLASS (scenario);
gchar *uri = gst_filename_to_uri (scenario_file, &err);
if (uri == NULL)
@ -560,7 +567,8 @@ failed:
}
gboolean
gst_qa_scenario_load (GstQaScenario * scenario, const gchar * scenario_name)
gst_validate_scenario_load (GstValidateScenario * scenario,
const gchar * scenario_name)
{
gboolean ret = TRUE;
gchar *lfilename = NULL, *tldir = NULL;
@ -568,18 +576,19 @@ gst_qa_scenario_load (GstQaScenario * scenario, const gchar * scenario_name)
if (!scenario_name)
goto invalid_name;
lfilename = g_strdup_printf ("%s" GST_QA_SCENARIO_SUFFIX, scenario_name);
lfilename =
g_strdup_printf ("%s" GST_VALIDATE_SCENARIO_SUFFIX, scenario_name);
/* Try from local profiles */
tldir =
g_build_filename (g_get_user_data_dir (), "gstreamer-" GST_API_VERSION,
GST_QA_SCENARIO_DIRECTORY, lfilename, NULL);
GST_VALIDATE_SCENARIO_DIRECTORY, lfilename, NULL);
if (!(ret = _load_scenario_file (scenario, tldir))) {
g_free (tldir);
/* Try from system-wide profiles */
tldir = g_build_filename (GST_DATADIR, "gstreamer-" GST_API_VERSION,
GST_QA_SCENARIO_DIRECTORY, lfilename, NULL);
GST_VALIDATE_SCENARIO_DIRECTORY, lfilename, NULL);
ret = _load_scenario_file (scenario, tldir);
}
@ -609,14 +618,14 @@ invalid_name:
static void
gst_qa_scenario_set_property (GObject * object, guint prop_id,
gst_validate_scenario_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
switch (prop_id) {
case PROP_RUNNER:
/* we assume the runner is valid as long as this scenario is,
* no ref taken */
gst_qa_reporter_set_runner (GST_QA_REPORTER (object),
gst_validate_reporter_set_runner (GST_VALIDATE_REPORTER (object),
g_value_get_object (value));
break;
default:
@ -625,7 +634,7 @@ gst_qa_scenario_set_property (GObject * object, guint prop_id,
}
static void
gst_qa_scenario_get_property (GObject * object, guint prop_id,
gst_validate_scenario_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
switch (prop_id) {
@ -633,7 +642,7 @@ gst_qa_scenario_get_property (GObject * object, guint prop_id,
/* we assume the runner is valid as long as this scenario is,
* no ref taken */
g_value_set_object (value,
gst_qa_reporter_get_runner (GST_QA_REPORTER (object)));
gst_validate_reporter_get_runner (GST_VALIDATE_REPORTER (object)));
break;
default:
break;
@ -641,24 +650,25 @@ gst_qa_scenario_get_property (GObject * object, guint prop_id,
}
static void
gst_qa_scenario_class_init (GstQaScenarioClass * klass)
gst_validate_scenario_class_init (GstValidateScenarioClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GST_DEBUG_CATEGORY_INIT (gst_qa_scenario, "gstqascenario",
GST_DEBUG_CATEGORY_INIT (gst_validate_scenario, "gstvalidatescenario",
GST_DEBUG_FG_MAGENTA, "gst qa scenario");
g_type_class_add_private (klass, sizeof (GstQaScenarioPrivate));
g_type_class_add_private (klass, sizeof (GstValidateScenarioPrivate));
object_class->dispose = gst_qa_scenario_dispose;
object_class->finalize = gst_qa_scenario_finalize;
object_class->dispose = gst_validate_scenario_dispose;
object_class->finalize = gst_validate_scenario_finalize;
object_class->get_property = gst_qa_scenario_get_property;
object_class->set_property = gst_qa_scenario_set_property;
object_class->get_property = gst_validate_scenario_get_property;
object_class->set_property = gst_validate_scenario_set_property;
g_object_class_install_property (object_class, PROP_RUNNER,
g_param_spec_object ("qa-runner", "QA Runner", "The QA runner to "
"report errors to", GST_TYPE_QA_RUNNER,
g_param_spec_object ("qa-runner", "VALIDATE Runner",
"The Validate runner to " "report errors to",
GST_TYPE_VALIDATE_RUNNER,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
klass->content_parser.start_element = _parse_element_start;
@ -666,10 +676,10 @@ gst_qa_scenario_class_init (GstQaScenarioClass * klass)
}
static void
gst_qa_scenario_init (GstQaScenario * scenario)
gst_validate_scenario_init (GstValidateScenario * scenario)
{
GstQaScenarioPrivate *priv = scenario->priv =
GST_QA_SCENARIO_GET_PRIVATE (scenario);
GstValidateScenarioPrivate *priv = scenario->priv =
GST_VALIDATE_SCENARIO_GET_PRIVATE (scenario);
priv->seeked_position = GST_CLOCK_TIME_NONE;
@ -677,40 +687,41 @@ gst_qa_scenario_init (GstQaScenario * scenario)
}
static void
gst_qa_scenario_dispose (GObject * object)
gst_validate_scenario_dispose (GObject * object)
{
GstQaScenarioPrivate *priv = GST_QA_SCENARIO (object)->priv;
GstValidateScenarioPrivate *priv = GST_VALIDATE_SCENARIO (object)->priv;
if (priv->pipeline)
gst_object_unref (priv->pipeline);
g_list_free_full (priv->seeks, (GDestroyNotify) _free_scenario_action);
G_OBJECT_CLASS (gst_qa_scenario_parent_class)->dispose (object);
G_OBJECT_CLASS (gst_validate_scenario_parent_class)->dispose (object);
}
static void
gst_qa_scenario_finalize (GObject * object)
gst_validate_scenario_finalize (GObject * object)
{
G_OBJECT_CLASS (gst_qa_scenario_parent_class)->finalize (object);
G_OBJECT_CLASS (gst_validate_scenario_parent_class)->finalize (object);
}
GstQaScenario *
gst_qa_scenario_factory_create (GstQaRunner * runner, GstElement * pipeline,
const gchar * scenario_name)
GstValidateScenario *
gst_validate_scenario_factory_create (GstValidateRunner * runner,
GstElement * pipeline, const gchar * scenario_name)
{
GstBus *bus;
GstQaScenario *scenario = g_object_new (GST_TYPE_QA_SCENARIO, "qa-runner",
GstValidateScenario *scenario =
g_object_new (GST_TYPE_VALIDATE_SCENARIO, "qa-runner",
runner, NULL);
GST_LOG ("Creating scenario %s", scenario_name);
if (!gst_qa_scenario_load (scenario, scenario_name)) {
if (!gst_validate_scenario_load (scenario, scenario_name)) {
g_object_unref (scenario);
return NULL;
}
scenario->priv->pipeline = gst_object_ref (pipeline);
gst_qa_reporter_set_name (GST_QA_REPORTER (scenario),
gst_validate_reporter_set_name (GST_VALIDATE_REPORTER (scenario),
g_strdup (scenario_name));
bus = gst_element_get_bus (pipeline);

View file

@ -0,0 +1,65 @@
/* GStreamer
* Copyright (C) 2013 Thibault Saunier <thibault.saunier@collabora.com>
*
* gst-validate-runner.c - Validate 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.
*/
#ifndef __GST_VALIDATE_SCENARIO_H__
#define __GST_VALIDATE_SCENARIO_H__
#include <glib.h>
#include <glib-object.h>
#include "gst-validate-runner.h"
G_BEGIN_DECLS
#define GST_TYPE_VALIDATE_SCENARIO (gst_validate_scenario_get_type ())
#define GST_VALIDATE_SCENARIO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenario))
#define GST_VALIDATE_SCENARIO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenarioClass))
#define GST_IS_VALIDATE_SCENARIO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_SCENARIO))
#define GST_IS_VALIDATE_SCENARIO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_SCENARIO))
#define GST_VALIDATE_SCENARIO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenarioClass))
typedef struct _GstValidateScenario GstValidateScenario;
typedef struct _GstValidateScenarioClass GstValidateScenarioClass;
typedef struct _GstValidateScenarioPrivate GstValidateScenarioPrivate;
struct _GstValidateScenarioClass
{
GObjectClass parent_class;
GMarkupParser content_parser;
};
struct _GstValidateScenario
{
GObject parent;
GstValidateScenarioPrivate *priv;
};
GType gst_validate_scenario_get_type (void);
GstValidateScenario * gst_validate_scenario_factory_create (GstValidateRunner *runner,
GstElement *pipeline,
const gchar *scenario_name);
G_END_DECLS
#endif /* __GST_VALIDATE_SCENARIOS__ */

View file

@ -10,10 +10,10 @@
#include <string.h>
#include <gst/gst.h>
#include <gst/qa/qa.h>
#include <gst/validate/validate.h>
#include <gst/pbutils/encoding-profile.h>
#include "gst-qa-file-checker.h"
#include "gst-validate-file-checker.h"
static GMainLoop *mainloop;
@ -34,7 +34,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
if (new == GST_STATE_PLAYING) {
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline),
GST_DEBUG_GRAPH_SHOW_ALL, "gst-qa-transcode.playing");
GST_DEBUG_GRAPH_SHOW_ALL, "gst-validate-transcode.playing");
}
}
@ -243,8 +243,8 @@ int
main (int argc, gchar ** argv)
{
GstBus *bus;
GstQaRunner *runner;
GstQaMonitor *monitor;
GstValidateRunner *runner;
GstValidateMonitor *monitor;
GOptionContext *ctx;
GError *err = NULL;
@ -263,7 +263,7 @@ main (int argc, gchar ** argv)
"video/webm:video/x-vp8|<presence>:audio/x-vorbis\n",
"properties-values"},
{"set-scenario", '\0', 0, G_OPTION_ARG_STRING, &scenario,
"Let you set a scenario, it will override the GST_QA_SCENARIO "
"Let you set a scenario, it will override the GST_VALIDATE_SCENARIO "
"environment variable", NULL},
{"run-file-checks", 'c', 0, G_OPTION_ARG_NONE,
&run_file_checks, "If post file transcoding checks should be run",
@ -271,7 +271,7 @@ main (int argc, gchar ** argv)
{NULL}
};
ctx = g_option_context_new ("- runs QA transcoding test.");
ctx = g_option_context_new ("- runs Validate transcoding test.");
g_option_context_add_main_entries (ctx, options, NULL);
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
@ -283,14 +283,14 @@ main (int argc, gchar ** argv)
g_option_context_free (ctx);
if (scenario)
g_setenv ("GST_QA_SCENARIO", scenario, TRUE);
g_setenv ("GST_VALIDATE_SCENARIO", scenario, TRUE);
gst_init (&argc, &argv);
if (argc != 3) {
g_printerr ("%i arguments recived, 2 expected.\n"
"You should run the test using:\n"
" ./gst-qa-transcoding-0.10 <input-file> <output-file> [options]\n",
" ./gst-validate-transcoding-0.10 <input-file> <output-file> [options]\n",
argc - 1);
return 1;
}
@ -305,13 +305,14 @@ main (int argc, gchar ** argv)
/* Create the pipeline */
create_transcoding_pipeline (argv[1], argv[2]);
runner = gst_qa_runner_new ();
runner = gst_validate_runner_new ();
monitor =
gst_qa_monitor_factory_create (GST_OBJECT_CAST (pipeline), runner, NULL);
gst_validate_monitor_factory_create (GST_OBJECT_CAST (pipeline), runner,
NULL);
mainloop = g_main_loop_new (NULL, FALSE);
if (!runner) {
g_printerr ("Failed to setup QA Runner\n");
g_printerr ("Failed to setup Validate Runner\n");
exit (1);
}
@ -325,7 +326,7 @@ main (int argc, gchar ** argv)
goto exit;
g_main_loop_run (mainloop);
count = gst_qa_runner_get_reports_count (runner);
count = gst_validate_runner_get_reports_count (runner);
g_print ("Pipeline finished, total issues found: %u\n", count);
exit:
@ -336,10 +337,11 @@ exit:
g_object_unref (pipeline);
if (run_file_checks) {
GstQaFileChecker *fc = g_object_new (GST_TYPE_QA_FILE_CHECKER, "uri",
GstValidateFileChecker *fc =
g_object_new (GST_TYPE_VALIDATE_FILE_CHECKER, "uri",
argv[2], "profile", encoding_profile, "test-playback", TRUE, NULL);
if (!gst_qa_file_checker_run (fc)) {
if (!gst_validate_file_checker_run (fc)) {
g_print ("Failed file checking\n");
}

View file

@ -10,7 +10,7 @@
#include <string.h>
#include <gst/gst.h>
#include <gst/qa/qa.h>
#include <gst/validate/validate.h>
static GMainLoop *mainloop;
static GstElement *pipeline;
@ -50,17 +50,17 @@ main (int argc, gchar ** argv)
GOptionEntry options[] = {
{"set-scenario", '\0', 0, G_OPTION_ARG_STRING, &scenario,
"Let you set a scenario, it will override the GST_QA_SCENARIO "
"Let you set a scenario, it will override the GST_VALIDATE_SCENARIO "
"environment variable", NULL},
{NULL}
};
GOptionContext *ctx;
gchar **argvn;
GstQaRunner *runner;
GstQaMonitor *monitor;
GstValidateRunner *runner;
GstValidateMonitor *monitor;
GstBus *bus;
ctx = g_option_context_new ("- runs QA tests for a pipeline.");
ctx = g_option_context_new ("- runs Validate tests for a pipeline.");
g_option_context_add_main_entries (ctx, options, NULL);
if (argc == 1) {
@ -75,7 +75,7 @@ main (int argc, gchar ** argv)
}
if (scenario) {
g_setenv ("GST_QA_SCENARIO", scenario, TRUE);
g_setenv ("GST_VALIDATE_SCENARIO", scenario, TRUE);
}
g_option_context_free (ctx);
@ -88,13 +88,14 @@ main (int argc, gchar ** argv)
pipeline = (GstElement *) gst_parse_launchv ((const gchar **) argvn, &err);
g_free (argvn);
runner = gst_qa_runner_new ();
runner = gst_validate_runner_new ();
monitor =
gst_qa_monitor_factory_create (GST_OBJECT_CAST (pipeline), runner, NULL);
gst_validate_monitor_factory_create (GST_OBJECT_CAST (pipeline), runner,
NULL);
mainloop = g_main_loop_new (NULL, FALSE);
if (!runner) {
g_printerr ("Failed to setup QA Runner\n");
g_printerr ("Failed to setup Validate Runner\n");
exit (1);
}
@ -108,7 +109,7 @@ main (int argc, gchar ** argv)
goto exit;
g_main_loop_run (mainloop);
count = gst_qa_runner_get_reports_count (runner);
count = gst_validate_runner_get_reports_count (runner);
g_print ("Pipeline finished, issues found: %u\n", count);
exit:

View file

@ -0,0 +1,8 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*/
#include <gst/validate/gst-validate-runner.h>
#include <gst/validate/gst-validate-file-checker.h>
#include <gst/validate/gst-validate-monitor-factory.h>