mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
gst/gst.override (_wrap_gst_pad_query, _wrap_gst_element_query)
Original commit message from CVS: * gst/gst.override (_wrap_gst_pad_query, _wrap_gst_element_query) (_wrap_gst_pad_convert): Remove exceptions, return Long values (and convert from LongLongs) and clean up a little)
This commit is contained in:
parent
9165bf8c35
commit
e779537e83
2 changed files with 27 additions and 29 deletions
|
@ -1,5 +1,9 @@
|
||||||
2004-07-13 Johan Dahlin <johan@gnome.org>
|
2004-07-13 Johan Dahlin <johan@gnome.org>
|
||||||
|
|
||||||
|
* gst/gst.override (_wrap_gst_pad_query, _wrap_gst_element_query)
|
||||||
|
(_wrap_gst_pad_convert): Remove exceptions, return Long values
|
||||||
|
(and convert from LongLongs) and clean up a little)
|
||||||
|
|
||||||
* testsuite/element.py (QueryTest.testQuery): Another small test
|
* testsuite/element.py (QueryTest.testQuery): Another small test
|
||||||
|
|
||||||
* gst/gst.override (_wrap_gst_element_query): Ditto
|
* gst/gst.override (_wrap_gst_element_query): Ditto
|
||||||
|
|
|
@ -174,20 +174,16 @@ _wrap_gst_pad_query(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||||
static char *kwlist[] = { "type", "format", NULL };
|
static char *kwlist[] = { "type", "format", NULL };
|
||||||
GstQueryType type;
|
GstQueryType type;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gint64 value;
|
gint64 value = 0;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GstPad.query", kwlist, &type, &format))
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||||
|
"ii:GstPad.query", kwlist,
|
||||||
|
&type, &format))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
value = 0;
|
|
||||||
ret = gst_pad_query(GST_PAD(self->obj), type, &format, &value);
|
ret = gst_pad_query(GST_PAD(self->obj), type, &format, &value);
|
||||||
if (!ret) {
|
return PyLong_FromLongLong(value);
|
||||||
PyErr_SetString(PyExc_RuntimeError, "query could not be performed");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PyInt_FromLong(value);
|
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
override gst_element_query kwargs
|
override gst_element_query kwargs
|
||||||
|
@ -197,42 +193,40 @@ _wrap_gst_element_query(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||||
static char *kwlist[] = { "type", "format", NULL };
|
static char *kwlist[] = { "type", "format", NULL };
|
||||||
GstQueryType type;
|
GstQueryType type;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gint64 value;
|
gint64 value = 0;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GstElement.query", kwlist, &type, &format))
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||||
|
"ii:GstElement.query", kwlist,
|
||||||
|
&type, &format))
|
||||||
return NULL;
|
return NULL;
|
||||||
value = 0;
|
|
||||||
ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value);
|
|
||||||
if (!ret) {
|
|
||||||
PyErr_SetString(PyExc_RuntimeError, "query could not be performed");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PyInt_FromLong(value);
|
ret = gst_element_query(GST_ELEMENT(self->obj), type, &format, &value);
|
||||||
|
return PyLong_FromLongLong(value);
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
override gst_pad_convert kwargs
|
override gst_pad_convert kwargs
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_wrap_gst_pad_convert(PyGObject *self, PyObject *args, PyObject *kwargs)
|
_wrap_gst_pad_convert(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
static char *kwlist[] = { "src_format", "src_value", "dest_format", NULL };
|
static char *kwlist[] = { "src_format", "src_value",
|
||||||
|
"dest_format", NULL };
|
||||||
GstFormat src_format, dest_format;
|
GstFormat src_format, dest_format;
|
||||||
PyObject *src_value_obj;
|
PyObject *src_value_obj;
|
||||||
gint64 src_value, dest_value;
|
gint64 src_value, dest_value = 0;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iOi:GstPad.convert", kwlist, &src_format, &src_value_obj, &dest_format))
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||||
|
"iOi:GstPad.convert", kwlist,
|
||||||
|
&src_format, &src_value_obj,
|
||||||
|
&dest_format))
|
||||||
return NULL;
|
return NULL;
|
||||||
src_value = PyLong_AsLongLong(src_value_obj);
|
|
||||||
dest_value = 0;
|
|
||||||
ret = gst_pad_convert(GST_PAD(self->obj), src_format, src_value, &dest_format, &dest_value);
|
|
||||||
if (!ret) {
|
|
||||||
PyErr_SetString(PyExc_RuntimeError, "conversion could not be performed");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PyInt_FromLong(dest_value);
|
src_value = PyLong_AsLongLong(src_value_obj);
|
||||||
|
|
||||||
|
ret = gst_pad_convert(GST_PAD(self->obj), src_format, src_value,
|
||||||
|
&dest_format, &dest_value);
|
||||||
|
return PyLong_FromLongLong(dest_value);
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
override gst_element_convert kwargs
|
override gst_element_convert kwargs
|
||||||
|
|
Loading…
Reference in a new issue