Added a simple thread state change app.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 27 Jul 2001 17:12:46 +0000 (17:12 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 27 Jul 2001 17:12:46 +0000 (17:12 +0000)
Original commit message from CVS:
Added a simple thread state change app.

tests/Makefile.am
tests/faketest.c [new file with mode: 0644]
tests/muxing/case1.c

index e974d86..d4f24b3 100644 (file)
@@ -2,7 +2,7 @@ SUBDIRS = sched eos nego muxing
 
 noinst_PROGRAMS = init loadall simplefake states caps queue registry \
 paranoia rip mp3encode autoplug props case4 markup load tee autoplug2 autoplug3 \
-capsconnect padfactory autoplug4 incsched reaping threadlock mp1vid reconnect
+capsconnect padfactory autoplug4 incsched reaping threadlock mp1vid reconnect faketest
 
 # we have nothing but apps here, we can do this safely
 LIBS += $(GST_LIBS)
diff --git a/tests/faketest.c b/tests/faketest.c
new file mode 100644 (file)
index 0000000..bcfb89c
--- /dev/null
@@ -0,0 +1,44 @@
+#include <gst/gst.h>
+
+int 
+main (int argc, gchar *argv[])
+{
+  GstElement *pipeline;
+  GstElement *fakesrc, *fakesink, *identity;
+  GstElement *queue, *thread;
+
+  gst_init (&argc, &argv);
+
+  pipeline = gst_pipeline_new ("main");
+  g_assert (pipeline != NULL);
+
+  queue = gst_elementfactory_make ("queue", "queue");
+  g_assert (queue);
+  thread = gst_elementfactory_make ("thread", "thread");
+  g_assert (thread);
+  fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
+  g_assert (fakesrc);
+  fakesink = gst_elementfactory_make ("fakesink", "fakesink");
+  g_assert (fakesink);
+  identity = gst_elementfactory_make ("identity", "identity");
+  g_assert (identity);
+
+  gst_bin_add (GST_BIN (pipeline), fakesrc);
+  gst_bin_add (GST_BIN (pipeline), identity);
+  gst_bin_add (GST_BIN (pipeline), queue);
+
+  gst_bin_add (GST_BIN (thread), fakesink);
+  gst_bin_add (GST_BIN (pipeline), thread);
+
+  gst_element_connect (fakesrc, "src", identity, "sink");
+  gst_element_connect (identity, "src", queue, "sink");
+  gst_element_connect (queue, "src", fakesink, "sink");
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  gst_bin_iterate (GST_BIN (pipeline));
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+
+  return 0;
+}
index dd93076..671b81d 100644 (file)
@@ -32,12 +32,14 @@ main(int argc,char *argv[])
   g_return_val_if_fail (src != NULL, 2);
   tee = gst_elementfactory_make ("tee", "tee");
   g_return_val_if_fail (tee != NULL, 3);
-  identity1 = gst_elementfactory_make ("identity", "identity1");
+  identity1 = gst_elementfactory_make ("identity", "identity0");
   g_return_val_if_fail (identity1 != NULL, 3);
-  identity2 = gst_elementfactory_make ("identity", "identity2");
+  identity2 = gst_elementfactory_make ("identity", "identity1");
   g_object_set (G_OBJECT (identity2), "duplicate", 2, NULL);
+  g_object_set (G_OBJECT (identity2), "loop_based", TRUE, NULL);
   g_return_val_if_fail (identity2 != NULL, 3);
   aggregator = gst_elementfactory_make ("aggregator", "aggregator");
+  g_object_set (G_OBJECT (aggregator), "sched", 3, NULL);
   g_return_val_if_fail (aggregator != NULL, 3);
   sink = gst_elementfactory_make ("fakesink", "sink");
   g_return_val_if_fail (sink != NULL, 4);