gstreamer/testsuite/caps2/caps.c
David Schleef 63ee736634 Global change from "caps2" to "caps". Script is: #!/bin/sh find . -name '*.[chy]' -exec perl -i -p \
Original commit message from CVS:
Global change from "caps2" to "caps".  Script is:
#!/bin/sh

find . -name '*.[chy]' -exec perl -i -p \
-e 's/gst_static_caps2_/gst_static_caps_/g;\
s/GST_CAPS2_/GST_CAPS_/g;\
s/gst_caps2_/gst_caps_/g;\
s/GstCaps2/GstCaps/g;\
s/GstStaticCaps2/GstStaticCaps/g;\
s/GST_STATIC_CAPS2_/GST_STATIC_CAPS_/g;\
s/GST_TYPE_CAPS2/GST_TYPE_CAPS/g;\
s/gst_caps_get_nth_cap/gst_caps_get_structure/g;\
s/gst_caps_get_n_structures/gst_caps_get_size/g;\
s/gst_caps_append_cap/gst_caps_append_structure/g;\
s/GST_CAPS2_/GST_CAPS_/g;' \
{} \;
2003-12-21 22:33:42 +00:00

140 lines
4.2 KiB
C

#include <gst/gst.h>
void test1(void)
{
GstCaps *caps;
GstCaps *caps2;
g_print("type is %d\n", (int)gst_caps_get_type());
caps = gst_caps_new_empty();
g_assert(caps != NULL);
gst_caps_free(caps);
caps = gst_caps_new_any();
g_assert(caps != NULL);
gst_caps_free(caps);
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_chained(caps)==FALSE);
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",
"_double", G_TYPE_DOUBLE, 100.0, 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_chained(caps)==FALSE);
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_chained(caps)==FALSE);
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",
"_boolean", G_TYPE_BOOLEAN, TRUE, 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_chained(caps)==FALSE);
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, 100, NULL),
gst_structure_new("audio/raw2", "_int", G_TYPE_INT, 100, NULL),
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_chained(caps)==TRUE);
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_chained(caps2)==FALSE);
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_chained(caps)==TRUE);
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_chained(caps)==TRUE);
g_assert(gst_caps_is_fixed(caps)==FALSE);
g_print("%s\n", gst_caps_to_string(caps));
gst_caps_free(caps);
}
void test2(void)
{
GstCaps *caps1;
GstCaps *caps2;
GstCaps *caps;
caps1 = gst_caps_new_full(
gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
gst_structure_new("audio/raw", "_int", G_TYPE_INT, 200, NULL),
NULL);
caps2 = gst_caps_new_full(
gst_structure_new("audio/raw", "_int", G_TYPE_INT, 100, NULL),
gst_structure_new("audio/raw", "_int", G_TYPE_INT, 300, NULL),
NULL);
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);
}
int main(int argc, char *argv[])
{
gst_init(&argc, &argv);
test1();
test2();
return 0;
}