def stop(self): """ Stop the leveller, freeing all resources. Call after the leveller emitted 'done' to clean up. """ gst.debug("Setting to NULL") self.set_state(gst.STATE_NULL) gst.debug("Set to NULL") utils.gc_collect('Leveller.stop()')
def clean(self): # clean ourselves up completely self.stop() # let's be ghetto and clean out our bin manually self.remove(self._source) self.remove(self._level) self.remove(self._fakesink) gst.debug("Emptied myself") self._source.clean() utils.gc_collect('Leveller.clean() cleaned up source') self._source = None self._fakesink = None self._level = None utils.gc_collect('Leveller.clean() done')
dontstop = True leveller.set_state(gst.STATE_PLAYING) while dontstop: message = bus.poll(gst.MESSAGE_ANY, gst.SECOND) if message: gst.debug("got message from poll:%s/%r" % (message.type, message)) else: gst.debug("got NOTHING from poll") if message: if message.type == gst.MESSAGE_EOS: print "in: %s, out: %s, length: %s" % (gst.TIME_ARGS(leveller.mixin), gst.TIME_ARGS(leveller.mixout), gst.TIME_ARGS(leveller.length)) print "rms: %f, %f dB" % (leveller.rms, leveller.rmsdB) dontstop = False elif message.type == gst.MESSAGE_ERROR: error,debug = message.parse_error() print "ERROR[%s] %s" % (error.domain, error.message) dontstop = False leveller.stop() leveller.clean() gst.debug('deleting leveller, verify objects are freed') utils.gc_collect('quit main loop') del leveller utils.gc_collect('deleted leveller') gst.debug('stopping forever')