gstreamer/testsuite/caps/deserialize.c
Zaheer Abbas Merali 4be4551a62 testsuite/caps/: fix small things to prevent warnings on 64bit
Original commit message from CVS:
2005-05-02  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

* testsuite/caps/deserialize.c: (main):
* testsuite/caps/sets.c: (check_caps):
* testsuite/caps/simplify.c: (check_caps):
fix small things to prevent warnings on 64bit
2005-05-02 12:45:26 +00:00

85 lines
1.6 KiB
C

#include <gst/gst.h>
#include <string.h>
/* The caps_strings file is created using:
*
* grep '^.caps' /home/ds/.gstreamer-0.8/registry.xml | \
* sed 's/^.caps.\(.*\)..caps.$/\1/' | awk '{print length($ln) " " $ln; }' | \
* sort -n | uniq | sed 's/^[^ ]* //' >caps_strings
*
*/
int
main (int argc, char *argv[])
{
char *filename;
char *data;
char **list;
int i;
gsize length;
GstCaps *caps;
gst_init (&argc, &argv);
if (argc > 1) {
filename = g_strdup (argv[1]);
} else {
const char *srcdir = g_getenv ("srcdir");
if (srcdir) {
filename = g_build_filename (srcdir, "caps_strings", NULL);
} else {
filename = g_strdup ("caps_strings");
}
}
if (!g_file_get_contents (filename, &data, &length, NULL)) {
g_print ("could not open file %s\n", filename);
abort ();
}
list = g_strsplit (data, "\n", 0);
for (i = 0; list[i] != NULL; i++) {
if (list[i][0] == 0) {
g_free (list[i]);
continue;
}
caps = gst_caps_from_string (list[i]);
if (caps == NULL) {
char **list2;
int j;
g_print ("Could not parse: %s\n", list[i]);
g_print ("Trying each structure...\n");
list2 = g_strsplit (list[i], ";", 0);
for (j = 0; list2[j] != NULL; j++) {
caps = gst_caps_from_string (list2[j]);
if (caps == NULL) {
g_print ("Could not parse %s\n", list2[j]);
abort ();
}
gst_caps_free (caps);
}
g_print ("parsed each structure individually\n");
abort ();
}
gst_caps_free (caps);
g_free (list[i]);
}
g_free (list);
g_free (data);
g_free (filename);
return 0;
}