mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
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:
parent
1ead698175
commit
fc520c8a72
5 changed files with 23 additions and 26 deletions
|
@ -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:
|
||||
|
|
14
gst/gst.defs
14
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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue