gst/: update for latest API changes

Original commit message from CVS:
* gst/gst.defs:
* gst/gstmessage.override:
update for latest API changes
* gst/gstelement.override:
use GstClockTime for get_state
* testsuite/test_pad.py:
add logging
This commit is contained in:
Thomas Vander Stichele 2005-10-19 11:45:34 +00:00
parent 7fbe25b7a0
commit a96098cba8
5 changed files with 37 additions and 23 deletions

View file

@ -1,3 +1,13 @@
2005-10-19 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gst.defs:
* gst/gstmessage.override:
update for latest API changes
* gst/gstelement.override:
use GstClockTime for get_state
* testsuite/test_pad.py:
add logging
2005-10-18 Andy Wingo <wingo@pobox.com>
* examples/pipeline-tester: Fix for state change changes.

View file

@ -2679,7 +2679,8 @@
(caller-owns-return #t)
(parameters
'("GstObject*" "src")
'("GstClockTime" "timestamp")
'("GstFormat" "format")
'("gint64" "position")
)
)
@ -2689,7 +2690,8 @@
(caller-owns-return #t)
(parameters
'("GstObject*" "src")
'("GstClockTime" "timestamp")
'("GstFormat" "format")
'("gint64" "position")
)
)

View file

@ -82,15 +82,9 @@ _wrap_gst_element_get_state(PyGObject *self, PyObject *args, PyObject *kwargs)
GstState pending;
GstStateChangeReturn ret;
PyObject *timeout = NULL;
gdouble timeoutd;
GstClockTime timeout64 = GST_CLOCK_TIME_NONE;
PyObject *tuple;
/*
* infinite timeout: timevalp == NULL
* 0 timeout: timeval set to 0, timevalp points to timeval
* x timeout: timeval set to gdouble conversion, timevalp points to timeval
*/
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:GstElement.get_state", kwlist,
&timeout)) {
@ -102,17 +96,12 @@ _wrap_gst_element_get_state(PyGObject *self, PyObject *args, PyObject *kwargs)
timeout64 = GST_CLOCK_TIME_NONE;
}
else {
if (timeout == NULL) {
timeoutd = 0.0;
} else {
if (!PyFloat_Check (timeout)) {
PyErr_SetString(PyExc_TypeError, "Timeout not specified as double");
if (!PyLong_Check (timeout)) {
PyErr_SetString(PyExc_TypeError, "timeout not specified as a long");
return NULL;
}
timeoutd = PyFloat_AsDouble (timeout);
}
timeout64 = PyLong_AsLong (timeout);
timeout64 = timeoutd * GST_SECOND;
}
pyg_begin_allow_threads;

View file

@ -76,7 +76,8 @@ override gst_message_parse_segment_start noargs
static PyObject *
_wrap_gst_message_parse_segment_start (PyGstMiniObject *self)
{
GstClockTime timestart;
gint64 position;
GstFormat format;
PyObject *ret;
/* Should raise an exception if it's not a segment start message */
@ -84,31 +85,40 @@ _wrap_gst_message_parse_segment_start (PyGstMiniObject *self)
PyErr_SetString(PyExc_TypeError, "Message is not a segment start message");
return NULL;
}
gst_message_parse_segment_start (GST_MESSAGE(self->obj), &timestart);
gst_message_parse_segment_start (GST_MESSAGE(self->obj), &format, &position);
/* Return this as a tuple */
ret = PyLong_FromUnsignedLongLong(timestart);
ret = PyList_New(2);
PyList_SET_ITEM(ret, 0, pyg_enum_from_gtype(GST_TYPE_FORMAT, format));
PyList_SET_ITEM(ret, 1, PyLong_FromLongLong(position));
return ret;
}
%%
override gst_message_parse_segment_done noargs
static PyObject *
_wrap_gst_message_parse_segment_done (PyGstMiniObject *self)
{
GstClockTime timestart;
gint64 position;
GstFormat format;
PyObject *ret;
/* Should raise an exception if it's not a segment start message */
/* Should raise an exception if it's not a segment done message */
if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_SEGMENT_DONE) {
PyErr_SetString(PyExc_TypeError, "Message is not a segment done message");
return NULL;
}
gst_message_parse_segment_done (GST_MESSAGE(self->obj), &timestart);
gst_message_parse_segment_done (GST_MESSAGE(self->obj), &format, &position);
/* Return this as a tuple */
ret = PyLong_FromUnsignedLongLong(timestart);
ret = PyList_New(2);
PyList_SET_ITEM(ret, 0, pyg_enum_from_gtype(GST_TYPE_FORMAT, format));
PyList_SET_ITEM(ret, 1, PyLong_FromLongLong(position));
return ret;
}
%%
override gst_message_parse_error noargs
static PyObject *

View file

@ -283,6 +283,7 @@ class PadProbePipeTest(TestCase):
gst.debug('waiting for fakesink buffer')
pass
gst.debug('got buffers from fakesrc and fakesink')
self.assertEquals(self._got_fakesink_buffer, 1)
pad.remove_buffer_probe(id)
@ -318,6 +319,8 @@ class PadProbePipeTest(TestCase):
self._got_fakesink_buffer += 1
gst.debug('fakesink got buffer %r, %d total received' % (
buffer, self._got_fakesrc_buffer))
gst.debug('pad %r, py refcount %d, go rc %d, gst rc %d' % (
pad, sys.getrefcount(pad), pad.__grefcount__, pad.__gstrefcount__))
return True
def testRemovingProbe(self):