codegen/codegen.py: When chaining up to the parent class methods from python to C...
authorEdward Hervey <bilboed@bilboed.com>
Wed, 10 Jan 2007 16:13:29 +0000 (16:13 +0000)
committerEdward Hervey <bilboed@bilboed.com>
Wed, 10 Jan 2007 16:13:29 +0000 (16:13 +0000)
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
codegen/codegen.py
common
gst/gstbase.override
gst/gstbin.override

index d10d1b4..ebc72b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * gst/extend/discoverer.py:
index a671fe3..6ab8781 100644 (file)
@@ -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 ee0bb43..8ba5dff 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit ee0bb43e2b66781d04078e2210404da48f6c68f0
+Subproject commit 8ba5dffb5ee7e7daea1030f6b34bfef10f9801a3
index a00ca45..639ca47 100644 (file)
@@ -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;
index 071158f..f82a643 100644 (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));
     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);