diff --git a/ChangeLog b/ChangeLog index 93a1a41f1d..d4a79255f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-11-01 Edward Hervey + + * gst/gstelement.override: + added wrapper for gst_element_query_duration() + * gst/gstpad.override: + added wrapper for gst_pad_query_duration() + + Also converted some functions using fixed size PyList to use + PyList_SetItem instead of PyList_Append + + Closes bug #320357 + 2005-11-01 Edward Hervey * gst/gst-types.defs: diff --git a/gst/gstelement.override b/gst/gstelement.override index 9e575f6d63..d2a666ad43 100644 --- a/gst/gstelement.override +++ b/gst/gstelement.override @@ -373,15 +373,43 @@ _wrap_gst_element_query_position (PyGObject *self, PyObject *args) return NULL; } - ret = PyList_New(0); if (!(gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur))) { PyErr_Format(PyGstExc_QueryError, "query failed"); return NULL; } - PyList_Append(ret, PyLong_FromLongLong(cur)); - PyList_Append(ret, pyg_enum_from_gtype (GST_TYPE_FORMAT, format )); + ret = PyList_New(2); + PyList_SetItem(ret, 0, PyLong_FromLongLong(cur)); + PyList_SetItem(ret, 1, pyg_enum_from_gtype (GST_TYPE_FORMAT, format )); + + return ret; +} +%% +override gst_element_query_duration args +static PyObject * +_wrap_gst_element_query_duration (PyGObject *self, PyObject *args) +{ + gint64 cur; + gint format; + PyObject *pformat; + PyObject *ret; + + pformat = (PyObject*)PyTuple_GetItem(args, 0); + if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { + PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); + return NULL; + } + + if (!(gst_element_query_duration(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur))) { + PyErr_Format(PyGstExc_QueryError, + "query failed"); + return NULL; + } + + ret = PyList_New(2); + PyList_SetItem(ret, 0, PyLong_FromLongLong(cur)); + PyList_SetItem(ret, 1, pyg_enum_from_gtype (GST_TYPE_FORMAT, format )); return ret; } @@ -419,9 +447,9 @@ _wrap_gst_element_query_convert (PyGObject *self, PyObject *args, PyObject *kwar return Py_None; } - ret = PyList_New(0); - PyList_Append(ret, pyg_enum_from_gtype (GST_TYPE_FORMAT, destformat)); - PyList_Append(ret, PyLong_FromLongLong(dstval)); + ret = PyList_New(2); + PyList_SetItem(ret, 0, pyg_enum_from_gtype (GST_TYPE_FORMAT, destformat)); + PyList_SetItem(ret, 1, PyLong_FromLongLong(dstval)); return ret; } diff --git a/gst/gstpad.override b/gst/gstpad.override index e14f213bde..ff89a08330 100644 --- a/gst/gstpad.override +++ b/gst/gstpad.override @@ -686,6 +686,33 @@ _wrap_gst_pad_query_position (PyGObject *self, PyObject *args) return ret; } %% +override gst_pad_query_duration args +static PyObject * +_wrap_gst_pad_query_duration (PyGObject *self, PyObject *args) +{ + gint64 cur; + gint format; + PyObject *pformat; + PyObject *ret; + + pformat = (PyObject*)PyTuple_GetItem(args, 0); + if (pyg_enum_get_value (GST_TYPE_FORMAT, pformat, &format)) { + PyErr_SetString(PyExc_TypeError, "argument should be a GstFormat"); + return NULL; + } + + if ((gst_pad_query_duration(GST_PAD (self->obj), (GstFormat*) &format, &cur))) { + ret = PyList_New(2); + PyList_SetItem(ret, 0, PyLong_FromLongLong(cur)); + PyList_SetItem(ret, 2, pyg_enum_from_gtype (GST_TYPE_FORMAT, format )); + } else { + Py_INCREF(Py_None); + ret = Py_None; + } + + return ret; +} +%% override gst_pad_query_convert kwargs static PyObject * _wrap_gst_pad_query_convert (PyGObject *self, PyObject *args, PyObject *kwargs) @@ -749,7 +776,7 @@ _wrap_gst_pad_alloc_buffer (PyGObject *self, PyObject * args, PyObject *kwargs) ret = PyList_New(2); PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res)); if (res != GST_FLOW_OK) { - PyList_Append(ret, Py_None); + PyList_SetItem(ret, 1, Py_None); } else { PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf))); } @@ -776,7 +803,7 @@ _wrap_gst_pad_pull_range (PyGObject *self, PyObject * args, PyObject *kwargs) ret = PyList_New(2); PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res)); if (res != GST_FLOW_OK) { - PyList_Append(ret, Py_None); + PyList_SetItem(ret, 1, Py_None); } else { PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf))); } @@ -803,7 +830,7 @@ _wrap_gst_pad_get_range (PyGObject *self, PyObject * args, PyObject *kwargs) ret = PyList_New(2); PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res)); if (res != GST_FLOW_OK) { - PyList_Append(ret, Py_None); + PyList_SetItem(ret, 1, Py_None); } else { PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf))); }