mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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:
parent
85b73ba53f
commit
1912b5b2eb
3 changed files with 76 additions and 9 deletions
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2005-11-01 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst/gst-types.defs:
|
* gst/gst-types.defs:
|
||||||
|
|
|
@ -373,15 +373,43 @@ _wrap_gst_element_query_position (PyGObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = PyList_New(0);
|
|
||||||
if (!(gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur))) {
|
if (!(gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur))) {
|
||||||
PyErr_Format(PyGstExc_QueryError,
|
PyErr_Format(PyGstExc_QueryError,
|
||||||
"query failed");
|
"query failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyList_Append(ret, PyLong_FromLongLong(cur));
|
ret = PyList_New(2);
|
||||||
PyList_Append(ret, pyg_enum_from_gtype (GST_TYPE_FORMAT, format ));
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -419,9 +447,9 @@ _wrap_gst_element_query_convert (PyGObject *self, PyObject *args, PyObject *kwar
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = PyList_New(0);
|
ret = PyList_New(2);
|
||||||
PyList_Append(ret, pyg_enum_from_gtype (GST_TYPE_FORMAT, destformat));
|
PyList_SetItem(ret, 0, pyg_enum_from_gtype (GST_TYPE_FORMAT, destformat));
|
||||||
PyList_Append(ret, PyLong_FromLongLong(dstval));
|
PyList_SetItem(ret, 1, PyLong_FromLongLong(dstval));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -686,6 +686,33 @@ _wrap_gst_pad_query_position (PyGObject *self, PyObject *args)
|
||||||
return ret;
|
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
|
override gst_pad_query_convert kwargs
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_wrap_gst_pad_query_convert (PyGObject *self, PyObject *args, PyObject *kwargs)
|
_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);
|
ret = PyList_New(2);
|
||||||
PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res));
|
PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res));
|
||||||
if (res != GST_FLOW_OK) {
|
if (res != GST_FLOW_OK) {
|
||||||
PyList_Append(ret, Py_None);
|
PyList_SetItem(ret, 1, Py_None);
|
||||||
} else {
|
} else {
|
||||||
PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf)));
|
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);
|
ret = PyList_New(2);
|
||||||
PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res));
|
PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res));
|
||||||
if (res != GST_FLOW_OK) {
|
if (res != GST_FLOW_OK) {
|
||||||
PyList_Append(ret, Py_None);
|
PyList_SetItem(ret, 1, Py_None);
|
||||||
} else {
|
} else {
|
||||||
PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf)));
|
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);
|
ret = PyList_New(2);
|
||||||
PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res));
|
PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FLOW_RETURN, res));
|
||||||
if (res != GST_FLOW_OK) {
|
if (res != GST_FLOW_OK) {
|
||||||
PyList_Append(ret, Py_None);
|
PyList_SetItem(ret, 1, Py_None);
|
||||||
} else {
|
} else {
|
||||||
PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf)));
|
PyList_SetItem(ret, 1, pygstminiobject_new(GST_MINI_OBJECT(buf)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue