gst/gst.*: Thanks to Sebastien Merle for resurrecting a patch I'd forgotten about that adds a constructor method for ...

Original commit message from CVS:
* gst/gst.defs:
* gst/gst.override:
Thanks to Sebastien Merle for resurrecting a patch I'd forgotten about
that adds a constructor method for gst.GError, so you can create
error gst.Message.
Added a few GIL releases for overrides.
This commit is contained in:
Edward Hervey 2007-10-18 08:44:43 +00:00
parent 4ff70f44a2
commit 13804466c9
3 changed files with 49 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2007-10-18 Edward Hervey <bilboed@bilboed.com>
* gst/gst.defs:
* gst/gst.override:
Thanks to Sebastien Merle for resurrecting a patch I'd forgotten about
that adds a constructor method for gst.GError, so you can create
error gst.Message.
Added a few GIL releases for overrides.
2007-10-13 Edward Hervey <bilboed@bilboed.com>
* gst/gstobject.override:

View file

@ -1885,7 +1885,16 @@
(return-type "GQuark")
)
(define-function new
(c-name "g_error_new")
(is-constructor-of "GError")
(return-type "GError*")
(parameters
'("gchar*" "domain")
'("gint" "code")
'("gchar*" "message")
)
)
;; From ../gstreamer/gst/gstevent.h

View file

@ -511,7 +511,9 @@ _wrap_gst_registry_get_feature_list (PyGObject *self, PyObject *args, PyObject *
registry = GST_REGISTRY (self->obj);
pyg_begin_allow_threads;
features = gst_registry_get_feature_list (registry, type);
pyg_end_allow_threads;
list = PyList_New (g_list_length(features));
for (l = features, i = 0; l; l = l->next, ++i) {
@ -543,7 +545,9 @@ _wrap_gst_registry_get_feature_list_by_plugin (PyGObject *self, PyObject *args,
registry = GST_REGISTRY (self->obj);
pyg_begin_allow_threads;
features = gst_registry_get_feature_list_by_plugin (registry, name);
pyg_end_allow_threads;
list = PyList_New (g_list_length(features));
for (l = features, i = 0; l; l = l->next, ++i) {
@ -1204,3 +1208,29 @@ _wrap_gst_segment_clip (PyObject * self, PyObject * args, PyObject * kwargs)
return py_ret;
}
%%
override g_error_new kwargs
static int
_wrap_g_error_new(PyGBoxed *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "domain", "code", "message", NULL };
int code;
gchar *message;
gchar *domain;
GQuark domainq;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sis:GError.__init__", kwlist, &domain, &code, &message))
return -1;
domainq = g_quark_from_string(domain);
self->gtype = GST_TYPE_G_ERROR;
self->free_on_dealloc = FALSE;
self->boxed = g_error_new(domainq, code, message);
if (!self->boxed) {
PyErr_SetString(PyExc_RuntimeError, "could not create GError object");
return -1;
}
self->free_on_dealloc = TRUE;
return 0;
}