Take a slightly different approach to converting to structure fields
authorJohan Dahlin <johan@gnome.org>
Fri, 6 Aug 2004 19:19:41 +0000 (19:19 +0000)
committerJohan Dahlin <johan@gnome.org>
Fri, 6 Aug 2004 19:19:41 +0000 (19:19 +0000)
Original commit message from CVS:
Take a slightly different approach to converting to structure fields

gst/gst.override

index ae8eeb0..e5e6df9 100644 (file)
@@ -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);
        }