gst/gstpad.override: misc fixes for change in gst_pad_get_parent()

Original commit message from CVS:
* gst/gstpad.override: misc fixes for change in gst_pad_get_parent()
* gst/gst.defs: Updating defs file even more :)
This commit is contained in:
Edward Hervey 2005-07-18 17:13:04 +00:00
parent dc1bb839cd
commit c4d8993ca4
2 changed files with 104 additions and 3 deletions

View file

@ -1,5 +1,7 @@
2005-07-18 Edward Hervey <edward@fluendo.com> 2005-07-18 Edward Hervey <edward@fluendo.com>
* gst/gstpad.override: misc fixes for change in gst_pad_get_parent()
* gst/gst.defs: Updating defs file even more :) * gst/gst.defs: Updating defs file even more :)
2005-07-18 Edward Hervey <edward@fluendo.com> 2005-07-18 Edward Hervey <edward@fluendo.com>

View file

@ -245,7 +245,7 @@ override gst_pad_set_chain_function kwargs
static void EXCEPTION_HANDLER static void EXCEPTION_HANDLER
handle_chain_function_exception (GValue *ret, guint n, const GValue *params) handle_chain_function_exception (GValue *ret, guint n, const GValue *params)
{ {
GstElement *element = gst_pad_get_parent (g_value_get_object (&params[0])); GstElement *element = GST_ELEMENT (gst_object_get_parent (g_value_get_object (&params[0])));
if (!_pygst_element_check_error (element)) if (!_pygst_element_check_error (element))
g_assert_not_reached (); /* only returns FALSE when there's no error */ g_assert_not_reached (); /* only returns FALSE when there's no error */
@ -295,7 +295,7 @@ override gst_pad_set_event_function kwargs
static void EXCEPTION_HANDLER static void EXCEPTION_HANDLER
handle_event_function_exception (GValue *ret, guint n, const GValue *params) handle_event_function_exception (GValue *ret, guint n, const GValue *params)
{ {
GstElement *element = gst_pad_get_parent (g_value_get_object (&params[0])); GstElement *element = GST_ELEMENT (gst_pad_get_parent (g_value_get_object (&params[0])));
if (!_pygst_element_check_error (element)) if (!_pygst_element_check_error (element))
g_assert_not_reached (); /* only returns FALSE when there's no error */ g_assert_not_reached (); /* only returns FALSE when there's no error */
@ -388,7 +388,7 @@ _wrap_gst_pad_tp_repr (PyGObject *self)
GstElement *parent; GstElement *parent;
pad = GST_PAD(self->obj); pad = GST_PAD(self->obj);
parent = gst_pad_get_parent (pad); parent = GST_ELEMENT (gst_pad_get_parent (pad));
buf = g_strdup_printf ("<GstPad (%s:%s) at %lx>", buf = g_strdup_printf ("<GstPad (%s:%s) at %lx>",
parent ? gst_element_get_name (parent) : "---", parent ? gst_element_get_name (parent) : "---",
@ -998,3 +998,102 @@ _wrap_gst_pad_get_query_types_default (PyGObject *self)
return ret; return ret;
} }
%%
override gst_pad_set_blocked_async args
static void
pad_block_callback_marshal(GstPad *pad, gboolean blocked, gpointer user_data)
{
PyGILState_STATE state;
PyObject *callback, *args;
PyObject *ret;
PyObject *py_data;
PyObject *py_user_data;
gint len, i;
g_return_if_fail(user_data != NULL);
state = pyg_gil_state_ensure();
py_user_data = (PyObject *) user_data;
if (blocked)
py_data = Py_True;
else
py_data = Py_False;
Py_INCREF(py_data);
callback = PyTuple_GetItem(py_user_data, 0);
args = Py_BuildValue("(NN)",
pygobject_new(G_OBJECT(pad)),
py_data);
len = PyTuple_Size(py_user_data);
for (i = 1; i < len; ++i) {
PyObject *tuple = args;
args = PySequence_Concat(tuple, PyTuple_GetItem(py_user_data, i));
Py_DECREF(tuple);
}
ret = PyObject_CallObject(callback, args);
if (!ret)
PyErr_Print();
Py_DECREF(py_data);
Py_DECREF(args);
pyg_gil_state_release(state);
}
static PyObject *
_wrap_gst_pad_set_blocked_async (PyGObject *self, PyObject *args)
{
PyObject *callback, *cbargs = NULL, *data;
PyObject *pblocked, *pret;
gboolean blocked;
gboolean ret;
gint len;
len = PyTuple_Size(args);
if (len < 2) {
PyErr_SetString(PyExc_TypeError, "Requires at least 2 arg");
return NULL;
}
pblocked = PySequence_GetItem(args, 0);
blocked = PyBool_Check(pblocked) ? TRUE : FALSE;
callback = PySequence_GetItem(args, 1);
if (!PyCallable_Check(callback)) {
PyErr_SetString(PyExc_TypeError, "callback is not callable");
return NULL;
}
cbargs = PySequence_GetSlice(args, 2, len);
if (cbargs == NULL)
return NULL;
data = Py_BuildValue("(ON)", callback, cbargs);
if (data == NULL)
return NULL;
ret = gst_pad_set_blocked_async (GST_PAD (self->obj), blocked,
(GstPadBlockCallback) pad_block_callback_marshal, data);
if (ret)
pret = Py_True;
else
pret = Py_False;
Py_INCREF(pret);
return pret;
}
/* %% */
/* override gst_pad_set_bufferalloc_function args */
/* static GstFlowReturn */
/* pad_set_bufferalloc_marshal (GstPad *pad, guint64 offset, guint size, */
/* GstCaps *caps, GstBuffer **buf) */
/* { */
/* } */
/* PyObject * */
/* _wrap_gst_pad_set_bufferalloc_function (PyGObject *self, PyObject *args) */
/* { */
/* } */