codegen/codegen.py: When chaining up to the parent class methods from python to C, we need to allow threads (i.e. rel...

Original commit message from CVS:
* codegen/codegen.py:
When chaining up to the parent class methods from python to C, we need
to allow threads (i.e. release the GIL).
* gst/gstbase.override:
* gst/gstbin.override:
Modify __do_*() overrides in the same way as above.
This commit is contained in:
Edward Hervey 2007-01-10 16:13:29 +00:00
parent 67e9861541
commit 4acc40c8d2
5 changed files with 40 additions and 15 deletions

View file

@ -1,3 +1,12 @@
2007-01-10 Edward Hervey <edward@fluendo.com>
* codegen/codegen.py:
When chaining up to the parent class methods from python to C, we need
to allow threads (i.e. release the GIL).
* gst/gstbase.override:
* gst/gstbin.override:
Modify __do_*() overrides in the same way as above.
2007-01-05 Thomas Vander Stichele <thomas at apestaart dot org> 2007-01-05 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/extend/discoverer.py: * gst/extend/discoverer.py:

View file

@ -211,10 +211,12 @@ class Wrapper:
'%(parseargs)s' '%(parseargs)s'
'%(codebefore)s' '%(codebefore)s'
' klass = g_type_class_ref(pyg_type_from_object(cls));\n' ' klass = g_type_class_ref(pyg_type_from_object(cls));\n'
' if (%(class_cast_macro)s(klass)->%(virtual)s)\n' ' if (%(class_cast_macro)s(klass)->%(virtual)s) {\n'
' pyg_begin_allow_threads;\n'
' %(setreturn)s%(class_cast_macro)s(klass)->' ' %(setreturn)s%(class_cast_macro)s(klass)->'
'%(virtual)s(%(arglist)s);\n' '%(virtual)s(%(arglist)s);\n'
' else {\n' ' pyg_end_allow_threads;\n'
' } else {\n'
' PyErr_SetString(PyExc_NotImplementedError, ' ' PyErr_SetString(PyExc_NotImplementedError, '
'"virtual method %(name)s not implemented");\n' '"virtual method %(name)s not implemented");\n'
' g_type_class_unref(klass);\n' ' g_type_class_unref(klass);\n'

2
common

@ -1 +1 @@
Subproject commit ee0bb43e2b66781d04078e2210404da48f6c68f0 Subproject commit 8ba5dffb5ee7e7daea1030f6b34bfef10f9801a3

View file

@ -152,9 +152,11 @@ _wrap_GstBaseSrc__do_create (PyObject *cls, PyObject *args, PyObject *kwargs)
return NULL; return NULL;
klass = g_type_class_ref(pyg_type_from_object(cls)); klass = g_type_class_ref(pyg_type_from_object(cls));
if (GST_BASE_SRC_CLASS(klass)->create) if (GST_BASE_SRC_CLASS(klass)->create) {
pyg_begin_allow_threads;
flow = GST_BASE_SRC_CLASS(klass)->create(GST_BASE_SRC(self->obj), offset, size, &buffer); flow = GST_BASE_SRC_CLASS(klass)->create(GST_BASE_SRC(self->obj), offset, size, &buffer);
else { pyg_end_allow_threads;
} else {
PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.set_caps not implemented"); PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.set_caps not implemented");
g_type_class_unref(klass); g_type_class_unref(klass);
return NULL; return NULL;
@ -247,9 +249,11 @@ _wrap_GstBaseSrc__do_get_size (PyObject *cls, PyObject *args, PyObject *kwargs)
kwlist, &PyGstBaseSrc_Type, &self)) kwlist, &PyGstBaseSrc_Type, &self))
return NULL; return NULL;
klass = g_type_class_ref(pyg_type_from_object(cls)); klass = g_type_class_ref(pyg_type_from_object(cls));
if (GST_BASE_SRC_CLASS(klass)->get_size) if (GST_BASE_SRC_CLASS(klass)->get_size) {
pyg_begin_allow_threads;
ret = GST_BASE_SRC_CLASS(klass)->get_size(GST_BASE_SRC(self->obj), &size); ret = GST_BASE_SRC_CLASS(klass)->get_size(GST_BASE_SRC(self->obj), &size);
else { pyg_end_allow_threads;
} else {
PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_size not implemented"); PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_size not implemented");
g_type_class_unref(klass); g_type_class_unref(klass);
return NULL; return NULL;
@ -338,11 +342,13 @@ _wrap_GstBaseSrc__do_get_times (PyObject *cls, PyObject *args, PyObject *kwargs)
&PyGstBuffer_Type, &py_buffer)) &PyGstBuffer_Type, &py_buffer))
return NULL; return NULL;
klass = g_type_class_ref(pyg_type_from_object(cls)); klass = g_type_class_ref(pyg_type_from_object(cls));
if (GST_BASE_SRC_CLASS(klass)->get_times) if (GST_BASE_SRC_CLASS(klass)->get_times) {
pyg_begin_allow_threads;
GST_BASE_SRC_CLASS(klass)->get_times(GST_BASE_SRC(self->obj), GST_BASE_SRC_CLASS(klass)->get_times(GST_BASE_SRC(self->obj),
GST_BUFFER(py_buffer->obj), GST_BUFFER(py_buffer->obj),
&start, &end); &start, &end);
else { pyg_end_allow_threads;
} else {
PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_times not implemented"); PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_times not implemented");
g_type_class_unref(klass); g_type_class_unref(klass);
return NULL; return NULL;
@ -432,10 +438,12 @@ _wrap_GstPushSrc__do_create (PyObject *cls, PyObject *args, PyObject *kwargs)
kwlist, &PyGstPushSrc_Type, &self)) kwlist, &PyGstPushSrc_Type, &self))
return NULL; return NULL;
klass = g_type_class_ref(pyg_type_from_object(cls)); klass = g_type_class_ref(pyg_type_from_object(cls));
if (GST_PUSH_SRC_CLASS(klass)->create) if (GST_PUSH_SRC_CLASS(klass)->create) {
pyg_begin_allow_threads;
flow = GST_PUSH_SRC_CLASS(klass)->create(GST_PUSH_SRC(self->obj), flow = GST_PUSH_SRC_CLASS(klass)->create(GST_PUSH_SRC(self->obj),
(GstBuffer**) &buffer); (GstBuffer**) &buffer);
else { pyg_end_allow_threads;
} else {
PyErr_SetString(PyExc_NotImplementedError, "virtual method GstPushSrc.create not implemented"); PyErr_SetString(PyExc_NotImplementedError, "virtual method GstPushSrc.create not implemented");
g_type_class_unref(klass); g_type_class_unref(klass);
return NULL; return NULL;
@ -537,9 +545,11 @@ _wrap_GstBaseTransform__do_get_unit_size (PyObject *cls, PyObject *args, PyObjec
kwlist, &PyGstBaseTransform_Type, &self, &PyGstCaps_Type, &caps)) kwlist, &PyGstBaseTransform_Type, &self, &PyGstCaps_Type, &caps))
return NULL; return NULL;
klass = g_type_class_ref(pyg_type_from_object(cls)); klass = g_type_class_ref(pyg_type_from_object(cls));
if (GST_BASE_TRANSFORM_CLASS(klass)->get_unit_size) if (GST_BASE_TRANSFORM_CLASS(klass)->get_unit_size) {
pyg_begin_allow_threads;
ret = GST_BASE_TRANSFORM_CLASS(klass)->get_unit_size(GST_BASE_TRANSFORM(self->obj), GST_CAPS(caps->obj), &size); ret = GST_BASE_TRANSFORM_CLASS(klass)->get_unit_size(GST_BASE_TRANSFORM(self->obj), GST_CAPS(caps->obj), &size);
else { pyg_end_allow_threads;
} else {
PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseTransform.get_unit_size not implemented"); PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseTransform.get_unit_size not implemented");
g_type_class_unref(klass); g_type_class_unref(klass);
return NULL; return NULL;
@ -628,11 +638,13 @@ _wrap_GstBaseSink__do_get_times (PyObject *cls, PyObject *args, PyObject *kwargs
&PyGstBuffer_Type, &py_buffer)) &PyGstBuffer_Type, &py_buffer))
return NULL; return NULL;
klass = g_type_class_ref(pyg_type_from_object(cls)); klass = g_type_class_ref(pyg_type_from_object(cls));
if (GST_BASE_SINK_CLASS(klass)->get_times) if (GST_BASE_SINK_CLASS(klass)->get_times) {
pyg_begin_allow_threads;
GST_BASE_SINK_CLASS(klass)->get_times(GST_BASE_SINK(self->obj), GST_BASE_SINK_CLASS(klass)->get_times(GST_BASE_SINK(self->obj),
GST_BUFFER(py_buffer->obj), GST_BUFFER(py_buffer->obj),
&start, &end); &start, &end);
else { pyg_end_allow_threads;
} else {
PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSink.get_times not implemented"); PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSink.get_times not implemented");
g_type_class_unref(klass); g_type_class_unref(klass);
return NULL; return NULL;

View file

@ -162,7 +162,9 @@ _wrap_GstBin__do_handle_message(PyObject *cls, PyObject *args, PyObject *kwargs)
klass = g_type_class_ref(pyg_type_from_object(cls)); klass = g_type_class_ref(pyg_type_from_object(cls));
if (GST_BIN_CLASS(klass)->handle_message) { if (GST_BIN_CLASS(klass)->handle_message) {
gst_mini_object_ref (message->obj); gst_mini_object_ref (message->obj);
pyg_begin_allow_threads;
GST_BIN_CLASS(klass)->handle_message(GST_BIN(self->obj), GST_MESSAGE(message->obj)); GST_BIN_CLASS(klass)->handle_message(GST_BIN(self->obj), GST_MESSAGE(message->obj));
pyg_end_allow_threads;
} else { } else {
PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBin.handle_message not implemented"); PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBin.handle_message not implemented");
g_type_class_unref(klass); g_type_class_unref(klass);