From 3412a9bd20c26574cf1e16faf8ab3d032d6bfafc Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Fri, 6 Aug 2004 19:19:41 +0000 Subject: [PATCH] Take a slightly different approach to converting to structure fields Original commit message from CVS: Take a slightly different approach to converting to structure fields --- gst/gst.override | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst/gst.override b/gst/gst.override index ae8eeb013a..e5e6df967d 100644 --- a/gst/gst.override +++ b/gst/gst.override @@ -771,6 +771,13 @@ _wrap_gst_structure_ass_subscript(PyGObject *self, structure = (GstStructure*)self->obj; key = PyString_AsString(py_key); if (py_value != NULL) { + if (PyString_Check(py_value)) + gst_structure_set(structure, key, G_TYPE_STRING, PyString_AsString(py_value), NULL); + else if (PyInt_Check(py_value)) + gst_structure_set(structure, key, G_TYPE_INT, PyInt_AsLong(py_value), NULL); + else if (PyFloat_Check(py_value)) + gst_structure_set(structure, key, G_TYPE_DOUBLE, PyFloat_AsDouble(py_value), NULL); +#if 0 g_value_init(&value, g_type_from_name("PyObject")); if (pyg_value_from_pyobject(&value, py_value)) { PyErr_SetString(PyExc_TypeError, "can't convert value"); @@ -779,6 +786,7 @@ _wrap_gst_structure_ass_subscript(PyGObject *self, gst_structure_set_value(structure, key, &value); g_value_unset(&value); +#endif } else { gst_structure_remove_field(structure, key); }