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.
This commit is contained in:
Edward Hervey 2006-01-13 17:40:09 +00:00
parent 938205e1da
commit f75b8e2494
2 changed files with 16 additions and 29 deletions

View file

@ -1,3 +1,8 @@
2006-01-13 Edward Hervey <edward@fluendo.com>
* gst/gstlibs.override:
GstController : don't use values that are now in non-public API.
2006-01-09 Edward Hervey <edward@fluendo.com> 2006-01-09 Edward Hervey <edward@fluendo.com>
* gst/base.defs: * gst/base.defs:

View file

@ -32,31 +32,24 @@ _wrap_gst_controller_set (PyGObject *self, PyObject *args)
{ {
GstController *controller = (GstController *) self->obj; GstController *controller = (GstController *) self->obj;
gchar *param_name; gchar *param_name;
GParamSpec *pspec = NULL;
GstClockTime timestamp; GstClockTime timestamp;
GValue value = { 0, }; GValue value = { 0, };
PyObject *pvalue; PyObject *pvalue;
GType type = 0;
GList *tmp;
gboolean res; gboolean res;
if (!PyArg_ParseTuple(args, "sLO:GstController.set", if (!PyArg_ParseTuple(args, "sLO:GstController.set",
&param_name, &timestamp, &pvalue)) &param_name, &timestamp, &pvalue))
return NULL; return NULL;
/* We need to find the GType to convert to */ if (!(pspec = g_object_class_find_property(G_OBJECT_GET_CLASS (controller->object),
for (tmp = controller->properties; tmp; tmp = g_list_next (tmp)) { (const gchar*) param_name))) {
GstControlledProperty *prop = (GstControlledProperty *) tmp->data; PyErr_SetString (PyExc_TypeError,
if (!strcmp (prop->name, param_name)) "The controlled object doesn't have the given property");
type = prop->type; return NULL;
} }
if (!type) { g_value_init (&value, pspec->value_type);
PyErr_SetString (PyExc_TypeError,
"The controller doesn't handle the given property");
return NULL;
}
g_value_init (&value, type);
if (pyg_value_from_pyobject (&value, pvalue)) { if (pyg_value_from_pyobject (&value, pvalue)) {
PyErr_SetString (PyExc_TypeError, PyErr_SetString (PyExc_TypeError,
@ -179,9 +172,8 @@ _wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args)
gint len; gint len;
gchar *pname; gchar *pname;
GSList *list = NULL; GSList *list = NULL;
GList *props; GParamSpec *pspec = NULL;
gboolean res = FALSE; gboolean res = FALSE;
GType vtype = 0;
PyObject *pret; PyObject *pret;
if ((len = PyTuple_Size(args)) < 2) { if ((len = PyTuple_Size(args)) < 2) {
@ -196,18 +188,8 @@ _wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args)
} }
pname = PyString_AsString(temp); pname = PyString_AsString(temp);
/* Get the GType of the given property */ if (!(pspec = g_object_class_find_property(G_OBJECT_GET_CLASS (controller->object),
g_mutex_lock (controller->lock); (const gchar*) pname)))
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)
goto error; goto error;
while (len-- > 1) { while (len-- > 1) {
@ -221,7 +203,7 @@ _wrap_gst_controller_set_from_list (PyGObject *self, PyObject *args)
} }
tval = g_new0(GstTimedValue, 1); tval = g_new0(GstTimedValue, 1);
tval->timestamp = PyLong_AsUnsignedLongLong(PyTuple_GetItem(temp2, 0)); 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) { if ((pyg_value_from_pyobject (&tval->value, PyTuple_GetItem (temp2, 1))) < 0) {
PyErr_SetString (PyExc_TypeError, "Couldn't convert value to correct type"); PyErr_SetString (PyExc_TypeError, "Couldn't convert value to correct type");
goto error; goto error;