validate: Make GstValidateActionType a GstMiniObject and expose it in the API
authorThibault Saunier <thibault.saunier@collabora.com>
Wed, 13 Aug 2014 18:47:24 +0000 (20:47 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Fri, 5 Sep 2014 17:00:23 +0000 (19:00 +0200)
validate/gst/validate/gst-validate-scenario.c
validate/gst/validate/gst-validate-scenario.h

index 8fa70ae9165ab34a86a55fdd711f3ad30ba5c4a0..95d57d261e0b65073ac62bf17ffa733fafcd7c8d 100644 (file)
@@ -63,14 +63,6 @@ static void gst_validate_scenario_dispose (GObject * object);
 static void gst_validate_scenario_finalize (GObject * object);
 static GRegex *clean_action_str;
 
-typedef struct _GstValidateActionType
-{
-  GstValidateExecuteAction execute;
-  gchar **mandatory_fields;
-  gchar *description;
-  gboolean is_config;
-} GstValidateActionType;
-
 struct _GstValidateScenarioPrivate
 {
   GstValidateRunner *runner;
@@ -185,6 +177,36 @@ gst_validate_action_new (void)
   return action;
 }
 
+/* GstValidateActionType implementation */
+GType _gst_validate_action_type_type;
+GST_DEFINE_MINI_OBJECT_TYPE (GstValidateActionType, gst_validate_action_type);
+static GstValidateActionType *gst_validate_action_type_new (void);
+
+static void
+_action_type_free (GstValidateActionType * type)
+{
+  g_strfreev (type->mandatory_fields);
+  g_free (type->description);
+}
+
+static void
+gst_validate_action_type_init (GstValidateActionType * type)
+{
+  gst_mini_object_init ((GstMiniObject *) type, 0,
+      _gst_validate_action_type_type, NULL, NULL,
+      (GstMiniObjectFreeFunction) _action_type_free);
+}
+
+GstValidateActionType *
+gst_validate_action_type_new (void)
+{
+  GstValidateActionType *type = g_slice_new0 (GstValidateActionType);
+
+  gst_validate_action_type_init (type);
+
+  return type;
+}
+
 static gboolean
 _set_variable_func (const gchar * name, double *value, gpointer user_data)
 {
@@ -1827,7 +1849,7 @@ gst_validate_add_action_type (const gchar * type_name,
     GstValidateExecuteAction function, const gchar * const *mandatory_fields,
     const gchar * description, gboolean is_config)
 {
-  GstValidateActionType *type = g_slice_new0 (GstValidateActionType);
+  GstValidateActionType *type = gst_validate_action_type_new ();
 
   if (action_types_table == NULL)
     action_types_table = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -1859,6 +1881,7 @@ init_scenarios (void)
       GST_DEBUG_FG_YELLOW, "Gst validate scenarios");
 
   _gst_validate_action_type = gst_validate_action_get_type ();
+  _gst_validate_action_type_type = gst_validate_action_type_get_type ();
 
   clean_action_str = g_regex_new ("\\\\\n|#.*\n", G_REGEX_CASELESS, 0, NULL);
   gst_validate_add_action_type ("seek", _execute_seek, seek_mandatory_fields,
index 7262ab3b75132138c929b6adf7fbd6a5f8927529..46af719d80d5f83b6e3bd1f93ce9b102b455ccd9 100644 (file)
@@ -40,10 +40,12 @@ typedef struct _GstValidateScenario        GstValidateScenario;
 typedef struct _GstValidateScenarioClass   GstValidateScenarioClass;
 typedef struct _GstValidateScenarioPrivate GstValidateScenarioPrivate;
 typedef struct _GstValidateAction          GstValidateAction;
+typedef struct _GstValidateActionType      GstValidateActionType;
 
 typedef gboolean (*GstValidateExecuteAction) (GstValidateScenario * scenario, GstValidateAction * action);
 
 GST_EXPORT GType _gst_validate_action_type;
+GST_EXPORT GType _gst_validate_action_type_type;
 
 struct _GstValidateAction
 {
@@ -59,6 +61,30 @@ struct _GstValidateAction
   gpointer _gst_reserved[GST_PADDING_LARGE];
 };
 
+#define GST_TYPE_VALIDATE_ACTION            (gst_validate_action_get_type ())
+#define GST_IS_VALIDATE_ACTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION))
+GType gst_validate_action_get_type (void);
+
+struct _GstValidateActionType
+{
+  GstMiniObject          mini_object;
+
+  GstValidateExecuteAction execute;
+
+  gchar **mandatory_fields;
+  gchar **option_fields;
+
+  gchar *description;
+  gboolean is_config;
+
+  gpointer _gst_reserved[GST_PADDING_LARGE];
+};
+
+#define GST_TYPE_VALIDATE_ACTION_TYPE       (gst_validate_action_type_get_type ())
+#define GST_IS_VALIDATE_ACTION_TYPE(obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION_TYPE))
+GType gst_validate_action_type_get_type (void);
+
+
 struct _GstValidateScenarioClass
 {
   GObjectClass parent_class;