gst/gstelement.override: added wrapper for gst_element_query_duration()

Original commit message from CVS:
* 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
This commit is contained in:
Edward Hervey 2005-11-01 18:19:08 +00:00
parent 85b73ba53f
commit 1912b5b2eb
3 changed files with 76 additions and 9 deletions

View file

@ -1,3 +1,15 @@
2005-11-01 Edward Hervey <edward@fluendo.com>
* 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 <edward@fluendo.com>
* gst/gst-types.defs:

View file

@ -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;
}

View file

@ -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)));
}