summaryrefslogtreecommitdiff
path: root/tests/sched
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-13 15:27:01 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-13 15:27:01 +0000
commita967370df58163d7f5219a285a8331b3f79930a3 (patch)
treed6c4b98d58ce96273f7e99f836d4bbef0e7e2cce /tests/sched
parentb8edc59edb7c71b3edcc9d51bf6f6d145e60df91 (diff)
gst-indent run on core
Original commit message from CVS: gst-indent run on core
Diffstat (limited to 'tests/sched')
-rw-r--r--tests/sched/dynamic-pipeline.c105
-rw-r--r--tests/sched/interrupt1.c9
-rw-r--r--tests/sched/interrupt2.c9
-rw-r--r--tests/sched/interrupt3.c9
-rw-r--r--tests/sched/runxml.c49
-rw-r--r--tests/sched/sched-stress.c13
6 files changed, 97 insertions, 97 deletions
diff --git a/tests/sched/dynamic-pipeline.c b/tests/sched/dynamic-pipeline.c
index de30ff17f..46b25c792 100644
--- a/tests/sched/dynamic-pipeline.c
+++ b/tests/sched/dynamic-pipeline.c
@@ -5,60 +5,59 @@
* cothreading that is fixed in the newer cothreads package.
*/
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
- GstElement *fakesrc, *fakesink1, *fakesink2, *pipe1, *pipe2;
-
- gst_init(&argc, &argv);
-
- if (argc!=1) {
- g_print("usage: %s\n", argv[0]);
- exit(-1);
- }
-
- fakesrc = gst_element_factory_make("fakesrc", "fakesrc");
- fakesink1 = gst_element_factory_make("fakesink", "fakesink1");
- fakesink2 = gst_element_factory_make("fakesink", "fakesink2");
+ GstElement *fakesrc, *fakesink1, *fakesink2, *pipe1, *pipe2;
- /* a crucial part of this test (and one that the old cothreads fails on) is
- having two active pipelines in the same thread. */
- pipe1 = gst_pipeline_new("pipe1");
- pipe2 = gst_pipeline_new("pipe2");
-
- /* make the first pipeline */
- gst_bin_add (GST_BIN(pipe1), fakesrc);
- gst_bin_add (GST_BIN(pipe1), fakesink1);
- gst_element_link_pads (fakesrc, "src", fakesink1, "sink");
-
- /* initialize cothreads */
- gst_element_set_state(pipe1, GST_STATE_PLAYING);
- gst_bin_iterate (GST_BIN (pipe1));
- gst_element_set_state(pipe1, GST_STATE_READY);
-
- /* destroy the fakesink, but keep fakesrc (its state is GST_STATE_READY) */
- gst_element_unlink_pads (fakesrc, "src", fakesink1, "sink");
- gst_object_ref(GST_OBJECT(fakesrc));
- gst_bin_remove(GST_BIN(pipe1), fakesrc);
- gst_bin_remove(GST_BIN(pipe1), fakesink1);
+ gst_init (&argc, &argv);
- gst_object_unref (GST_OBJECT (pipe1));
-
- /* make a new pipeline */
- gst_bin_add (GST_BIN(pipe2), fakesink2);
-
- /* don't change the new pipeline's state, it should change on the bin_add */
- gst_bin_add (GST_BIN(pipe2), fakesrc);
- gst_element_link_pads (fakesrc, "src", fakesink2, "sink");
-
- /* show the pipeline state */
- gst_xml_write_file (GST_ELEMENT (pipe2), stdout);
-
- /* try to iterate the pipeline */
- gst_element_set_state(pipe2, GST_STATE_PLAYING);
- gst_bin_iterate(GST_BIN(pipe2));
- gst_element_set_state(pipe2, GST_STATE_NULL);
-
- return 0;
-}
+ if (argc != 1) {
+ g_print ("usage: %s\n", argv[0]);
+ exit (-1);
+ }
+
+ fakesrc = gst_element_factory_make ("fakesrc", "fakesrc");
+ fakesink1 = gst_element_factory_make ("fakesink", "fakesink1");
+ fakesink2 = gst_element_factory_make ("fakesink", "fakesink2");
+
+ /* a crucial part of this test (and one that the old cothreads fails on) is
+ having two active pipelines in the same thread. */
+ pipe1 = gst_pipeline_new ("pipe1");
+ pipe2 = gst_pipeline_new ("pipe2");
+
+ /* make the first pipeline */
+ gst_bin_add (GST_BIN (pipe1), fakesrc);
+ gst_bin_add (GST_BIN (pipe1), fakesink1);
+ gst_element_link_pads (fakesrc, "src", fakesink1, "sink");
+
+ /* initialize cothreads */
+ gst_element_set_state (pipe1, GST_STATE_PLAYING);
+ gst_bin_iterate (GST_BIN (pipe1));
+ gst_element_set_state (pipe1, GST_STATE_READY);
+
+ /* destroy the fakesink, but keep fakesrc (its state is GST_STATE_READY) */
+ gst_element_unlink_pads (fakesrc, "src", fakesink1, "sink");
+ gst_object_ref (GST_OBJECT (fakesrc));
+ gst_bin_remove (GST_BIN (pipe1), fakesrc);
+ gst_bin_remove (GST_BIN (pipe1), fakesink1);
-
+ gst_object_unref (GST_OBJECT (pipe1));
+
+ /* make a new pipeline */
+ gst_bin_add (GST_BIN (pipe2), fakesink2);
+
+ /* don't change the new pipeline's state, it should change on the bin_add */
+ gst_bin_add (GST_BIN (pipe2), fakesrc);
+ gst_element_link_pads (fakesrc, "src", fakesink2, "sink");
+
+ /* show the pipeline state */
+ gst_xml_write_file (GST_ELEMENT (pipe2), stdout);
+
+ /* try to iterate the pipeline */
+ gst_element_set_state (pipe2, GST_STATE_PLAYING);
+ gst_bin_iterate (GST_BIN (pipe2));
+ gst_element_set_state (pipe2, GST_STATE_NULL);
+
+ return 0;
+}
diff --git a/tests/sched/interrupt1.c b/tests/sched/interrupt1.c
index 2fae69af4..e33df4304 100644
--- a/tests/sched/interrupt1.c
+++ b/tests/sched/interrupt1.c
@@ -1,22 +1,23 @@
#include <gst/gst.h>
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
GstElement *pipeline, *thread, *queue, *src, *sink;
gst_init (&argc, &argv);
- free (malloc (8)); /* -lefence */
+ free (malloc (8)); /* -lefence */
pipeline = gst_pipeline_new ("pipeline");
src = gst_element_factory_make ("fakesrc", "src");
thread = gst_thread_new ("thread");
-
+
queue = gst_element_factory_make ("queue", "queue");
sink = gst_element_factory_make ("fakesink", "sink");
-
+
gst_bin_add (GST_BIN (thread), queue);
gst_bin_add (GST_BIN (thread), sink);
gst_bin_add (GST_BIN (pipeline), thread);
diff --git a/tests/sched/interrupt2.c b/tests/sched/interrupt2.c
index 4e2551bfc..df2b97929 100644
--- a/tests/sched/interrupt2.c
+++ b/tests/sched/interrupt2.c
@@ -1,24 +1,25 @@
#include <gst/gst.h>
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
GstElement *pipeline, *thread, *queue, *src, *identity, *sink;
gst_init (&argc, &argv);
- free (malloc (8)); /* -lefence */
+ free (malloc (8)); /* -lefence */
pipeline = gst_pipeline_new ("pipeline");
src = gst_element_factory_make ("fakesrc", "src");
thread = gst_thread_new ("thread");
-
+
queue = gst_element_factory_make ("queue", "queue");
identity = gst_element_factory_make ("identity", "identity");
g_object_set (G_OBJECT (identity), "loop_based", TRUE, NULL);
sink = gst_element_factory_make ("fakesink", "sink");
-
+
gst_bin_add (GST_BIN (thread), queue);
gst_bin_add (GST_BIN (thread), identity);
gst_bin_add (GST_BIN (thread), sink);
diff --git a/tests/sched/interrupt3.c b/tests/sched/interrupt3.c
index 38f06e518..937b1fd6a 100644
--- a/tests/sched/interrupt3.c
+++ b/tests/sched/interrupt3.c
@@ -1,13 +1,14 @@
#include <gst/gst.h>
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
GstElement *pipeline, *thread, *queue, *src, *adder, *sink;
GstPad *sinkpad;
gst_init (&argc, &argv);
- free (malloc (8)); /* -lefence */
+ free (malloc (8)); /* -lefence */
pipeline = gst_pipeline_new ("pipeline");
@@ -15,11 +16,11 @@ int main (int argc, char *argv[])
g_object_set (G_OBJECT (src), "sizetype", 2, NULL);
thread = gst_thread_new ("thread");
-
+
queue = gst_element_factory_make ("queue", "queue");
adder = gst_element_factory_make ("adder", "adder");
sink = gst_element_factory_make ("fakesink", "sink");
-
+
gst_bin_add (GST_BIN (thread), queue);
gst_bin_add (GST_BIN (thread), adder);
gst_bin_add (GST_BIN (thread), sink);
diff --git a/tests/sched/runxml.c b/tests/sched/runxml.c
index d1b2a6dfe..753490761 100644
--- a/tests/sched/runxml.c
+++ b/tests/sched/runxml.c
@@ -5,34 +5,36 @@
static guint outcount, incount;
static void
-buffer_handoff_sink (GstElement *src, GstBuffer *buf, GstElement *bin)
+buffer_handoff_sink (GstElement * src, GstBuffer * buf, GstElement * bin)
{
g_print ("\n\n *** buffer arrived in sink ***\n\n");
- gst_element_set_state(bin, GST_STATE_NULL);
+ gst_element_set_state (bin, GST_STATE_NULL);
outcount++;
}
static void
-buffer_handoff_src (GstElement *src, GstBuffer *buf, GstElement *bin)
+buffer_handoff_src (GstElement * src, GstBuffer * buf, GstElement * bin)
{
g_print ("\n\n *** buffer started in src ***\n\n");
incount++;
}
/* eos will be called when the src element has an end of stream */
-void eos(GstElement *element, gpointer data)
+void
+eos (GstElement * element, gpointer data)
{
- g_print("have eos, quitting\n");
+ g_print ("have eos, quitting\n");
}
-int main(int argc,char *argv[])
+int
+main (int argc, char *argv[])
{
GstXML *xml;
GList *toplevelelements;
gint i = 1;
- gst_init(&argc,&argv);
+ gst_init (&argc, &argv);
if (argc < 2) {
g_print ("usage: %s <xml file>\n", argv[0]);
@@ -41,48 +43,45 @@ int main(int argc,char *argv[])
g_print ("\n *** using testfile %s\n", argv[1]);
- xml = gst_xml_new();
+ xml = gst_xml_new ();
gst_xml_parse_file (xml, argv[1], NULL);
toplevelelements = gst_xml_get_topelements (xml);
while (toplevelelements) {
- GstElement *bin = (GstElement *)toplevelelements->data;
+ GstElement *bin = (GstElement *) toplevelelements->data;
GstElement *src, *sink;
g_print ("\n ***** testcase %d\n", i++);
src = gst_bin_get_by_name (GST_BIN (bin), "fakesrc");
if (src) {
- g_signal_connect (G_OBJECT(src), "handoff",
- G_CALLBACK(buffer_handoff_src), bin);
- }
- else {
+ g_signal_connect (G_OBJECT (src), "handoff",
+ G_CALLBACK (buffer_handoff_src), bin);
+ } else {
g_print ("could not find src element\n");
- exit(-1);
+ exit (-1);
}
-
+
sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink");
if (sink) {
- g_signal_connect (G_OBJECT(sink), "handoff",
- G_CALLBACK(buffer_handoff_sink), bin);
- }
- else {
+ g_signal_connect (G_OBJECT (sink), "handoff",
+ G_CALLBACK (buffer_handoff_sink), bin);
+ } else {
g_print ("could not find sink element\n");
- exit(-1);
+ exit (-1);
}
incount = 0;
outcount = 0;
/* gst_element_set_state(bin, GST_STATE_READY); */
- gst_element_set_state(bin, GST_STATE_PLAYING);
+ gst_element_set_state (bin, GST_STATE_PLAYING);
if (GST_IS_THREAD (bin)) {
g_usleep (G_USEC_PER_SEC);
- }
- else {
- gst_bin_iterate(GST_BIN(bin));
+ } else {
+ gst_bin_iterate (GST_BIN (bin));
}
if (outcount != 1 && incount != 1) {
@@ -93,5 +92,5 @@ int main(int argc,char *argv[])
toplevelelements = g_list_next (toplevelelements);
}
- exit(0);
+ exit (0);
}
diff --git a/tests/sched/sched-stress.c b/tests/sched/sched-stress.c
index 28cccc6b5..34981598f 100644
--- a/tests/sched/sched-stress.c
+++ b/tests/sched/sched-stress.c
@@ -2,17 +2,17 @@
#define TAILLE 100
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
GstElement *bin, *src, *dec, *sink;
int i, j;
gst_init (&argc, &argv);
- free (malloc (8)); /* -lefence */
+ free (malloc (8)); /* -lefence */
- for(i = 0; i < TAILLE; i++)
- {
+ for (i = 0; i < TAILLE; i++) {
bin = gst_pipeline_new ("pipeline");
src = gst_element_factory_make ("fakesrc", "source");
dec = gst_element_factory_make ("identity", "decoder");
@@ -20,11 +20,10 @@ int main (int argc, char *argv[])
gst_bin_add_many (GST_BIN (bin), src, dec, sink, NULL);
gst_element_link_many (src, dec, sink, NULL);
gst_element_set_state (bin, GST_STATE_PLAYING);
- for(j = 0; j < 30; j++)
- gst_bin_iterate(GST_BIN(bin));
+ for (j = 0; j < 30; j++)
+ gst_bin_iterate (GST_BIN (bin));
gst_element_set_state (bin, GST_STATE_PAUSED);
}
return 0;
}
-