diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2015-04-28 19:59:31 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-04-28 20:07:40 +0100 |
commit | 6386934b3fa18ecd64e4e6b11c6c37a264b0b294 (patch) | |
tree | c2fa2c01b2f4b6790abde8ecedefc0a4b81de4e2 /tests | |
parent | b58245ac0a53336ea90e6462a0a3ca3d70e3d8d0 (diff) |
tests: remove some pointless ancient code examples
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/Makefile.am | 32 | ||||
-rw-r--r-- | tests/examples/launch/.gitignore | 5 | ||||
-rw-r--r-- | tests/examples/launch/Makefile.am | 7 | ||||
-rw-r--r-- | tests/examples/launch/mp3parselaunch.c | 87 | ||||
-rw-r--r-- | tests/examples/metadata/.gitignore | 6 | ||||
-rw-r--r-- | tests/examples/metadata/Makefile.am | 4 | ||||
-rw-r--r-- | tests/examples/metadata/read-metadata.c | 217 | ||||
-rw-r--r-- | tests/examples/queue/.gitignore | 5 | ||||
-rw-r--r-- | tests/examples/queue/Makefile.am | 5 | ||||
-rw-r--r-- | tests/examples/queue/queue.c | 106 | ||||
-rw-r--r-- | tests/examples/typefind/.gitignore | 5 | ||||
-rw-r--r-- | tests/examples/typefind/Makefile.am | 5 | ||||
-rw-r--r-- | tests/examples/typefind/typefind.c | 135 |
13 files changed, 3 insertions, 616 deletions
diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am index fce72a15c..f3cfd8d71 100644 --- a/tests/examples/Makefile.am +++ b/tests/examples/Makefile.am @@ -1,9 +1,3 @@ -if GST_DISABLE_PARSE -GST_PARSE_DIRS = -else -GST_PARSE_DIRS = launch -endif - # adapter test needs sys/times.h and unistd.h if HAVE_SYS_TIMES_H_AND_UNISTD_H ADAPTER_TEST_DIR = adapter @@ -16,35 +10,15 @@ always_dirs = \ helloworld \ manual \ memory \ - metadata \ netclock \ - queue \ stepping \ streamiddemux \ - streams \ - typefind - -#appreader -#cutter -#events -#helloworld2 -#launch -#manual -#mixer -#pingpong -#plugins -#pwg -#queue2 -#queue3 -#queue4 -#retag -#thread + streams SUBDIRS = \ $(always_dirs) \ - $(ADAPTER_TEST_DIR) \ - $(GST_PARSE_DIRS) + $(ADAPTER_TEST_DIR) -DIST_SUBDIRS = $(always_dirs) adapter launch +DIST_SUBDIRS = $(always_dirs) adapter include $(top_srcdir)/common/parallel-subdirs.mak diff --git a/tests/examples/launch/.gitignore b/tests/examples/launch/.gitignore deleted file mode 100644 index c548fb651..000000000 --- a/tests/examples/launch/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -mp3parselaunch -*.bb -*.bbg -*.da -mp3parselaunch-mp3parselaunch.gcno diff --git a/tests/examples/launch/Makefile.am b/tests/examples/launch/Makefile.am deleted file mode 100644 index bee5789f4..000000000 --- a/tests/examples/launch/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -noinst_PROGRAMS = mp3parselaunch - -mp3parselaunch_LDADD = $(GST_OBJ_LIBS) -mp3parselaunch_CFLAGS = $(GST_OBJ_CFLAGS) - -#noinst_SCRIPTS = mp3play -#EXTRA_DIST = mp3play diff --git a/tests/examples/launch/mp3parselaunch.c b/tests/examples/launch/mp3parselaunch.c deleted file mode 100644 index e77c1bd00..000000000 --- a/tests/examples/launch/mp3parselaunch.c +++ /dev/null @@ -1,87 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <gst/gst.h> - -static void -event_loop (GstElement * pipe) -{ - GstBus *bus; - GstMessage *message = NULL; - gboolean running = TRUE; - - bus = gst_element_get_bus (GST_ELEMENT (pipe)); - - while (running) { - message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); - - g_assert (message != NULL); - - switch (message->type) { - case GST_MESSAGE_EOS: - running = FALSE; - break; - case GST_MESSAGE_WARNING:{ - GError *gerror; - gchar *debug; - - gst_message_parse_warning (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - g_error_free (gerror); - g_free (debug); - break; - } - case GST_MESSAGE_ERROR:{ - GError *gerror; - gchar *debug; - - gst_message_parse_error (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - g_error_free (gerror); - g_free (debug); - running = FALSE; - break; - } - default: - break; - } - gst_message_unref (message); - } - gst_object_unref (bus); -} - -int -main (int argc, char *argv[]) -{ - GstElement *bin; - GstElement *filesrc; - GError *error = NULL; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s <mp3 file>\n", argv[0]); - exit (-1); - } - - bin = (GstElement *) - gst_parse_launch ("filesrc name=my_filesrc ! mad ! osssink", &error); - if (!bin) { - fprintf (stderr, "Parse error: %s", error->message); - exit (-1); - } - - filesrc = gst_bin_get_by_name (GST_BIN (bin), "my_filesrc"); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - gst_object_unref (filesrc); - - /* start playing */ - gst_element_set_state (bin, GST_STATE_PLAYING); - - /* Run event loop listening for bus messages until EOS or ERROR */ - event_loop (bin); - - /* stop the bin */ - gst_element_set_state (bin, GST_STATE_NULL); - - exit (0); -} diff --git a/tests/examples/metadata/.gitignore b/tests/examples/metadata/.gitignore deleted file mode 100644 index 9d531442f..000000000 --- a/tests/examples/metadata/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -read-metadata -*.bb -*.bbg -*.da - -read_metadata-read-metadata.gcno diff --git a/tests/examples/metadata/Makefile.am b/tests/examples/metadata/Makefile.am deleted file mode 100644 index 61d2eb815..000000000 --- a/tests/examples/metadata/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -noinst_PROGRAMS = read-metadata - -read_metadata_LDADD = $(GST_OBJ_LIBS) -read_metadata_CFLAGS = $(GST_OBJ_CFLAGS) diff --git a/tests/examples/metadata/read-metadata.c b/tests/examples/metadata/read-metadata.c deleted file mode 100644 index a8722892d..000000000 --- a/tests/examples/metadata/read-metadata.c +++ /dev/null @@ -1,217 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Thomas Vander Stichele <thomas@apestaart.org> - * 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * 2005 Andy Wingo <wingo@pobox.com> - * 2005 Jan Schmidt <thaytan@mad.scientist.com> - * - * gst-metadata.c: Use GStreamer to display metadata within files. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <string.h> -#include <stdlib.h> -#include <locale.h> -#include <gst/gst.h> - -static char *filename = NULL; -static GstElement *pipeline = NULL; -static GstElement *source = NULL; - -#define NEW_PIPE_PER_FILE - -static gboolean -message_loop (GstElement * element, GstTagList ** tags) -{ - GstBus *bus; - gboolean done = FALSE; - - bus = gst_element_get_bus (element); - g_return_val_if_fail (bus != NULL, FALSE); - g_return_val_if_fail (tags != NULL, FALSE); - - while (!done) { - GstMessage *message; - - message = gst_bus_pop (bus); - if (message == NULL) - /* All messages read, we're done */ - break; - - switch (GST_MESSAGE_TYPE (message)) { - case GST_MESSAGE_ERROR: - case GST_MESSAGE_EOS: - gst_message_unref (message); - return TRUE; - case GST_MESSAGE_TAG: - { - GstTagList *new_tags, *old_tags; - - gst_message_parse_tag (message, &new_tags); - if (*tags) { - old_tags = *tags; - *tags = gst_tag_list_merge (old_tags, new_tags, GST_TAG_MERGE_KEEP); - gst_tag_list_unref (old_tags); - } else - *tags = new_tags; - break; - } - default: - break; - } - gst_message_unref (message); - } - gst_object_unref (bus); - return TRUE; -} - -static void -make_pipeline (void) -{ - GstElement *decodebin; - - if (pipeline != NULL) - gst_object_unref (pipeline); - - pipeline = gst_pipeline_new (NULL); - - source = gst_element_factory_make ("filesrc", "source"); - g_assert (GST_IS_ELEMENT (source)); - decodebin = gst_element_factory_make ("decodebin", "decodebin"); - g_assert (GST_IS_ELEMENT (decodebin)); - - gst_bin_add_many (GST_BIN (pipeline), source, decodebin, NULL); - gst_element_link (source, decodebin); -} - -static void -print_tag (const GstTagList * list, const gchar * tag, gpointer unused) -{ - gint i, count; - - count = gst_tag_list_get_tag_size (list, tag); - - for (i = 0; i < count; i++) { - gchar *str; - - if (gst_tag_get_type (tag) == G_TYPE_STRING) { - if (!gst_tag_list_get_string_index (list, tag, i, &str)) - g_assert_not_reached (); - } else { - str = - g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); - } - - if (i == 0) { - g_print (" %15s: %s\n", gst_tag_get_nick (tag), str); - } else { - g_print (" : %s\n", str); - } - - g_free (str); - } -} - -int -main (int argc, char *argv[]) -{ - guint i = 1; - - setlocale (LC_ALL, ""); - - gst_init (&argc, &argv); - - if (argc < 2) { - g_print ("Please give filenames to read metadata from\n\n"); - return 1; - } - - make_pipeline (); - while (i < argc) { - GstStateChangeReturn sret; - GstState state; - GstTagList *tags = NULL; - - filename = argv[i]; - g_object_set (source, "location", filename, NULL); - - GST_DEBUG ("Starting reading for %s", filename); - - /* Decodebin will only commit to PAUSED if it actually finds a type; - * otherwise the state change fails */ - sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED); - - if (GST_STATE_CHANGE_ASYNC == sret) { - if (GST_STATE_CHANGE_SUCCESS != - gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, - 5 * GST_SECOND)) { - g_print ("State change failed for %s. Aborting\n", filename); - break; - } - } else if (sret != GST_STATE_CHANGE_SUCCESS) { - g_print ("%s - Could not read file\n", filename); - goto next_file; - } - - if (!message_loop (GST_ELEMENT (pipeline), &tags)) { - g_print ("Failed in message reading for %s\n", argv[i]); - } - - if (tags) { - g_print ("Metadata for %s:\n", argv[i]); - gst_tag_list_foreach (tags, print_tag, NULL); - gst_tag_list_unref (tags); - tags = NULL; - } else - g_print ("No metadata found for %s\n", argv[i]); - - sret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); -#ifdef NEW_PIPE_PER_FILE - if (sret != GST_STATE_CHANGE_SUCCESS) { - g_print ("State change failed. Aborting\n"); - break; - } -#else - if (GST_STATE_CHANGE_ASYNC == sret) { - if (GST_STATE_CHANGE_FAILURE == - gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, - GST_CLOCK_TIME_NONE)) { - g_print ("State change failed. Aborting"); - break; - } - } else if (sret != GST_STATE_CHANGE_SUCCESS) { - g_print ("State change failed. Aborting\n"); - break; - } -#endif - - next_file: - i++; - -#ifdef NEW_PIPE_PER_FILE - make_pipeline (); -#endif - } - - if (pipeline) - gst_object_unref (pipeline); - return 0; -} diff --git a/tests/examples/queue/.gitignore b/tests/examples/queue/.gitignore deleted file mode 100644 index 1a3535ef1..000000000 --- a/tests/examples/queue/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -queue -*.bb -*.bbg -*.da -queue-queue.gcno diff --git a/tests/examples/queue/Makefile.am b/tests/examples/queue/Makefile.am deleted file mode 100644 index 9d668392a..000000000 --- a/tests/examples/queue/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = queue - -queue_LDADD = $(GST_OBJ_LIBS) -queue_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/examples/queue/queue.c b/tests/examples/queue/queue.c deleted file mode 100644 index 27ca94e1f..000000000 --- a/tests/examples/queue/queue.c +++ /dev/null @@ -1,106 +0,0 @@ -#include <stdlib.h> -#include <gst/gst.h> - -/* This example uses the queue element to create a buffer between 2 elements. - * The scheduler automatically uses 2 threads, 1 to feed and another to consume - * data from the queue buffer - */ - -/* Event loop to listen to events posted on the GstBus from the pipeline. Exits - * on EOS or ERROR events - */ -static void -event_loop (GstElement * pipe) -{ - GstBus *bus; - GstMessage *message = NULL; - gboolean running = TRUE; - - bus = gst_element_get_bus (GST_ELEMENT (pipe)); - - while (running) { - message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); - - g_assert (message != NULL); - - switch (message->type) { - case GST_MESSAGE_EOS: - running = FALSE; - break; - case GST_MESSAGE_WARNING:{ - GError *gerror; - gchar *debug; - - gst_message_parse_warning (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - g_error_free (gerror); - g_free (debug); - break; - } - case GST_MESSAGE_ERROR:{ - GError *gerror; - gchar *debug; - - gst_message_parse_error (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - g_error_free (gerror); - g_free (debug); - running = FALSE; - break; - } - default: - break; - } - gst_message_unref (message); - } - gst_object_unref (bus); -} - -int -main (int argc, char *argv[]) -{ - GstElement *filesrc, *audiosink, *decode, *queue; - GstElement *pipeline; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s <filename>\n", argv[0]); - exit (-1); - } - - /* create a new pipeline to hold the elements */ - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline != NULL); - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - decode = gst_element_factory_make ("mad", "decode"); - g_assert (decode != NULL); - - queue = gst_element_factory_make ("queue", "queue"); - g_assert (queue != NULL); - - /* and an audio sink */ - audiosink = gst_element_factory_make ("alsasink", "play_audio"); - g_assert (audiosink != NULL); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (pipeline), filesrc, decode, queue, audiosink, - NULL); - - gst_element_link_many (filesrc, decode, queue, audiosink, NULL); - - /* start playing */ - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); - - /* Listen for EOS */ - event_loop (pipeline); - - gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL); - - exit (0); -} diff --git a/tests/examples/typefind/.gitignore b/tests/examples/typefind/.gitignore deleted file mode 100644 index 49d03f117..000000000 --- a/tests/examples/typefind/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -typefind -*.bb -*.bbg -*.da -typefind-typefind.gcno diff --git a/tests/examples/typefind/Makefile.am b/tests/examples/typefind/Makefile.am deleted file mode 100644 index cc998021a..000000000 --- a/tests/examples/typefind/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = typefind - -typefind_LDADD = $(GST_OBJ_LIBS) -typefind_CFLAGS = $(GST_OBJ_CFLAGS) - diff --git a/tests/examples/typefind/typefind.c b/tests/examples/typefind/typefind.c deleted file mode 100644 index d9576a4e1..000000000 --- a/tests/examples/typefind/typefind.c +++ /dev/null @@ -1,135 +0,0 @@ -/* GStreamer typefind element example - * Copyright (C) <2005> Stefan Kost - * Copyright (C) <2006> Tim-Philipp Müller - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include <gst/gst.h> - -#include <stdlib.h> - -static void -type_found (GstElement * typefind, guint probability, const GstCaps * caps, - gpointer user_data) -{ - gchar *xml, *caps_str; - - caps_str = gst_caps_to_string (caps); - xml = g_markup_printf_escaped ("<?xml version=\"1.0\"?>\n<Capabilities>\n" - " <Caps1>%s</Caps1>\n</Capabilities>", caps_str); - g_free (caps_str); - - g_print ("%s\n", xml); - g_free (xml); -} - -static void -event_loop (GstElement * pipe) -{ - GstBus *bus; - GstMessage *message = NULL; - gboolean running = TRUE; - - bus = gst_element_get_bus (GST_ELEMENT (pipe)); - - while (running) { - message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); - - g_assert (message != NULL); - - switch (message->type) { - case GST_MESSAGE_EOS: - running = FALSE; - break; - case GST_MESSAGE_WARNING:{ - GError *gerror; - gchar *debug; - - gst_message_parse_warning (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - g_error_free (gerror); - g_free (debug); - break; - } - case GST_MESSAGE_ERROR:{ - GError *gerror; - gchar *debug; - - gst_message_parse_error (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - g_error_free (gerror); - g_free (debug); - running = FALSE; - break; - } - default: - break; - } - gst_message_unref (message); - } - gst_object_unref (bus); -} - -int -main (int argc, char *argv[]) -{ - GstElement *pipeline, *filesrc, *typefind, *sink; - - gst_init (&argc, &argv); - - if (argc != 2) { - g_print ("usage: %s <filename>\n", argv[0]); - exit (-1); - } - - /* create a new pipeline to hold the elements */ - pipeline = gst_pipeline_new ("pipeline"); - g_assert (pipeline != NULL); - - /* create a file reader */ - filesrc = gst_element_factory_make ("filesrc", "file_source"); - g_assert (filesrc != NULL); - g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); - - typefind = gst_element_factory_make ("typefind", "typefind"); - g_assert (typefind != NULL); - - sink = gst_element_factory_make ("fakesink", "sink"); - g_assert (sink != NULL); - - /* add objects to the main pipeline */ - gst_bin_add (GST_BIN (pipeline), filesrc); - gst_bin_add (GST_BIN (pipeline), typefind); - gst_bin_add (GST_BIN (pipeline), sink); - - g_signal_connect (G_OBJECT (typefind), "have-type", - G_CALLBACK (type_found), NULL); - - gst_element_link_many (filesrc, typefind, sink, NULL); - - /* start playing */ - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - /* Run event loop listening for bus messages until EOS or ERROR */ - event_loop (pipeline); - - /* stop the bin */ - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); - - exit (0); -} |