gstpad.override: Take a copy of gst_static_pad_template_get_caps()

This means that we take a completely new caps for the sole usage of
gst-python. The GstCaps return by gst_static_pad_template_get_caps() are
(surprise) static and therefore will always exist... as long as the
GstStaticPadTemplate (and the factory providing it) still exist.

This solves the case of getting the caps of a static pad template *before*
any element was created using the GstElementFactory. When the factory is
used to create an element, a new factory is created, replacing the old one,
and plainly discarding any static values (including those caps).
This commit is contained in:
Edward Hervey 2009-02-20 18:29:20 +01:00
parent c4d785bc7b
commit d66033a19c

View file

@ -1622,3 +1622,15 @@ _wrap_gst_pad_start_task(PyGObject *self, PyObject *args)
Py_INCREF(py_ret);
return py_ret;
}
%%
override gst_static_pad_template_get_caps noargs
static PyObject *
_wrap_gst_static_pad_template_get_caps(PyObject *self)
{
GstCaps *ret;
ret = gst_static_pad_template_get_caps(pyg_pointer_get(self, GstStaticPadTemplate));
/* We take a copy of the caps so they don't disappear */
ret = gst_caps_copy(ret);
return pyg_boxed_new (GST_TYPE_CAPS, ret, FALSE, TRUE);
}