summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2005-11-30 18:24:08 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2005-11-30 18:24:08 +0000
commit33fb1e42107134a06cf911f0f49c81555a8dcb8a (patch)
tree9fc49be998c08afff4eca8f0b0be51fa873ea987
parentaab214c94a17368b1485121332e581d21c2ff991 (diff)
move under tests
Original commit message from CVS: move under tests
-rw-r--r--ChangeLog31
-rw-r--r--Makefile.am12
-rw-r--r--check/.gitignore1
-rw-r--r--check/Makefile.am34
-rw-r--r--check/elements/.gitignore3
-rw-r--r--check/elements/level.c190
-rw-r--r--check/elements/matroskamux.c427
-rw-r--r--configure.ac2
-rw-r--r--examples/Makefile.am14
-rw-r--r--examples/capsfilter/Makefile.am6
-rw-r--r--examples/capsfilter/capsfilter1.c87
-rw-r--r--examples/gob/Makefile.am19
-rw-r--r--examples/gob/gst-identity2.gob141
-rw-r--r--examples/gstplay/.gitignore1
-rw-r--r--examples/gstplay/Makefile.am11
-rw-r--r--examples/gstplay/player.c176
-rw-r--r--examples/indexing/.gitignore1
-rw-r--r--examples/indexing/Makefile.am7
-rw-r--r--examples/indexing/indexmpeg.c321
-rw-r--r--examples/level/Makefile.am11
-rw-r--r--examples/level/README39
-rw-r--r--examples/level/demo.c155
-rw-r--r--examples/level/plot.c123
-rw-r--r--examples/stats/Makefile.am6
-rw-r--r--examples/stats/mp2ogg.c102
-rw-r--r--examples/switch/.gitignore1
-rw-r--r--examples/switch/Makefile.am7
-rw-r--r--examples/switch/switcher.c104
28 files changed, 34 insertions, 1998 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a8df4a2..2ed0844f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2005-11-30 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
+
+ * Makefile.am:
+ * check/.cvsignore:
+ * check/Makefile.am:
+ * check/elements/.cvsignore:
+ * check/elements/level.c:
+ * check/elements/matroskamux.c:
+ * configure.ac:
+ * examples/Makefile.am:
+ * examples/capsfilter/Makefile.am:
+ * examples/capsfilter/capsfilter1.c:
+ * examples/gob/Makefile.am:
+ * examples/gob/gst-identity2.gob:
+ * examples/gstplay/.cvsignore:
+ * examples/gstplay/Makefile.am:
+ * examples/gstplay/player.c:
+ * examples/indexing/.cvsignore:
+ * examples/indexing/Makefile.am:
+ * examples/indexing/indexmpeg.c:
+ * examples/level/Makefile.am:
+ * examples/level/README:
+ * examples/level/demo.c:
+ * examples/level/plot.c:
+ * examples/stats/Makefile.am:
+ * examples/stats/mp2ogg.c:
+ * examples/switch/.cvsignore:
+ * examples/switch/Makefile.am:
+ * examples/switch/switcher.c:
+ move under tests/
+
2005-11-30 Tim-Philipp Müller <tim at centricular dot net>
* ext/pango/gsttextrender.c: (gst_text_render_base_init),
diff --git a/Makefile.am b/Makefile.am
index 171c1d29..6b2868db 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,12 +6,6 @@ else
GCONF_DIR =
endif
-if HAVE_CHECK
-SUBDIRS_CHECK = check
-else
-SUBDIRS_CHECK =
-endif
-
ALWAYS_SUBDIRS = \
gst sys ext \
docs \
@@ -20,12 +14,10 @@ ALWAYS_SUBDIRS = \
SUBDIRS = \
$(ALWAYS_SUBDIRS) \
- $(SUBDIRS_CHECK) \
$(GCONF_DIR)
DIST_SUBDIRS = \
$(ALWAYS_SUBDIRS) \
- check \
gconf
EXTRA_DIST = \
@@ -45,7 +37,7 @@ include $(top_srcdir)/common/release.mak
# include $(top_srcdir)/common/po.mak
check-valgrind:
- cd check && make check-valgrind
+ cd tests/check && make check-valgrind
check-torture:
- cd check && make torture
+ cd tests/check && make torture
diff --git a/check/.gitignore b/check/.gitignore
deleted file mode 100644
index 5d45c6c3..00000000
--- a/check/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-test-registry.xml
diff --git a/check/Makefile.am b/check/Makefile.am
deleted file mode 100644
index 256c19a0..00000000
--- a/check/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-include $(top_srcdir)/common/check.mak
-
-CHECK_REGISTRY = $(top_builddir)/check/test-registry.xml
-
-REGISTRY_ENVIRONMENT = \
- GST_REGISTRY=$(CHECK_REGISTRY)
-
-TESTS_ENVIRONMENT = \
- $(REGISTRY_ENVIRONMENT) \
- GST_PLUGIN_SYSTEM_PATH= \
- GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/ext:$(GST_PLUGINS_DIR)
-
-# ths core dumps of some machines have PIDs appended
-CLEANFILES = core.* test-registry.xml
-
-clean-local: clean-local-check
-
-TESTS = $(check_PROGRAMS)
-
-check_PROGRAMS = \
- elements/level \
- elements/matroskamux
-
-
-# these tests don't even pass
-noinst_PROGRAMS =
-
-AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS)
-LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS)
-
-# valgrind testing
-VALGRIND_TESTS_DISABLE =
-
-SUPPRESSIONS = $(top_srcdir)/common/gst.supp
diff --git a/check/elements/.gitignore b/check/elements/.gitignore
deleted file mode 100644
index 312ea60e..00000000
--- a/check/elements/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.dirstamp
-level
-matroskamux
diff --git a/check/elements/level.c b/check/elements/level.c
deleted file mode 100644
index b68dac04..00000000
--- a/check/elements/level.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* GStreamer
- *
- * unit test for level
- *
- * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
- *
- * 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 <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-GList *buffers = NULL;
-gboolean have_eos = FALSE;
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-GstPad *mysrcpad, *mysinkpad;
-
-#define LEVEL_CAPS_TEMPLATE_STRING \
- "audio/x-raw-int, " \
- "rate = (int) [ 1, MAX ], " \
- "channels = (int) [ 1, 8 ], " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) {8, 16}, " \
- "depth = (int) {8, 16}, " \
- "signed = (boolean) true"
-
-#define LEVEL_CAPS_STRING \
- "audio/x-raw-int, " \
- "rate = (int) 1000, " \
- "channels = (int) 2, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 16, " \
- "depth = (int) 16, " \
- "signed = (boolean) true"
-
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (LEVEL_CAPS_TEMPLATE_STRING)
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (LEVEL_CAPS_TEMPLATE_STRING)
- );
-
-/* takes over reference for outcaps */
-GstElement *
-setup_level ()
-{
- GstElement *level;
-
- GST_DEBUG ("setup_level");
- level = gst_check_setup_element ("level");
- mysrcpad = gst_check_setup_src_pad (level, &srctemplate, NULL);
- mysinkpad = gst_check_setup_sink_pad (level, &sinktemplate, NULL);
-
- return level;
-}
-
-void
-cleanup_level (GstElement * level)
-{
- GST_DEBUG ("cleanup_level");
-
- gst_check_teardown_src_pad (level);
- gst_check_teardown_sink_pad (level);
- gst_check_teardown_element (level);
-}
-
-
-GST_START_TEST (test_int16)
-{
- GstElement *level;
- GstBuffer *inbuffer, *outbuffer;
- GstBus *bus;
- GstMessage *message;
- const GstStructure *structure;
- int i, j;
- gint16 *data;
- const GValue *list, *value;
- GstClockTime endtime;
- gdouble dB;
-
- level = setup_level ();
- g_object_set (level, "message", TRUE, "interval", GST_SECOND / 10, NULL);
-
- fail_unless (gst_element_set_state (level,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- /* create a fake 0.1 sec buffer with a half-amplitude block signal */
- inbuffer = gst_buffer_new_and_alloc (400);
- data = (gint16 *) GST_BUFFER_DATA (inbuffer);
- for (j = 0; j < 200; ++j) {
- *data = 16536;
- ++data;
- }
- gst_buffer_set_caps (inbuffer, gst_caps_from_string (LEVEL_CAPS_STRING));
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* create a bus to get the level message on */
- bus = gst_bus_new ();
- gst_element_set_bus (level, bus);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... but it ends up being collected on the global buffer list */
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- fail_unless (inbuffer == outbuffer);
-
- message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, -1);
-
- fail_unless (message != NULL);
- fail_unless (GST_MESSAGE_SRC (message) == GST_OBJECT (level));
- fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT);
- structure = gst_message_get_structure (message);
- fail_if (structure == NULL);
- fail_unless_equals_string ((char *) gst_structure_get_name (structure),
- "level");
- fail_unless (gst_structure_get_clock_time (structure, "endtime", &endtime));
-
- /* block wave of half amplitude has -5.94 dB for rms, peak and decay */
- for (i = 0; i < 2; ++i) {
- gchar *fields[3] = { "rms", "peak", "decay" };
- for (j = 0; j < 3; ++j) {
- list = gst_structure_get_value (structure, fields[j]);
- value = gst_value_list_get_value (list, i);
- dB = g_value_get_double (value);
- fail_if (dB < -6.0);
- fail_if (dB > -5.9);
- }
- }
-
- gst_message_unref (message);
- // FIXME: need to fix leaks in level object first
- //gst_object_unref (level);
-}
-
-GST_END_TEST;
-
-
-Suite *
-level_suite (void)
-{
- Suite *s = suite_create ("level");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_int16);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = level_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/check/elements/matroskamux.c b/check/elements/matroskamux.c
deleted file mode 100644
index 6c1ee77a..00000000
--- a/check/elements/matroskamux.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/* GStreamer
- *
- * unit test for matroskamux
- *
- * Copyright (C) <2005> Michal Benes <michal.benes@xeris.cz>
- *
- * 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 <unistd.h>
-
-#include <gst/check/gstcheck.h>
-
-GList *buffers = NULL;
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-GstPad *mysrcpad, *mysinkpad;
-
-#define AC3_CAPS_STRING "audio/x-ac3, " \
- "channels = (int) 1, " \
- "rate = (int) 8000"
-#define VORBIS_CAPS_STRING "audio/x-vorbis, " \
- "channels = (int) 1, " \
- "rate = (int) 8000, " \
- "streamheader=(buffer)<10, 2020, 303030>"
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-matroska"));
-static GstStaticPadTemplate srcvorbistemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (VORBIS_CAPS_STRING));
-
-static GstStaticPadTemplate srcac3template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (AC3_CAPS_STRING));
-
-
-GstPad *
-setup_src_pad (GstElement * element,
- GstStaticPadTemplate * template, GstCaps * caps)
-{
- GstPad *srcpad, *sinkpad;
-
- GST_DEBUG_OBJECT (element, "setting up sending pad");
- /* sending pad */
- srcpad = gst_pad_new_from_static_template (template, "src");
- fail_if (srcpad == NULL, "Could not create a srcpad");
- ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
-
- sinkpad = gst_element_get_pad (element, "audio_%d");
- fail_if (sinkpad == NULL, "Could not get sink pad from %s",
- GST_ELEMENT_NAME (element));
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- if (caps)
- fail_unless (gst_pad_set_caps (srcpad, caps));
- fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
- "Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
- gst_object_unref (sinkpad); /* because we got it higher up */
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
-
- return srcpad;
-}
-
-void
-teardown_src_pad (GstElement * element)
-{
- GstPad *srcpad, *sinkpad;
-
- /* clean up floating src pad */
- sinkpad = gst_element_get_pad (element, "audio_0");
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- srcpad = gst_pad_get_peer (sinkpad);
-
- gst_pad_unlink (srcpad, sinkpad);
-
- /* pad refs held by both creator and this function (through _get) */
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- gst_object_unref (sinkpad);
- /* one more ref is held by element itself */
-
- /* pad refs held by both creator and this function (through _get_peer) */
- ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2);
- gst_object_unref (srcpad);
- gst_object_unref (srcpad);
-}
-
-GstPad *
-setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
- GstCaps * caps)
-{
- GstPad *srcpad, *sinkpad;
-
- GST_DEBUG_OBJECT (element, "setting up receiving pad");
- /* receiving pad */
- sinkpad = gst_pad_new_from_static_template (template, "sink");
-
- fail_if (sinkpad == NULL, "Could not create a sinkpad");
-
- srcpad = gst_element_get_pad (element, "src");
- fail_if (srcpad == NULL, "Could not get source pad from %s",
- GST_ELEMENT_NAME (element));
- if (caps)
- fail_unless (gst_pad_set_caps (sinkpad, caps));
- gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
-
- fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
- "Could not link %s source and sink pads", GST_ELEMENT_NAME (element));
- gst_object_unref (srcpad); /* because we got it higher up */
- ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2);
-
- return sinkpad;
-}
-
-void
-teardown_sink_pad (GstElement * element)
-{
- GstPad *srcpad, *sinkpad;
-
- /* clean up floating sink pad */
- srcpad = gst_element_get_pad (element, "src");
- sinkpad = gst_pad_get_peer (srcpad);
- gst_pad_unlink (srcpad, sinkpad);
-
- /* pad refs held by both creator and this function (through _get_pad) */
- ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 3);
- gst_object_unref (srcpad);
- /* one more ref is held by element itself */
-
- /* pad refs held by both creator and this function (through _get_peer) */
- ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
- gst_object_unref (sinkpad);
- gst_object_unref (sinkpad);
-}
-
-
-GstElement *
-setup_matroskamux (GstStaticPadTemplate * srctemplate)
-{
- GstElement *matroskamux;
-
- GST_DEBUG ("setup_matroskamux");
- matroskamux = gst_check_setup_element ("matroskamux");
- mysrcpad = setup_src_pad (matroskamux, srctemplate, NULL);
- mysinkpad = setup_sink_pad (matroskamux, &sinktemplate, NULL);
-
- return matroskamux;
-}
-
-void
-cleanup_matroskamux (GstElement * matroskamux)
-{
- GST_DEBUG ("cleanup_matroskamux");
- gst_element_set_state (matroskamux, GST_STATE_NULL);
-
- teardown_src_pad (matroskamux);
- teardown_sink_pad (matroskamux);
- gst_check_teardown_element (matroskamux);
-}
-
-void
-check_buffer_data (GstBuffer * buffer, void *data, size_t data_size)
-{
- fail_unless (GST_BUFFER_SIZE (buffer) == data_size);
- fail_unless (memcmp (data, GST_BUFFER_DATA (buffer), data_size) == 0);
-}
-
-GST_START_TEST (test_ebml_header)
-{
- GstElement *matroskamux;
- GstBuffer *inbuffer, *outbuffer;
- int num_buffers;
- int i;
- guint8 data0[12] =
- { 0x1a, 0x45, 0xdf, 0xa3, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff
- };
- guint8 data1[12] =
- { 0x42, 0x82, 0x89, 0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61,
- 0x00
- };
- guint8 data2[4] = { 0x42, 0x87, 0x81, 0x01 };
- guint8 data3[4] = { 0x42, 0x85, 0x81, 0x01 };
- guint8 data4[8] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14 };
-
- matroskamux = setup_matroskamux (&srcac3template);
- fail_unless (gst_element_set_state (matroskamux,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (1);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- num_buffers = g_list_length (buffers);
- fail_unless (num_buffers >= 5);
-
- for (i = 0; i < num_buffers; ++i) {
- outbuffer = GST_BUFFER (buffers->data);
- fail_if (outbuffer == NULL);
- buffers = g_list_remove (buffers, outbuffer);
-
- switch (i) {
- case 0:
- check_buffer_data (outbuffer, data0, sizeof (data0));
- break;
- case 1:
- check_buffer_data (outbuffer, data1, sizeof (data1));
- break;
- case 2:
- check_buffer_data (outbuffer, data2, sizeof (data2));
- break;
- case 3:
- check_buffer_data (outbuffer, data3, sizeof (data3));
- break;
- case 4:
- check_buffer_data (outbuffer, data4, sizeof (data4));
- break;
- default:
- break;
- }
-
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- gst_buffer_unref (outbuffer);
- outbuffer = NULL;
- }
-
- cleanup_matroskamux (matroskamux);
- g_list_free (buffers);
- buffers = NULL;
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_vorbis_header)
-{
- GstElement *matroskamux;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- int num_buffers;
- int i;
- gboolean vorbis_header_found = FALSE;
- guint8 data[12] =
- { 0x63, 0xa2, 0x89, 0x02, 0x01, 0x02, 0x10, 0x20, 0x20, 0x30, 0x30,
- 0x30
- };
-
- matroskamux = setup_matroskamux (&srcvorbistemplate);
- fail_unless (gst_element_set_state (matroskamux,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- inbuffer = gst_buffer_new_and_alloc (1);
- caps = gst_caps_from_string (VORBIS_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- num_buffers = g_list_length (buffers);
-
- for (i = 0; i < num_buffers; ++i) {
- outbuffer = GST_BUFFER (buffers->data);
- fail_if (outbuffer == NULL);
- buffers = g_list_remove (buffers, outbuffer);
-
- if (!vorbis_header_found && GST_BUFFER_SIZE (outbuffer) == sizeof (data)) {
- vorbis_header_found =
- memcmp (GST_BUFFER_DATA (outbuffer), data, sizeof (data));
- }
-
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- gst_buffer_unref (outbuffer);
- outbuffer = NULL;
- }
-
- fail_unless (vorbis_header_found);
-
- cleanup_matroskamux (matroskamux);
- g_list_free (buffers);
- buffers = NULL;
-}
-
-GST_END_TEST;
-
-
-GST_START_TEST (test_block_group)
-{
- GstElement *matroskamux;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- int num_buffers;
- int i;
- guint8 data0[9] = { 0xa0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
- guint8 data1[2] = { 0xa1, 0x85 };
- guint8 data2[4] = { 0x81, 0x00, 0x01, 0x00 };
- guint8 data3[1] = { 0x42 };
- guint8 data4[8] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 };
-
- matroskamux = setup_matroskamux (&srcac3template);
- fail_unless (gst_element_set_state (matroskamux,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- /* Generate the header */
- inbuffer = gst_buffer_new_and_alloc (1);
- GST_BUFFER_TIMESTAMP (inbuffer) = 0;
- caps = gst_caps_from_string (AC3_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- num_buffers = g_list_length (buffers);
-
- for (i = 0; i < num_buffers; ++i) {
- outbuffer = GST_BUFFER (buffers->data);
- fail_if (outbuffer == NULL);
- buffers = g_list_remove (buffers, outbuffer);
-
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- gst_buffer_unref (outbuffer);
- outbuffer = NULL;
- }
-
- g_list_free (buffers);
- buffers = NULL;
-
- /* Now push a buffer */
- inbuffer = gst_buffer_new_and_alloc (1);
- GST_BUFFER_DATA (inbuffer)[0] = 0x42;
- GST_BUFFER_TIMESTAMP (inbuffer) = 1000000;
- caps = gst_caps_from_string (AC3_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- num_buffers = g_list_length (buffers);
- fail_unless (num_buffers >= 5);
-
- for (i = 0; i < num_buffers; ++i) {
- outbuffer = GST_BUFFER (buffers->data);
- fail_if (outbuffer == NULL);
- buffers = g_list_remove (buffers, outbuffer);
-
- switch (i) {
- case 0:
- check_buffer_data (outbuffer, data0, sizeof (data0));
- break;
- case 1:
- check_buffer_data (outbuffer, data1, sizeof (data1));
- break;
- case 2:
- check_buffer_data (outbuffer, data2, sizeof (data2));
- break;
- case 3:
- check_buffer_data (outbuffer, data3, sizeof (data3));
- break;
- case 4:
- check_buffer_data (outbuffer, data4, sizeof (data4));
- break;
- default:
- break;
- }
-
- ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
- gst_buffer_unref (outbuffer);
- outbuffer = NULL;
- }
-
- g_list_free (buffers);
- buffers = NULL;
-
- cleanup_matroskamux (matroskamux);
-}
-
-GST_END_TEST;
-
-Suite *
-matroskamux_suite (void)
-{
- Suite *s = suite_create ("matroskamux");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_ebml_header);
- tcase_add_test (tc_chain, test_vorbis_header);
- tcase_add_test (tc_chain, test_block_group);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = matroskamux_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/configure.ac b/configure.ac
index 7d0bb1d9..22407237 100644
--- a/configure.ac
+++ b/configure.ac
@@ -578,7 +578,7 @@ gconf/gstreamer.schemas
docs/Makefile
docs/plugins/Makefile
docs/version.entities
-check/Makefile
+tests/check/Makefile
common/Makefile
common/m4/Makefile
m4/Makefile
diff --git a/examples/Makefile.am b/examples/Makefile.am
deleted file mode 100644
index 4620963e..00000000
--- a/examples/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-if HAVE_GTK
-GTK_SUBDIRS=dynparams level $(FT2_SUBDIRS)
-else
-GTK_SUBDIRS=
-endif
-
-if USE_GCONF
-GCONF_SUBDIRS=gstplay
-else
-GCONF_SUBDIRS=
-endif
-
-SUBDIRS=$(GTK_SUBDIRS) $(GCONF_SUBDIRS) switch
-DIST_SUBDIRS=capsfilter dynparams indexing gstplay switch level
diff --git a/examples/capsfilter/Makefile.am b/examples/capsfilter/Makefile.am
deleted file mode 100644
index f8562fee..00000000
--- a/examples/capsfilter/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-noinst_PROGRAMS = capsfilter1
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
diff --git a/examples/capsfilter/capsfilter1.c b/examples/capsfilter/capsfilter1.c
deleted file mode 100644
index a59f728e..00000000
--- a/examples/capsfilter/capsfilter1.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <string.h>
-#include <gst/gst.h>
-
-/* 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 <mpeg1 system stream>\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/examples/gob/Makefile.am b/examples/gob/Makefile.am
deleted file mode 100644
index 7abde4dc..00000000
--- a/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/examples/gob/gst-identity2.gob b/examples/gob/gst-identity2.gob
deleted file mode 100644
index 9c34cb55..00000000
--- a/examples/gob/gst-identity2.gob
+++ /dev/null
@@ -1,141 +0,0 @@
-
-%header{
-#include <gst/gst.h>
-#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 = {
- "GOB Identity",
- "Filter/Effect",
- "Does nothing",
- "1.0",
- "Wim Taymans <wim.taymans@chello.be>",
- "(C) 2001",
- };
- 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/examples/gstplay/.gitignore b/examples/gstplay/.gitignore
deleted file mode 100644
index a1eb1c43..00000000
--- a/examples/gstplay/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-player
diff --git a/examples/gstplay/Makefile.am b/examples/gstplay/Makefile.am
deleted file mode 100644
index cbae9cbf..00000000
--- a/examples/gstplay/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-
-noinst_PROGRAMS = player
-
-player_SOURCES = player.c
-player_CFLAGS = $(GST_CFLAGS) $(GCONF_CFLAGS)
-player_LDFLAGS = \
- $(GST_LIBS) \
- $(top_builddir)/gst-libs/gst/gconf/libgstgconf-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/play/libgstplay-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la
-
diff --git a/examples/gstplay/player.c b/examples/gstplay/player.c
deleted file mode 100644
index 76453785..00000000
--- a/examples/gstplay/player.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * 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 <gst/play/play.h>
-#include <gst/gconf/gconf.h>
-
-static GMainLoop *loop = NULL;
-static gint64 length = 0;
-
-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);
- }
-}
-
-static void
-got_found_tag (GstPlay * play, GstElement * source, GstTagList * tag_list)
-{
- gst_tag_list_foreach (tag_list, print_tag, NULL);
-}
-
-static void
-got_time_tick (GstPlay * play, gint64 time_nanos)
-{
- g_print ("time tick %f\n", time_nanos / (float) GST_SECOND);
-}
-
-static void
-got_stream_length (GstPlay * play, gint64 length_nanos)
-{
- g_print ("got length %" G_GUINT64_FORMAT "\n", length_nanos);
- length = length_nanos;
-}
-
-static void
-got_video_size (GstPlay * play, gint width, gint height)
-{
- g_print ("got video size %d, %d\n", width, height);
-}
-
-static void
-got_eos (GstPlay * play)
-{
- g_print ("End Of Stream\n");
- g_main_loop_quit (loop);
-}
-
-static gboolean
-seek_timer (GstPlay * play)
-{
- gst_play_seek_to_time (play, length / 2);
- return FALSE;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstPlay *play;
- GstElement *data_src, *video_sink, *audio_sink, *vis_element;
- GError *error = NULL;
-
- /* Initing GStreamer library */
- gst_init (&argc, &argv);
-
- if (argc != 2) {
- g_print ("usage: %s <video filename>\n", argv[0]);
- exit (-1);
- }
-
- loop = g_main_loop_new (NULL, FALSE);
-
- /* Creating the GstPlay object */
- play = gst_play_new (&error);
- if (error) {
- g_print ("Error: could not create play object:\n%s\n", error->message);
- g_error_free (error);
- return 1;
- }
-
- /* Getting default audio and video plugins from GConf */
- vis_element = gst_element_factory_make ("goom", "vis_element");
- data_src = gst_element_factory_make ("gnomevfssrc", "source");
-
- audio_sink = gst_gconf_get_default_audio_sink ();
- if (!GST_IS_ELEMENT (audio_sink))
- g_error ("Could not get default audio sink from GConf");
- video_sink = gst_gconf_get_default_video_sink ();
- if (!GST_IS_ELEMENT (video_sink))
- g_error ("Could not get default video sink from GConf");
-
-
- /* Let's send them to GstPlay object */
- if (!gst_play_set_audio_sink (play, audio_sink))
- g_warning ("Could not set audio sink");
- if (!gst_play_set_video_sink (play, video_sink))
- g_warning ("Could not set video sink");
- if (!gst_play_set_data_src (play, data_src))
- g_warning ("Could not set data src");
- if (!gst_play_set_visualization (play, vis_element))
- g_warning ("Could not set visualisation");
-
- /* Setting location we want to play */
- if (!gst_play_set_location (play, argv[1]))
- g_warning ("Could not set location");
-
- /* Uncomment that line to get an XML dump of the pipeline */
- /* gst_xml_write_file (GST_ELEMENT (play), stdout); */
-
- g_signal_connect (G_OBJECT (play), "time_tick",
- G_CALLBACK (got_time_tick), NULL);
- g_signal_connect (G_OBJECT (play), "stream_length",
- G_CALLBACK (got_stream_length), NULL);
- g_signal_connect (G_OBJECT (play), "have_video_size",
- G_CALLBACK (got_video_size), NULL);
- g_signal_connect (G_OBJECT (play), "found_tag",
- G_CALLBACK (got_found_tag), NULL);
- g_signal_connect (G_OBJECT (play), "error",
- G_CALLBACK (gst_element_default_error), NULL);
- g_signal_connect (G_OBJECT (play), "eos", G_CALLBACK (got_eos), NULL);
-
- /* Change state to PLAYING */
- if (gst_element_set_state (GST_ELEMENT (play),
- GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE)
- g_error ("Could not set state to PLAYING");
-
- g_timeout_add (20000, (GSourceFunc) seek_timer, play);
-
- g_main_loop_run (loop);
-
- g_print ("setting pipeline to ready\n");
-
- gst_element_set_state (GST_ELEMENT (play), GST_STATE_READY);
-
- /* unref
- gst_object_unref (GST_OBJECT (play)); */
-
- exit (0);
-}
diff --git a/examples/indexing/.gitignore b/examples/indexing/.gitignore
deleted file mode 100644
index 5ce09473..00000000
--- a/examples/indexing/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-indexmpeg
diff --git a/examples/indexing/Makefile.am b/examples/indexing/Makefile.am
deleted file mode 100644
index 022bfc85..00000000
--- a/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/examples/indexing/indexmpeg.c b/examples/indexing/indexmpeg.c
deleted file mode 100644
index a670ad8a..00000000
--- a/examples/indexing/indexmpeg.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * 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 <string.h>
-#include <gst/gst.h>
-
-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] <type> <filename> \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/examples/level/Makefile.am b/examples/level/Makefile.am
deleted file mode 100644
index bf76136f..00000000
--- a/examples/level/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-noinst_PROGRAMS = demo plot
-
-demo_SOURCES = demo.c
-demo_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS)
-demo_LDFLAGS = $(GTK_LIBS) $(GST_LIBS)
-
-plot_SOURCES = plot.c
-plot_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS)
-plot_LDFLAGS = $(GTK_LIBS) $(GST_LIBS)
-
-EXTRA_DIST = README
diff --git a/examples/level/README b/examples/level/README
deleted file mode 100644
index 0ae84188..00000000
--- a/examples/level/README
+++ /dev/null
@@ -1,39 +0,0 @@
-level plugin by thomas <thomas@apestaart.org>
-
-this plugin signals:
- - running time since last EOS/start
- - channel
- - RMS level
- - peak level
- - decaying peak level
-over the given interval.
-
-This is useful for a VU meter display and for plotting out the signal graph.
-The VU meter can either display RMS, or display immediate peak level and
-have the falloff decaying peak level displayed as a line.
-
-The interval for signal emission, ttl of decay peak, and falloff of decay peak
-can all be set.
-
-The element only takes unsigned data in; it could be extended to signed as
-well, if separate fast chain functions are made that displaces the incoming
-data to its midpoint (ie, 0,65535 should be mapped to -32768, 32767)
-
-There are two demo apps, apps and plot. apps will create some GTK sliders
-to display the volume. plot will output data readable by gnuplot.
-
-Here is a sample plot script to plot output of the plot command that was
-stored to plot.dat
-
-set xlabel "Seconds"
-set ylabel "dB"
-set yrange [-60:0]
-plot 'plot.dat' using 1:2 title 'L RMS' with lines, \
- 'plot.dat' using 1:3 title 'L peak' with lines, \
- 'plot.dat' using 1:4 title 'L decay' with lines
-
-plot 'plot.dat' using 1:5 title 'R RMS' with lines, \
- 'plot.dat' using 1:6 title 'R peak' with lines, \
- 'plot.dat' using 1:7 title 'R decay' with lines
-
-
diff --git a/examples/level/demo.c b/examples/level/demo.c
deleted file mode 100644
index 502f50f7..00000000
--- a/examples/level/demo.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * demo.c: sample application to display VU meter-like output of level
- * Copyright (C) 2003
- * Thomas Vander Stichele <thomas at apestaart dot org>
- *
- * 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 <gst/gst.h>
-#include <gtk/gtk.h>
-
-/* global array for the scale widgets, we'll assume stereo */
-GtkWidget *elapsed;
-GtkWidget *scale[2][3];
-
-static void
-level_callback (GstElement * element, gdouble time, gint channel,
- gdouble rms, gdouble peak, gdouble decay)
-{
- gchar *label;
-
- label = g_strdup_printf ("%.3f", time);
- gtk_label_set (GTK_LABEL (elapsed), label);
- g_free (label);
- gtk_range_set_value (GTK_RANGE (scale[channel][0]), rms);
- gtk_range_set_value (GTK_RANGE (scale[channel][1]), peak);
- gtk_range_set_value (GTK_RANGE (scale[channel][2]), decay);
-}
-
-static gboolean
-idler (gpointer data)
-{
- GstElement *pipeline = GST_ELEMENT (data);
-
- g_print ("+");
- if (gst_bin_iterate (GST_BIN (pipeline)))
- return TRUE;
- gtk_main_quit ();
- return FALSE;
-}
-
-static void
-setup_gui ()
-{
- GtkWidget *window;
- GtkWidget *vbox;
- GtkWidget *label, *hbox;
- int c;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (window, "destroy", gtk_main_quit, NULL);
-
- vbox = gtk_vbox_new (TRUE, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- /* elapsed widget */
- hbox = gtk_hbox_new (TRUE, 0);
- label = gtk_label_new ("Elapsed");
- elapsed = gtk_label_new ("0.000");
- gtk_container_add (GTK_CONTAINER (hbox), label);
- gtk_container_add (GTK_CONTAINER (hbox), elapsed);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
-
- for (c = 0; c < 2; ++c) {
- /* RMS */
- hbox = gtk_hbox_new (TRUE, 0);
- label = gtk_label_new ("RMS");
- gtk_container_add (GTK_CONTAINER (hbox), label);
- scale[c][0] = gtk_hscale_new_with_range (-90.0, 0.0, 0.2);
- gtk_widget_set_size_request (scale[c][0], 100, -1);
- gtk_container_add (GTK_CONTAINER (hbox), scale[c][0]);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- /* peak */
- hbox = gtk_hbox_new (TRUE, 0);
- label = gtk_label_new ("peak");
- gtk_container_add (GTK_CONTAINER (hbox), label);
- scale[c][1] = gtk_hscale_new_with_range (-90.0, 0.0, 0.2);
- gtk_widget_set_size_request (scale[c][1], 100, -1);
- gtk_container_add (GTK_CONTAINER (hbox), scale[c][1]);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- /* decay */
- hbox = gtk_hbox_new (TRUE, 0);
- label = gtk_label_new ("decaying peek");
- gtk_container_add (GTK_CONTAINER (hbox), label);
- scale[c][2] = gtk_hscale_new_with_range (-90.0, 0.0, 0.2);
- gtk_widget_set_size_request (scale[c][2], 100, -1);
- gtk_container_add (GTK_CONTAINER (hbox), scale[c][2]);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- }
-
- gtk_widget_show_all (GTK_WIDGET (window));
-}
-
-int
-main (int argc, char *argv[])
-{
-
- GstElement *pipeline = NULL;
- GError *error = NULL;
- GstElement *level;
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error);
- if (error) {
- g_print ("pipeline could not be constructed: %s\n", error->message);
- g_print ("Please give a complete pipeline with a 'level' element.\n");
- g_print ("Example: sinesrc ! level ! %s\n", DEFAULT_AUDIOSINK);
- g_error_free (error);
- return 1;
- }
-
- level = gst_bin_get_by_name (GST_BIN (pipeline), "level0");
- if (level == NULL) {
- g_print ("Please give a pipeline with a 'level' element in it\n");
- return 1;
- }
-
- g_object_set (level, "signal", TRUE, NULL);
- g_signal_connect (level, "level", G_CALLBACK (level_callback), NULL);
-
-
- /* setup GUI */
- setup_gui ();
-
- /* connect level signal */
-
- /* go to main loop */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_idle_add (idler, pipeline);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/examples/level/plot.c b/examples/level/plot.c
deleted file mode 100644
index 6df01065..00000000
--- a/examples/level/plot.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * plot.c: output data points to be graphed with gnuplot
- * Copyright (C) 2003
- * Thomas Vander Stichele <thomas at apestaart dot org>
- *
- * 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 <gst/gst.h>
-#include <gtk/gtk.h>
-
-gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */
-gint channels = 0; /* guess at how many channels there are */
-gdouble last_time = 0.0; /* time of last signal */
-gdouble values[2][3]; /* array of levels from which to print */
-
-static void
-level_callback (GstElement * element, gdouble time, gint channel,
- gdouble rms, gdouble peak, gdouble decay)
-{
- int i = 0, j = 0;
- gboolean got_all = FALSE;
-
- if (channel + 1 > channels)
- channels = channel + 1;
-
- /* reset got_channel if this is a new time point */
- if (time > last_time) {
- for (i = 0; i < channels; ++i)
- got_channel[i] = FALSE;
- last_time = time;
- }
-
- /* store values */
- got_channel[channel] = TRUE;
- values[channel][0] = rms;
- values[channel][1] = peak;
- values[channel][2] = decay;
-
- /* check if we have all channels, and output if we do */
- /* FIXME: this fails on the first, no ? */
- got_all = TRUE;
- for (i = 0; i < channels; ++i)
- if (!got_channel[i])
- got_all = FALSE;
- if (got_all) {
- g_print ("%f ", time);
- for (i = 0; i < channels; ++i)
- for (j = 0; j < 3; ++j)
- g_print ("%f ", values[i][j]);
- g_print ("\n");
- }
-}
-
-static gboolean
-idler (gpointer data)
-{
- GstElement *pipeline = GST_ELEMENT (data);
-
- if (gst_bin_iterate (GST_BIN (pipeline)))
- return TRUE;
-
- gtk_main_quit ();
- return FALSE;
-}
-
-int
-main (int argc, char *argv[])
-{
-
- GstElement *pipeline = NULL;
- GError *error = NULL;
- GstElement *level;
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error);
- if (error) {
- g_print ("pipeline could not be constructed: %s\n", error->message);
- g_print ("Please give a complete pipeline with a 'level' element.\n");
- g_print ("Example: sinesrc ! level ! %s\n", DEFAULT_AUDIOSINK);
- g_error_free (error);
- return 1;
- }
-
- level = gst_bin_get_by_name (GST_BIN (pipeline), "level0");
- if (level == NULL) {
- g_print ("Please give a pipeline with a 'level' element in it\n");
- return 1;
- }
-
- g_object_set (level, "signal", TRUE, NULL);
- g_signal_connect (level, "level", G_CALLBACK (level_callback), NULL);
-
-
- /* go to main loop */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_idle_add (idler, pipeline);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/examples/stats/Makefile.am b/examples/stats/Makefile.am
deleted file mode 100644
index 0f7d81cf..00000000
--- a/examples/stats/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-noinst_PROGRAMS = mp2ogg
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
diff --git a/examples/stats/mp2ogg.c b/examples/stats/mp2ogg.c
deleted file mode 100644
index fc56d5b5..00000000
--- a/examples/stats/mp2ogg.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * 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 <gst/gst.h>
-
-/* 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 <inputfile> <outputfile>\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/examples/switch/.gitignore b/examples/switch/.gitignore
deleted file mode 100644
index 7893c435..00000000
--- a/examples/switch/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-switcher
diff --git a/examples/switch/Makefile.am b/examples/switch/Makefile.am
deleted file mode 100644
index 9a706048..00000000
--- a/examples/switch/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-
-noinst_PROGRAMS = switcher
-
-switcher_SOURCES = switcher.c
-switcher_CFLAGS = $(GST_CFLAGS)
-switcher_LDFLAGS = $(GST_LIBS)
-
diff --git a/examples/switch/switcher.c b/examples/switch/switcher.c
deleted file mode 100644
index 92bf501e..00000000
--- a/examples/switch/switcher.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * 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 <gst/gst.h>
-
-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 (GST_OBJECT (pipeline));
-
- exit (0);
-}