validate: Make GstValidateActionType a GstMiniObject and expose it in the API

This commit is contained in:
Thibault Saunier 2014-08-13 20:47:24 +02:00 committed by Thibault Saunier
parent bdc09d2d4a
commit 8eeaa1a95f
2 changed files with 58 additions and 9 deletions

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

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