def run(self, channels=None, samplerate=None, blocksize=None):
source = self.processors[<NUM_LIT:0>]<EOL>items = self.processors[<NUM_LIT:1>:]<EOL>force_samplerate = set([item.force_samplerate for item in items<EOL>if item.force_samplerate])<EOL>if force_samplerate:<EOL><INDENT>if len(force_samplerate) > <NUM_LIT:1>:<EOL><INDENT>raise ValueError<EOL><DEDENT>force_samplerate = force_samplerate.pop()<EOL>if samplerate and samplerate != force_samplerate:<EOL><INDENT>raise ValueError<EOL><DEDENT>samplerate = force_samplerate<EOL><DEDENT>source.setup(channels=channels, samplerate=samplerate,<EOL>blocksize=blocksize)<EOL>source.SIG_STOP = False<EOL>last = source<EOL>for item in items:<EOL><INDENT>item.source_mediainfo = source.mediainfo()<EOL>item.setup(channels=last.channels(),<EOL>samplerate=last.samplerate(),<EOL>blocksize=last.blocksize(),<EOL>totalframes=last.totalframes())<EOL>self._register_streamer(item)<EOL>last = item<EOL><DEDENT>if self._stream_thread:<EOL><INDENT>self._running_cond.acquire()<EOL><DEDENT>self._is_running = True<EOL>if self._stream_thread:<EOL><INDENT>self._running_cond.notify()<EOL>self._running_cond.release()<EOL><DEDENT>eod = False<EOL>if source.id() == '<STR_LIT>':<EOL><INDENT>import signal<EOL>def signal_handler(signum, frame):<EOL><INDENT>source.stop()<EOL><DEDENT>signal.signal(signal.SIGINT, signal_handler)<EOL><DEDENT>while not eod:<EOL><INDENT>frames, eod = source.process()<EOL>for item in items:<EOL><INDENT>frames, eod = item.process(frames, eod)<EOL><DEDENT><DEDENT>if source.id() == '<STR_LIT>':<EOL><INDENT>signal.signal(signal.SIGINT, signal.SIG_DFL)<EOL><DEDENT>for item in items:<EOL><INDENT>item.post_process()<EOL><DEDENT>source.release()<EOL>for item in items:<EOL><INDENT>item.release()<EOL><DEDENT>self._is_running = False<EOL>
Setup/reset all processors in cascade