gst-validate-scenario: the structure has the type

Get the GValue directly from the structure and do not assume everything
is stored as a string and use the GstStructure's GValue to set the property
to the instances
This commit is contained in:
Thiago Santos 2014-07-21 22:41:28 -03:00
parent d7c3d652d0
commit fd7c13d446

View file

@ -855,9 +855,8 @@ _execute_dot_pipeline (GstValidateScenario * scenario,
static gboolean static gboolean
_object_set_property (GObject * object, const gchar * property, _object_set_property (GObject * object, const gchar * property,
const gchar * value_str) const GValue * value)
{ {
GValue value = { 0 };
GObjectClass *klass = G_OBJECT_GET_CLASS (object); GObjectClass *klass = G_OBJECT_GET_CLASS (object);
GParamSpec *paramspec; GParamSpec *paramspec;
@ -867,17 +866,7 @@ _object_set_property (GObject * object, const gchar * property,
return FALSE; return FALSE;
} }
g_value_init (&value, paramspec->value_type); g_object_set_property (object, property, value);
if (!gst_value_deserialize (&value, value_str)) {
GST_ERROR ("Failed to deserialize string '%s' for property: '%s'",
value_str, property);
g_value_reset (&value);
return FALSE;
}
g_object_set_property (object, property, &value);
g_value_reset (&value);
return TRUE; return TRUE;
} }
@ -889,7 +878,7 @@ _execute_set_property (GstValidateScenario * scenario,
GstElement *target; GstElement *target;
const gchar *name; const gchar *name;
const gchar *property; const gchar *property;
const gchar *property_value; const GValue *property_value;
gboolean ret; gboolean ret;
name = gst_structure_get_string (action->structure, "target-element-name"); name = gst_structure_get_string (action->structure, "target-element-name");
@ -900,8 +889,8 @@ _execute_set_property (GstValidateScenario * scenario,
} }
property = gst_structure_get_string (action->structure, "property-name"); property = gst_structure_get_string (action->structure, "property-name");
property_value = property_value = gst_structure_get_value (action->structure,
gst_structure_get_string (action->structure, "property-value"); "property-value");
ret = _object_set_property (G_OBJECT (target), property, property_value); ret = _object_set_property (G_OBJECT (target), property, property_value);