-testprogs = thread1 thread2 thread3 thread4 thread5 threadb
+testprogs = thread1 thread2 thread3 thread4 thread5
+testsfailing = threadb
TESTS = $(testprogs)
check_PROGRAMS = $(testprogs)
+noinst_PROGRAMS = $(testsfailing)
+
LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
+CFLAGS = $(GST_CFLAGS)
thread1_SOURCES = thread.c
thread1_CFLAGS = -DTESTNUM=1
GstElement *src, *sink, *queue, *identity, *thread;
src = gst_element_factory_make ("fakesrc", NULL);
- sink = gst_element_factory_make ("fakesink", NULL);
+ sink = gst_element_factory_make ("fakesink", "sink");
identity = gst_element_factory_make ("identity", NULL);
queue = gst_element_factory_make ("queue", NULL);
thread = gst_element_factory_make ("thread", NULL);
}
if (TESTNUM == 3) {
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("running2 ...\n");
+ g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL);
}
gint run;
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("running3 ...\n");
+ g_print ("running ...\n");
for (run = 0; run < 3; run++) {
gst_bin_iterate (GST_BIN (pipeline));
}
GstElement *sink;
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
+ g_assert (sink);
- g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (change_state), pipeline);
+ g_signal_connect (G_OBJECT (sink), "handoff",
+ G_CALLBACK (change_state), pipeline);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("running3 ...\n");
+ g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL);
}
void
state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data)
{
- g_print ("element %s has changed state\n", GST_ELEMENT_NAME (el));
+ static gboolean running = FALSE;
+ GstElementState state = gst_element_get_state (el);
+
+ g_print ("element %s has changed state to %s\n",
+ GST_ELEMENT_NAME (el),
+ gst_element_state_get_name (state));
+ if (state == GST_STATE_PLAYING) running = TRUE;
+ /* if we move from PLAYING to PAUSED, we're done */
+ if (state == GST_STATE_PAUSED && running) gst_main_quit ();
}
int
g_assert (thread);
/* connect state change signal */
- g_signal_connect (G_OBJECT (thread), "state_change", state_changed, NULL);
+ g_signal_connect (G_OBJECT (thread), "state_change",
+ G_CALLBACK (state_changed), NULL);
construct_pipeline (thread);
g_print ("Setting thread to play\n");
g_print ("Going into the main GStreamer loop\n");
gst_main ();
+ g_print ("Coming out of the main GStreamer loop\n");
return 0;
}
-testprogs = thread1 thread2 thread3 thread4 thread5 threadb
+testprogs = thread1 thread2 thread3 thread4 thread5
+testsfailing = threadb
TESTS = $(testprogs)
check_PROGRAMS = $(testprogs)
+noinst_PROGRAMS = $(testsfailing)
+
LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
+CFLAGS = $(GST_CFLAGS)
thread1_SOURCES = thread.c
thread1_CFLAGS = -DTESTNUM=1
GstElement *src, *sink, *queue, *identity, *thread;
src = gst_element_factory_make ("fakesrc", NULL);
- sink = gst_element_factory_make ("fakesink", NULL);
+ sink = gst_element_factory_make ("fakesink", "sink");
identity = gst_element_factory_make ("identity", NULL);
queue = gst_element_factory_make ("queue", NULL);
thread = gst_element_factory_make ("thread", NULL);
}
if (TESTNUM == 3) {
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("running2 ...\n");
+ g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL);
}
gint run;
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("running3 ...\n");
+ g_print ("running ...\n");
for (run = 0; run < 3; run++) {
gst_bin_iterate (GST_BIN (pipeline));
}
GstElement *sink;
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
+ g_assert (sink);
- g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (change_state), pipeline);
+ g_signal_connect (G_OBJECT (sink), "handoff",
+ G_CALLBACK (change_state), pipeline);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("running3 ...\n");
+ g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL);
}
void
state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data)
{
- g_print ("element %s has changed state\n", GST_ELEMENT_NAME (el));
+ static gboolean running = FALSE;
+ GstElementState state = gst_element_get_state (el);
+
+ g_print ("element %s has changed state to %s\n",
+ GST_ELEMENT_NAME (el),
+ gst_element_state_get_name (state));
+ if (state == GST_STATE_PLAYING) running = TRUE;
+ /* if we move from PLAYING to PAUSED, we're done */
+ if (state == GST_STATE_PAUSED && running) gst_main_quit ();
}
int
g_assert (thread);
/* connect state change signal */
- g_signal_connect (G_OBJECT (thread), "state_change", state_changed, NULL);
+ g_signal_connect (G_OBJECT (thread), "state_change",
+ G_CALLBACK (state_changed), NULL);
construct_pipeline (thread);
g_print ("Setting thread to play\n");
g_print ("Going into the main GStreamer loop\n");
gst_main ();
+ g_print ("Coming out of the main GStreamer loop\n");
return 0;
}