From d66033a19c860039ce4b4fbe0ba25cfa1e6c73ca Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 20 Feb 2009 18:29:20 +0100 Subject: [PATCH] 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). --- gst/gstpad.override | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); +} -- 2.7.4