summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2009-02-20 18:29:20 +0100
committerEdward Hervey <bilboed@bilboed.com>2009-02-20 18:29:20 +0100
commitd66033a19c860039ce4b4fbe0ba25cfa1e6c73ca (patch)
tree5a4b1af6446364a9476e1fcd50a8a5105cb93718
parentc4d785bc7b9d41f54b20eee5515b9fdfaa75e726 (diff)
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).
-rw-r--r--gst/gstpad.override12
1 files changed, 12 insertions, 0 deletions
diff --git a/gst/gstpad.override b/gst/gstpad.override
index ec20842..0050ca7 100644
--- a/gst/gstpad.override
+++ b/gst/gstpad.override
@@ -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);
+}