2004-05-04 01:58:36 +00:00
|
|
|
|
|
|
|
#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[])
|
|
|
|
{
|
2004-05-04 02:30:11 +00:00
|
|
|
char *filename;
|
2004-05-04 01:58:36 +00:00
|
|
|
char *data;
|
|
|
|
char **list;
|
|
|
|
int i;
|
2005-05-02 12:45:26 +00:00
|
|
|
gsize length;
|
2004-05-04 01:58:36 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
2004-05-04 02:30:11 +00:00
|
|
|
if (argc > 1) {
|
|
|
|
filename = g_strdup (argv[1]);
|
|
|
|
} else {
|
|
|
|
const char *srcdir = g_getenv ("srcdir");
|
|
|
|
|
|
|
|
if (srcdir) {
|
2004-05-04 06:23:48 +00:00
|
|
|
filename = g_build_filename (srcdir, "caps_strings", NULL);
|
2004-05-04 02:30:11 +00:00
|
|
|
} else {
|
|
|
|
filename = g_strdup ("caps_strings");
|
|
|
|
}
|
|
|
|
}
|
2004-05-04 01:58:36 +00:00
|
|
|
|
|
|
|
if (!g_file_get_contents (filename, &data, &length, NULL)) {
|
2004-05-04 06:23:48 +00:00
|
|
|
g_print ("could not open file %s\n", filename);
|
2004-05-04 01:58:36 +00:00
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
list = g_strsplit (data, "\n", 0);
|
|
|
|
|
|
|
|
for (i = 0; list[i] != NULL; i++) {
|
2004-05-04 02:30:11 +00:00
|
|
|
if (list[i][0] == 0) {
|
|
|
|
g_free (list[i]);
|
2004-05-04 01:58:36 +00:00
|
|
|
continue;
|
2004-05-04 02:30:11 +00:00
|
|
|
}
|
2004-05-04 01:58:36 +00:00
|
|
|
|
|
|
|
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);
|
2004-05-04 02:30:11 +00:00
|
|
|
g_free (filename);
|
2004-05-04 01:58:36 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|