diff options
Diffstat (limited to 'tests/old/testsuite')
-rw-r--r-- | tests/old/testsuite/alsa/.gitignore | 3 | ||||
-rw-r--r-- | tests/old/testsuite/alsa/Makefile.am | 13 | ||||
-rw-r--r-- | tests/old/testsuite/alsa/formats.c | 183 | ||||
-rw-r--r-- | tests/old/testsuite/alsa/sinesrc.c | 349 | ||||
-rw-r--r-- | tests/old/testsuite/alsa/sinesrc.h | 89 | ||||
-rw-r--r-- | tests/old/testsuite/alsa/srcstate.c | 95 | ||||
-rw-r--r-- | tests/old/testsuite/alsa/state.c | 108 | ||||
-rw-r--r-- | tests/old/testsuite/embed/Makefile.am | 7 | ||||
-rw-r--r-- | tests/old/testsuite/embed/embed.c | 54 | ||||
-rwxr-xr-x | tests/old/testsuite/gst-lint | 571 |
10 files changed, 0 insertions, 1472 deletions
diff --git a/tests/old/testsuite/alsa/.gitignore b/tests/old/testsuite/alsa/.gitignore deleted file mode 100644 index abf7b414..00000000 --- a/tests/old/testsuite/alsa/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -formats -srcstate -state diff --git a/tests/old/testsuite/alsa/Makefile.am b/tests/old/testsuite/alsa/Makefile.am deleted file mode 100644 index 6557bc58..00000000 --- a/tests/old/testsuite/alsa/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -testprogs = formats state srcstate - -noinst_PROGRAMS = $(testprogs) - -formats_SOURCES = formats.c sinesrc.c sinesrc.h -state_SOURCES = state.c sinesrc.c sinesrc.h -srcstate_SOURCES =srcstate.c - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) - -noinst_HEADERS = sinesrc.h diff --git a/tests/old/testsuite/alsa/formats.c b/tests/old/testsuite/alsa/formats.c deleted file mode 100644 index 0142e9d9..00000000 --- a/tests/old/testsuite/alsa/formats.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * formats.c: Tests the different formats on alsasink - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "sinesrc.h" - -GstElement *pipeline; -gint channels = 1; -gboolean sign = FALSE; -gint endianness = G_LITTLE_ENDIAN; -gint depth = 8; -gint width = 8; - -#define NUMBER_OF_INT_TESTS 28 -#define NUMBER_OF_FLOAT_TESTS 2 -#define NUMBER_OF_LAW_TESTS 2 - -gint last = 0; -gint counter = 0; - -static void create_pipeline (void); - - -static void -pre_get_func (SineSrc * src) -{ - counter++; -}; -static void -create_pipeline (void) -{ - GstElement *src; - SineSrc *sinesrc; - GstElement *alsasink; - - pipeline = gst_pipeline_new ("pipeline"); - src = sinesrc_new (); - alsasink = gst_element_factory_make ("alsasink", "alsasink"); - - gst_bin_add_many (GST_BIN (pipeline), src, alsasink, NULL); - gst_element_link (src, alsasink); - - /* prepare our sinesrc */ - sinesrc = (SineSrc *) src; - sinesrc->pre_get_func = pre_get_func; - sinesrc->newcaps = TRUE; - /* int tests */ - if (last < NUMBER_OF_INT_TESTS) { - sinesrc->type = SINE_SRC_INT; - sinesrc->sign = ((last % 2) == 0) ? TRUE : FALSE; - sinesrc->endianness = - ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; - switch ((last / 4) % 8) { - case 0: - sinesrc->depth = 8; - sinesrc->width = 8; - break; - case 1: - sinesrc->depth = 16; - sinesrc->width = 16; - break; - case 2: - sinesrc->depth = 24; - sinesrc->width = 32; - break; - case 3: - sinesrc->depth = 32; - sinesrc->width = 32; - break; - /* nomore tests below until i know what 24bit width means to alsa wrt endianness */ - case 4: - sinesrc->depth = 24; - sinesrc->width = 24; - break; - case 5: - sinesrc->depth = 20; - sinesrc->width = 24; - break; - case 6: - sinesrc->depth = 18; - sinesrc->width = 24; - break; - case 7: - /* not used yet */ - sinesrc->depth = 8; - sinesrc->width = 8; - break; - default: - g_assert_not_reached (); - } - - g_print ("Setting format to: format: \"int\"\n" - " sign: %s\n" - " endianness: %d\n" - " width: %d\n" - " depth: %d\n", - sinesrc->sign ? "TRUE" : "FALSE", sinesrc->endianness, - sinesrc->width, sinesrc->depth); - } else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS) { - gint temp = last - NUMBER_OF_INT_TESTS; - - sinesrc->type = SINE_SRC_FLOAT; - switch (temp) { - case 0: - sinesrc->width = 32; - break; - case 1: - sinesrc->width = 64; - break; - default: - g_assert_not_reached (); - } - g_print ("Setting format to float width %d\n", sinesrc->width); - } else if (last < - NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS + NUMBER_OF_LAW_TESTS) { - gint temp = last - NUMBER_OF_INT_TESTS - NUMBER_OF_FLOAT_TESTS; - GstElement *law; - - sinesrc->type = SINE_SRC_INT; - sinesrc->sign = TRUE; - sinesrc->endianness = G_BYTE_ORDER; - sinesrc->depth = 16; - sinesrc->width = 16; - - if (temp == 0) { - law = gst_element_factory_make ("mulawenc", "mulaw"); - } else { - law = gst_element_factory_make ("alawenc", "alaw"); - } - g_assert (law); - gst_element_unlink (src, alsasink); - gst_bin_add (GST_BIN (pipeline), law); - gst_element_link_many (src, law, alsasink, NULL); - if (temp == 0) { - g_print ("Setting format to: format: \"MU law\"\n"); - } else { - g_print ("Setting format to: format: \"A law\"\n"); - } - } else { - g_print ("All formats work like a charm.\n"); - exit (0); - } - gst_element_set_state (pipeline, GST_STATE_PLAYING); -} - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - - g_print ("\n" - "This test will test the various formats ALSA and GStreamer support.\n" - "You will hear a short sine tone on your default ALSA soundcard for every\n" - "format tested. They should all sound the same (incl. volume).\n" "\n"); - create_pipeline (); - - while (pipeline) { - gst_bin_iterate (GST_BIN (pipeline)); - if ((counter / 200) > last) { - last = counter / 200; - gst_object_unref (pipeline); - create_pipeline (); - } - } - - return 0; -} diff --git a/tests/old/testsuite/alsa/sinesrc.c b/tests/old/testsuite/alsa/sinesrc.c deleted file mode 100644 index f684aaec..00000000 --- a/tests/old/testsuite/alsa/sinesrc.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * sinesrc.c: An elemnt emitting a sine src in lots of different formats - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "sinesrc.h" -#include <math.h> -#include <string.h> /* memcpy */ - -#define SAMPLES_PER_WAVE 200 - -static GstStaticPadTemplate sinesrc_src_factory = - GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " - "signed = (boolean) { FALSE, TRUE }, " - "width = (int) [8, 32], " - "depth = (int) [8, 32], " - "rate = (int) [8000, 192000], " - "channels = (int) [1, 16];" - "audio/x-raw-float, " - "endianness = (int) BYTE_ORDER, " - "width = (int) {32, 64}, " - "rate = (int) [8000, 192000], " "channels = (int) [1, 16]") - ); - -static GstElementClass *parent_class = NULL; - -static void sinesrc_init (SineSrc * src); -static void sinesrc_class_init (SineSrcClass * klass); - -static GstData *sinesrc_get (GstPad * pad); -static GstStateChangeReturn sinesrc_change_state (GstElement * element, - GstStateChange transition); - - -GType -sinesrc_get_type (void) -{ - static GType sinesrc_type = 0; - - if (!sinesrc_type) { - static const GTypeInfo sinesrc_info = { - sizeof (SineSrcClass), NULL, NULL, - (GClassInitFunc) sinesrc_class_init, NULL, NULL, - sizeof (SineSrc), 0, - (GInstanceInitFunc) sinesrc_init, - }; - - sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "SineSrc", - &sinesrc_info, 0); - } - return sinesrc_type; -} -static void -sinesrc_class_init (SineSrcClass * klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - element_class->change_state = sinesrc_change_state; - - parent_class = g_type_class_peek_parent (klass); -} - -static void -sinesrc_init (SineSrc * src) -{ - src->src = - gst_pad_new_from_template (gst_static_pad_template_get - (&sinesrc_src_factory), "src"); - gst_element_add_pad (GST_ELEMENT (src), src->src); - gst_pad_set_get_function (src->src, sinesrc_get); - - src->width = 16; - src->depth = 16; - src->sign = TRUE; - src->endianness = G_BYTE_ORDER; - src->rate = 44100; - src->channels = 1; - src->type = SINE_SRC_INT; - src->newcaps = TRUE; - - src->pre_get_func = NULL; - - GST_OBJECT (src)->name = "sinesrc"; -} - -static void -sinesrc_force_caps (SineSrc * src) -{ - GstCaps *caps; - - if (!src->newcaps) - return; - - src->newcaps = FALSE; - - switch (src->type) { - case SINE_SRC_INT: - caps = gst_caps_new_simple ("audio/x-raw-int", - "signed", G_TYPE_BOOLEAN, src->sign, - "depth", G_TYPE_INT, src->depth, NULL); - if (src->width > 8) - gst_caps_set_simple (caps, - "endianness", G_TYPE_INT, src->endianness, NULL); - break; - case SINE_SRC_FLOAT: - g_assert (src->width == 32 || src->width == 64); - caps = gst_caps_new_simple ("audio/x-raw-float", - "endianness", G_TYPE_INT, src->endianness, NULL); - break; - default: - caps = NULL; - g_assert_not_reached (); - } - gst_caps_set_simple (caps, - "width", G_TYPE_INT, src->width, - "rate", G_TYPE_INT, src->rate, - "channels", G_TYPE_INT, src->channels, NULL); - - if (gst_pad_try_set_caps (src->src, caps) != GST_PAD_LINK_OK) - g_assert_not_reached (); -} - -/* always return 1 wave - * there are 200 waves in 1 second, so the frequency is samplerate/200 - */ -static guint8 -UIDENTITY (guint8 x) -{ - return x; -}; -static gint8 -IDENTITY (gint8 x) -{ - return x; -}; - -#define POPULATE(format, be_func, le_func) G_STMT_START {\ - format val = (format) int_value;\ - format *p = data;\ - switch (src->endianness) {\ - case G_LITTLE_ENDIAN:\ - val = le_func (val);\ - break;\ - case G_BIG_ENDIAN:\ - val = be_func (val);\ - break;\ - default: \ - g_assert_not_reached ();\ - };\ - for (j = 0; j < src->channels; j++) {\ - *p = val;\ - p ++;\ - }\ - data = p;\ -} G_STMT_END - -static GstData * -sinesrc_get (GstPad * pad) -{ - GstBuffer *buf; - SineSrc *src; - - void *data; - gint i, j; - gdouble value; - - g_return_val_if_fail (pad != NULL, NULL); - src = SINESRC (gst_pad_get_parent (pad)); - - if (src->pre_get_func) - src->pre_get_func (src); - - buf = gst_buffer_new_and_alloc ((src->width / 8) * src->channels * - SAMPLES_PER_WAVE); - g_assert (buf); - data = GST_BUFFER_DATA (buf); - g_assert (data); - - for (i = 0; i < SAMPLES_PER_WAVE; i++) { - value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE); - switch (src->type) { - case SINE_SRC_INT:{ - gint64 int_value = - (value + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1)); - if (int_value == - (1 + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1))) - int_value--; - switch (src->width) { - case 8: - if (src->sign) - POPULATE (gint8, IDENTITY, IDENTITY); - else - POPULATE (guint8, UIDENTITY, UIDENTITY); - break; - case 16: - if (src->sign) - POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE); - else - POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE); - break; - case 24: - if (src->sign) { - gpointer p; - gint32 val = (gint32) int_value; - - switch (src->endianness) { - case G_LITTLE_ENDIAN: - val = GINT32_TO_LE (val); - break; - case G_BIG_ENDIAN: - val = GINT32_TO_BE (val); - break; - default: - g_assert_not_reached (); - }; - p = &val; - if (src->endianness == G_BIG_ENDIAN) - p++; - for (j = 0; j < src->channels; j++) { - memcpy (data, p, 3); - data += 3; - } - } else { - gpointer p; - guint32 val = (guint32) int_value; - - switch (src->endianness) { - case G_LITTLE_ENDIAN: - val = GUINT32_TO_LE (val); - break; - case G_BIG_ENDIAN: - val = GUINT32_TO_BE (val); - break; - default: - g_assert_not_reached (); - }; - p = &val; - if (src->endianness == G_BIG_ENDIAN) - p++; - for (j = 0; j < src->channels; j++) { - memcpy (data, p, 3); - data += 3; - } - } - break; - case 32: - if (src->sign) - POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE); - else - POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE); - break; - default: - g_assert_not_reached (); - } - break; - } - case SINE_SRC_FLOAT: - if (src->width == 32) { - gfloat *p = (gfloat *) data; - gfloat fval = (gfloat) value; - - for (j = 0; j < src->channels; j++) { - *p = fval; - p++; - } - data = p; - break; - } - if (src->width == 64) { - gdouble *p = (gdouble *) data; - - for (j = 0; j < src->channels; j++) { - *p = value; - p++; - } - data = p; - break; - } - g_assert_not_reached (); - default: - g_assert_not_reached (); - } - } - - if (src->newcaps) { - sinesrc_force_caps (src); - } - return GST_DATA (buf); -} - -GstElement * -sinesrc_new (void) -{ - return GST_ELEMENT (g_object_new (TYPE_SINESRC, NULL)); -} - -void -sinesrc_set_pre_get_func (SineSrc * src, PreGetFunc func) -{ - src->pre_get_func = func; -} - -static GstStateChangeReturn -sinesrc_change_state (GstElement * element, GstStateChange transition) -{ - SineSrc *sinesrc; - - g_return_val_if_fail (element != NULL, FALSE); - sinesrc = SINESRC (element); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - case GST_STATE_CHANGE_READY_TO_PAUSED: - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - sinesrc->newcaps = TRUE; - break; - case GST_STATE_CHANGE_READY_TO_NULL: - break; - default: - g_assert_not_reached (); - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - return GST_STATE_CHANGE_SUCCESS; -} diff --git a/tests/old/testsuite/alsa/sinesrc.h b/tests/old/testsuite/alsa/sinesrc.h deleted file mode 100644 index 057428d3..00000000 --- a/tests/old/testsuite/alsa/sinesrc.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * sinesrc.h: Header file for sinesrc.c - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __SINESRC_H__ -#define __SINESRC_H__ - - -#include <gst/gst.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define TYPE_SINESRC \ - (sinesrc_get_type()) -#define SINESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),TYPE_SINESRC,SineSrc)) -#define SINESRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),TYPE_SINESRC,SineSrcClass)) -#define IS_SINESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),TYPE_SINESRC)) -#define IS_SINESRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),TYPE_SINESRC)) - -typedef struct _SineSrc SineSrc; -typedef struct _SineSrcClass SineSrcClass; - -typedef void (*PreGetFunc) (SineSrc *src); - -typedef enum { - SINE_SRC_INT, - SINE_SRC_FLOAT -} SineSrcAudio; - -struct _SineSrc { - GstElement element; - - /* pads */ - GstPad *src; - - /* audio parameters */ - SineSrcAudio type; - gint width; /* int + float */ - gint depth; /* int */ - gboolean sign; /* int */ - gint endianness; /* int */ - - gint rate; - gint channels; /* interleaved */ - - gboolean newcaps; - - /* freaky stuff for testing */ - PreGetFunc pre_get_func; -}; - -struct _SineSrcClass { - GstElementClass parent_class; -}; - -GType sinesrc_get_type (void); -GstElement * sinesrc_new (void); - -void sinesrc_set_pre_get_func (SineSrc *src, PreGetFunc func); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GST_SINESRC_H__ */ diff --git a/tests/old/testsuite/alsa/srcstate.c b/tests/old/testsuite/alsa/srcstate.c deleted file mode 100644 index 4ae536da..00000000 --- a/tests/old/testsuite/alsa/srcstate.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * srcstate.c: Tests alsasrc for state changes - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#include <gst/gst.h> - -GstElement *pipeline; - -static void -set_state (GstState state) -{ - GstState old_state = gst_element_get_state (pipeline); - - g_print ("Setting state from %s to %s...", - gst_element_state_get_name (old_state), - gst_element_state_get_name (state)); - - if (!gst_element_set_state (pipeline, state)) { - g_print (" ERROR\n"); - exit (-1); - } - - if (state == GST_STATE_PLAYING) { - gint i; - - g_print (" DONE - iterating a bit..."); - for (i = 0; i < 5; i++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) { - g_print (" ERROR in iteration %d\n", i); - exit (-2); - } - } - } - g_print (" DONE\n"); -} - -static void -create_pipeline (void) -{ - GstElement *alsasrc; - GstElement *fakesink; - - pipeline = gst_pipeline_new ("pipeline"); - alsasrc = gst_element_factory_make ("alsasrc", "alsasrc"); - fakesink = gst_element_factory_make ("fakesink", "fakesink"); - - gst_bin_add_many (GST_BIN (pipeline), alsasrc, fakesink, NULL); - gst_element_link (alsasrc, fakesink); - -} - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - - g_print ("\n" "This test will check if state changes work on the alsasrc.\n"); - create_pipeline (); - - /* simulate some state changes here */ - set_state (GST_STATE_READY); - set_state (GST_STATE_NULL); - set_state (GST_STATE_READY); - set_state (GST_STATE_NULL); - set_state (GST_STATE_PAUSED); - set_state (GST_STATE_NULL); - set_state (GST_STATE_PLAYING); - set_state (GST_STATE_PAUSED); - set_state (GST_STATE_PLAYING); - set_state (GST_STATE_READY); - set_state (GST_STATE_PLAYING); - set_state (GST_STATE_NULL); - set_state (GST_STATE_PLAYING); - - g_print ("The alsa plugin mastered another test.\n"); - - gst_object_unref (pipeline); - - return 0; -} diff --git a/tests/old/testsuite/alsa/state.c b/tests/old/testsuite/alsa/state.c deleted file mode 100644 index 9cbd8acf..00000000 --- a/tests/old/testsuite/alsa/state.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * state.c: Tests alsasink for state changes - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "sinesrc.h" - -GstElement *pipeline; - -static void -set_state (GstState state) -{ - GstState old_state = gst_element_get_state (pipeline); - - g_print ("Setting state from %s to %s...", - gst_element_state_get_name (old_state), - gst_element_state_get_name (state)); - - if (!gst_element_set_state (pipeline, state)) { - g_print (" ERROR\n"); - exit (-1); - } - - if (state == GST_STATE_PLAYING) { - gint i; - - g_print (" DONE - iterating a bit..."); - for (i = 0; i < 400; i++) { - if (!gst_bin_iterate (GST_BIN (pipeline))) { - g_print (" ERROR in iteration %d\n", i); - exit (-2); - } - } - } - g_print (" DONE\n"); -} - -static void -create_pipeline (void) -{ - GstElement *src; - SineSrc *sinesrc; - GstElement *alsasink; - - pipeline = gst_pipeline_new ("pipeline"); - src = sinesrc_new (); - alsasink = gst_element_factory_make ("alsasink", "alsasink"); - - gst_bin_add_many (GST_BIN (pipeline), src, alsasink, NULL); - gst_element_link (src, alsasink); - - /* prepare our sinesrc */ - sinesrc = (SineSrc *) src; - sinesrc->newcaps = TRUE; - sinesrc->type = SINE_SRC_INT; - sinesrc->sign = TRUE; - sinesrc->endianness = G_BYTE_ORDER; - sinesrc->depth = 16; - sinesrc->width = 16; -} - -gint -main (gint argc, gchar * argv[]) -{ - gst_init (&argc, &argv); - - g_print ("\n" - "This test will check if state changes work on the alsasink.\n" - "You will hear some short sine tones on your default ALSA soundcard,\n" - "but they are not important in this test.\n" "\n"); - create_pipeline (); - - /* simulate some state changes here */ - set_state (GST_STATE_READY); - set_state (GST_STATE_NULL); - set_state (GST_STATE_READY); - set_state (GST_STATE_NULL); - set_state (GST_STATE_PAUSED); - set_state (GST_STATE_NULL); - set_state (GST_STATE_PLAYING); - set_state (GST_STATE_PAUSED); - set_state (GST_STATE_PLAYING); - set_state (GST_STATE_READY); - set_state (GST_STATE_PLAYING); - set_state (GST_STATE_NULL); - set_state (GST_STATE_PLAYING); - - g_print ("The alsa plugin mastered another test.\n"); - - gst_object_unref (pipeline); - - return 0; -} diff --git a/tests/old/testsuite/embed/Makefile.am b/tests/old/testsuite/embed/Makefile.am deleted file mode 100644 index 2ffdc768..00000000 --- a/tests/old/testsuite/embed/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ - -noinst_PROGRAMS = embed - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) $(GTK_LIBS) \ - $(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la -AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS) diff --git a/tests/old/testsuite/embed/embed.c b/tests/old/testsuite/embed/embed.c deleted file mode 100644 index ed4a93cc..00000000 --- a/tests/old/testsuite/embed/embed.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Sample app for element embedding. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <gst/gst.h> -#include <gst/xoverlay/xoverlay.h> -#include <gtk/gtk.h> -#include <gdk/gdkx.h> - -static void -cb_expose (GtkWidget * w, GdkEventExpose * ev, GstElement * e) -{ - if (GST_IS_X_OVERLAY (e) && - !GTK_WIDGET_NO_WINDOW (w) && GTK_WIDGET_REALIZED (w)) { - gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (e), - GDK_WINDOW_XWINDOW (w->window)); - } -} - -int -main (int argc, char *argv[]) -{ - GtkWidget *window, *content; - GstElement *testsrc, *csp, *videosink, *pipeline; - - gtk_init (&argc, &argv); - gst_init (&argc, &argv); - - pipeline = gst_element_factory_make ("pipeline", NULL); - testsrc = gst_element_factory_make ("videotestsrc", NULL); - csp = gst_element_factory_make ("ffmpegcolorspace", NULL); - videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size (GTK_WINDOW (window), 640, 480); - gtk_window_set_title (GTK_WINDOW (window), "My application"); - content = gtk_event_box_new (); - gtk_container_add (GTK_CONTAINER (window), content); - g_signal_connect (content, "expose-event", G_CALLBACK (cb_expose), videosink); - gtk_widget_show_all (window); - - gst_bin_add_many (GST_BIN (pipeline), testsrc, csp, videosink, NULL); - gst_element_link_many (testsrc, csp, videosink, NULL); - - g_idle_add ((GSourceFunc) gst_bin_iterate, pipeline); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - gtk_main (); - - return 0; -} diff --git a/tests/old/testsuite/gst-lint b/tests/old/testsuite/gst-lint deleted file mode 100755 index a924f052..00000000 --- a/tests/old/testsuite/gst-lint +++ /dev/null @@ -1,571 +0,0 @@ -#!/usr/bin/perl -w -# vi: set ts=4: -# - -# -# GStreamer developers: please add comments on any tests you think -# are dumb or have too many false positives. -# - -# -# Future ideas: -# - spell check comments -# - check each function for at least one assertion (?) -# - check parameters that init/set/get have consistent types -# - check for gst_caps_set() without check for writeability -# - check .so files for stray symbols -# - -# -# Random "other" testing ideas -# - load each plugin individually -# - -sub check_copyright(); -sub check_license(); -sub check_buffer_alloc(); -sub check_bad_includes(); -sub check_begin_decls(); -sub check_c99_comments(); -sub check_carriage_returns(); -sub check_printf_lld(); -sub check_glibisms(); -sub check_indentation(); -sub check_no_ignore(); -sub check_deprecated(); -sub check_config_h(); -sub check_varargs_functions(); -sub check_debugging(); -sub check_old_typefind(); -sub check_bad_casts(); -sub check_old_plugin(); -sub check_signal_new(); -sub check_gnuc_const(); -sub check_caps(); -sub check_lib_deprecated(); -sub check_typo(); -sub check_explicit_caps(); -sub check_signals(); -sub check_gettext(); -sub check_padtemplate(); -sub check_parent_class(); - -sub m_check_plugindir(); -sub m_check_interfaces(); - -open FIND, "find . -name \"*.[ch]\" -print|"; - -foreach $filename (<FIND>) { - chomp $filename; - open FILE, "$filename"; - @lines = <FILE>; - close FILE; - - print "I: $filename\n"; - - # important stuff - check_bad_includes(); - check_printf_lld(); - check_no_ignore(); - check_deprecated(); - check_config_h(); - check_old_typefind(); - check_old_plugin(); - check_caps(); - check_lib_deprecated(); - check_typo(); - check_glibisms(); - check_explicit_caps(); - check_signals(); - check_gettext(); - check_padtemplate(); - check_parent_class(); - - # less important stuff - check_license(); - -if (0) { - check_copyright(); - - check_gnuc_const(); - check_begin_decls(); - check_buffer_alloc(); - check_c99_comments(); - check_carriage_returns(); - #check_indentation(); - check_varargs_functions(); - check_debugging(); - check_bad_casts(); - check_signal_new(); -} -} - -open FIND, "find . -name \"Makefile.am\" -print|"; - -foreach $filename (<FIND>) { - chomp $filename; - open FILE, "$filename"; - @lines = <FILE>; - close FILE; - - print "I: $filename\n"; - - m_check_plugindir(); - m_check_interfaces(); -} - -# -# Every source file must have a copyright block -# -sub check_copyright() -{ - if (! grep { /copyright/i; } @lines) { - print "E: no copyright block\n"; - } -} - -# -# Every source file should have a license statement -# -sub check_license() -{ - if (grep { /Lesser General Public License/; } @lines) { - print "I: license is LGPL\n"; - } elsif (grep { /Library General Public License/; } @lines) { - print "I: license is LGPL\n"; - print "W: copyright header uses \"Library\" LGPL\n"; - } elsif (grep { /General Public License/; } @lines) { - print "I: license is GPL\n"; - } else { - print "E: unknown license or no copyright block\n"; - } -} - -# -# Suggest usage of gst_buffer_new_and_alloc() -# -sub check_buffer_alloc() -{ - my $n = 0; - my $lineno = 1; - - foreach $line (@lines){ - if($line =~ /gst_buffer_new/){ - $n=5; - } - if($n>0 && $line =~ /malloc/){ - print "W: ($lineno) gst_buffer_new() followed by malloc(), suggest gst_buffer_new_and_alloc()\n"; - return; - } - $n--; - $lineno++; - } -} - -sub check_bad_includes() -{ - # - # malloc.h is non-standard (and probably not what is indended) - # - if (grep { /^#include\s+<malloc.h>/; } @lines) { - print "E: bad header: malloc.h\n" - } -} - -sub check_begin_decls() -{ - # - # Prefer "G_BEGIN_DECLS" to 'extern "C" {' - # - if($filename =~ /\.h$/){ - if (grep { /extern\s*\"C\"\s*/; } @lines) { - print "W: extern \"C\" { should be changed to G_BEGIN_DECLS,G_END_DECLS\n"; - }elsif (!grep { /G_BEGIN_DECLS/; } @lines) { - print "E: header doesn't use G_BEGIN_DECLS\n"; - } - } -} - -# -# Prefer c89-style comments -# -sub check_c99_comments() -{ - if (grep { /\/\//; } @lines) { - print "W: //-style comments should be converted to /* */\n" - } -} - -# -# DOS end-of-line characters are just wrong -# -sub check_carriage_returns() -{ - if (grep { /\r/; } @lines) { - print "E: source has carriage returns (DOS-style files)\n" - } -} - -# -# Many uses of %lld are wrong. This could have a lot of false-positives -# -sub check_printf_lld() -{ - if (grep { /\".*\%\d*ll[du].*\"/; } @lines) { - print "W: Possible \%lld or \%llu in printf format\n" - } -} - -# -# Glib functions are preferred -# -sub check_glibisms() -{ - if (grep { /\bcalloc\s*\(/; } @lines) { - print "E: use g_malloc0() instead of calloc()\n" - } - if (grep { /\bfree\s*\(/; } @lines) { - print "E: use g_free() instead of free()\n" - } - if (grep { /\bmalloc\s*\(/; } @lines) { - print "E: use g_malloc() instead of malloc()\n" - } - if (grep { /\bprintf\s*\(/; } @lines) { - print "E: use g_print() instead of printf()\n" - } - if (grep { /\brealloc\s*\(/; } @lines) { - print "E: use g_realloc() instead of realloc()\n" - } - if (grep { /^#include\s+<ctype.h>/; } @lines) { - print "E: ctype.h functions are not locale-independent and don't work in UTF-8 locales. Use g_ascii_is*()\n" - } -} - -# -# I don't think that indentation necessarily needs to be fixed, since -# it causes problems with patching and cvs annotate. -# -# This takes forever and isn't very useful -# -sub check_indentation() -{ - my $changed_lines; - my $percent; - - `indent -br -bad -cbi0 -cli2 -bls -l80 -ut -ce $filename -o .check_plugin.tmp`; - $changed_lines = `diff $filename .check_plugin.tmp | grep '^>' | wc -l`; - `rm -f .check_plugin.tmp`; - - $percent = int(100 * $changed_lines / $#lines); - - if($percent < 10){ - print "I: indent changed $percent % of the lines\n"; - }elsif($percent <20){ - print "W: indent changed $percent % of the lines\n"; - }else{ - print "E: indent changed $percent % of the lines\n"; - } -} - - -# -# Check (roughly) for functions whose value should not be ignored -# -sub check_no_ignore() -{ - if (grep { /^\s+gst_buffer_merge\s*\(/; } @lines) { - print "E: return value of gst_buffer_merge () possibly ignored\n"; - } - if (grep { /^\s+malloc\s*\(/; } @lines) { - print "E: return value of malloc() possibly ignored\n"; - } - if (grep { /^\s+gst_buffer_new\s*\(/; } @lines) { - print "E: return value of gst_buffer_new() possibly ignored\n"; - } -} - -# -# Check for some deprecated stuff (that _shouldn't_ be around anymore) -# -sub check_deprecated() -{ - # - # Check for old GST_DEBUG() usage - # (none found) - # - if (grep { /GST_DEBUG\s*\(\s+\d/; } @lines) { - print "E: old-style GST_DEBUG()\n"; - } - if (grep { /GST_INFO\s*\(\s+\d/; } @lines) { - print "E: old-style GST_DEBUG()\n"; - } - if (grep { /GstEventFlags/; } @lines) { - print "W: who uses GstEventFlags\n"; - } - if (grep { /g_type_class_ref/ } @lines) { - print "W: g_type_class_ref should be changed to g_type_class_peek_parent\n"; - } - -} - -# -# Every .c file should include config.h before any other headers -# No .h file should include config.h -# -sub check_config_h() -{ - if($filename =~ /\.c$/){ - # - # config.h should be wrapped - # - my @includes = grep { /^#include/; } @lines; - - if (!grep { /^#include\s+["<]config.h[">]/; } @includes) { - print "E: #include <config.h> missing\n"; - }else{ - if (!($includes[0] =~ /^#include\s+["<]config.h[">]/)){ - print "E: #include <config.h> is not first include\n"; - } - if(!grep { /^#ifdef HAVE_CONFIG_H/; } @lines) { - print "E: #include <config.h> not surrounded by #ifdef HAVE_CONFIG_H\n"; - } - } - } - - if($filename =~ /\.h$/){ - if (grep { /^#include\s+["<]config.h[">]/; } @lines) { - print "E: headers should not #include <config.h>\n"; - } - } - -} - -# -# Check for functions that take varargs to make sure they are -# named correctly -# -sub check_varargs_functions() -{ - if($filename =~ /\.h$/){ - if (grep { /varargs/; } @lines) { - print "I: has varargs\n"; - } - } -} - -# -# Debugging checks -# -sub check_debugging() -{ - if (grep { /\Wg_print\W/ || /\Wprintf\W/ && /\Wfprintf\W/; } @lines) { - print "W: friendly libraries don't print to stdio or stderr\n"; - } - - if (grep { /GST_DEBUG.*\\n"/; } @lines) { - print "W: possible newline in GST_DEBUG()\n"; - } - -} - -# -# check for plugindir= -# -sub m_check_plugindir() -{ - if (grep { /plugindir\s*=/; } @lines) { - print "E: plugindir= is no longer necessary\n"; - } -} - -# -# check for old typefinding code -# -sub check_old_typefind() -{ - if (grep { /GstTypeDefinition/ || /GstTypeFactory/ } @lines) { - print "E: old typefind interface has been removed\n"; - } -} - -# -# check for casts that we've deemed incorrect (fix the prototype) -# -sub check_bad_casts() -{ - if (grep { /GBaseInitFunc/ || /GBaseFinalizeFunc/ || - /GClassInitFunc/ || /GClassFinalizeFunc/ || - /GInstanceInitFunc/ || /GInterfaceInitFunc/ || - /GInterfaceFinalizeFunc/ } @lines) { - print "W: bad casts (fix prototype)\n"; - } - if (grep { /\(\s*Gst[A-Z][A-Za-z]*\s*\*\s*\)/ } @lines ) { - print "W: use GST_XXX() instead of (GstXxx *)\n"; - } - -} - -# -# check for old plugin code -# -sub check_old_plugin() -{ - if (grep { /plugin_init.*GModule.*GstPlugin/ } @lines) { - print "E: old plugin interface detected\n"; - } - if (grep { /GstPluginDesc.*plugin_desc/ } @lines) { - print "W: should use GST_PLUGIN_DEFINE() instead of GstPluginDesc\n"; - } -} - -# -# Check for calls to g_signal_new() with a callback type of G_TYPE_POINTER -# -sub check_signal_new() -{ - my $n = 0; - my $lineno = 1; - - foreach $line (@lines){ - if($line =~ /g_signal_new/){ - $n=5; - } - if($n>0 && $line =~ /G_TYPE_POINTER/){ - print "W: ($lineno) g_signal_new() with callback type of G_TYPE_POINTER. Register and use a boxed type instead.\n"; - return; - } - $n--; - $lineno++; - } -} - -# -# Check that libgstinterfaces is in LDADD -# -sub m_check_interfaces() -{ - if (grep { /libgstinterfaces.la/ } @lines) { - if (! grep { /libgstinterfaces_la/ } @lines) { - if (! grep { /_LDADD.*libgstinterfaces.la/ } @lines) { - print "E: libgstinterfaces.la not in LDADD\n"; - } - } - } -} - -# -# Check that get_type() functions return G_CONST_RETURN GType -# -sub check_gnuc_const() -{ - my $n = 0; - my $lineno = 1; - - foreach $line (@lines){ - if($line =~ /GType.*get_type.*/ && - !($line =~ /GType.*get_type.*G_GNUC_CONST/)) { - - print "E: get_type function does not have G_GNUC_CONST attribute\n"; - } - } -} - -# -# Check caps usage -# -sub check_caps() -{ - if (grep { /gst_pad_get_caps/ } @lines) { - print "E: elements should not call gst_pad_get_caps(), use gst_pad_get_allowed_caps()\n"; - } -} - -# -# Check for use of deprecated functions -# -sub check_lib_deprecated() -{ - if (grep { /bzero/ } @lines) { - print "E: change bzero() to memset()\n"; - } -} - -# -# Check for typos -# -sub check_typo() -{ - if (grep { /;\s*;\s*$/ } @lines) { - print "W: typo? \";;\"\n"; - } -} - -# -# set_explicit_caps() should preceed pad_add() -# -sub check_explicit_caps() -{ - my $n = 0; - my $lineno = 1; - - foreach $line (@lines){ - if($line =~ /gst_element_add_pad/){ - $n=10; - } - if($n>0 && $line =~ /gst_pad_set_explicit_caps/){ - print "W: ($lineno) explicit caps should be set before adding pad\n"; - return; - } - $n--; - $lineno++; - } -} - -# -# Check for - in signal names -# -sub check_signals() -{ - if (grep { /g_signal_new.*\".*-.*\"/; } @lines) { - print "E: g_signal_new() with a signal name with a - in it (we prefer _)\n" - } -} - -# -# Check for things that gettext gets wrong -# -sub check_gettext() -{ - if (grep { /\b_\(.*G_GU?INT64_FORMAT/ || - /\b_\(.*GST_TIME_FORMAT/ || - /\b_\(.*GST_FOURCC_FORMAT/ } @lines) { - print "E: gettext doesn't handle format strings that are defines\n" - } -} - -# -# Check that pad templates are statically scoped -# -sub check_padtemplate() -{ - foreach $line (@lines){ - if ($line =~ /GstStaticPadTemplate/ && !($line =~ /static/)) { - print "W: pad template definitions should be static\n"; - return; - } - } -} - -# -# Check that parent_class is statically scoped -# -sub check_parent_class() -{ - foreach $line (@lines){ - if ($line =~ /Gst.*\*\s*parent_class/ && !($line =~ /static/)) { - print "E: parent_class definitions should be static\n"; - return; - } - } -} - |