From: yomguy Date: Fri, 4 Mar 2011 11:35:47 +0000 (+0000) Subject: bugfixes X-Git-Tag: 0.3.2~71 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=2ab456bb91c403ef1355b60f9f5e9aaee9a51e38;p=timeside.git bugfixes --- diff --git a/timeside/encoder/flac.py b/timeside/encoder/flac.py index 0cb6e03..632e545 100644 --- a/timeside/encoder/flac.py +++ b/timeside/encoder/flac.py @@ -40,7 +40,7 @@ class FlacEncoder(Processor): self.filename = None self.streaming = streaming - if not self.filename and self.streaming: + if not self.filename and not self.streaming: raise Exception('Must give an output') @interfacedoc diff --git a/timeside/encoder/mp3.py b/timeside/encoder/mp3.py index 6baba12..76ab425 100644 --- a/timeside/encoder/mp3.py +++ b/timeside/encoder/mp3.py @@ -42,8 +42,7 @@ class Mp3Encoder(Processor): else: self.filename = None self.streaming = streaming - - if not self.filename and self.streaming: + if not self.filename and not self.streaming: raise Exception('Must give an output') @interfacedoc @@ -51,23 +50,23 @@ class Mp3Encoder(Processor): super(Mp3Encoder, self).setup(channels, samplerate, nframes) #TODO: open file for writing # the output data format we want - pipe = ''' appsrc name=src max-bytes=32768 block=true + self.pipe = ''' appsrc name=src max-bytes=32768 block=true ! audioconvert - ! lame name=enc vbr=0 bitrate=256 ! id3v2mux + ! lamemp3enc bitrate=192 quality=2 ! id3v2mux ''' if self.filename and self.streaming: - pipe += ''' - ! queue2 name=q0 ! tee name=tee - tee. ! queue name=q1 ! appsink name=app sync=false - tee. ! queue name=q2 ! filesink location=%s + self.pipe += ''' + ! tee name=t + ! queue ! appsink name=app + t. ! queue ! filesink location=%s ''' % self.filename elif self.filename : - pipe += '! filesink location=%s ' % self.filename + self.pipe += '! filesink location=%s ' % self.filename else: - pipe += '! appsink name=app sync=false ' + self.pipe += '! appsink name=app ' - self.pipeline = gst.parse_launch(pipe) + self.pipeline = gst.parse_launch(self.pipe) # store a pointer to appsrc in our encoder object self.src = self.pipeline.get_by_name('src') # store a pointer to appsink in our encoder object @@ -119,11 +118,11 @@ class Mp3Encoder(Processor): self.src.emit('push-buffer', buf) if self.streaming: pull = self.app.emit('pull-buffer') - if eod: self.src.emit('end-of-stream') - if not self.streaming: - return frames, eod - else: +# if eod: self.app.emit('end-of-stream') + if self.streaming: return pull, eod + else: + return frames, eod def numpy_array_to_gst_buffer(self, frames): """ gstreamer buffer to numpy array conversion """ diff --git a/timeside/encoder/ogg.py b/timeside/encoder/ogg.py index 1d2bbb6..fe84fe3 100644 --- a/timeside/encoder/ogg.py +++ b/timeside/encoder/ogg.py @@ -41,7 +41,7 @@ class VorbisEncoder(Processor): self.filename = None self.streaming = streaming - if not self.filename and self.streaming: + if not self.filename and not self.streaming: raise Exception('Must give an output') @interfacedoc @@ -58,7 +58,7 @@ class VorbisEncoder(Processor): pipe += ''' ! queue2 name=q0 ! tee name=tee tee. ! queue name=q1 ! appsink name=app sync=false - tee. ! queue name=q2 ! filesink location=%s + tee. ! queue name=q2 ! filesink location=%s ''' % self.filename elif self.filename : diff --git a/timeside/encoder/wav.py b/timeside/encoder/wav.py index 1ff5a1b..c60521b 100644 --- a/timeside/encoder/wav.py +++ b/timeside/encoder/wav.py @@ -42,7 +42,7 @@ class WavEncoder(Processor): self.filename = None self.streaming = streaming - if not self.filename and self.streaming: + if not self.filename and not self.streaming: raise Exception('Must give an output') @interfacedoc