mainloop test and some caps fixes that had to go in

Original commit message from CVS:
mainloop test
and some caps fixes that had to go in
This commit is contained in:
Thomas Vander Stichele 2002-10-29 17:45:02 +00:00
parent de8df7b917
commit b60d8fe04c
6 changed files with 86 additions and 20 deletions

View file

@ -93,31 +93,31 @@ main (int argc, char *argv[])
gst_init (&argc, &argv);
testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps));
g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps));
g_print ("4 <-> 1 == %d (valid, subset)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
g_print ("1 <-> 4 == %d (invalid, superset)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3));
g_print ("2 <-> 5 == %d (valid)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps));
g_print ("5 <-> 2 == %d (invalid)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3));
g_print ("3 <-> 5 == %d (valid)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps));
g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps));
g_print ("2 <-> 2 == %d (valid, same caps)\n", testret);
return 0;

View file

@ -3,7 +3,7 @@ tests_failing = element bin element_pad pad
else
tests_failing =
endif
tests_working =
tests_working = mainloop
element_SOURCES = element.c mem.c
pad_SOURCES = pad.c mem.c

View file

@ -0,0 +1,33 @@
#include <gst/gst.h>
/* test to make sure that we can do gst_main and gst_main_quit in succession */
/* FIXME: use mutexes */
gboolean mainloop = FALSE;
static gboolean
quit_main (gpointer data)
{
if (mainloop)
{
mainloop = FALSE;
g_print ("-");
gst_main_quit ();
}
return TRUE;
}
int
main (int argc, gchar *argv[])
{
int i;
g_timeout_add (10, quit_main, NULL);
for (i = 0; i < 1000; ++i)
{
mainloop = TRUE;
g_print ("+");
gst_main ();
}
return 0;
}

View file

@ -93,31 +93,31 @@ main (int argc, char *argv[])
gst_init (&argc, &argv);
testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (rawcaps));
g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (mp1parsecaps), GST_CAPS_GET (sinkcaps));
g_print ("4 <-> 1 == %d (valid, subset)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (sinkcaps), GST_CAPS_GET (mp1parsecaps));
g_print ("1 <-> 4 == %d (invalid, superset)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps2));
g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps3));
g_print ("2 <-> 5 == %d (valid)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps3), GST_CAPS_GET (rawcaps));
g_print ("5 <-> 2 == %d (invalid)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps3));
g_print ("3 <-> 5 == %d (valid)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps2), GST_CAPS_GET (rawcaps));
g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret);
testret = gst_caps_check_compatibility (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps));
testret = gst_caps_is_always_compatible (GST_CAPS_GET (rawcaps), GST_CAPS_GET (rawcaps));
g_print ("2 <-> 2 == %d (valid, same caps)\n", testret);
return 0;

View file

@ -3,7 +3,7 @@ tests_failing = element bin element_pad pad
else
tests_failing =
endif
tests_working =
tests_working = mainloop
element_SOURCES = element.c mem.c
pad_SOURCES = pad.c mem.c

View file

@ -0,0 +1,33 @@
#include <gst/gst.h>
/* test to make sure that we can do gst_main and gst_main_quit in succession */
/* FIXME: use mutexes */
gboolean mainloop = FALSE;
static gboolean
quit_main (gpointer data)
{
if (mainloop)
{
mainloop = FALSE;
g_print ("-");
gst_main_quit ();
}
return TRUE;
}
int
main (int argc, gchar *argv[])
{
int i;
g_timeout_add (10, quit_main, NULL);
for (i = 0; i < 1000; ++i)
{
mainloop = TRUE;
g_print ("+");
gst_main ();
}
return 0;
}