From: Edward Hervey Date: Fri, 13 Jan 2006 17:40:09 +0000 (+0000) Subject: gst/gstlibs.override: GstController : don't use values that are now in non-public... X-Git-Tag: 1.19.3~485^2~885 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f75b8e2494d46e3a2b9241d5110d9f75c64e23f2;p=platform%2Fupstream%2Fgstreamer.git gst/gstlibs.override: GstController : don't use values that are now in non-public API. Original commit message from CVS: * gst/gstlibs.override: GstController : don't use values that are now in non-public API. --- diff --git a/ChangeLog b/ChangeLog index 58553e5..f6400f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-01-13 Edward Hervey + + * gst/gstlibs.override: + GstController : don't use values that are now in non-public API. + 2006-01-09 Edward Hervey * gst/base.defs: diff --git a/gst/gstlibs.override b/gst/gstlibs.override index 37d38b9..c3efcb4 100644 --- a/gst/gstlibs.override +++ b/gst/gstlibs.override @@ -32,31 +32,24 @@ _wrap_gst_controller_set (PyGObject *self, PyObject *args) { GstController *controller = (GstController *) self->obj; gchar *param_name; + GParamSpec *pspec = NULL; GstClockTime timestamp; GValue value = { 0, }; PyObject *pvalue; - GType type = 0; - GList *tmp; gboolean res; if (!PyArg_ParseTuple(args, "sLO:GstController.set", ¶m_name, ×tamp, &pvalue)) return NULL; - /* We need to find the GType to convert to */ - for (tmp = controller->properties; tmp; tmp = g_list_next (tmp)) { - GstControlledProperty *prop = (GstControlledProperty *) tmp->data; - if (!strcmp (prop->name, param_name)) - type = prop->type; + if (!(pspec = g_object_class_find_property(G_OBJECT_GET_CLASS (controller->object), + (const gchar*) param_name))) { + PyErr_SetString (PyExc_TypeError, + "The controlled object doesn't have the given property"); + return NULL; } - if (!type) { - PyErr_SetString (PyExc_TypeError, - "The controller doesn't handle the given property"); - return NULL; - } - - g_value_init (&value, type); + g_value_init (&value, pspec->value_type); if (pyg_value_from_pyobject (&value, pvalue)) { PyErr_SetString (PyExc_TypeError, @@ -179,9 +172,8 @@ _wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args) gint len; gchar *pname; GSList *list = NULL; - GList *props; + GParamSpec *pspec = NULL; gboolean res = FALSE; - GType vtype = 0; PyObject *pret; if ((len = PyTuple_Size(args)) < 2) { @@ -196,18 +188,8 @@ _wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args) } pname = PyString_AsString(temp); - /* Get the GType of the given property */ - g_mutex_lock (controller->lock); - for (props = controller->properties; props; props = g_list_next(props)) { - GstControlledProperty *prop = (GstControlledProperty *) props->data; - - if (!strcmp(prop->name, pname)) { - vtype = prop->type; - break; - } - } - g_mutex_unlock (controller->lock); - if (!vtype) + if (!(pspec = g_object_class_find_property(G_OBJECT_GET_CLASS (controller->object), + (const gchar*) pname))) goto error; while (len-- > 1) { @@ -221,7 +203,7 @@ _wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args) } tval = g_new0(GstTimedValue, 1); tval->timestamp = PyLong_AsUnsignedLongLong(PyTuple_GetItem(temp2, 0)); - g_value_init (&tval->value, vtype); + g_value_init (&tval->value, pspec->value_type); if ((pyg_value_from_pyobject (&tval->value, PyTuple_GetItem (temp2, 1))) < 0) { PyErr_SetString (PyExc_TypeError, "Couldn't convert value to correct type"); goto error;