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