diff options
author | Edward Hervey <bilboed@bilboed.com> | 2006-02-17 15:35:34 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2006-02-17 15:35:34 +0000 |
commit | c690bf507f92393571be2bffeb7579a06d2c6d1c (patch) | |
tree | b1df94a86ecbddb78742b011dca6e6698cfc8d95 | |
parent | e8df8fe73ca87289beb0493940ee82c45ac28e09 (diff) |
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.
-rw-r--r-- | ChangeLog | 6 | ||||
m--------- | common | 0 | ||||
-rw-r--r-- | gst/gst.defs | 35 | ||||
-rw-r--r-- | gst/gstquery.override | 83 |
4 files changed, 123 insertions, 1 deletions
@@ -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) diff --git a/common b/common -Subproject 58567e5519f2d00a4592491db1a6e8302993279 +Subproject c30611ac38336030fed6d258c6e558cc537adbc diff --git a/gst/gst.defs b/gst/gst.defs index 7a22e12..7d47249 100644 --- a/gst/gst.defs +++ b/gst/gst.defs @@ -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 diff --git a/gst/gstquery.override b/gst/gstquery.override index d7e035f..1b54225 100644 --- a/gst/gstquery.override +++ b/gst/gstquery.override @@ -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; +} |