gst/: Add implementation of gst.Pad.set_setcaps_function().

Original commit message from CVS:
* gst/common.h:
* gst/gstpad.override:
Add implementation of gst.Pad.set_setcaps_function().
This commit is contained in:
Edward Hervey 2006-12-01 17:41:28 +00:00
parent b2d90fa5ac
commit c09393b5b9
3 changed files with 56 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2006-12-01 Edward Hervey <edward@fluendo.com>
* gst/common.h:
* gst/gstpad.override:
Add implementation of gst.Pad.set_setcaps_function().
2006-11-28 Edward Hervey <edward@fluendo.com>
* configure.ac:

View file

@ -42,6 +42,7 @@ typedef struct {
GClosure *chain_function;
GClosure *get_function;
GClosure *getcaps_function;
GClosure *setcaps_function;
} PyGstPadPrivate;
typedef struct {

View file

@ -80,6 +80,7 @@ free_pad_private (gpointer data)
INVALIDATE_CLOSURE (private->chain_function)
INVALIDATE_CLOSURE (private->get_function)
INVALIDATE_CLOSURE (private->getcaps_function)
INVALIDATE_CLOSURE (private->setcaps_function)
#undef INVALIDATE_CLOSURE
}
@ -347,6 +348,54 @@ _wrap_gst_pad_set_event_function (PyGObject *self,
kwargs, event_function)
}
%%
override gst_pad_set_setcaps_function kwargs
static void EXCEPTION_HANDLER
handle_setcaps_function_exception (GValue *ret, guint n, const GValue *params)
{
GstElement *element = GST_ELEMENT (gst_pad_get_parent (g_value_get_object (&params[0])));
if (!_pygst_element_check_error (element)) {
g_assert_not_reached (); /* only returns FALSE when there's no error */
}
}
static gboolean
call_setcaps_function (GstPad *pad, GstCaps *caps)
{
GClosure *closure;
GValue ret = { 0, };
GValue args[2] = { { 0, }, { 0, } };
gboolean bool;
g_value_init (&ret, G_TYPE_BOOLEAN);
g_value_set_boolean (&ret, FALSE);
g_value_init (&args[0], GST_TYPE_PAD);
g_value_init (&args[1], GST_TYPE_CAPS);
g_value_set_object (&args[0], pad);
gst_value_set_caps (&args[1], (const GstCaps*) caps);
closure = pad_private(pad)->setcaps_function;
g_closure_invoke (closure, &ret, 2, args, NULL);
bool = g_value_get_boolean (&ret);
g_value_unset (&ret);
g_value_unset (&args[0]);
g_value_unset (&args[1]);
return bool;
}
static PyObject*
_wrap_gst_pad_set_setcaps_function (PyGObject *self,
PyObject *args,
PyObject *kwargs)
{
SET_PAD_CLOSURE (self, args,
kwargs, setcaps_function)
}
%%
override-slot GstPad.tp_repr
static PyObject *