mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +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>
|
2005-09-29 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* gst/gst.defs:
|
* gst/gst.defs:
|
||||||
|
|
14
gst/gst.defs
14
gst/gst.defs
|
@ -262,9 +262,6 @@
|
||||||
(of-object "GstBus")
|
(of-object "GstBus")
|
||||||
(c-name "gst_bus_have_pending")
|
(c-name "gst_bus_have_pending")
|
||||||
(return-type "gboolean")
|
(return-type "gboolean")
|
||||||
(parameters
|
|
||||||
'("GstMessageType" "events")
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(define-method peek
|
(define-method peek
|
||||||
|
@ -304,9 +301,6 @@
|
||||||
(of-object "GstBus")
|
(of-object "GstBus")
|
||||||
(c-name "gst_bus_create_watch")
|
(c-name "gst_bus_create_watch")
|
||||||
(return-type "GSource*")
|
(return-type "GSource*")
|
||||||
(parameters
|
|
||||||
'("GstMessageType" "events")
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(define-method add_watch_full
|
(define-method add_watch_full
|
||||||
|
@ -315,7 +309,6 @@
|
||||||
(return-type "guint")
|
(return-type "guint")
|
||||||
(parameters
|
(parameters
|
||||||
'("gint" "priority")
|
'("gint" "priority")
|
||||||
'("GstMessageType" "events")
|
|
||||||
'("GstBusFunc" "func")
|
'("GstBusFunc" "func")
|
||||||
'("gpointer" "user_data")
|
'("gpointer" "user_data")
|
||||||
'("GDestroyNotify" "notify")
|
'("GDestroyNotify" "notify")
|
||||||
|
@ -327,7 +320,6 @@
|
||||||
(c-name "gst_bus_add_watch")
|
(c-name "gst_bus_add_watch")
|
||||||
(return-type "guint")
|
(return-type "guint")
|
||||||
(parameters
|
(parameters
|
||||||
'("GstMessageType" "events")
|
|
||||||
'("GstBusFunc" "func")
|
'("GstBusFunc" "func")
|
||||||
'("gpointer" "user_data")
|
'("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
|
;; From ../gstreamer/gst/gstcaps.h
|
||||||
|
|
||||||
|
|
|
@ -182,38 +182,30 @@ override gst_bus_add_watch args
|
||||||
static PyObject *
|
static PyObject *
|
||||||
_wrap_gst_bus_add_watch (PyGObject *self, PyObject *args)
|
_wrap_gst_bus_add_watch (PyGObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *callback, *py_events, *cbargs = NULL, *data;
|
PyObject *callback, *cbargs = NULL, *data;
|
||||||
guint sigid;
|
guint sigid;
|
||||||
guint len;
|
guint len;
|
||||||
GstMessageType events;
|
|
||||||
|
|
||||||
len = PyTuple_Size(args);
|
len = PyTuple_Size(args);
|
||||||
|
|
||||||
if (len < 2) {
|
if (len < 1) {
|
||||||
PyErr_SetString(PyExc_TypeError, "Bus.add_watch requires at least 2 args");
|
PyErr_SetString(PyExc_TypeError, "Bus.add_watch requires at least 1 argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
py_events = PySequence_GetItem(args, 0);
|
|
||||||
if (pyg_flags_get_value (GST_TYPE_MESSAGE_TYPE, py_events,
|
callback = PySequence_GetItem(args, 0);
|
||||||
(gint *)&events)) {
|
|
||||||
PyErr_SetString(PyExc_TypeError,
|
|
||||||
"message type is not a GST_TYPE_MESSAGE_TYPE");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
callback = PySequence_GetItem(args, 1);
|
|
||||||
if (!PyCallable_Check(callback)) {
|
if (!PyCallable_Check(callback)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "callback is not callable");
|
PyErr_SetString(PyExc_TypeError, "callback is not callable");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cbargs = PySequence_GetSlice(args, 2, len);
|
cbargs = PySequence_GetSlice(args, 1, len);
|
||||||
if (cbargs == NULL)
|
if (cbargs == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* FIXME: thomas: I'm pretty sure the second N needs to be O */
|
/* FIXME: thomas: I'm pretty sure the second N needs to be O */
|
||||||
data = Py_BuildValue("(ON)", callback, cbargs);
|
data = Py_BuildValue("(ON)", callback, cbargs);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return 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);
|
(GstBusFunc) bus_func, data);
|
||||||
|
|
||||||
return PyInt_FromLong(sigid);
|
return PyInt_FromLong(sigid);
|
||||||
|
|
|
@ -34,7 +34,7 @@ class BusAddWatchTest(TestCase):
|
||||||
bus = pipeline.get_bus()
|
bus = pipeline.get_bus()
|
||||||
self.assertEquals(bus.__gstrefcount__, 2)
|
self.assertEquals(bus.__gstrefcount__, 2)
|
||||||
self.assertEquals(pipeline.__gstrefcount__, 1)
|
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(bus.__gstrefcount__, 3)
|
||||||
self.assertEquals(pipeline.__gstrefcount__, 1)
|
self.assertEquals(pipeline.__gstrefcount__, 1)
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,7 @@ class PipelineAndBus(TestCase):
|
||||||
|
|
||||||
self.bus = self.pipeline.get_bus()
|
self.bus = self.pipeline.get_bus()
|
||||||
self.assertEquals(self.bus.__gstrefcount__, 2)
|
self.assertEquals(self.bus.__gstrefcount__, 2)
|
||||||
self.handler = self.bus.add_watch(
|
self.handler = self.bus.add_watch(self._message_received)
|
||||||
gst.MESSAGE_ANY, self._message_received)
|
|
||||||
self.assertEquals(self.bus.__gstrefcount__, 3)
|
self.assertEquals(self.bus.__gstrefcount__, 3)
|
||||||
|
|
||||||
self.loop = gobject.MainLoop()
|
self.loop = gobject.MainLoop()
|
||||||
|
|
Loading…
Reference in a new issue