add gst.Caps.__refcount__

Original commit message from CVS:

* gst/gst-types.defs:
* gst/gstcaps.override:
* testsuite/test_caps.py:
add gst.Caps.__refcount__
This commit is contained in:
Thomas Vander Stichele 2005-10-05 17:18:32 +00:00
parent ead5c45836
commit 2dc54c0954
4 changed files with 25 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2005-10-05 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gst-types.defs:
* gst/gstcaps.override:
* testsuite/test_caps.py:
add gst.Caps.__refcount__
2005-10-05 Thomas Vander Stichele <thomas at apestaart dot org>
* testsuite/test_pad.py:

View file

@ -203,6 +203,9 @@
(in-module "Gst")
(c-name "GstCaps")
(gtype-id "GST_TYPE_CAPS")
(fields
'("int" "__refcount__")
)
)
(define-object Plugin

View file

@ -419,6 +419,8 @@ _wrap_gst_caps_tp_dealloc (PyObject *self)
if (boxed->free_on_dealloc && boxed->boxed) {
pygst_caps_map_modified (self);
GST_DEBUG ("unreffing caps %" GST_PTR_FORMAT "with refcount %d",
boxed->boxed, GST_CAPS_REFCOUNT (boxed->boxed));
gst_caps_unref (boxed->boxed);
}
@ -438,3 +440,13 @@ _wrap_gst_caps_tp_str(PyGObject *self)
return retval;
}
%%
override-attr GstCaps.__refcount__
static PyObject *
_wrap_gst_caps__get___refcount__(PyGObject *self, void *closure)
{
return PyInt_FromLong(GST_CAPS_REFCOUNT(self->obj));
}

View file

@ -26,9 +26,12 @@ from common import gst, unittest
class CapsTest(unittest.TestCase):
def setUp(self):
self.caps = gst.caps_from_string('video/x-raw-yuv,width=10,framerate=5.0;video/x-raw-rgb,width=15,framerate=10.0')
self.assertEquals(self.caps.__refcount__, 1)
self.structure = self.caps[0]
self.any = gst.Caps("ANY")
self.assertEquals(self.any.__refcount__, 1)
self.empty = gst.Caps()
self.assertEquals(self.empty.__refcount__, 1)
def testCapsMime(self):
mime = self.structure.get_name()