|
1 #ifndef __GST_PARSE_TYPES_H__ |
|
2 #define __GST_PARSE_TYPES_H__ |
|
3 |
|
4 #include <glib-object.h> |
|
5 #include "../gstelement.h" |
|
6 |
|
7 typedef struct { |
|
8 GstElement *src; |
|
9 GstElement *sink; |
|
10 gchar *src_name; |
|
11 gchar *sink_name; |
|
12 GSList *src_pads; |
|
13 GSList *sink_pads; |
|
14 GstCaps *caps; |
|
15 } link_t; |
|
16 |
|
17 typedef struct { |
|
18 GSList *elements; |
|
19 GstElement *first; |
|
20 GstElement *last; |
|
21 link_t *front; |
|
22 link_t *back; |
|
23 } chain_t; |
|
24 |
|
25 typedef struct _graph_t graph_t; |
|
26 struct _graph_t { |
|
27 chain_t *chain; /* links are supposed to be done now */ |
|
28 GSList *links; |
|
29 GError **error; |
|
30 }; |
|
31 |
|
32 |
|
33 /* |
|
34 * Memory checking. Should probably be done with gsttrace stuff, but that |
|
35 * doesn't really work. |
|
36 * This is not safe from reentrance issues, but that doesn't matter as long as |
|
37 * we lock a mutex before parsing anyway. |
|
38 */ |
|
39 #ifdef GST_DEBUG_ENABLED |
|
40 # define __GST_PARSE_TRACE |
|
41 #endif |
|
42 |
|
43 #ifdef __GST_PARSE_TRACE |
|
44 gchar *__gst_parse_strdup (gchar *org); |
|
45 void __gst_parse_strfree (gchar *str); |
|
46 link_t *__gst_parse_link_new (); |
|
47 void __gst_parse_link_free (link_t *data); |
|
48 chain_t *__gst_parse_chain_new (); |
|
49 void __gst_parse_chain_free (chain_t *data); |
|
50 # define gst_parse_strdup __gst_parse_strdup |
|
51 # define gst_parse_strfree __gst_parse_strfree |
|
52 # define gst_parse_link_new __gst_parse_link_new |
|
53 # define gst_parse_link_free __gst_parse_link_free |
|
54 # define gst_parse_chain_new __gst_parse_chain_new |
|
55 # define gst_parse_chain_free __gst_parse_chain_free |
|
56 #else /* __GST_PARSE_TRACE */ |
|
57 # define gst_parse_strdup g_strdup |
|
58 # define gst_parse_strfree g_free |
|
59 # define gst_parse_link_new() g_new0 (link_t, 1) |
|
60 # define gst_parse_link_free g_free |
|
61 # define gst_parse_chain_new() g_new0 (chain_t, 1) |
|
62 # define gst_parse_chain_free g_free |
|
63 #endif /* __GST_PARSE_TRACE */ |
|
64 |
|
65 static inline void |
|
66 gst_parse_unescape (gchar *str) |
|
67 { |
|
68 gchar *walk; |
|
69 |
|
70 g_return_if_fail (str != NULL); |
|
71 |
|
72 walk = str; |
|
73 |
|
74 while (*walk) { |
|
75 if (*walk == '\\') |
|
76 walk++; |
|
77 *str = *walk; |
|
78 str++; |
|
79 walk++; |
|
80 } |
|
81 *str = '\0'; |
|
82 } |
|
83 |
|
84 #endif /* __GST_PARSE_TYPES_H__ */ |