def remoteSetUp(self): debug("%s", self.uuid) gst.log("%s" % self.uuid) # local variables # create the pipeline try: self.pipeline = self.createPipeline() except: exception("Error while creating pipeline") self.pipeline = None finally: self.validateStep("valid-pipeline", not self.pipeline == None) if self.pipeline == None: self.remoteStop() return factory = self.pipeline.get_factory() if factory is None: facname = "(no factory)" else: facname = factory.get_name() self._elements = [(self.pipeline.get_name(),facname, "")] #name,factoryname,parentname self._watchContainer(self.pipeline) # connect to bus self.bus = self.pipeline.get_bus() self.bus.add_signal_watch() self.bus.connect("message", self._busMessageHandlerCb) PythonDBusTest.remoteSetUp(self)
def remoteTest(self): # kickstart pipeline to initial state PythonDBusTest.remoteTest(self) debug("Setting pipeline to initial state %r", self.__pipeline_initial_state__) gst.log("Setting pipeline to initial state %r" % self.__pipeline_initial_state__) res = self.pipeline.set_state(self.__pipeline_initial_state__) debug("set_state returned %r", res) gst.log("set_state() returned %r" % res) self.validateStep("pipeline-change-state", not res == gst.STATE_CHANGE_FAILURE) if res == gst.STATE_CHANGE_FAILURE: warning("Setting pipeline to initial state failed, stopping test") gst.warning("State change failed, stopping") self.stop()
def remoteTearDown(self): if not PythonDBusTest.remoteTearDown(self): return False gst.log("Tearing Down") # unref pipeline and so forth if self._waitcb: gobject.source_remove(self._waitcb) self._waitcb = None if self.pipeline: self.pipeline.set_state(gst.STATE_NULL) self.validateStep("no-errors-seen", self._errors == []) if not self._errors == []: self.extraInfo("errors", self._errors) if not self._tags == {}: debug("Got tags %r", self._tags) for key, val in self._tags.iteritems(): if isinstance(val, int): # make sure that only values < 2**31 (MAX_INT32) are ints # TODO : this is gonna screw up MASSIVELY with values > 2**63 if val >= 2**31: self._tags[key] = long(val) # FIXME : if the value is a list, the dbus python bindings screw up # # For the time being we remove the values of type list, but this is REALLY # bad. listval = [x for x in self._tags.keys() if type(self._tags[x]) == list] if listval: warning("Removing this from the taglist since they're list:%r", listval) for val in listval: del self._tags[val] self.extraInfo("tags", dbus.Dictionary(self._tags, signature="sv")) if not self._elements == []: self.extraInfo("elements-used", self._elements) return True
def __init__(self, env=None, *args, **kwargs): # We don't want the tests to update the registry because: # * it will make the tests start up faster # * the tests accros testrun should be using the same registry/plugins # # This feature is only available since 0.10.19.1 (24th April 2008) in # GStreamer core if env == None: env = {} env["GST_REGISTRY_UPDATE"] = "no" self.pipeline = None self.bus = None self._errors = [] self._tags = {} self._elements = [] self._waitcb = None self._reachedInitialState = False PythonDBusTest.__init__(self, env=env, *args, **kwargs)
def setUp(self): # default gst debug output to NOTHING self._environ["GST_DEBUG"] = "0" return PythonDBusTest.setUp(self)
def stop(self): gst.log("Stopping...") PythonDBusTest.stop(self)