gst/: Updated and properly wrapped new GstQuery formats API.

Original commit message from CVS:
* gst/gst.defs:
* gst/gstquery.override:
Updated and properly wrapped new GstQuery formats API.
This commit is contained in:
Edward Hervey 2006-02-17 15:35:34 +00:00
parent e8df8fe73c
commit c690bf507f
4 changed files with 124 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2006-02-17 Edward Hervey <edward@fluendo.com>
* gst/gst.defs:
* gst/gstquery.override:
Updated and properly wrapped new GstQuery formats API.
2006-02-10 Andy Wingo <wingo@pobox.com>
* gst/gst.defs (disable_sync_message_emission)

2
common

@ -1 +1 @@
Subproject commit 58567e5519f2d00a4592491db1a6e8302993279e
Subproject commit c30611ac38336030fed6d258c6e558cc537adbc5

View file

@ -4473,6 +4473,12 @@
)
)
(define-function query_new_formats
(c-name "gst_query_new_formats")
(caller-owns-return #t)
(return-type "GstQuery*")
)
(define-method set_formats
(of-object "GstQuery")
(c-name "gst_query_set_formats")
@ -4483,6 +4489,35 @@
(varargs #t)
)
(define-method set_formatsv
(of-object "GstQuery")
(c-name "gst_query_set_formatsv")
(return-type "none")
(parameters
'("gint" "n_formats")
'("GstFormat*" "formats")
)
)
(define-method parse_formats_length
(of-object "GstQuery")
(c-name "gst_query_parse_formats_length")
(return-type "none")
(parameters
'("guint*" "n_formats")
)
)
(define-method parse_formats_nth
(of-object "GstQuery")
(c-name "gst_query_parse_formats_nth")
(return-type "none")
(parameters
'("guint" "nth")
'("GstFormat*" "format")
)
)
;; From ../gstreamer/gst/gstregistry.h

View file

@ -19,7 +19,9 @@
*
* Author: Johan Dahlin <johan@gnome.org>
*/
%%
ignore
gst_query_set_formatsv
%%
override gst_query_parse_position noargs
static PyObject *
@ -145,3 +147,82 @@ _wrap_gst_query_parse_seeking (PyGstMiniObject *self)
return ret;
}
%%
override gst_query_parse_formats_length noargs
static PyObject *
_wrap_gst_query_parse_formats_length (PyGstMiniObject *self)
{
PyObject *ret;
guint n_formats;
if (GST_QUERY_TYPE(self->obj) != GST_QUERY_FORMATS) {
PyErr_SetString(PyExc_TypeError, "Query is not a 'Formats' query");
return NULL;
}
gst_query_parse_formats_length (GST_QUERY (self->obj),
&n_formats);
ret = PyInt_FromLong(n_formats);
return ret;
}
%%
override gst_query_parse_formats_nth kwargs
static PyObject *
_wrap_gst_query_parse_formats_nth (PyGstMiniObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"nth", NULL};
guint nth;
GstFormat format;
if (GST_QUERY_TYPE (self->obj) != GST_QUERY_FORMATS) {
PyErr_SetString(PyExc_TypeError, "Query is not a 'Formats' query");
return NULL;
}
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "I:GstQuery.parse_formats_nth", kwlist, &nth))
return NULL;
gst_query_parse_formats_nth (GST_QUERY (self->obj),
nth, &format);
return pyg_enum_from_gtype (GST_TYPE_FORMAT, format);
}
%%
override gst_query_set_formats args
static PyObject *
_wrap_gst_query_set_formats (PyGstMiniObject *self, PyObject *args)
{
PyObject *ret = NULL;
gint len, i;
GstFormat *formats;
if (GST_QUERY_TYPE (self->obj) != GST_QUERY_FORMATS) {
PyErr_SetString(PyExc_TypeError, "Query is not a 'Formats' query");
return NULL;
}
if ((len = PyTuple_Size(args)) < 1) {
PyErr_SetString(PyExc_TypeError, "You need to supply at least one gst.Format");
return NULL;
}
formats = g_new0(GstFormat, len);
for (i = 0; i < len; i++) {
if (pyg_enum_get_value(GST_TYPE_FORMAT,
PyTuple_GetItem(args, i),
(gint *) &formats[i]))
goto beach;
}
gst_query_set_formatsv (GST_QUERY(self->obj), len, formats);
Py_INCREF(Py_None);
ret = Py_None;
beach:
g_free(formats);
return ret;
}