From ee9f1ad9b259bd04b92686221f207eae42e815cb Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 14 Aug 2013 19:14:18 -0300 Subject: [PATCH] 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 --- validate/gst/validate/Makefile.am | 3 +- .../gst/validate/gst-validate-file-check.c | 1 + .../validate/gst-validate-monitor-preload.c | 7 ++-- validate/gst/validate/gst-validate-runner.c | 6 ---- .../gst/validate/gst-validate-transcoding.c | 1 + validate/gst/validate/gst-validate.c | 1 + validate/gst/validate/validate.c | 36 +++++++++++++++++++ validate/gst/validate/validate.h | 2 ++ 8 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 validate/gst/validate/validate.c diff --git a/validate/gst/validate/Makefile.am b/validate/gst/validate/Makefile.am index c9ae2091a2..3b97dc696e 100644 --- a/validate/gst/validate/Makefile.am +++ b/validate/gst/validate/Makefile.am @@ -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 \ diff --git a/validate/gst/validate/gst-validate-file-check.c b/validate/gst/validate/gst-validate-file-check.c index f477ea3c9b..54d05ef71a 100644 --- a/validate/gst/validate/gst-validate-file-check.c +++ b/validate/gst/validate/gst-validate-file-check.c @@ -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" diff --git a/validate/gst/validate/gst-validate-monitor-preload.c b/validate/gst/validate/gst-validate-monitor-preload.c index f27d48368b..0e9e5f78cf 100644 --- a/validate/gst/validate/gst-validate-monitor-preload.c +++ b/validate/gst/validate/gst-validate-monitor-preload.c @@ -21,8 +21,7 @@ #include #include -#include "gst-validate-runner.h" -#include "gst-validate-monitor-factory.h" +#include #define __USE_GNU #include @@ -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); diff --git a/validate/gst/validate/gst-validate-runner.c b/validate/gst/validate/gst-validate-runner.c index 0a24b5a3c6..5a736cabc9 100644 --- a/validate/gst/validate/gst-validate-runner.c +++ b/validate/gst/validate/gst-validate-runner.c @@ -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, diff --git a/validate/gst/validate/gst-validate-transcoding.c b/validate/gst/validate/gst-validate-transcoding.c index 7a0ca5b6c3..ddde179d74 100644 --- a/validate/gst/validate/gst-validate-transcoding.c +++ b/validate/gst/validate/gst-validate-transcoding.c @@ -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" diff --git a/validate/gst/validate/gst-validate.c b/validate/gst/validate/gst-validate.c index b59aeb47da..9981559374 100644 --- a/validate/gst/validate/gst-validate.c +++ b/validate/gst/validate/gst-validate.c @@ -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); diff --git a/validate/gst/validate/validate.c b/validate/gst/validate/validate.c new file mode 100644 index 0000000000..9094016dc0 --- /dev/null +++ b/validate/gst/validate/validate.c @@ -0,0 +1,36 @@ +/* GStreamer + * Copyright (C) 2013 Thiago Santos + * + * 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 (); +} diff --git a/validate/gst/validate/validate.h b/validate/gst/validate/validate.h index 63a5a6b17f..5211ba0473 100644 --- a/validate/gst/validate/validate.h +++ b/validate/gst/validate/validate.h @@ -5,4 +5,6 @@ #include #include #include +#include +void gst_validate_init (void);