mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
gst/gst.*: add another registry method
Original commit message from CVS: * gst/gst.defs: * gst/gst.override: add another registry method * testsuite/Makefile.am: add check-verbose * testsuite/runtests.py: check for VERBOSE env var * testsuite/test_pad.py: refactor a test and add one more for probes
This commit is contained in:
parent
1f45a20a81
commit
cfdc81b592
7 changed files with 97 additions and 23 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2005-09-23 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/gst.defs:
|
||||
* gst/gst.override:
|
||||
add another registry method
|
||||
* testsuite/Makefile.am:
|
||||
add check-verbose
|
||||
* testsuite/runtests.py:
|
||||
check for VERBOSE env var
|
||||
* testsuite/test_pad.py:
|
||||
refactor a test and add one more for probes
|
||||
|
||||
2005-09-22 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* gst/gstbuffer.override:
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit cd4da6a319d9f92d28f7b8a3b412577e6de50b64
|
||||
Subproject commit 345fd9851051274dd758a19bbe33dbb561b4d303
|
|
@ -4135,6 +4135,14 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method get_feature_list_by_plugin
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_get_feature_list_by_plugin")
|
||||
(return-type "GList*")
|
||||
(parameters
|
||||
'("const gchar*" "name")
|
||||
)
|
||||
)
|
||||
(define-method add_feature
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_add_feature")
|
||||
|
|
|
@ -747,6 +747,37 @@ _wrap_gst_registry_get_feature_list (PyGObject *self, PyObject *args, PyObject *
|
|||
return list;
|
||||
}
|
||||
|
||||
%%
|
||||
override gst_registry_get_feature_list_by_plugin kwargs
|
||||
static PyObject *
|
||||
_wrap_gst_registry_get_feature_list_by_plugin (PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "name", NULL };
|
||||
gchar * name = NULL;
|
||||
|
||||
GstRegistry *registry;
|
||||
GList *l, *features;
|
||||
PyObject *list;
|
||||
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
"s:GstRegistry.get_feature_list_by_plugin", kwlist, &name))
|
||||
return NULL;
|
||||
|
||||
registry = GST_REGISTRY (self->obj);
|
||||
|
||||
features = gst_registry_get_feature_list_by_plugin (registry, name);
|
||||
|
||||
list = PyList_New (0);
|
||||
for (l = features; l; l = l->next) {
|
||||
GstPluginFeature *feature = (GstPluginFeature *) l->data;
|
||||
PyList_Append (list, pygobject_new (G_OBJECT (feature)));
|
||||
}
|
||||
g_list_free (features);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
%%
|
||||
override gst_xml_new noargs
|
||||
|
||||
|
|
|
@ -34,5 +34,9 @@ check-local: testhelper.la
|
|||
@G_DEBUG=fatal_warnings GST_DEBUG=*:0 PYTHONPATH=$(top_builddir):$(top_builddir)/gst/.libs:`pwd`:$(top_srcdir):$(PYTHONPATH) $(PYTHON) $(srcdir)/runtests.py
|
||||
@rm -fr *.pyc
|
||||
|
||||
check-verbose: testhelper.la
|
||||
@VERBOSE=yes G_DEBUG=fatal_warnings GST_DEBUG=*:0 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
|
||||
|
||||
|
|
|
@ -41,7 +41,14 @@ loader = unittest.TestLoader()
|
|||
for name in gettestnames():
|
||||
suite.addTest(loader.loadTestsFromName(name))
|
||||
|
||||
testRunner = unittest.TextTestRunner()
|
||||
descriptions = 1
|
||||
verbosity = 1
|
||||
if os.environ.has_key('VERBOSE'):
|
||||
descriptions = 2
|
||||
verbosity = 2
|
||||
|
||||
testRunner = unittest.TextTestRunner(descriptions=descriptions,
|
||||
verbosity=verbosity)
|
||||
result = testRunner.run(suite)
|
||||
if result.failures or result.errors:
|
||||
sys.exit(1)
|
||||
|
|
|
@ -55,31 +55,45 @@ class PadPipelineTest(unittest.TestCase):
|
|||
# assert self.srcpad.query(gst.QUERY_POSITION, gst.FORMAT_TIME) == 0
|
||||
|
||||
class PadProbeTest(unittest.TestCase):
|
||||
def testFakeSrcProbe(self):
|
||||
pipeline = gst.Pipeline()
|
||||
fakesrc = gst.element_factory_make('fakesrc')
|
||||
fakesrc.set_property('num-buffers', 1)
|
||||
fakesink = gst.element_factory_make('fakesink')
|
||||
def setUp(self):
|
||||
self.pipeline = gst.Pipeline()
|
||||
self.fakesrc = gst.element_factory_make('fakesrc')
|
||||
self.fakesink = gst.element_factory_make('fakesink')
|
||||
self.pipeline.add_many(self.fakesrc, self.fakesink)
|
||||
self.fakesrc.link(self.fakesink)
|
||||
|
||||
pipeline.add_many(fakesrc, fakesink)
|
||||
fakesrc.link(fakesink)
|
||||
pad = fakesrc.get_pad('src')
|
||||
def testFakeSrcProbeOnce(self):
|
||||
self.fakesrc.set_property('num-buffers', 1)
|
||||
|
||||
pad = self.fakesrc.get_pad('src')
|
||||
pad.add_buffer_probe(self._probe_callback_fakesrc)
|
||||
self._got_fakesrc_buffer = False
|
||||
pipeline.set_state(gst.STATE_PLAYING)
|
||||
self._got_fakesrc_buffer = 0
|
||||
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||
while not self._got_fakesrc_buffer:
|
||||
pass
|
||||
|
||||
self.pipeline.set_state(gst.STATE_NULL)
|
||||
|
||||
def testFakeSrcProbeMany(self):
|
||||
self.fakesrc.set_property('num-buffers', 1000)
|
||||
|
||||
pad = self.fakesrc.get_pad('src')
|
||||
pad.add_buffer_probe(self._probe_callback_fakesrc)
|
||||
self._got_fakesrc_buffer = 0
|
||||
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||
while not self._got_fakesrc_buffer == 1000:
|
||||
pass
|
||||
|
||||
self.pipeline.set_state(gst.STATE_NULL)
|
||||
|
||||
|
||||
def _probe_callback_fakesrc(self, pad, buffer):
|
||||
self.failUnless(isinstance(pad, gst.Pad))
|
||||
self.failUnless(isinstance(buffer, gst.Buffer))
|
||||
self._got_fakesrc_buffer = True
|
||||
self._got_fakesrc_buffer += 1
|
||||
|
||||
def testRemovingProbe(self):
|
||||
pipeline = gst.Pipeline()
|
||||
fakesrc = gst.element_factory_make('fakesrc')
|
||||
fakesrc.set_property('num-buffers', 10)
|
||||
fakesink = gst.element_factory_make('fakesink')
|
||||
self.fakesrc.set_property('num-buffers', 10)
|
||||
|
||||
handle = None
|
||||
self._num_times_called = 0
|
||||
|
@ -88,15 +102,13 @@ class PadProbeTest(unittest.TestCase):
|
|||
pad.remove_buffer_probe(handle)
|
||||
return True
|
||||
|
||||
pipeline.add_many(fakesrc, fakesink)
|
||||
fakesrc.link(fakesink)
|
||||
pad = fakesrc.get_pad('src')
|
||||
pad = self.fakesrc.get_pad('src')
|
||||
handle = pad.add_buffer_probe(buffer_probe)
|
||||
self._got_fakesrc_buffer = False
|
||||
pipeline.set_state(gst.STATE_PLAYING)
|
||||
m = pipeline.get_bus().poll(gst.MESSAGE_EOS, -1)
|
||||
self.pipeline.set_state(gst.STATE_PLAYING)
|
||||
m = self.pipeline.get_bus().poll(gst.MESSAGE_EOS, -1)
|
||||
assert m
|
||||
assert self._num_times_called == 1
|
||||
self.pipeline.set_state(gst.STATE_NULL)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue