validate: add init function

Adds an init() function that should be called before using the lib.
It takes care of calling all internal initializing functions in
gst-validete
This commit is contained in:
Thiago Santos 2013-08-14 19:14:18 -03:00
parent 3dea4388fd
commit ee9f1ad9b2
8 changed files with 47 additions and 10 deletions

View file

@ -10,7 +10,8 @@ libgstvalidate_@GST_API_VERSION@_la_SOURCES = \
gst-validate-scenario.c \
gst-validate-override.c \
gst-validate-override-registry.c \
gst-validate-file-checker.c
gst-validate-file-checker.c \
validate.c
noinst_HEADERS = \
gettext.h \

View file

@ -204,6 +204,7 @@ main (int argc, gchar ** argv)
g_option_context_free (ctx);
gst_init (&argc, &argv);
gst_validate_init ();
if (argc != 2) {
g_printerr ("%i arguments recived, 1 expected.\n"

View file

@ -21,8 +21,7 @@
#include <gst/gst.h>
#include <string.h>
#include "gst-validate-runner.h"
#include "gst-validate-monitor-factory.h"
#include <gst/validate/validate.h>
#define __USE_GNU
#include <dlfcn.h>
@ -37,8 +36,10 @@ static GstValidateRunner *runner = NULL;
static void
gst_validate_preload_wrap (GstElement * element)
{
if (runner == NULL)
if (runner == NULL) {
gst_validate_init ();
runner = gst_validate_runner_new ();
}
/* the reference to the monitor is lost */
gst_validate_monitor_factory_create (GST_OBJECT_CAST (element), runner, NULL);

View file

@ -70,12 +70,6 @@ gst_validate_runner_class_init (GstValidateRunnerClass * klass)
gobject_class->dispose = gst_validate_runner_dispose;
/* init the report system (can be called multiple times) */
gst_validate_report_init ();
/* Ensure we load overrides before any use of a monitor */
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,

View file

@ -292,6 +292,7 @@ main (int argc, gchar ** argv)
g_setenv ("GST_VALIDATE_SCENARIO", scenario, TRUE);
gst_init (&argc, &argv);
gst_validate_init ();
if (argc != 3) {
g_printerr ("%i arguments recived, 2 expected.\n"

View file

@ -84,6 +84,7 @@ main (int argc, gchar ** argv)
g_option_context_free (ctx);
gst_init (&argc, &argv);
gst_validate_init ();
/* Create the pipeline */
argvn = g_new0 (char *, argc);

View file

@ -0,0 +1,36 @@
/* GStreamer
* Copyright (C) 2013 Thiago Santos <thiago.sousa.santos@collabora.com>
*
* validate.c - Validate generic 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 "validate.h"
void
gst_validate_init (void)
{
/* init the report system (can be called multiple times) */
gst_validate_report_init ();
/* Ensure we load overrides before any use of a monitor */
gst_validate_override_registry_preload ();
}

View file

@ -5,4 +5,6 @@
#include <gst/validate/gst-validate-runner.h>
#include <gst/validate/gst-validate-file-checker.h>
#include <gst/validate/gst-validate-monitor-factory.h>
#include <gst/validate/gst-validate-override-registry.h>
void gst_validate_init (void);