From a409d04d211f4ee5be3e916d5cdc8e013472f8f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 7 Jul 2011 21:04:47 +0100 Subject: [PATCH] tests: remove tests from ancient times They're just noise. --- tests/old/Makefile.am | 26 -- tests/old/examples/Makefile.am | 15 - tests/old/examples/capsfilter/Makefile.am | 6 - tests/old/examples/capsfilter/capsfilter1.c | 87 ----- tests/old/examples/gob/Makefile.am | 19 - tests/old/examples/gob/gst-identity2.gob | 139 ------- tests/old/examples/indexing/.gitignore | 1 - tests/old/examples/indexing/Makefile.am | 7 - tests/old/examples/indexing/indexmpeg.c | 321 ---------------- tests/old/examples/seek/.gitignore | 6 - tests/old/examples/seek/Makefile.am | 7 - tests/old/examples/seek/cdparanoia.c | 215 ----------- tests/old/examples/seek/cdplayer.c | 292 -------------- tests/old/examples/seek/chained.c | 107 ------ tests/old/examples/stats/Makefile.am | 6 - tests/old/examples/stats/mp2ogg.c | 102 ----- tests/old/examples/switch/.gitignore | 1 - tests/old/examples/switch/Makefile.am | 7 - tests/old/examples/switch/switcher.c | 104 ----- tests/old/testsuite/alsa/.gitignore | 3 - tests/old/testsuite/alsa/Makefile.am | 13 - tests/old/testsuite/alsa/formats.c | 184 --------- tests/old/testsuite/alsa/sinesrc.c | 351 ----------------- tests/old/testsuite/alsa/sinesrc.h | 89 ----- tests/old/testsuite/alsa/srcstate.c | 95 ----- tests/old/testsuite/alsa/state.c | 108 ------ tests/old/testsuite/embed/Makefile.am | 7 - tests/old/testsuite/embed/embed.c | 54 --- tests/old/testsuite/gst-lint | 571 ---------------------------- 29 files changed, 2943 deletions(-) delete mode 100644 tests/old/Makefile.am delete mode 100644 tests/old/examples/Makefile.am delete mode 100644 tests/old/examples/capsfilter/Makefile.am delete mode 100644 tests/old/examples/capsfilter/capsfilter1.c delete mode 100644 tests/old/examples/gob/Makefile.am delete mode 100644 tests/old/examples/gob/gst-identity2.gob delete mode 100644 tests/old/examples/indexing/.gitignore delete mode 100644 tests/old/examples/indexing/Makefile.am delete mode 100644 tests/old/examples/indexing/indexmpeg.c delete mode 100644 tests/old/examples/seek/.gitignore delete mode 100644 tests/old/examples/seek/Makefile.am delete mode 100644 tests/old/examples/seek/cdparanoia.c delete mode 100644 tests/old/examples/seek/cdplayer.c delete mode 100644 tests/old/examples/seek/chained.c delete mode 100644 tests/old/examples/stats/Makefile.am delete mode 100644 tests/old/examples/stats/mp2ogg.c delete mode 100644 tests/old/examples/switch/.gitignore delete mode 100644 tests/old/examples/switch/Makefile.am delete mode 100644 tests/old/examples/switch/switcher.c delete mode 100644 tests/old/testsuite/alsa/.gitignore delete mode 100644 tests/old/testsuite/alsa/Makefile.am delete mode 100644 tests/old/testsuite/alsa/formats.c delete mode 100644 tests/old/testsuite/alsa/sinesrc.c delete mode 100644 tests/old/testsuite/alsa/sinesrc.h delete mode 100644 tests/old/testsuite/alsa/srcstate.c delete mode 100644 tests/old/testsuite/alsa/state.c delete mode 100644 tests/old/testsuite/embed/Makefile.am delete mode 100644 tests/old/testsuite/embed/embed.c delete mode 100755 tests/old/testsuite/gst-lint diff --git a/tests/old/Makefile.am b/tests/old/Makefile.am deleted file mode 100644 index c376eaa..0000000 --- a/tests/old/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -if USE_ALSA -ALSA_DIR=alsa -else -ALSA_DIR= -endif - -# if HAVE_GTK -# EMBED_DIR=embed -# else -# EMBED_DIR= -# endif - -SUBDIRS = \ - $(ALSA_DIR) #seeking -DIST_SUBDIRS = \ - alsa - -GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) - -#$(TESTS): -# @echo -e '\nrunning gst-register...\n' -# $(GST_TOOLS_DIR)/gst-register --gst-plugin-path=$(GST_PLUGIN_PATH) - -#TESTS=$(GST_TOOLS_DIR)/gst-compprep - -.PHONY: $(TESTS) diff --git a/tests/old/examples/Makefile.am b/tests/old/examples/Makefile.am deleted file mode 100644 index b443119..0000000 --- a/tests/old/examples/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -if HAVE_FT2 -FT2_SUBDIRS=seeking -else -FT2_SUBDIRS= -endif - -# if HAVE_GTK -# GTK_SUBDIRS=dynparams $(FT2_SUBDIRS) -# else -GTK_SUBDIRS= -# endif - -SUBDIRS=$(GTK_SUBDIRS) -#DIST_SUBDIRS=capsfilter seeking indexing switch -DIST_SUBDIRS=seeking diff --git a/tests/old/examples/capsfilter/Makefile.am b/tests/old/examples/capsfilter/Makefile.am deleted file mode 100644 index f8562fe..0000000 --- a/tests/old/examples/capsfilter/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_PROGRAMS = capsfilter1 - -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) - - diff --git a/tests/old/examples/capsfilter/capsfilter1.c b/tests/old/examples/capsfilter/capsfilter1.c deleted file mode 100644 index a59f728..0000000 --- a/tests/old/examples/capsfilter/capsfilter1.c +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include - -/* This app uses a filter to connect colorspace and videosink - * so that only RGB data can pass the connection, colorspace will use - * a converter to convert the I420 data to RGB. Without a filter, this - * connection would use the I420 format (assuming Xv is enabled) */ - -static void -new_pad_func (GstElement * element, GstPad * newpad, gpointer data) -{ - GstElement *pipeline = (GstElement *) data; - GstElement *queue = gst_bin_get_by_name (GST_BIN (pipeline), "queue"); - - if (!strcmp (gst_pad_get_name (newpad), "video_00")) { - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_pad_link (newpad, gst_element_get_pad (queue, "sink")); - gst_element_set_state (pipeline, GST_STATE_PLAYING); - } -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *filesrc; - GstElement *demux; - GstElement *thread; - GstElement *queue; - GstElement *mpeg2dec; - GstElement *colorspace; - GstElement *videosink; - gboolean res; - - gst_init (&argc, &argv); - - if (argc < 2) { - g_print ("usage: %s \n", argv[0]); - return (-1); - } - - pipeline = gst_pipeline_new ("main_pipeline"); - filesrc = gst_element_factory_make ("filesrc", "filesrc"); - g_return_val_if_fail (filesrc, -1); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - demux = gst_element_factory_make ("mpegdemux", "demux"); - g_return_val_if_fail (demux, -1); - g_signal_connect (G_OBJECT (demux), "new_pad", G_CALLBACK (new_pad_func), - pipeline); - - thread = gst_thread_new ("thread"); - queue = gst_element_factory_make ("queue", "queue"); - mpeg2dec = gst_element_factory_make ("mpeg2dec", "mpeg2dec"); - g_return_val_if_fail (mpeg2dec, -1); - colorspace = gst_element_factory_make ("ffmpegcolorspace", "colorspace"); - g_return_val_if_fail (colorspace, -1); - videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink"); - g_return_val_if_fail (videosink, -1); - - gst_bin_add (GST_BIN (pipeline), filesrc); - gst_bin_add (GST_BIN (pipeline), demux); - - gst_bin_add (GST_BIN (thread), queue); - gst_bin_add (GST_BIN (thread), mpeg2dec); - gst_bin_add (GST_BIN (thread), colorspace); - gst_bin_add (GST_BIN (thread), videosink); - gst_bin_add (GST_BIN (pipeline), thread); - - gst_element_link_pads (filesrc, "src", demux, "sink"); - gst_element_link_pads (queue, "src", mpeg2dec, "sink"); - gst_element_link_pads (mpeg2dec, "src", colorspace, "sink"); - /* force RGB data passing between colorspace and videosink */ - res = gst_element_link_pads_filtered (colorspace, "src", videosink, "sink", - gst_caps_new_simple ("video/x-raw-rgb", NULL)); - if (!res) { - g_print ("could not connect colorspace and videosink\n"); - return -1; - } - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/gob/Makefile.am b/tests/old/examples/gob/Makefile.am deleted file mode 100644 index 7abde4d..0000000 --- a/tests/old/examples/gob/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ - -plugin_LTLIBRARIES = libgstidentity2.la - -GOB_FILES_ID = gst-identity2.c gst-identity2.h gst-identity2-private.h - -BUILT_SOURCES = \ - $(GOB_FILES_ID) - -libgstidentity2_la_SOURCES = gst-identity2.gob $(GOB_FILES_ID) -libgstidentity2_la_CFLAGS = $(GST_CFLAGS) -libgstidentity2_la_LIBADD = - -%.c %.h %-private.h: %.gob - gob $< - -CLEANFILES = $(GOB_FILES_ID) - -dist-hook: - cd $(distdir); rm -f $(CLEANFILES) diff --git a/tests/old/examples/gob/gst-identity2.gob b/tests/old/examples/gob/gst-identity2.gob deleted file mode 100644 index 2c58f06..0000000 --- a/tests/old/examples/gob/gst-identity2.gob +++ /dev/null @@ -1,139 +0,0 @@ - -%header{ -#include -#include "gst-identity2.h" -#include "gst-identity2-private.h" -%} - -class Gst:Identity2 from Gst:Element { - - /* plugin init */ - private gboolean - plugin_init (GModule *module, GstPlugin *plugin) - { - static GstElementDetails identity2_details = - GST_ELEMENT_DETAILS ( - "GOB Identity", - "Filter/Effect", - "Does nothing", - "Wim Taymans "); - GstElementFactory *factory; - - factory = gst_elementfactory_new ("identity2", TYPE_SELF, - &identity2_details); - g_return_val_if_fail (factory != NULL, FALSE); - - gst_plugin_add_feature (plugin, &(factory->feature)); - - return TRUE; - } - - /* pads FIXME gob oculd be improved here */ - private GstPad *sinkpad = - { - gst_pad_new ("sink", GST_PAD_SINK); - gst_element_add_pad (GST_ELEMENT (o), o->_priv->sinkpad); - gst_pad_set_chain_function (o->_priv->sinkpad, chain); - gst_pad_set_bufferpool_function (o->_priv->sinkpad, get_bufferpool); - //gst_pad_set_negotiate_function (o->_priv->sinkpad, negotiate_sink); - }; - private GstPad *srcpad = - { - gst_pad_new ("src", GST_PAD_SRC); - gst_element_add_pad (GST_ELEMENT (o), o->_priv->srcpad); - //gst_pad_set_negotiate_function (o->_priv->srcpad, negotiate_src); - }; - - /* arguments */ - /* - private gboolean loop_based = FALSE; argument BOOL loop_based - get { - ARG = self->_priv->loop_based; - } - set { - self->_priv->loop_based = ARG; - if (self->_priv->loop_based) { - gst_element_set_loop_function (GST_ELEMENT (self), loop); - gst_pad_set_chain_function (self->_priv->sinkpad, NULL); - } - else { - gst_pad_set_chain_function (self->_priv->sinkpad, chain); - gst_element_set_loop_function (GST_ELEMENT (self), NULL); - } - };*/ - private guint sleep_time = 0; argument UINT sleep_time link; - private gboolean silent = FALSE; argument BOOL silent link; - - /* signals */ - private signal last NONE(NONE) void handoff(self); - - /* core code here */ - private GstBufferPool* - get_bufferpool (GstPad *pad (check null)) - { - Self *self = SELF (gst_pad_get_parent (pad)); - - return gst_pad_get_bufferpool (self->_priv->srcpad); - } - - /* private GstPadNegotiateReturn - negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) - { - Self *self = SELF (gst_pad_get_parent (pad)); - - return gst_pad_negotiate_proxy (pad, self->_priv->sinkpad, caps); - } - - private GstPadNegotiateReturn - negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) - { - Self *self = SELF (gst_pad_get_parent (pad)); - - return gst_pad_negotiate_proxy (pad, self->_priv->srcpad, caps); - } */ - - private void - chain (GstPad *pad (check null), GstBuffer *buf (check null)) - { - Self *self; - - self = SELF (gst_pad_get_parent (pad)); - - if (!self->_priv->silent) - g_print("identity2: chain ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad)); - - handoff (self); - gst_pad_push (self->_priv->srcpad, buf); - - if (self->_priv->sleep_time) - usleep (self->_priv->sleep_time); - } - - /*private void - loop (GstElement *element (check null)) - { - Self *self = SELF (element); - GstBuffer *buf; - - do { - buf = gst_pad_pull (self->_priv->sinkpad); - g_print("identity2: loop ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(self->_priv->sinkpad)); - - handoff (self); - gst_pad_push (self->_priv->srcpad, buf); - - if (self->_priv->sleep_time) - usleep (self->_priv->sleep_time); - - } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); - }*/ -} - -%{ -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "identity2", - gst_identity2_plugin_init -}; -%} diff --git a/tests/old/examples/indexing/.gitignore b/tests/old/examples/indexing/.gitignore deleted file mode 100644 index 5ce0947..0000000 --- a/tests/old/examples/indexing/.gitignore +++ /dev/null @@ -1 +0,0 @@ -indexmpeg diff --git a/tests/old/examples/indexing/Makefile.am b/tests/old/examples/indexing/Makefile.am deleted file mode 100644 index 022bfc8..0000000 --- a/tests/old/examples/indexing/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -examples = indexmpeg - -noinst_PROGRAMS = $(examples) - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) $(GTK_LIBS) -AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS) diff --git a/tests/old/examples/indexing/indexmpeg.c b/tests/old/examples/indexing/indexmpeg.c deleted file mode 100644 index a670ad8..0000000 --- a/tests/old/examples/indexing/indexmpeg.c +++ /dev/null @@ -1,321 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * 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 -#include - -static gboolean verbose = FALSE; -static gboolean quiet = FALSE; - -static void -entry_added (GstIndex * index, GstIndexEntry * entry) -{ - switch (entry->type) { - case GST_INDEX_ENTRY_ID: - g_print ("id %d describes writer %s\n", entry->id, - GST_INDEX_ID_DESCRIPTION (entry)); - break; - case GST_INDEX_ENTRY_FORMAT: - g_print ("%d: registered format %d for %s\n", entry->id, - GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry)); - break; - case GST_INDEX_ENTRY_ASSOCIATION: - { - gint i; - - g_print ("%p, %d: %08x ", entry, entry->id, - GST_INDEX_ASSOC_FLAGS (entry)); - for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) { - g_print ("%d %" G_GINT64_FORMAT " ", GST_INDEX_ASSOC_FORMAT (entry, i), - GST_INDEX_ASSOC_VALUE (entry, i)); - } - g_print ("\n"); - break; - } - default: - break; - } -} - -typedef struct -{ - const gchar *padname; - GstPad *target; - GstElement *bin; - GstElement *pipeline; - GstIndex *index; -} -dyn_link; - -static void -dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data) -{ - dyn_link *link = (dyn_link *) data; - - if (!strcmp (gst_pad_get_name (newpad), link->padname)) { - gst_element_set_state (link->pipeline, GST_STATE_PAUSED); - gst_bin_add (GST_BIN (link->pipeline), link->bin); - gst_pad_link (newpad, link->target); - gst_element_set_index (link->bin, link->index); - gst_element_set_state (link->pipeline, GST_STATE_PLAYING); - } -} - -static void -setup_dynamic_linking (GstElement * pipeline, - GstElement * element, - const gchar * padname, GstPad * target, GstElement * bin, GstIndex * index) -{ - dyn_link *link; - - link = g_new0 (dyn_link, 1); - link->padname = g_strdup (padname); - link->target = target; - link->bin = bin; - link->pipeline = pipeline; - link->index = index; - - g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link), - link); -} - -static GstElement * -make_mpeg_systems_pipeline (const gchar * path, GstIndex * index) -{ - GstElement *pipeline; - GstElement *src, *demux; - - pipeline = gst_pipeline_new ("pipeline"); - - src = gst_element_factory_make ("filesrc", "src"); - g_object_set (G_OBJECT (src), "location", path, NULL); - - demux = gst_element_factory_make ("mpegdemux", "demux"); - - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), demux); - - if (index) { - gst_element_set_index (pipeline, index); - } - - gst_element_link_pads (src, "src", demux, "sink"); - - return pipeline; -} - -static GstElement * -make_mpeg_decoder_pipeline (const gchar * path, GstIndex * index) -{ - GstElement *pipeline; - GstElement *src, *demux; - GstElement *video_bin, *audio_bin; - GstElement *video_decoder, *audio_decoder; - - pipeline = gst_pipeline_new ("pipeline"); - - src = gst_element_factory_make ("filesrc", "src"); - g_object_set (G_OBJECT (src), "location", path, NULL); - - demux = gst_element_factory_make ("mpegdemux", "demux"); - - gst_bin_add (GST_BIN (pipeline), src); - gst_bin_add (GST_BIN (pipeline), demux); - - gst_element_link_pads (src, "src", demux, "sink"); - - video_bin = gst_bin_new ("video_bin"); - video_decoder = gst_element_factory_make ("mpeg2dec", "video_decoder"); - - gst_bin_add (GST_BIN (video_bin), video_decoder); - - setup_dynamic_linking (pipeline, demux, "video_00", - gst_element_get_pad (video_decoder, "sink"), video_bin, index); - - audio_bin = gst_bin_new ("audio_bin"); - audio_decoder = gst_element_factory_make ("mad", "audio_decoder"); - - setup_dynamic_linking (pipeline, demux, "audio_00", - gst_element_get_pad (audio_decoder, "sink"), audio_bin, index); - - gst_bin_add (GST_BIN (audio_bin), audio_decoder); - - if (index) { - gst_element_set_index (pipeline, index); - } - - return pipeline; -} - -static void -print_progress (GstPad * pad) -{ - gint i = 0; - gchar status[53]; - GstFormat format; - gboolean res; - gint64 value; - gint percent = 0; - - status[0] = '|'; - - format = GST_FORMAT_PERCENT; - res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value); - if (res) { - percent = value / (2 * GST_FORMAT_PERCENT_SCALE); - } - - for (i = 0; i < percent; i++) { - status[i + 1] = '='; - } - for (i = percent; i < 50; i++) { - status[i + 1] = ' '; - } - status[51] = '|'; - status[52] = 0; - - g_print ("%s\r", status); -} - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GstElement *src; - GstPad *pad; - GstIndex *index; - gint count = 0; - GstEvent *event; - gboolean res; - GstElement *sink; - struct poptOption options[] = { - {"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0, - "Print index entries", NULL}, - {"quiet", 'q', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &quiet, 0, - "don't print progress bar", NULL}, - POPT_TABLEEND - }; - - if (!gst_init_check_with_popt_table (&argc, &argv, options) || argc < 3) { - g_print ("usage: %s [-v] \n" - " type can be: 0 mpeg_systems\n" - " 1 mpeg_decoder\n" - " -v : report added index entries\n" - " -q : don't print progress\n", argv[0]); - return -1; - } - - /* create index that elements can fill */ - index = gst_index_factory_make ("memindex"); - if (index) { - if (verbose) - g_signal_connect (G_OBJECT (index), "entry_added", - G_CALLBACK (entry_added), NULL); - - g_object_set (G_OBJECT (index), "resolver", 1, NULL); - } - - /* construct pipeline */ - switch (atoi (argv[1])) { - case 0: - pipeline = make_mpeg_systems_pipeline (argv[2], index); - break; - case 1: - pipeline = make_mpeg_decoder_pipeline (argv[2], index); - break; - default: - g_print ("unknown type %d\n", atoi (argv[1])); - return -1; - } - - /* setup some default info/error handlers */ - g_signal_connect (G_OBJECT (pipeline), "deep_notify", - G_CALLBACK (gst_element_default_deep_notify), NULL); - g_signal_connect (G_OBJECT (pipeline), "error", - G_CALLBACK (gst_element_default_error), NULL); - - /* get a pad to perform progress reporting on */ - src = gst_bin_get_by_name (GST_BIN (pipeline), "src"); - pad = gst_element_get_pad (src, "src"); - - /* prepare for iteration */ - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - g_print ("indexing %s...\n", argv[2]); - /* run through the complete stream to let it generate an index */ - while (gst_bin_iterate (GST_BIN (pipeline))) { - if (!quiet && (count % 1000 == 0)) { - print_progress (pad); - } - count++; - } - g_print ("\n"); - - /* bring to ready to restart the pipeline */ - gst_element_set_state (pipeline, GST_STATE_READY); - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - if (index) - GST_OBJECT_FLAG_UNSET (index, GST_INDEX_WRITABLE); - - src = gst_bin_get_by_name (GST_BIN (pipeline), "video_decoder"); - - { - gint id; - GstIndexEntry *entry; - gint64 result; - gint total_tm; - - gst_index_get_writer_id (index, GST_OBJECT (src), &id); - - entry = gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_BEFORE, 0, - GST_FORMAT_TIME, G_MAXINT64); - g_assert (entry); - gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &result); - total_tm = result * 60 / GST_SECOND; - g_print ("total time = %.2fs\n", total_tm / 60.0); - } - - pad = gst_element_get_pad (src, "src"); - sink = gst_element_factory_make ("fakesink", "sink"); - gst_element_link_pads (src, "src", sink, "sink"); - gst_bin_add (GST_BIN (pipeline), sink); - - g_print ("seeking %s...\n", argv[2]); - event = gst_event_new_seek (GST_FORMAT_TIME | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND); - - res = gst_pad_send_event (pad, event); - if (!res) { - g_warning ("seek failed"); - } - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - count = 0; - while (gst_bin_iterate (GST_BIN (pipeline))) { - if (!quiet && (count % 1000 == 0)) { - print_progress (pad); - } - count++; - } - - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 1; -} diff --git a/tests/old/examples/seek/.gitignore b/tests/old/examples/seek/.gitignore deleted file mode 100644 index fcb1d20..0000000 --- a/tests/old/examples/seek/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -cdparanoia -cdplayer -seek -spider_seek -vorbisfile - diff --git a/tests/old/examples/seek/Makefile.am b/tests/old/examples/seek/Makefile.am deleted file mode 100644 index b53022b..0000000 --- a/tests/old/examples/seek/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -examples = seek scrubby #cdplayer cdparanoia - -noinst_PROGRAMS = $(examples) - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) $(GTK_LIBS) -AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS) diff --git a/tests/old/examples/seek/cdparanoia.c b/tests/old/examples/seek/cdparanoia.c deleted file mode 100644 index f5b8c32..0000000 --- a/tests/old/examples/seek/cdparanoia.c +++ /dev/null @@ -1,215 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include -#include -#include - -static void -get_position_info (GstElement * cdparanoia) -{ - GstFormat track_format; - const GstFormat *formats; - GstPad *pad; - - track_format = gst_format_get_by_nick ("track"); - g_assert (track_format != 0); - - pad = gst_element_get_pad (cdparanoia, "src"); - formats = gst_pad_get_formats (pad); - - while (*formats) { - const GstFormatDefinition *definition; - GstFormat format; - gint64 position; - gboolean res; - - definition = gst_format_get_details (*formats); - - format = *formats; - res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &position); - - if (format == GST_FORMAT_TIME) { - position /= GST_SECOND; - g_print ("%s: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT, - definition->nick, position / 60, position % 60); - } else { - g_print ("%s: %" G_GINT64_FORMAT, definition->nick, position); - } - - formats++; - if (*formats) { - g_print (", "); - } - } - g_print ("\r"); -} - -static void -get_track_info (GstElement * cdparanoia) -{ - GstFormat track_format; - gint64 total_tracks = 0, total_time = 0; - GstPad *pad; - const GstFormat *formats; - gint i; - gint64 time_count = 0; - - track_format = gst_format_get_by_nick ("track"); - g_assert (track_format != 0); - - pad = gst_element_get_pad (cdparanoia, "src"); - formats = gst_pad_get_formats (pad); - - /* we loop over all supported formats and report the total - * number of them */ - while (*formats) { - const GstFormatDefinition *definition; - gint64 total; - GstFormat format; - gboolean res; - - definition = gst_format_get_details (*formats); - - format = *formats; - res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &total); - if (res) { - if (format == GST_FORMAT_TIME) { - total /= GST_SECOND; - g_print ("%s total: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n", - definition->nick, total / 60, total % 60); - } else - g_print ("%s total: %" G_GINT64_FORMAT "\n", definition->nick, total); - - if (format == track_format) - total_tracks = total; - else if (format == GST_FORMAT_TIME) - total_time = total; - } else - g_print ("failed to get %s total\n", definition->nick); - - formats++; - } - - /* then we loop over all the tracks to get more info. - * since pad_convert always works from 0, the time from track 1 needs - * to be substracted from track 2 */ - for (i = 0; i <= total_tracks; i++) { - gint64 time; - gboolean res; - - if (i < total_tracks) { - GstFormat format; - - format = GST_FORMAT_TIME; - res = gst_pad_convert (pad, track_format, i, &format, &time); - time /= GST_SECOND; - } else { - time = total_time; - res = TRUE; - } - - if (res) { - /* for the first track (i==0) we wait until we have the - * time of the next track */ - if (i > 0) { - gint64 length = time - time_count; - - g_print ("track %d: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT - " -> %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ", length: %" - G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n", - i - 1, - time_count / 60, time_count % 60, - time / 60, time % 60, length / 60, length % 60); - } - } else { - g_print ("could not get time for track %d\n", i); - } - - time_count = time; - } -} - -int -main (int argc, char **argv) -{ - GstElement *pipeline; - GstElement *cdparanoia; - GstElement *audiosink; - GstPad *pad; - GstFormat track_format; - GstEvent *event; - gint count; - gboolean res; - - gst_init (&argc, &argv); - - pipeline = gst_pipeline_new ("pipeline"); - - cdparanoia = gst_element_factory_make ("cdparanoia", "cdparanoia"); - g_assert (cdparanoia); - g_object_set (G_OBJECT (cdparanoia), "paranoia_mode", 0, NULL); - - audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK); - g_assert (audiosink); - - gst_bin_add (GST_BIN (pipeline), cdparanoia); - gst_bin_add (GST_BIN (pipeline), audiosink); - - gst_element_link_pads (cdparanoia, "src", audiosink, "sink"); - - g_signal_connect (G_OBJECT (pipeline), "deep_notify", - G_CALLBACK (gst_object_default_deep_notify), NULL); - - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - /* now we go into probe mode */ - get_track_info (cdparanoia); - - track_format = gst_format_get_by_nick ("track"); - g_assert (track_format != 0); - - pad = gst_element_get_pad (cdparanoia, "src"); - g_assert (pad); - - g_print ("playing from track 3\n"); - /* seek to track3 */ - event = gst_event_new_seek (track_format | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 3); - - res = gst_pad_send_event (pad, event); - if (!res) - g_warning ("seek failed"); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - count = 0; - while (count++ < 500) { - get_position_info (cdparanoia); - g_usleep (G_USEC_PER_SEC / 2); - } - gst_element_set_state (pipeline, GST_STATE_PAUSED); - - g_print ("\nplaying from second 25 to second 29\n"); - /* seek to some seconds */ - event = gst_event_new_segment_seek (GST_FORMAT_TIME | - GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH, 25 * GST_SECOND, 29 * GST_SECOND); - res = gst_pad_send_event (pad, event); - if (!res) - g_warning ("seek failed"); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - count = 0; - while (count++ < 500) { - get_position_info (cdparanoia); - g_usleep (G_USEC_PER_SEC / 2); - } - g_print ("\n"); - - /* shutdown everything again */ - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/seek/cdplayer.c b/tests/old/examples/seek/cdplayer.c deleted file mode 100644 index 6305d50..0000000 --- a/tests/old/examples/seek/cdplayer.c +++ /dev/null @@ -1,292 +0,0 @@ -#include -#include -#include -#include -#include - -static GList *seekable_elements = NULL; - -static GstElement *pipeline; -static GtkAdjustment *adjustment; -static gboolean stats = FALSE; -static guint64 duration; - -static guint update_id; - -#define UPDATE_INTERVAL 500 - -static GstElement * -make_cdaudio_pipeline (void) -{ - GstElement *cdaudio; - - cdaudio = gst_element_factory_make ("cdaudio", "cdaudio"); - g_assert (cdaudio != NULL); - - seekable_elements = g_list_prepend (seekable_elements, cdaudio); - - return cdaudio; -} - -static gchar * -format_value (GtkScale * scale, gdouble value) -{ - gint64 real; - gint64 seconds; - gint64 subseconds; - - real = value * duration / 100; - seconds = (gint64) real / GST_SECOND; - subseconds = (gint64) real / (GST_SECOND / 100); - - return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02" - G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100); -} - -typedef struct -{ - const gchar *name; - const GstFormat format; -} -seek_format; - -static seek_format seek_formats[] = { - {"tim", GST_FORMAT_TIME}, - {"byt", GST_FORMAT_BYTES}, - {"buf", GST_FORMAT_BUFFERS}, - {"def", GST_FORMAT_DEFAULT}, - {NULL, 0}, -}; - - -G_GNUC_UNUSED static void -query_durations () -{ - GList *walk = seekable_elements; - - while (walk) { - GstElement *element = GST_ELEMENT (walk->data); - gint i = 0; - - g_print ("durations %8.8s: ", GST_ELEMENT_NAME (element)); - while (seek_formats[i].name) { - gboolean res; - gint64 value; - GstFormat format; - - format = seek_formats[i].format; - res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value); - if (res) { - g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value); - } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); - } - i++; - } - g_print (" %s\n", GST_ELEMENT_NAME (element)); - walk = g_list_next (walk); - } -} - -G_GNUC_UNUSED static void -query_positions () -{ - GList *walk = seekable_elements; - - while (walk) { - GstElement *element = GST_ELEMENT (walk->data); - gint i = 0; - - g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element)); - while (seek_formats[i].name) { - gboolean res; - gint64 value; - GstFormat format; - - format = seek_formats[i].format; - res = gst_element_query (element, GST_QUERY_POSITION, &format, &value); - if (res) { - g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value); - } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); - } - i++; - } - g_print (" %s\n", GST_ELEMENT_NAME (element)); - walk = g_list_next (walk); - } -} - -static gboolean -update_scale (gpointer data) -{ - GstClock *clock; - guint64 position = 0; - GstFormat format = GST_FORMAT_TIME; - - duration = 0; - clock = gst_pipeline_get_clock (GST_PIPELINE (pipeline)); - - if (seekable_elements) { - GstElement *element = GST_ELEMENT (seekable_elements->data); - - gst_element_query (element, GST_QUERY_TOTAL, &format, &duration); - gst_element_query (element, GST_QUERY_POSITION, &format, &position); - } - - if (stats) { - if (clock) - g_print ("clock: %13" G_GUINT64_FORMAT " (%s)\n", - position, gst_object_get_name (GST_OBJECT (clock))); - query_durations (); - query_positions (); - } - if (duration > 0) { - gtk_adjustment_set_value (adjustment, position * 100.0 / duration); - } - - return TRUE; -} - -static gboolean -start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data) -{ - gst_element_set_state (pipeline, GST_STATE_PAUSED); - g_timeout_remove (update_id); - - return FALSE; -} - -static gboolean -stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data) -{ - gint64 real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100; - gboolean res; - GstEvent *s_event; - GList *walk = seekable_elements; - - while (walk) { - GstElement *seekable = GST_ELEMENT (walk->data); - - g_print ("seek to %" G_GINT64_FORMAT " on element %s\n", real, - GST_ELEMENT_NAME (seekable)); - s_event = - gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH, real); - - res = gst_element_send_event (seekable, s_event); - - walk = g_list_next (walk); - } - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - update_id = - g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); - - return FALSE; -} - -static void -play_cb (GtkButton * button, gpointer data) -{ - GstState state; - - gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE); - if (state != GST_STATE_PLAYING) { - gst_element_set_state (pipeline, GST_STATE_PLAYING); - update_id = - g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); - } -} - -static void -pause_cb (GtkButton * button, gpointer data) -{ - GstState state; - - gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE); - if (state != GST_STATE_PAUSED) { - gst_element_set_state (pipeline, GST_STATE_PAUSED); - g_timeout_remove (update_id); - } -} - -static void -stop_cb (GtkButton * button, gpointer data) -{ - GstState state; - - gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE); - if (state != GST_STATE_READY) { - gst_element_set_state (pipeline, GST_STATE_READY); - g_timeout_remove (update_id); - } -} - -int -main (int argc, char **argv) -{ - GtkWidget *window, *hbox, *vbox, - *play_button, *pause_button, *stop_button, *hscale; - struct poptOption options[] = { - {"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0, - "Show element stats", NULL}, - POPT_TABLEEND - }; - - gst_init_with_popt_table (&argc, &argv, options); - gtk_init (&argc, &argv); - - pipeline = make_cdaudio_pipeline (); - - g_signal_connect (pipeline, "deep_notify", - G_CALLBACK (gst_object_default_deep_notify), NULL); - - /* initialize gui elements ... */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - hbox = gtk_hbox_new (FALSE, 0); - vbox = gtk_vbox_new (FALSE, 0); - play_button = gtk_button_new_with_label ("play"); - pause_button = gtk_button_new_with_label ("pause"); - stop_button = gtk_button_new_with_label ("stop"); - - adjustment = - GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0)); - hscale = gtk_hscale_new (adjustment); - gtk_scale_set_digits (GTK_SCALE (hscale), 2); - gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS); - - g_signal_connect (GTK_OBJECT (hscale), - "button_press_event", G_CALLBACK (start_seek), pipeline); - g_signal_connect (GTK_OBJECT (hscale), - "button_release_event", G_CALLBACK (stop_seek), pipeline); - g_signal_connect (GTK_OBJECT (hscale), - "format_value", G_CALLBACK (format_value), pipeline); - - /* do the packing stuff ... */ - gtk_window_set_default_size (GTK_WINDOW (window), 96, 96); - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_container_add (GTK_CONTAINER (vbox), hbox); - gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2); - - /* connect things ... */ - g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb), - pipeline); - g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb), - pipeline); - g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb), - pipeline); - g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL); - - /* show the gui. */ - gtk_widget_show_all (window); - - gtk_main (); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/seek/chained.c b/tests/old/examples/seek/chained.c deleted file mode 100644 index bf23e05..0000000 --- a/tests/old/examples/seek/chained.c +++ /dev/null @@ -1,107 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include -#include -#include - -static GstElement *bin; - -static void -unlinked (GstPad * pad, GstPad * peerpad, GstElement * pipeline) -{ - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_bin_remove (GST_BIN (pipeline), bin); - gst_element_set_state (bin, GST_STATE_READY); - gst_element_set_state (pipeline, GST_STATE_PLAYING); -} - -static void -new_pad (GstElement * elem, GstPad * newpad, GstElement * pipeline) -{ - GstScheduler *sched; - GstClock *clock; - - g_print ("new pad %s\n", gst_pad_get_name (newpad)); - - gst_element_set_state (pipeline, GST_STATE_PAUSED); - gst_bin_add (GST_BIN (pipeline), bin); - - sched = gst_element_get_scheduler (GST_ELEMENT (pipeline)); - clock = gst_scheduler_get_clock (sched); - gst_scheduler_set_clock (sched, clock); - - gst_pad_link (newpad, gst_element_get_pad (bin, "sink")); - - g_signal_connect (G_OBJECT (newpad), "unlinked", G_CALLBACK (unlinked), - pipeline); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); -} - -int -main (int argc, char **argv) -{ - GstElement *pipeline; - GstElement *filesrc; - GstElement *oggdemux; - GstElement *vorbisdec; - GstElement *audioconvert; - GstElement *audiosink; - - gst_init (&argc, &argv); - - if (argc < 2) { - g_print ("usage: %s \n", argv[0]); - return (-1); - } - - pipeline = gst_pipeline_new ("pipeline"); - - filesrc = gst_element_factory_make ("filesrc", "filesrc"); - g_assert (filesrc); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - oggdemux = gst_element_factory_make ("oggdemux", "oggdemux"); - g_assert (oggdemux); - - gst_bin_add (GST_BIN (pipeline), filesrc); - gst_bin_add (GST_BIN (pipeline), oggdemux); - - gst_element_link_pads (filesrc, "src", oggdemux, "sink"); - - g_signal_connect (G_OBJECT (oggdemux), "new_pad", G_CALLBACK (new_pad), - pipeline); - - bin = gst_bin_new ("bin"); - vorbisdec = gst_element_factory_make ("vorbisdec", "vorbisdec"); - g_assert (vorbisdec); - audioconvert = gst_element_factory_make ("audioconvert", "audioconvert"); - g_assert (audioconvert); - audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK); - g_assert (audiosink); - gst_bin_add (GST_BIN (bin), vorbisdec); - gst_bin_add (GST_BIN (bin), audioconvert); - gst_bin_add (GST_BIN (bin), audiosink); - - gst_element_link_pads (vorbisdec, "src", audioconvert, "sink"); - gst_element_link_pads (audioconvert, "src", audiosink, "sink"); - - gst_element_add_ghost_pad (bin, gst_element_get_pad (vorbisdec, "sink"), - "sink"); - - g_object_ref (G_OBJECT (bin)); - - g_signal_connect (pipeline, "deep_notify", - G_CALLBACK (gst_element_default_deep_notify), NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - while (gst_bin_iterate (GST_BIN (pipeline))) - /* nop */ ; - - /* stop probe */ - gst_element_set_state (pipeline, GST_STATE_NULL); - - return 0; -} diff --git a/tests/old/examples/stats/Makefile.am b/tests/old/examples/stats/Makefile.am deleted file mode 100644 index 0f7d81c..0000000 --- a/tests/old/examples/stats/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_PROGRAMS = mp2ogg - -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) - - diff --git a/tests/old/examples/stats/mp2ogg.c b/tests/old/examples/stats/mp2ogg.c deleted file mode 100644 index fc56d5b..0000000 --- a/tests/old/examples/stats/mp2ogg.c +++ /dev/null @@ -1,102 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * 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 - -/* This example app demonstartes the use of pad query and convert to - * get useful statistics about a plugin. In this case we monitor the - * compression status of mpeg audio to ogg vorbis transcoding. - */ - -gint -main (gint argc, gchar * argv[]) -{ - GstElement *pipeline; - GError *error = NULL; - gchar *description; - GstElement *encoder, *decoder; - GstPad *dec_sink, *enc_src; - - gst_init (&argc, &argv); - - if (argc < 3) { - g_print ("usage: %s \n", argv[0]); - return -1; - } - - description = g_strdup_printf ("filesrc location=\"%s\" ! mad name=decoder ! " - "vorbisenc name=encoder ! filesink location=\"%s\"", argv[1], argv[2]); - - pipeline = GST_ELEMENT (gst_parse_launch (description, &error)); - if (!pipeline) { - if (error) - g_print ("ERROR: pipeline could not be constructed: %s\n", - error->message); - else - g_print ("ERROR: pipeline could not be constructed\n"); - return -1; - } - - decoder = gst_bin_get_by_name (GST_BIN (pipeline), "decoder"); - encoder = gst_bin_get_by_name (GST_BIN (pipeline), "encoder"); - - dec_sink = gst_element_get_pad (decoder, "sink"); - enc_src = gst_element_get_pad (encoder, "src"); - - if (gst_element_set_state (pipeline, - GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) { - g_print ("pipeline doesn't want to play\n"); - return -1; - } - - while (gst_bin_iterate (GST_BIN (pipeline))) { - gint64 position; - gint64 duration; - gint64 bitrate_enc, bitrate_dec; - GstFormat format; - - format = GST_FORMAT_TIME; - /* get the position */ - gst_pad_query (enc_src, GST_QUERY_POSITION, &format, &position); - - /* get the total duration */ - gst_pad_query (enc_src, GST_QUERY_TOTAL, &format, &duration); - - format = GST_FORMAT_BYTES; - /* see how many bytes are genereated per 8 seconds (== bitrate) */ - gst_pad_convert (enc_src, GST_FORMAT_TIME, 8 * GST_SECOND, - &format, &bitrate_enc); - - gst_pad_convert (dec_sink, GST_FORMAT_TIME, 8 * GST_SECOND, - &format, &bitrate_dec); - - g_print ("[%2dm %.2ds] of [%2dm %.2ds], " - "src avg bitrate: %" G_GINT64_FORMAT ", dest avg birate: %" - G_GINT64_FORMAT ", ratio [%02.2f] \r", - (gint) (position / (GST_SECOND * 60)), - (gint) (position / (GST_SECOND)) % 60, - (gint) (duration / (GST_SECOND * 60)), - (gint) (duration / (GST_SECOND)) % 60, bitrate_dec, bitrate_enc, - (gfloat) bitrate_dec / bitrate_enc); - } - - g_print ("\n"); - - return 0; -} diff --git a/tests/old/examples/switch/.gitignore b/tests/old/examples/switch/.gitignore deleted file mode 100644 index 7893c43..0000000 --- a/tests/old/examples/switch/.gitignore +++ /dev/null @@ -1 +0,0 @@ -switcher diff --git a/tests/old/examples/switch/Makefile.am b/tests/old/examples/switch/Makefile.am deleted file mode 100644 index bd7aaf6..0000000 --- a/tests/old/examples/switch/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ - -noinst_PROGRAMS = switcher - -switcher_SOURCES = switcher.c -switcher_CFLAGS = $(GST_CFLAGS) -switcher_LDADD = $(GST_LIBS) - diff --git a/tests/old/examples/switch/switcher.c b/tests/old/examples/switch/switcher.c deleted file mode 100644 index 8d463c2..0000000 --- a/tests/old/examples/switch/switcher.c +++ /dev/null @@ -1,104 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Julien Moutte - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -static GMainLoop *loop = NULL; - - - -static void -got_eos (GstElement * pipeline) -{ - g_main_loop_quit (loop); -} - -static gboolean -idle_iterate (GstElement * pipeline) -{ - gst_bin_iterate (GST_BIN (pipeline)); - return (GST_STATE (GST_ELEMENT (pipeline)) == GST_STATE_PLAYING); -} - -static gboolean -switch_timer (GstElement * video_switch) -{ - gint nb_sources, active_source; - - g_object_get (G_OBJECT (video_switch), "nb_sources", &nb_sources, NULL); - g_object_get (G_OBJECT (video_switch), "active_source", &active_source, NULL); - - active_source++; - - if (active_source > nb_sources - 1) - active_source = 0; - - g_object_set (G_OBJECT (video_switch), "active_source", active_source, NULL); - - g_message ("current number of sources : %d, active source %d", - nb_sources, active_source); - - return (GST_STATE (GST_ELEMENT (video_switch)) == GST_STATE_PLAYING); -} - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline, *src1, *src2, *video_switch, *video_sink; - - /* Initing GStreamer library */ - gst_init (&argc, &argv); - - loop = g_main_loop_new (NULL, FALSE); - - pipeline = gst_pipeline_new ("pipeline"); - src1 = gst_element_factory_make ("videotestsrc", "src1"); - g_object_set (G_OBJECT (src1), "pattern", 0, NULL); - src2 = gst_element_factory_make ("videotestsrc", "src2"); - g_object_set (G_OBJECT (src2), "pattern", 1, NULL); - video_switch = gst_element_factory_make ("switch", "video_switch"); - video_sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "video_sink"); - - gst_bin_add_many (GST_BIN (pipeline), src1, src2, video_switch, - video_sink, NULL); - - gst_element_link (src1, video_switch); - gst_element_link (src2, video_switch); - gst_element_link (video_switch, video_sink); - - g_signal_connect (G_OBJECT (pipeline), "eos", G_CALLBACK (got_eos), NULL); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - g_idle_add ((GSourceFunc) idle_iterate, pipeline); - g_timeout_add (2000, (GSourceFunc) switch_timer, video_switch); - - g_main_loop_run (loop); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY); - - /* unref */ - gst_object_unref (pipeline); - - exit (0); -} diff --git a/tests/old/testsuite/alsa/.gitignore b/tests/old/testsuite/alsa/.gitignore deleted file mode 100644 index abf7b41..0000000 --- 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 6557bc5..0000000 --- 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 e6ca8f1..0000000 --- a/tests/old/testsuite/alsa/formats.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte - * - * 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 a42db71..0000000 --- a/tests/old/testsuite/alsa/sinesrc.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte - * - * 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 -#include /* 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 057428d..0000000 --- a/tests/old/testsuite/alsa/sinesrc.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte - * - * 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 - -#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 4ae536d..0000000 --- a/tests/old/testsuite/alsa/srcstate.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte - * - * 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 - -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 9cbd8ac..0000000 --- a/tests/old/testsuite/alsa/state.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2003 Benjamin Otte - * - * 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 2ffdc76..0000000 --- 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 ed4a93c..0000000 --- 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 -#include -#include -#include - -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 a924f05..0000000 --- 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 () { - chomp $filename; - open FILE, "$filename"; - @lines = ; - 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 () { - chomp $filename; - open FILE, "$filename"; - @lines = ; - 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+/; } @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+/; } @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 missing\n"; - }else{ - if (!($includes[0] =~ /^#include\s+["<]config.h[">]/)){ - print "E: #include is not first include\n"; - } - if(!grep { /^#ifdef HAVE_CONFIG_H/; } @lines) { - print "E: #include not surrounded by #ifdef HAVE_CONFIG_H\n"; - } - } - } - - if($filename =~ /\.h$/){ - if (grep { /^#include\s+["<]config.h[">]/; } @lines) { - print "E: headers should not #include \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; - } - } -} - -- 2.7.4