mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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
This commit is contained in:
parent
f59e0690f6
commit
3412a9bd20
1 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue