gst/gstelement.override: Override the proxy method for GstElement::request_new_pad virtual methods since it can be ca...

Original commit message from CVS:
* gst/gstelement.override:
Override the proxy method for GstElement::request_new_pad virtual
methods since it can be called with NULL as the name.
Fixes #454259
This commit is contained in:
Edward Hervey 2007-07-09 19:42:31 +00:00
parent abe5953fb9
commit 3e4ab3eeb1
2 changed files with 96 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2007-07-09 Edward Hervey <bilboed@bilboed.com>
* gst/gstelement.override:
Override the proxy method for GstElement::request_new_pad virtual
methods since it can be called with NULL as the name.
Fixes #454259
2007-07-09 Edward Hervey <bilboed@bilboed.com>
Patch by: Zaheer Abbas Merali <zaheermerali@gmail.com>

View file

@ -543,3 +543,92 @@ _wrap_gst_element_get_pad_template_list(PyGObject *self)
return ret;
}
%%
override GstElement__proxy_do_request_new_pad
static GstPad*
_wrap_GstElement__proxy_do_request_new_pad(GstElement *self, GstPadTemplate*templ, const gchar*name)
{
PyGILState_STATE __py_state;
PyObject *py_self;
PyObject *py_templ = NULL;
PyObject *py_name;
GstPad* retval;
PyObject *py_retval;
PyObject *py_args;
PyObject *py_method;
__py_state = pyg_gil_state_ensure();
py_self = pygobject_new((GObject *) self);
if (!py_self) {
if (PyErr_Occurred())
PyErr_Print();
pyg_gil_state_release(__py_state);
return NULL;
}
if (templ)
py_templ = pygobject_new((GObject *) templ);
else {
Py_INCREF(Py_None);
py_templ = Py_None;
}
if (name == NULL) {
Py_INCREF(Py_None);
py_name = Py_None;
} else {
py_name = PyString_FromString(name);
if (!py_name) {
if (PyErr_Occurred())
PyErr_Print();
Py_DECREF(py_templ);
Py_DECREF(py_self);
pyg_gil_state_release(__py_state);
return NULL;
}
}
py_args = PyTuple_New(2);
PyTuple_SET_ITEM(py_args, 0, py_templ);
PyTuple_SET_ITEM(py_args, 1, py_name);
py_method = PyObject_GetAttrString(py_self, "do_request_new_pad");
if (!py_method) {
if (PyErr_Occurred())
PyErr_Print();
Py_DECREF(py_args);
Py_DECREF(py_self);
pyg_gil_state_release(__py_state);
return NULL;
}
py_retval = PyObject_CallObject(py_method, py_args);
if (!py_retval) {
if (PyErr_Occurred())
PyErr_Print();
Py_DECREF(py_method);
Py_DECREF(py_args);
Py_DECREF(py_self);
pyg_gil_state_release(__py_state);
return NULL;
}
if (!PyObject_TypeCheck(py_retval, &PyGObject_Type)) {
PyErr_SetString(PyExc_TypeError, "retval should be a GObject");
PyErr_Print();
Py_DECREF(py_retval);
Py_DECREF(py_method);
Py_DECREF(py_args);
Py_DECREF(py_self);
pyg_gil_state_release(__py_state);
return NULL;
}
retval = (GstPad*) pygobject_get(py_retval);
g_object_ref((GObject *) retval);
Py_DECREF(py_retval);
Py_DECREF(py_method);
Py_DECREF(py_args);
Py_DECREF(py_self);
pyg_gil_state_release(__py_state);
return retval;
}