Commit d60a3b8a authored by Edward Hervey's avatar Edward Hervey 🤘

gstreamer: remove unneeded casts

G_PARAM_SPEC_VALUE_TYPE does an expensive type check, whereas the
value_type field is a public field, so we can just use it directly.
parent f8a6a088
......@@ -281,7 +281,7 @@ gst_child_proxy_get_valist (GstObject * object,
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
goto not_found;
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (target), pspec->name, &value);
gst_object_unref (target);
......
......@@ -2939,7 +2939,7 @@ gst_element_save_thyself (GstObject * object, xmlNodePtr parent)
xmlNodePtr param;
char *contents;
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (spec));
g_value_init (&value, spec->value_type);
g_object_get_property (G_OBJECT (element), spec->name, &value);
param = xmlNewChild (parent, NULL, (xmlChar *) "param", NULL);
......
......@@ -579,13 +579,12 @@ param_mini_object_set_default (GParamSpec * pspec, GValue * value)
static gboolean
param_mini_object_validate (GParamSpec * pspec, GValue * value)
{
GstParamSpecMiniObject *ospec = GST_PARAM_SPEC_MINI_OBJECT (pspec);
GstMiniObject *mini_object = value->data[0].v_pointer;
gboolean changed = FALSE;
if (mini_object
&& !g_value_type_compatible (G_OBJECT_TYPE (mini_object),
G_PARAM_SPEC_VALUE_TYPE (ospec))) {
pspec->value_type)) {
gst_mini_object_unref (mini_object);
value->data[0].v_pointer = NULL;
changed = TRUE;
......
......@@ -560,7 +560,7 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig,
return;
excluded_props++;
}
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (orig), pspec->name, &value);
/* FIXME: handle flags */
......
......@@ -139,7 +139,7 @@ gst_util_set_object_arg (GObject * object, const gchar * name,
if (!pspec)
return;
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
value_type = pspec->value_type;
GST_DEBUG ("pspec->flags is %d, pspec->value_type is %s",
pspec->flags, g_type_name (value_type));
......@@ -803,7 +803,7 @@ gst_print_element_args (GString * buf, gint indent, GstElement * element)
spec = *walk;
if (spec->flags & G_PARAM_READABLE) {
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (spec));
g_value_init (&value, spec->value_type);
g_object_get_property (G_OBJECT (element), spec->name, &value);
str = g_strdup_value_contents (&value);
g_value_unset (&value);
......
......@@ -280,7 +280,7 @@ static void gst_parse_new_child(GstChildProxy *child_proxy, GObject *object,
if (gst_child_proxy_lookup (GST_OBJECT (set->parent), set->name, &target, &pspec)) {
gboolean got_value = FALSE;
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
value_type = pspec->value_type;
GST_CAT_LOG (GST_CAT_PIPELINE, "parsing delayed property %s as a %s from %s", pspec->name,
g_type_name (value_type), set->value_str);
......@@ -356,7 +356,7 @@ gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
if (gst_child_proxy_lookup (GST_OBJECT (element), value, &target, &pspec)) {
gboolean got_value = FALSE;
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
value_type = pspec->value_type;
GST_CAT_LOG (GST_CAT_PIPELINE, "parsing property %s as a %s", pspec->name,
g_type_name (value_type));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment