mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
gst/pygstiterator.c: Unref the return value, since the iterator refs them.
Original commit message from CVS: * gst/pygstiterator.c: Unref the return value, since the iterator refs them. * testsuite/test_iterator.py: Added more test cases, re-enabled gcverify now the bug is fixed * gst/pygstminiobject.c: (pygstminiobject_register_wrapper), (pygstminiobject_new), (pygstminiobject_dealloc): Comments to better track the creation/destruction of PyGstMiniObject Fixed naming (gst.GstMiniObject => gst.MiniObject) * testsuite/python.supp: Updated python specific valgrind suppressions to latest version and added x86_64 cases * testsuite/gstpython.supp: Series of suppressions for errors/leaks not solvable within gst-python * testsuite/Makefile.am: Added gstpython.supp
This commit is contained in:
parent
6858dbb214
commit
fd5f5ad8d0
4 changed files with 61 additions and 11 deletions
|
@ -1,5 +1,11 @@
|
|||
2005-10-07 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* gst/pygstiterator.c:
|
||||
Unref the return value, since the iterator refs them.
|
||||
|
||||
* testsuite/test_iterator.py:
|
||||
Added more test cases, re-enabled gcverify now the bug is fixed
|
||||
|
||||
* gst/pygstminiobject.c: (pygstminiobject_register_wrapper),
|
||||
(pygstminiobject_new), (pygstminiobject_dealloc):
|
||||
Comments to better track the creation/destruction of PyGstMiniObject
|
||||
|
|
|
@ -35,7 +35,7 @@ pygst_iterator_iter_next(PyGstIterator *self)
|
|||
gpointer element;
|
||||
PyObject *retval = NULL;
|
||||
GstIteratorResult result;
|
||||
|
||||
|
||||
result = gst_iterator_next(self->iter, &element);
|
||||
switch (result)
|
||||
{
|
||||
|
@ -43,11 +43,20 @@ pygst_iterator_iter_next(PyGstIterator *self)
|
|||
PyErr_SetNone(PyExc_StopIteration);
|
||||
break;
|
||||
case GST_ITERATOR_OK:
|
||||
if (g_type_is_a(self->iter->type, G_TYPE_OBJECT))
|
||||
if (g_type_is_a(self->iter->type, GST_TYPE_OBJECT)) {
|
||||
retval = pygstobject_new(G_OBJECT(element));
|
||||
else {
|
||||
pygst_object_unref (element);
|
||||
} else if (g_type_is_a(self->iter->type, G_TYPE_OBJECT)) {
|
||||
retval = pygobject_new(G_OBJECT(element));
|
||||
g_object_unref (element);
|
||||
} else if (g_type_is_a(self->iter->type, GST_TYPE_MINI_OBJECT)) {
|
||||
retval = pygstminiobject_new(GST_MINI_OBJECT(element));
|
||||
gst_mini_object_unref (element);
|
||||
} else {
|
||||
const gchar *type_name;
|
||||
type_name = g_type_name(self->iter->type);
|
||||
PyErr_Format(PyExc_TypeError, "Unsupported child type: %s",
|
||||
g_type_name(self->iter->type));
|
||||
type_name ? type_name : "unknown");
|
||||
}
|
||||
break;
|
||||
case GST_ITERATOR_RESYNC:
|
||||
|
@ -61,7 +70,6 @@ pygst_iterator_iter_next(PyGstIterator *self)
|
|||
g_assert_not_reached();
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -138,7 +146,10 @@ PyObject*
|
|||
pygst_iterator_new(GstIterator *iter)
|
||||
{
|
||||
PyGstIterator *self;
|
||||
|
||||
self = PyObject_NEW(PyGstIterator, &PyGstIterator_Type);
|
||||
self->iter = iter;
|
||||
GST_DEBUG("self:%p , iterator:%p, type:%d",
|
||||
self, self->iter, self->iter->type);
|
||||
return (PyObject *) self;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ testhelper_la_SOURCES = \
|
|||
testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
|
||||
|
||||
TESTS = \
|
||||
tests = \
|
||||
test_bin.py \
|
||||
test_buffer.py \
|
||||
test_caps.py \
|
||||
|
@ -40,7 +40,7 @@ check-verbose: testhelper.la
|
|||
@VERBOSE=yes PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py
|
||||
@rm -fr *.pyc
|
||||
|
||||
EXTRA_DIST = $(TESTS) common.py runtests.py test-object.h python.supp gstpython.supp
|
||||
EXTRA_DIST = $(tests) common.py runtests.py test-object.h python.supp gstpython.supp
|
||||
|
||||
if HAVE_VALGRIND
|
||||
check-valgrind:
|
||||
|
|
|
@ -21,11 +21,44 @@ import unittest
|
|||
from common import gst, TestCase
|
||||
|
||||
class IteratorTest(TestCase):
|
||||
# XXX: This is busted. Testsuite or iterator bindings?
|
||||
def gcverify(self):
|
||||
pass
|
||||
|
||||
# XXX: Elements
|
||||
def testBinIterateElements(self):
|
||||
pipeline = gst.parse_launch("fakesrc name=src ! fakesink name=sink")
|
||||
elements = list(pipeline.elements())
|
||||
fakesrc = pipeline.get_by_name("src")
|
||||
fakesink = pipeline.get_by_name("sink")
|
||||
|
||||
self.assertEqual(len(elements), 2)
|
||||
self.failUnless(fakesrc in elements)
|
||||
self.failUnless(fakesink in elements)
|
||||
|
||||
pipeline.remove(fakesrc)
|
||||
elements = list(pipeline.elements())
|
||||
|
||||
self.assertEqual(len(elements), 1)
|
||||
self.failUnless(not fakesrc in pipeline)
|
||||
|
||||
# XXX : There seems to be a problem about the GType
|
||||
# set in gst_bin_iterated_sorted
|
||||
|
||||
## def testBinIterateSorted(self):
|
||||
## gst.info("testBinIterateSorted beginning")
|
||||
## pipeline = gst.parse_launch("fakesrc name=src ! fakesink name=sink")
|
||||
## gst.info("before calling pipeline.sorted()")
|
||||
## elements = list(pipeline.sorted())
|
||||
## gst.info("after calling pipeline.sorted()")
|
||||
## fakesrc = pipeline.get_by_name("src")
|
||||
## fakesink = pipeline.get_by_name("sink")
|
||||
|
||||
## self.assertEqual(elements[0], fakesink)
|
||||
## self.assertEqual(elements[1], fakesrc)
|
||||
## gst.info("testBinIterateSorted end")
|
||||
|
||||
def testBinIterateSinks(self):
|
||||
pipeline = gst.parse_launch("fakesrc name=src ! fakesink name=sink")
|
||||
elements = list(pipeline.elements())
|
||||
fakesrc = pipeline.get_by_name("src")
|
||||
fakesink = pipeline.get_by_name("sink")
|
||||
|
||||
def testIteratePadsFakeSrc(self):
|
||||
fakesrc = gst.element_factory_make('fakesrc')
|
||||
|
|
Loading…
Reference in a new issue