gst/: Update (hopefully) final API modifications

Original commit message from CVS:
* gst/gst-types.defs:
* gst/gst.defs:
Update (hopefully) final API modifications
* gst/gstelement.override:
* gst/gstpad.override:
* gst/gstquery.override:
Updated position querying/parsing
Removed useless debug line
* testsuite/test_element.py:
Updated test for new API
This commit is contained in:
Edward Hervey 2005-10-19 17:32:29 +00:00
parent 4faa00625e
commit b07e3f3cf8
7 changed files with 74 additions and 24 deletions

View file

@ -1,3 +1,18 @@
2005-10-19 Edward Hervey <edward@fluendo.com>
* gst/gst-types.defs:
* gst/gst.defs:
Update (hopefully) final API modifications
* gst/gstelement.override:
* gst/gstpad.override:
* gst/gstquery.override:
Updated position querying/parsing
Removed useless debug line
* testsuite/test_element.py:
Updated test for new API
2005-10-19 Edward Hervey <edward@fluendo.com>
* gst/gstmessage.override:

View file

@ -812,6 +812,7 @@
(values
'("none" "GST_QUERY_NONE")
'("position" "GST_QUERY_POSITION")
'("duration" "GST_QUERY_DURATION")
'("latency" "GST_QUERY_LATENCY")
'("jitter" "GST_QUERY_JITTER")
'("rate" "GST_QUERY_RATE")

View file

@ -4100,7 +4100,6 @@
(parameters
'("GstFormat" "format")
'("gint64" "cur")
'("gint64" "end")
)
)
@ -4111,7 +4110,34 @@
(parameters
'("GstFormat*" "format")
'("gint64*" "cur")
'("gint64*" "end")
)
)
(define-function gst_query_new_duration
(c-name "gst_query_new_duration")
(return-type "GstQuery*")
(parameters
'("GstFormat" "format")
)
)
(define-method set_duration
(of-object "GstQuery")
(c-name "gst_query_set_duration")
(return-type "none")
(parameters
'("GstFormat" "format")
'("gint64" "duration")
)
)
(define-method parse_duration
(of-object "GstQuery")
(c-name "gst_query_parse_duration")
(return-type "none")
(parameters
'("GstFormat*" "format")
'("gint64*" "duration")
)
)
@ -4168,7 +4194,6 @@
'("GstFormat" "format")
'("gint64" "start_value")
'("gint64" "stop_value")
'("gint64" "base")
)
)
@ -4181,7 +4206,6 @@
'("GstFormat*" "format")
'("gint64*" "start_value")
'("gint64*" "stop_value")
'("gint64*" "base")
)
)
@ -6003,7 +6027,16 @@
(parameters
'("GstFormat*" "format")
'("gint64*" "cur")
'("gint64*" "end")
)
)
(define-method query_duration
(of-object "GstElement")
(c-name "gst_element_query_duration")
(return-type "gboolean")
(parameters
'("GstFormat*" "format")
'("gint64*" "duration")
)
)
@ -6081,7 +6114,16 @@
(parameters
'("GstFormat*" "format")
'("gint64*" "cur")
'("gint64*" "end")
)
)
(define-method query_duration
(of-object "GstPad")
(c-name "gst_pad_query_duration")
(return-type "gboolean")
(parameters
'("GstFormat*" "format")
'("gint64*" "duration")
)
)

View file

