validate: Add a way to retrieve register actoin type from outside

API:
  * GstValidateActionType
  * gst_validate_get_action_type

https://bugzilla.gnome.org/show_bug.cgi?id=743994
This commit is contained in:
Thibault Saunier 2014-12-13 19:15:59 +01:00
parent eac25a3ad6
commit e7cc086f95
3 changed files with 46 additions and 31 deletions

View 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);

View 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)
{

View 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,