static PyObject *
gi_gst_array_from_value (const GValue * value)
{
- PyObject *list;
+ PyObject *list, *array_type, *array;
gint i;
list = PyList_New (gst_value_array_get_size (value));
PyList_SET_ITEM (list, i, pyg_value_as_pyobject (v, TRUE));
}
- return list;
+ array_type = gi_gst_get_type ("ValueArray");
+ array = PyObject_CallFunction (array_type, "N", list);
+
+ Py_DECREF (array_type);
+
+ return array;
}
static int
static PyObject *
gi_gst_list_from_value (const GValue * value)
{
- PyObject *list;
+ PyObject *list, *value_list_type, *value_list;
gint i;
list = PyList_New (gst_value_list_get_size (value));
PyList_SET_ITEM (list, i, pyg_value_as_pyobject (v, TRUE));
}
- return list;
+ value_list_type = gi_gst_get_type ("ValueList");
+ value_list = PyObject_CallFunction (value_list_type, "N", list);
+
+ Py_DECREF (value_list_type);
+
+ return value_list;
}
static int
st = Gst.Structure.new_empty("video/x-raw")
st["array"] = A([Gst.Fraction(1, 30), Gst.Fraction(1, 2)])
value = st["array"]
+ st["array"] = A(value)
self.failUnlessEqual(value[0], Gst.Fraction(1, 30))
self.failUnlessEqual(value[1], Gst.Fraction(1, 2))
+
+ st["matrix"] = A([A([0, 1]), A([-1, 0])])
+ value = st["matrix"]
+
+ self.failUnlessEqual(value[0][0], 0)
+ self.failUnlessEqual(value[0][1], 1)
+ self.failUnlessEqual(value[1][0], -1)
+ self.failUnlessEqual(value[1][1], 0)
+
+
+
self.failUnlessEqual(value[0], Gst.Fraction(1, 30))
self.failUnlessEqual(value[1], Gst.Fraction(1, 2))
+
+ st["matrix"] = L([L([0, 1]), L([-1 ,0])])
+ value = st["matrix"]
+
+ self.failUnlessEqual(value[0][0], 0)
+ self.failUnlessEqual(value[0][1], 1)
+ self.failUnlessEqual(value[1][0], -1)
+ self.failUnlessEqual(value[1][1], 0)