2003-12-22 02:11:52 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
test1 (void)
|
2003-12-22 02:11:52 +00:00
|
|
|
{
|
2003-12-22 02:27:18 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstCaps *caps2;
|
2003-12-22 02:11:52 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print ("type is %d\n", (int) gst_caps_get_type ());
|
2003-12-22 02:11:52 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
gst_caps_free (caps);
|
2003-12-22 02:11:52 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
caps = gst_caps_new_any ();
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
gst_caps_free (caps);
|
2003-12-22 02:11:52 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
g_assert (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
2003-12-22 02:27:18 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/raw",
|
2003-12-22 02:11:52 +00:00
|
|
|
"_double", G_TYPE_DOUBLE, 100.0, NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
g_assert (caps != NULL);
|
|
|
|
g_assert (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/raw",
|
|
|
|
"_fourcc", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('a', 'b', 'c', 'd'), NULL);
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
g_assert (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/raw",
|
2003-12-22 02:11:52 +00:00
|
|
|
"_boolean", G_TYPE_BOOLEAN, TRUE, NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
g_assert (caps != NULL);
|
|
|
|
g_assert (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps) == TRUE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps) == TRUE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
|
|
|
|
|
|
|
caps =
|
|
|
|
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
|
2004-03-15 19:27:17 +00:00
|
|
|
100, NULL), gst_structure_new ("audio/raw2", "_int", G_TYPE_INT, 100,
|
|
|
|
NULL), NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
g_assert (caps != NULL);
|
|
|
|
g_assert (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
caps2 = gst_caps_copy (caps);
|
|
|
|
g_assert (caps2 != NULL);
|
|
|
|
g_assert (gst_caps_is_empty (caps2) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps2) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps2) == TRUE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps2) == TRUE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps2));
|
|
|
|
gst_caps_free (caps);
|
|
|
|
gst_caps_free (caps2);
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
|
|
|
gst_caps_append (caps,
|
|
|
|
gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 200, NULL));
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
g_assert (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/raw", "_int", G_TYPE_INT, 100, NULL);
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
gst_caps_append_structure (caps,
|
|
|
|
gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 200, NULL));
|
|
|
|
g_assert (gst_caps_is_empty (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_any (caps) == FALSE);
|
|
|
|
g_assert (GST_CAPS_IS_SIMPLE (caps) == FALSE);
|
|
|
|
g_assert (gst_caps_is_fixed (caps) == FALSE);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
2003-12-22 02:11:52 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
test2 (void)
|
2003-12-22 02:11:52 +00:00
|
|
|
{
|
2003-12-22 02:27:18 +00:00
|
|
|
GstCaps *caps1;
|
|
|
|
GstCaps *caps2;
|
|
|
|
GstCaps *caps;
|
2003-12-22 02:11:52 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
caps1 =
|
|
|
|
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
|
2004-03-15 19:27:17 +00:00
|
|
|
100, NULL), gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 200,
|
|
|
|
NULL), NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
caps2 =
|
|
|
|
gst_caps_new_full (gst_structure_new ("audio/raw", "_int", G_TYPE_INT,
|
2004-03-15 19:27:17 +00:00
|
|
|
100, NULL), gst_structure_new ("audio/raw", "_int", G_TYPE_INT, 300,
|
|
|
|
NULL), NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
caps = gst_caps_intersect (caps1, caps2);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps));
|
|
|
|
gst_caps_free (caps);
|
|
|
|
gst_caps_free (caps1);
|
|
|
|
gst_caps_free (caps2);
|
2003-12-22 02:11:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-05-08 01:41:12 +00:00
|
|
|
void
|
|
|
|
test3 (void)
|
|
|
|
{
|
|
|
|
GstCaps *caps1;
|
|
|
|
GstCaps *caps2;
|
|
|
|
|
|
|
|
caps1 = gst_caps_new_any ();
|
|
|
|
caps2 = gst_caps_new_simple ("audio/raw", NULL);
|
|
|
|
|
|
|
|
gst_caps_append (caps1, caps2);
|
|
|
|
g_print ("%s\n", gst_caps_to_string (caps1));
|
|
|
|
|
|
|
|
g_assert (gst_caps_is_any (caps1));
|
|
|
|
g_assert (gst_caps_get_size (caps1) == 0);
|
|
|
|
|
|
|
|
gst_caps_free (caps1);
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2003-12-22 02:11:52 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_init (&argc, &argv);
|
2003-12-22 02:11:52 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
test1 ();
|
|
|
|
test2 ();
|
2004-05-08 01:41:12 +00:00
|
|
|
test3 ();
|
2003-12-22 02:11:52 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|