element: Enforce that elements created by gst_element_factory_create/make() are floating
[platform/upstream/gstreamer.git] / gst / parse / types.h
index db1f585..5dbb959 100644 (file)
@@ -6,21 +6,22 @@
 #include "../gstparse.h"
 
 typedef struct {
-  GstElement *src;
-  GstElement *sink;
-  gchar *src_name;
-  gchar *sink_name;
-  GSList *src_pads;
-  GSList *sink_pads;
+  GstElement *element;
+  gchar *name;
+  GSList *pads;
+} reference_t;
+
+typedef struct {
+  reference_t src;
+  reference_t sink;
   GstCaps *caps;
+  gboolean all_pads;
 } link_t;
 
 typedef struct {
   GSList *elements;
-  GstElement *first;
-  GstElement *last;
-  link_t *front;
-  link_t *back;
+  reference_t first;
+  reference_t last;
 } chain_t;
 
 typedef struct _graph_t graph_t;
@@ -38,18 +39,22 @@ struct _graph_t {
  * doesn't really work.
  * This is not safe from reentrance issues, but that doesn't matter as long as
  * we lock a mutex before parsing anyway.
+ *
+ * FIXME: Disable this for now for the above reasons
  */
+#if 0
 #ifdef GST_DEBUG_ENABLED
 #  define __GST_PARSE_TRACE
 #endif
+#endif
 
 #ifdef __GST_PARSE_TRACE
-gchar  *__gst_parse_strdup (gchar *org);
-void   __gst_parse_strfree (gchar *str);
-link_t *__gst_parse_link_new ();
-void   __gst_parse_link_free (link_t *data);
-chain_t *__gst_parse_chain_new ();
-void   __gst_parse_chain_free (chain_t *data);
+G_GNUC_INTERNAL  gchar  *__gst_parse_strdup (gchar *org);
+G_GNUC_INTERNAL  void  __gst_parse_strfree (gchar *str);
+G_GNUC_INTERNAL  link_t *__gst_parse_link_new (void);
+G_GNUC_INTERNAL  void  __gst_parse_link_free (link_t *data);
+G_GNUC_INTERNAL  chain_t *__gst_parse_chain_new (void);
+G_GNUC_INTERNAL  void  __gst_parse_chain_free (chain_t *data);
 #  define gst_parse_strdup __gst_parse_strdup
 #  define gst_parse_strfree __gst_parse_strfree
 #  define gst_parse_link_new __gst_parse_link_new
@@ -59,10 +64,10 @@ void        __gst_parse_chain_free (chain_t *data);
 #else /* __GST_PARSE_TRACE */
 #  define gst_parse_strdup g_strdup
 #  define gst_parse_strfree g_free
-#  define gst_parse_link_new() g_new0 (link_t, 1)
-#  define gst_parse_link_free g_free
-#  define gst_parse_chain_new() g_new0 (chain_t, 1)
-#  define gst_parse_chain_free g_free
+#  define gst_parse_link_new() g_slice_new0 (link_t)
+#  define gst_parse_link_free(l) g_slice_free (link_t, l)
+#  define gst_parse_chain_new() g_slice_new0 (chain_t)
+#  define gst_parse_chain_free(c) g_slice_free (chain_t, c)
 #endif /* __GST_PARSE_TRACE */
 
 static inline void
@@ -76,14 +81,15 @@ gst_parse_unescape (gchar *str)
   walk = str;
   in_quotes = FALSE;
 
+  GST_DEBUG ("unescaping %s", str);
+
   while (*walk) {
     if (*walk == '\\' && !in_quotes) {
       walk++;
       /* make sure we don't read beyond the end of the string */
       if (*walk == '\0')
         break;
-    } else if (*walk == '"' && (!in_quotes || (in_quotes
-                && (*(walk - 1) != '\\')))) {
+    } else if (*walk == '"' && (!in_quotes || *(walk - 1) != '\\')) {
       /* don't unescape inside quotes and don't switch
        * state with escaped quoted inside quotes */
       in_quotes = !in_quotes;
@@ -95,7 +101,9 @@ gst_parse_unescape (gchar *str)
   *str = '\0';
 }
 
-GstElement *_gst_parse_launch (const gchar *, GError **,
-    GstParseContext *, GstParseFlags);
+G_GNUC_INTERNAL GstElement *priv_gst_parse_launch (const gchar      * str,
+                                                   GError          ** err,
+                                                   GstParseContext  * ctx,
+                                                   GstParseFlags      flags);
 
 #endif /* __GST_PARSE_TYPES_H__ */