gst/gstpad.override: Allow removing the negotiated pads of a cap by setting them to None.

Original commit message from CVS:
reviewed by: Edward Hervey  <edward@fluendo.com>
* gst/gstpad.override:
Allow removing the negotiated pads of a cap by setting them to None.
* testsuite/test_pad.py:
Added un-negotian of pads' caps to test above patch.
Fixes #363795
This commit is contained in:
Edward Hervey 2007-02-04 10:54:48 +00:00
parent 935a94da54
commit 1856ed8de0
3 changed files with 24 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2007-02-04 Rene Stadler <mail@renestadler.de>
reviewed by: Edward Hervey <edward@fluendo.com>
* gst/gstpad.override:
Allow removing the negotiated pads of a cap by setting them to None.
* testsuite/test_pad.py:
Added un-negotian of pads' caps to test above patch.
Fixes #363795
2007-02-04 Edward Hervey <edward@fluendo.com>
* gst/interfaces.override:

View file

@ -1231,12 +1231,16 @@ _wrap_gst_pad_set_caps(PyGObject *self, PyObject *args, PyObject *kwargs)
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GstPad.set_caps", kwlist, &py_caps))
return NULL;
caps = pygst_caps_from_pyobject (py_caps, NULL);
if (PyErr_Occurred())
return NULL;
if (py_caps == Py_None) {
caps = NULL;
} else {
caps = pygst_caps_from_pyobject (py_caps, NULL);
if (PyErr_Occurred())
return NULL;
}
pyg_begin_allow_threads;
ret = gst_pad_set_caps(GST_PAD(self->obj), caps);
if (ret)
if (ret && caps)
gst_caps_unref (caps);
pyg_end_allow_threads;
return PyBool_FromLong(ret);

View file

@ -92,9 +92,11 @@ class PadPushLinkedTest(TestCase):
def tearDown(self):
self.assertEquals(sys.getrefcount(self.src), 3)
self.assertEquals(self.src.__gstrefcount__, 1)
self.src.set_caps(None)
del self.src
self.assertEquals(sys.getrefcount(self.sink), 3)
self.assertEquals(self.sink.__gstrefcount__, 1)
self.sink.set_caps(None)
del self.sink
TestCase.tearDown(self)
@ -171,9 +173,11 @@ class PadPushEventLinkedTest(TestCase):
def tearDown(self):
self.assertEquals(sys.getrefcount(self.src), 3)
self.assertEquals(self.src.__gstrefcount__, 1)
self.src.set_caps(None)
del self.src
self.assertEquals(sys.getrefcount(self.sink), 3)
self.assertEquals(self.sink.__gstrefcount__, 1)
self.sink.set_caps(None)
del self.sink
TestCase.tearDown(self)
@ -267,9 +271,11 @@ class PadPushProbeLinkTest(TestCase):
def tearDown(self):
self.assertEquals(sys.getrefcount(self.src), 3)
self.assertEquals(self.src.__gstrefcount__, 1)
self.src.set_caps(None)
del self.src
self.assertEquals(sys.getrefcount(self.sink), 3)
self.assertEquals(self.sink.__gstrefcount__, 1)
self.sink.set_caps(None)
del self.sink
TestCase.tearDown(self)