Commit f1bbb486 authored by Edward Hervey's avatar Edward Hervey 🤘

gst.Event: Add override for step event

parent a018096a
......@@ -261,3 +261,27 @@ _wrap_gst_event_new_tag(PyObject *self, PyObject *args, PyObject *kwargs)
gst_mini_object_unref((GstMiniObject *)ret);
return py_ret;
}
%%
override gst_event_parse_step noargs
static PyObject *
_wrap_gst_event_parse_step (PyGstMiniObject * self)
{
GstFormat format;
guint64 amount;
gdouble rate;
gboolean flush, intermediate;
if (GST_EVENT_TYPE (self->obj) != GST_EVENT_STEP) {
PyErr_SetString(PyExc_TypeError, "Event is not a 'step' event");
return NULL;
}
gst_event_parse_step (GST_EVENT (self->obj), &format, &amount, &rate,
&flush, &intermediate);
return Py_BuildValue("OKdOO",
pyg_enum_from_gtype (GST_TYPE_FORMAT, format),
amount, rate,
PyBool_FromLong(flush),
PyBool_FromLong(intermediate));
}
......@@ -225,5 +225,20 @@ class TestDelayedEventProbe(TestCase):
# now let the buffer through
return True
class TestEventCreationParsing(TestCase):
def testEventStep(self):
if hasattr(gst.Event, "parse_step"):
e = gst.event_new_step(gst.FORMAT_TIME, 42, 1.0, True, True)
self.assertEquals(e.type, gst.EVENT_STEP)
fmt, amount, rate, flush, intermediate = e.parse_step()
self.assertEquals(fmt, gst.FORMAT_TIME)
self.assertEquals(amount, 42)
self.assertEquals(rate, 1.0)
self.assertEquals(flush, True)
self.assertEquals(intermediate, True)
if __name__ == "__main__":
unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment