mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
More test cases for EOS handling
Original commit message from CVS: More test cases for EOS handling
This commit is contained in:
parent
fdadef86d9
commit
029e7bfbd9
6 changed files with 250 additions and 5 deletions
5
tests/eos/.gitignore
vendored
5
tests/eos/.gitignore
vendored
|
@ -7,3 +7,8 @@ Makefile.in
|
|||
.libs
|
||||
*.xml
|
||||
case1
|
||||
case2
|
||||
case3
|
||||
case4
|
||||
case5
|
||||
case6
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
noinst_PROGRAMS = case1 #case2 case3
|
||||
noinst_PROGRAMS = case1 case2 case3 case4 case5 case6
|
||||
|
||||
# jsut apps here, this is safe
|
||||
LIBS += $(GST_LIBS)
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
gboolean playing = TRUE;
|
||||
|
||||
static void
|
||||
eos_signal_element (GstElement *element)
|
||||
eos_signal_element (GstElement *element)
|
||||
{
|
||||
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
}
|
||||
|
||||
static void
|
||||
eos_signal (GstElement *element)
|
||||
eos_signal (GstElement *element)
|
||||
{
|
||||
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
|
||||
playing = FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
GstBin *pipeline;
|
||||
GstElement *src,*identity,*sink;
|
||||
|
|
79
tests/eos/case4.c
Normal file
79
tests/eos/case4.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
gboolean playing = TRUE;
|
||||
|
||||
static void
|
||||
eos_signal_element (GstElement *element)
|
||||
{
|
||||
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
}
|
||||
|
||||
static void
|
||||
eos_signal (GstElement *element)
|
||||
{
|
||||
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
|
||||
playing = FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
GstBin *pipeline, *pipeline2;
|
||||
GstElement *src,*identity,*sink;
|
||||
GstElement *src2,*identity2,*sink2;
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
|
||||
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
|
||||
g_return_val_if_fail(pipeline != NULL, 1);
|
||||
|
||||
src = gst_elementfactory_make("fakesrc","src");
|
||||
gtk_object_set (GTK_OBJECT (src), "num_buffers", 1, NULL);
|
||||
g_return_val_if_fail(src != NULL, 2);
|
||||
|
||||
identity = gst_elementfactory_make("identity","identity");
|
||||
g_return_val_if_fail(identity != NULL, 3);
|
||||
|
||||
sink = gst_elementfactory_make("fakesink","sink");
|
||||
g_return_val_if_fail(sink != NULL, 4);
|
||||
|
||||
pipeline2 = GST_BIN(gst_pipeline_new("pipeline2"));
|
||||
g_return_val_if_fail(pipeline2 != NULL, 1);
|
||||
|
||||
gst_bin_add(pipeline2,GST_ELEMENT(src));
|
||||
gst_bin_add(pipeline2,GST_ELEMENT(identity));
|
||||
gst_bin_add(pipeline2,GST_ELEMENT(sink));
|
||||
|
||||
gst_bin_add(pipeline,GST_ELEMENT(pipeline2));
|
||||
|
||||
gst_element_connect(src,"src",identity,"sink");
|
||||
gst_element_connect(identity,"src",sink,"sink");
|
||||
|
||||
src2 = gst_elementfactory_make("fakesrc","src2");
|
||||
gtk_object_set (GTK_OBJECT (src2), "num_buffers", 3, NULL);
|
||||
g_return_val_if_fail(src2 != NULL, 2);
|
||||
|
||||
identity2 = gst_elementfactory_make("identity","identity2");
|
||||
g_return_val_if_fail(identity2 != NULL, 3);
|
||||
|
||||
sink2 = gst_elementfactory_make("fakesink","sink2");
|
||||
g_return_val_if_fail(sink2 != NULL, 4);
|
||||
|
||||
gst_bin_add(pipeline,GST_ELEMENT(src2));
|
||||
gst_bin_add(pipeline,GST_ELEMENT(identity2));
|
||||
gst_bin_add(pipeline,GST_ELEMENT(sink2));
|
||||
|
||||
gst_element_connect(src2,"src",identity2,"sink");
|
||||
gst_element_connect(identity2,"src",sink2,"sink");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (src), "eos", eos_signal_element, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (pipeline), "eos", eos_signal, NULL);
|
||||
|
||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
||||
|
||||
while (playing)
|
||||
gst_bin_iterate(pipeline);
|
||||
|
||||
exit (0);
|
||||
}
|
82
tests/eos/case5.c
Normal file
82
tests/eos/case5.c
Normal file
|
@ -0,0 +1,82 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
gboolean playing = TRUE;
|
||||
|
||||
static void
|
||||
eos_signal_element (GstElement *element)
|
||||
{
|
||||
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
}
|
||||
|
||||
static void
|
||||
eos_signal (GstElement *element)
|
||||
{
|
||||
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
|
||||
playing = FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
GstBin *pipeline, *thread;
|
||||
GstElement *src,*identity,*sink;
|
||||
GstElement *src2,*identity2,*sink2;
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
|
||||
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
|
||||
g_return_val_if_fail(pipeline != NULL, 1);
|
||||
|
||||
src = gst_elementfactory_make("fakesrc","src");
|
||||
gtk_object_set (GTK_OBJECT (src), "num_buffers", 1, NULL);
|
||||
g_return_val_if_fail(src != NULL, 2);
|
||||
|
||||
identity = gst_elementfactory_make("identity","identity");
|
||||
g_return_val_if_fail(identity != NULL, 3);
|
||||
|
||||
sink = gst_elementfactory_make("fakesink","sink");
|
||||
g_return_val_if_fail(sink != NULL, 4);
|
||||
|
||||
thread = GST_BIN(gst_thread_new("thread"));
|
||||
g_return_val_if_fail(thread != NULL, 1);
|
||||
|
||||
gst_bin_add(thread,GST_ELEMENT(src));
|
||||
gst_bin_add(thread,GST_ELEMENT(identity));
|
||||
gst_bin_add(thread,GST_ELEMENT(sink));
|
||||
|
||||
gst_bin_add(pipeline,GST_ELEMENT(thread));
|
||||
|
||||
gst_element_connect(src,"src",identity,"sink");
|
||||
gst_element_connect(identity,"src",sink,"sink");
|
||||
|
||||
src2 = gst_elementfactory_make("fakesrc","src2");
|
||||
gtk_object_set (GTK_OBJECT (src2), "num_buffers", 4, NULL);
|
||||
g_return_val_if_fail(src2 != NULL, 2);
|
||||
|
||||
identity2 = gst_elementfactory_make("identity","identity2");
|
||||
g_return_val_if_fail(identity2 != NULL, 3);
|
||||
|
||||
sink2 = gst_elementfactory_make("fakesink","sink2");
|
||||
g_return_val_if_fail(sink2 != NULL, 4);
|
||||
|
||||
gst_bin_add(pipeline,GST_ELEMENT(src2));
|
||||
gst_bin_add(pipeline,GST_ELEMENT(identity2));
|
||||
gst_bin_add(pipeline,GST_ELEMENT(sink2));
|
||||
|
||||
gst_element_connect(src2,"src",identity2,"sink");
|
||||
gst_element_connect(identity2,"src",sink2,"sink");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (src), "eos", eos_signal_element, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (src2), "eos", eos_signal_element, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (pipeline), "eos", eos_signal, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (thread), "eos", eos_signal_element, NULL);
|
||||
|
||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
||||
|
||||
while (gst_bin_iterate(pipeline));
|
||||
|
||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_NULL);
|
||||
|
||||
exit (0);
|
||||
}
|
79
tests/eos/case6.c
Normal file
79
tests/eos/case6.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
gboolean playing = TRUE;
|
||||
|
||||
static void
|
||||
eos_signal_element (GstElement *element)
|
||||
{
|
||||
g_print ("element eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
}
|
||||
|
||||
static void
|
||||
eos_signal (GstElement *element)
|
||||
{
|
||||
g_print ("eos received from \"%s\"\n", gst_element_get_name (element));
|
||||
|
||||
playing = FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc,char *argv[])
|
||||
{
|
||||
GstBin *pipeline, *thread;
|
||||
GstElement *queue,*identity,*sink;
|
||||
GstElement *src2, *identity2;
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
|
||||
pipeline = GST_BIN(gst_pipeline_new("pipeline"));
|
||||
g_return_val_if_fail(pipeline != NULL, 1);
|
||||
|
||||
src2 = gst_elementfactory_make("fakesrc","src2");
|
||||
gtk_object_set (GTK_OBJECT (src2), "num_buffers", 4, NULL);
|
||||
g_return_val_if_fail(src2 != NULL, 2);
|
||||
|
||||
identity2 = gst_elementfactory_make("identity","identity2");
|
||||
g_return_val_if_fail(identity2 != NULL, 3);
|
||||
|
||||
queue = gst_elementfactory_make("queue","queue");
|
||||
gtk_object_set (GTK_OBJECT (queue), "max_level", 1, NULL);
|
||||
g_return_val_if_fail(queue != NULL, 4);
|
||||
|
||||
gst_element_connect(src2,"src",identity2,"sink");
|
||||
gst_element_connect(identity2,"src",queue,"sink");
|
||||
|
||||
gst_bin_add(pipeline,GST_ELEMENT(src2));
|
||||
gst_bin_add(pipeline,GST_ELEMENT(identity2));
|
||||
gst_bin_add(pipeline,GST_ELEMENT(queue));
|
||||
|
||||
identity = gst_elementfactory_make("identity","identity");
|
||||
//gtk_object_set (GTK_OBJECT (identity), "sleep_time", 1000000, NULL);
|
||||
g_return_val_if_fail(identity != NULL, 3);
|
||||
|
||||
sink = gst_elementfactory_make("fakesink","sink");
|
||||
g_return_val_if_fail(sink != NULL, 3);
|
||||
|
||||
thread = GST_BIN(gst_thread_new("thread"));
|
||||
g_return_val_if_fail(thread != NULL, 1);
|
||||
|
||||
gst_bin_add(thread,GST_ELEMENT(identity));
|
||||
gst_bin_add(thread,GST_ELEMENT(sink));
|
||||
|
||||
gst_bin_add(pipeline,GST_ELEMENT(thread));
|
||||
|
||||
gst_element_connect(queue,"src",identity,"sink");
|
||||
gst_element_connect(identity,"src",sink,"sink");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (src2), "eos", eos_signal_element, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (queue), "eos", eos_signal_element, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (pipeline), "eos", eos_signal, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (thread), "eos", eos_signal_element, NULL);
|
||||
|
||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
||||
|
||||
while (gst_bin_iterate(pipeline));
|
||||
|
||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_NULL);
|
||||
|
||||
exit (0);
|
||||
}
|
Loading…
Reference in a new issue