diff --git a/ChangeLog b/ChangeLog index 9a69b73bb6..080f404360 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-09-29 Edward Hervey + + * 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 * gst/gst.defs: diff --git a/gst/gst.defs b/gst/gst.defs index 0a0b779f6c..858053d2ed 100644 --- a/gst/gst.defs +++ b/gst/gst.defs @@ -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 diff --git a/gst/gstbus.override b/gst/gstbus.override index 3b10ee1849..fd58c819ca 100644 --- a/gst/gstbus.override +++ b/gst/gstbus.override @@ -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); diff --git a/testsuite/test_bus.py b/testsuite/test_bus.py index 0b7e15a8cf..ab3e2dc4b4 100644 --- a/testsuite/test_bus.py +++ b/testsuite/test_bus.py @@ -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) diff --git a/testsuite/test_pipeline.py b/testsuite/test_pipeline.py index df6a60948c..2192e130ef 100644 --- a/testsuite/test_pipeline.py +++ b/testsuite/test_pipeline.py @@ -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()