@ -91,8 +91,6 @@ _wrap_gst_element_get_state(PyGObject *self, PyObject *args, PyObject *kwargs)
return NULL;
}
GST_DEBUG ("timeout:%lld", timeout);
pyg_begin_allow_threads;
ret = gst_element_get_state(GST_ELEMENT (self->obj), &state, &pending,
@ -364,7 +362,7 @@ override gst_element_query_position args
static PyObject *
_wrap_gst_element_query_position (PyGObject *self, PyObject *args)
{
gint64 cur, end;
gint64 cur;
gint format;
PyObject *pformat;
PyObject *ret;
@ -376,9 +374,8 @@ _wrap_gst_element_query_position (PyGObject *self, PyObject *args)
}
ret = PyList_New(0);
if ((gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur, &end))) {
if ((gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur))) {
PyList_Append(ret, PyLong_FromLongLong(cur));
PyList_Append(ret, PyLong_FromLongLong(end));
PyList_Append(ret, pyg_enum_from_gtype (GST_TYPE_FORMAT, format ));
} else {
g_print("FIXME: query failed\n");

View file

@ -663,7 +663,7 @@ override gst_pad_query_position args
static PyObject *
_wrap_gst_pad_query_position (PyGObject *self, PyObject *args)
{
gint64 cur, end;
gint64 cur;
gint format;
PyObject *pformat;
PyObject *ret;
@ -674,10 +674,9 @@ _wrap_gst_pad_query_position (PyGObject *self, PyObject *args)
return NULL;
}
if ((gst_pad_query_position(GST_PAD (self->obj), (GstFormat*) &format, &cur, &end))) {
ret = PyList_New(3);
if ((gst_pad_query_position(GST_PAD (self->obj), (GstFormat*) &format, &cur))) {
ret = PyList_New(2);
PyList_SetItem(ret, 0, PyLong_FromLongLong(cur));
PyList_SetItem(ret, 1, PyLong_FromLongLong(end));
PyList_SetItem(ret, 2, pyg_enum_from_gtype (GST_TYPE_FORMAT, format ));
} else {
Py_INCREF(Py_None);

View file

@ -26,7 +26,7 @@ static PyObject *
_wrap_gst_query_parse_position (PyGstMiniObject *self)
{
GstFormat format;
gint64 cur, end;
gint64 cur;
PyObject *ret;
if (GST_QUERY_TYPE(self->obj) != GST_QUERY_POSITION) {
@ -34,12 +34,11 @@ _wrap_gst_query_parse_position (PyGstMiniObject *self)
return NULL;
}
gst_query_parse_position (GST_QUERY(self->obj), &format, &cur, &end);
gst_query_parse_position (GST_QUERY(self->obj), &format, &cur);
ret = PyList_New(3);
ret = PyList_New(2);
PyList_SetItem(ret, 0, pyg_enum_from_gtype(GST_TYPE_FORMAT, format));
PyList_SetItem(ret, 1, PyLong_FromLongLong(cur));
PyList_SetItem(ret, 2, PyLong_FromLongLong(end));
return ret;
}
@ -79,7 +78,6 @@ _wrap_gst_query_parse_segment (PyGstMiniObject *self)
GstFormat format;
gint64 start_value;
gint64 stop_value;
gint64 base;
if (GST_QUERY_TYPE(self->obj) != GST_QUERY_SEGMENT) {
PyErr_SetString(PyExc_TypeError, "Query is not a 'Segment' query");
@ -88,14 +86,13 @@ _wrap_gst_query_parse_segment (PyGstMiniObject *self)
gst_query_parse_segment (GST_QUERY(self->obj),
&rate, &format,
&start_value, &stop_value, &base);
&start_value, &stop_value);
ret = PyList_New(5);
ret = PyList_New(4);
PyList_SetItem (ret, 0, PyFloat_FromDouble(rate));
PyList_SetItem (ret, 1, pyg_enum_from_gtype (GST_TYPE_FORMAT, format));
PyList_SetItem (ret, 2, PyLong_FromUnsignedLongLong(start_value));
PyList_SetItem (ret, 3, PyLong_FromUnsignedLongLong(stop_value));
PyList_SetItem (ret, 4, PyLong_FromUnsignedLongLong(base));
return ret;
}

View file

@ -197,7 +197,6 @@ class QueryTest(TestCase):
self.assertEquals(sys.getrefcount(self.element), 3)
assert res
assert res[0] == 0
assert res[1] == -1
res = self.element.query_position(gst.FORMAT_TIME)
assert not res
self.gccollect()