Updated definitions, wrapper and testsuite for changes in GstBus API

Original commit message from CVS:
* gst/gst.defs:
* gst/gstbus.override:
* testsuite/test_bus.py:
* testsuite/test_pipeline.py:
Updated definitions, wrapper and testsuite for changes in GstBus API
This commit is contained in:
Edward Hervey 2005-09-29 13:56:03 +00:00
parent 1ead698175
commit fc520c8a72
5 changed files with 23 additions and 26 deletions

View file

@ -1,3 +1,11 @@
2005-09-29 Edward Hervey <edward@fluendo.com>
* gst/gst.defs:
* gst/gstbus.override:
* testsuite/test_bus.py:
* testsuite/test_pipeline.py:
Updated definitions, wrapper and testsuite for changes in GstBus API
2005-09-29 Edward Hervey <edward@fluendo.com>
* gst/gst.defs:

View file

@ -262,9 +262,6 @@
(of-object "GstBus")
(c-name "gst_bus_have_pending")
(return-type "gboolean")
(parameters
'("GstMessageType" "events")
)
)
(define-method peek
@ -304,9 +301,6 @@
(of-object "GstBus")
(c-name "gst_bus_create_watch")
(return-type "GSource*")
(parameters
'("GstMessageType" "events")
)
)
(define-method add_watch_full
@ -315,7 +309,6 @@
(return-type "guint")
(parameters
'("gint" "priority")
'("GstMessageType" "events")
'("GstBusFunc" "func")
'("gpointer" "user_data")
'("GDestroyNotify" "notify")
@ -327,7 +320,6 @@
(c-name "gst_bus_add_watch")
(return-type "guint")
(parameters
'("GstMessageType" "events")
'("GstBusFunc" "func")
'("gpointer" "user_data")
)
@ -364,6 +356,12 @@
)
)
(define-method add_signal_watch
(of-object "GstBus")
(c-name "gst_bus_add_signal_watch")
(return-type "guint")
)
;; From ../gstreamer/gst/gstcaps.h

View file

@ -182,38 +182,30 @@ override gst_bus_add_watch args
static PyObject *
_wrap_gst_bus_add_watch (PyGObject *self, PyObject *args)
{
PyObject *callback, *py_events, *cbargs = NULL, *data;
PyObject *callback, *cbargs = NULL, *data;
guint sigid;
guint len;
GstMessageType events;
len = PyTuple_Size(args);
if (len < 2) {
PyErr_SetString(PyExc_TypeError, "Bus.add_watch requires at least 2 args");
if (len < 1) {
PyErr_SetString(PyExc_TypeError, "Bus.add_watch requires at least 1 argument");
return NULL;
}
py_events = PySequence_GetItem(args, 0);
if (pyg_flags_get_value (GST_TYPE_MESSAGE_TYPE, py_events,
(gint *)&events)) {
PyErr_SetString(PyExc_TypeError,
"message type is not a GST_TYPE_MESSAGE_TYPE");
return NULL;
}
callback = PySequence_GetItem(args, 1);
callback = PySequence_GetItem(args, 0);
if (!PyCallable_Check(callback)) {
PyErr_SetString(PyExc_TypeError, "callback is not callable");
return NULL;
}
cbargs = PySequence_GetSlice(args, 2, len);
cbargs = PySequence_GetSlice(args, 1, len);
if (cbargs == NULL)
return NULL;
/* FIXME: thomas: I'm pretty sure the second N needs to be O */
data = Py_BuildValue("(ON)", callback, cbargs);
if (data == NULL)
return NULL;
sigid = gst_bus_add_watch (GST_BUS (self->obj), events,
sigid = gst_bus_add_watch (GST_BUS (self->obj),
(GstBusFunc) bus_func, data);
return PyInt_FromLong(sigid);

View file

@ -34,7 +34,7 @@ class BusAddWatchTest(TestCase):
bus = pipeline.get_bus()
self.assertEquals(bus.__gstrefcount__, 2)
self.assertEquals(pipeline.__gstrefcount__, 1)
watch_id = bus.add_watch(gst.MESSAGE_ANY, self._message_received, pipeline, loop, "one")
watch_id = bus.add_watch(self._message_received, pipeline, loop, "one")
self.assertEquals(bus.__gstrefcount__, 3)
self.assertEquals(pipeline.__gstrefcount__, 1)

View file

@ -98,8 +98,7 @@ class PipelineAndBus(TestCase):
self.bus = self.pipeline.get_bus()
self.assertEquals(self.bus.__gstrefcount__, 2)
self.handler = self.bus.add_watch(
gst.MESSAGE_ANY, self._message_received)
self.handler = self.bus.add_watch(self._message_received)
self.assertEquals(self.bus.__gstrefcount__, 3)
self.loop = gobject.MainLoop()