validate: Add a way to retrieve register actoin type from outside
authorThibault Saunier <tsaunier@gnome.org>
Sat, 13 Dec 2014 18:15:59 +0000 (19:15 +0100)
committerThibault Saunier <tsaunier@gnome.org>
Sat, 14 Feb 2015 15:32:09 +0000 (16:32 +0100)
API:
  * GstValidateActionType
  * gst_validate_get_action_type

https://bugzilla.gnome.org/show_bug.cgi?id=743994

validate/gst/validate/gst-validate-internal.h
validate/gst/validate/gst-validate-scenario.c
validate/gst/validate/gst-validate-scenario.h

index de821c8..1febf08 100644 (file)
@@ -31,29 +31,9 @@ GST_DEBUG_CATEGORY_EXTERN (gstvalidate_debug);
 extern GRegex *newline_regex;
 
 
-typedef struct _GstValidateActionType      GstValidateActionType;
-
 /* If an action type is 1 (TRUE) we also concider it is a config to keep backward compatibility */
 #define IS_CONFIG_ACTION_TYPE(type) (((type) & GST_VALIDATE_ACTION_TYPE_CONFIG) || ((type) == TRUE))
 
-struct _GstValidateActionType
-{
-  GstMiniObject          mini_object;
-
-  gchar *name;
-  gchar *implementer_namespace;
-
-  GstValidateExecuteAction execute;
-
-  GstValidateActionParameter *parameters;
-
-  gchar *description;
-  GstValidateActionTypeFlags flags;
-
-  gpointer _gst_reserved[GST_PADDING_LARGE];
-};
-
-
 GST_EXPORT GType _gst_validate_action_type_type;
 
 void init_scenarios (void);
index a1edee7..13c82e4 100644 (file)
@@ -2126,6 +2126,18 @@ gst_validate_register_action_type (const gchar * type_name,
   action_types = g_list_append (action_types, type);
 }
 
+GstValidateActionType *
+gst_validate_get_action_type (const gchar * type_name)
+{
+  GstValidateActionType *type = _find_action_type (type_name);
+
+  if (type)
+    return
+        GST_VALIDATE_ACTION_TYPE (gst_mini_object_ref (GST_MINI_OBJECT (type)));
+
+  return NULL;
+}
+
 static GList *
 gst_validate_list_action_types (void)
 {
index 8be3aea..7f4b9ee 100644 (file)
@@ -101,6 +101,38 @@ void gst_validate_action_set_done (GstValidateAction *action);
 #define GST_IS_VALIDATE_ACTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_ACTION))
 GType gst_validate_action_get_type (void);
 
+typedef struct _GstValidateActionType      GstValidateActionType;
+
+/**
+ * GstValidateActionTypeFlags:
+ * @GST_VALIDATE_ACTION_TYPE_NONE: No special flag
+ * @GST_VALIDATE_ACTION_TYPE_CONFIG: The action is a config
+ * @GST_VALIDATE_ACTION_TYPE_ASYNC: The action can be executed ASYNC
+ */
+typedef enum
+{
+    GST_VALIDATE_ACTION_TYPE_NONE = 0,
+    GST_VALIDATE_ACTION_TYPE_CONFIG = 1 << 1,
+    GST_VALIDATE_ACTION_TYPE_ASYNC = 1 << 2,
+} GstValidateActionTypeFlags;
+
+struct _GstValidateActionType
+{
+  GstMiniObject          mini_object;
+
+  gchar *name;
+  gchar *implementer_namespace;
+
+  GstValidateExecuteAction execute;
+
+  GstValidateActionParameter *parameters;
+
+  gchar *description;
+  GstValidateActionTypeFlags flags;
+
+  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))
 #define GST_VALIDATE_ACTION_TYPE(obj)       ((GstValidateActionType*) obj)
@@ -165,17 +197,6 @@ struct _GstValidateScenario
   gpointer _gst_reserved[GST_PADDING];
 };
 
-/**
- * GstValidateActionTypeFlags:
- * @GST_VALIDATE_ACTION_TYPE_NONE: No special flag
- */
-typedef enum
-{
-    GST_VALIDATE_ACTION_TYPE_NONE = 0,
-    GST_VALIDATE_ACTION_TYPE_CONFIG = 1 << 1,
-    GST_VALIDATE_ACTION_TYPE_ASYNC = 1 << 2,
-} GstValidateActionTypeFlags;
-
 GType gst_validate_scenario_get_type (void);
 
 GstValidateScenario * gst_validate_scenario_factory_create (GstValidateRunner *runner,
@@ -186,6 +207,8 @@ gst_validate_list_scenarios       (gchar **scenarios,
                                    gint num_scenarios,
                                    gchar * output_file);
 
+GstValidateActionType *
+gst_validate_get_action_type           (const gchar *type_name);
 void gst_validate_register_action_type (const gchar *type_name,
                                         const gchar *implementer_namespace,
                                         GstValidateExecuteAction function,