Revision 21005,
1.6 KB
checked in by ghudson, 20 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r21004,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | |
---|
2 | #include <gst/gst.h> |
---|
3 | #include <string.h> |
---|
4 | |
---|
5 | /* The caps_strings file is created using: |
---|
6 | * |
---|
7 | * grep '^.caps' /home/ds/.gstreamer-0.8/registry.xml | \ |
---|
8 | * sed 's/^.caps.\(.*\)..caps.$/\1/' | awk '{print length($ln) " " $ln; }' | \ |
---|
9 | * sort -n | uniq | sed 's/^[^ ]* //' >caps_strings |
---|
10 | * |
---|
11 | */ |
---|
12 | |
---|
13 | |
---|
14 | int |
---|
15 | main (int argc, char *argv[]) |
---|
16 | { |
---|
17 | char *filename; |
---|
18 | char *data; |
---|
19 | char **list; |
---|
20 | int i; |
---|
21 | int length; |
---|
22 | GstCaps *caps; |
---|
23 | |
---|
24 | gst_init (&argc, &argv); |
---|
25 | |
---|
26 | if (argc > 1) { |
---|
27 | filename = g_strdup (argv[1]); |
---|
28 | } else { |
---|
29 | const char *srcdir = g_getenv ("srcdir"); |
---|
30 | |
---|
31 | if (srcdir) { |
---|
32 | filename = g_build_filename (srcdir, "caps_strings", NULL); |
---|
33 | } else { |
---|
34 | filename = g_strdup ("caps_strings"); |
---|
35 | } |
---|
36 | } |
---|
37 | |
---|
38 | if (!g_file_get_contents (filename, &data, &length, NULL)) { |
---|
39 | g_print ("could not open file %s\n", filename); |
---|
40 | abort (); |
---|
41 | } |
---|
42 | |
---|
43 | list = g_strsplit (data, "\n", 0); |
---|
44 | |
---|
45 | for (i = 0; list[i] != NULL; i++) { |
---|
46 | if (list[i][0] == 0) { |
---|
47 | g_free (list[i]); |
---|
48 | continue; |
---|
49 | } |
---|
50 | |
---|
51 | caps = gst_caps_from_string (list[i]); |
---|
52 | if (caps == NULL) { |
---|
53 | char **list2; |
---|
54 | int j; |
---|
55 | |
---|
56 | g_print ("Could not parse: %s\n", list[i]); |
---|
57 | g_print ("Trying each structure...\n"); |
---|
58 | |
---|
59 | list2 = g_strsplit (list[i], ";", 0); |
---|
60 | |
---|
61 | for (j = 0; list2[j] != NULL; j++) { |
---|
62 | caps = gst_caps_from_string (list2[j]); |
---|
63 | |
---|
64 | if (caps == NULL) { |
---|
65 | g_print ("Could not parse %s\n", list2[j]); |
---|
66 | abort (); |
---|
67 | } |
---|
68 | |
---|
69 | gst_caps_free (caps); |
---|
70 | } |
---|
71 | |
---|
72 | g_print ("parsed each structure individually\n"); |
---|
73 | abort (); |
---|
74 | } |
---|
75 | |
---|
76 | gst_caps_free (caps); |
---|
77 | g_free (list[i]); |
---|
78 | } |
---|
79 | |
---|
80 | g_free (list); |
---|
81 | g_free (data); |
---|
82 | g_free (filename); |
---|
83 | |
---|
84 | return 0; |
---|
85 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.