From 4acc40c8d218abad2af44e7500740e1d56e62df3 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 10 Jan 2007 16:13:29 +0000 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ codegen/codegen.py | 6 ++++-- common | 2 +- gst/gstbase.override | 36 ++++++++++++++++++++++++------------ gst/gstbin.override | 2 ++ 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index d10d1b4e35..ebc72b121b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-01-10 Edward Hervey + + * 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 * gst/extend/discoverer.py: diff --git a/codegen/codegen.py b/codegen/codegen.py index a671fe3b1e..6ab8781c76 100644 --- a/codegen/codegen.py +++ b/codegen/codegen.py @@ -211,10 +211,12 @@ class Wrapper: '%(parseargs)s' '%(codebefore)s' ' 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)->' '%(virtual)s(%(arglist)s);\n' - ' else {\n' + ' pyg_end_allow_threads;\n' + ' } else {\n' ' PyErr_SetString(PyExc_NotImplementedError, ' '"virtual method %(name)s not implemented");\n' ' g_type_class_unref(klass);\n' diff --git a/common b/common index ee0bb43e2b..8ba5dffb5e 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit ee0bb43e2b66781d04078e2210404da48f6c68f0 +Subproject commit 8ba5dffb5ee7e7daea1030f6b34bfef10f9801a3 diff --git a/gst/gstbase.override b/gst/gstbase.override index a00ca45b3e..639ca47a04 100644 --- a/gst/gstbase.override +++ b/gst/gstbase.override @@ -152,9 +152,11 @@ _wrap_GstBaseSrc__do_create (PyObject *cls, PyObject *args, PyObject *kwargs) return NULL; 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); - else { + pyg_end_allow_threads; + } else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.set_caps not implemented"); g_type_class_unref(klass); return NULL; @@ -247,9 +249,11 @@ _wrap_GstBaseSrc__do_get_size (PyObject *cls, PyObject *args, PyObject *kwargs) kwlist, &PyGstBaseSrc_Type, &self)) return NULL; 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); - else { + pyg_end_allow_threads; + } else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_size not implemented"); g_type_class_unref(klass); return NULL; @@ -338,11 +342,13 @@ _wrap_GstBaseSrc__do_get_times (PyObject *cls, PyObject *args, PyObject *kwargs) &PyGstBuffer_Type, &py_buffer)) return NULL; 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_BUFFER(py_buffer->obj), &start, &end); - else { + pyg_end_allow_threads; + } else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSrc.get_times not implemented"); g_type_class_unref(klass); return NULL; @@ -432,10 +438,12 @@ _wrap_GstPushSrc__do_create (PyObject *cls, PyObject *args, PyObject *kwargs) kwlist, &PyGstPushSrc_Type, &self)) return NULL; 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), (GstBuffer**) &buffer); - else { + pyg_end_allow_threads; + } else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GstPushSrc.create not implemented"); g_type_class_unref(klass); return NULL; @@ -537,9 +545,11 @@ _wrap_GstBaseTransform__do_get_unit_size (PyObject *cls, PyObject *args, PyObjec kwlist, &PyGstBaseTransform_Type, &self, &PyGstCaps_Type, &caps)) return NULL; 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); - else { + pyg_end_allow_threads; + } else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseTransform.get_unit_size not implemented"); g_type_class_unref(klass); return NULL; @@ -628,11 +638,13 @@ _wrap_GstBaseSink__do_get_times (PyObject *cls, PyObject *args, PyObject *kwargs &PyGstBuffer_Type, &py_buffer)) return NULL; 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_BUFFER(py_buffer->obj), &start, &end); - else { + pyg_end_allow_threads; + } else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBaseSink.get_times not implemented"); g_type_class_unref(klass); return NULL; diff --git a/gst/gstbin.override b/gst/gstbin.override index 071158f97f..f82a64332a 100644 --- a/gst/gstbin.override +++ b/gst/gstbin.override @@ -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)); if (GST_BIN_CLASS(klass)->handle_message) { gst_mini_object_ref (message->obj); + pyg_begin_allow_threads; GST_BIN_CLASS(klass)->handle_message(GST_BIN(self->obj), GST_MESSAGE(message->obj)); + pyg_end_allow_threads; } else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GstBin.handle_message not implemented"); g_type_class_unref(klass);