}
%%
+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
extern PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
# 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')
-
- pipeline.add_many(fakesrc, fakesink)
- fakesrc.link(fakesink)
- pad = fakesrc.get_pad('src')
+ 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)
+
+ 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
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__":