]> git.parisson.com Git - timeside.git/commitdiff
timeside/encoder/mp3.py: merge with origin gst
authorPaul Brossier <piem@piem.org>
Thu, 27 Sep 2012 15:39:58 +0000 (09:39 -0600)
committerPaul Brossier <piem@piem.org>
Thu, 27 Sep 2012 15:39:58 +0000 (09:39 -0600)
1  2 
timeside/encoder/mp3.py

index f100b5bac2e9a631a3916cfc13f208d4f2019fb2,a5ead73ee507658aa94c461bca056b4539578c68..c59cc57dd03cb7fe3394b67dac29c38ebd83a91c
@@@ -40,17 -40,19 +40,17 @@@ class Mp3Encoder(GstEncoder)
          self.streaming = streaming
          if not self.filename and not self.streaming:
              raise Exception('Must give an output')
-         
          self.metadata = None
          self.eod = False
-         
      @interfacedoc
 -    def setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None):
 -        self.channels = channels
 -        super(Mp3Encoder, self).setup(channels, samplerate, blocksize, totalframes)
 -        #TODO: open file for writing
 -        # the output data format we want
 +    def setup(self, channels=None, samplerate=None, nframes=None):
 +        super(Mp3Encoder, self).setup(channels, samplerate, nframes)
 +
          self.pipe = '''appsrc name=src
-                   ! audioconvert 
-                   ! lamemp3enc target=quality quality=2 encoding-engine-quality=standard ! id3v2mux 
+                   ! audioconvert
+                   ! lamemp3enc target=quality quality=2 encoding-engine-quality=standard ! id3v2mux
                    '''
          if self.filename and self.streaming:
              self.pipe += ''' ! tee name=t
              id3.save()
          except:
              raise IOError('EncoderError: cannot write tags')
-         
 -    @interfacedoc
 -    def process(self, frames, eod=False):
 -        self.eod = eod
 -        buf = numpy_array_to_gst_buffer(frames)
 -        self.src.emit('push-buffer', buf)
 -        if self.streaming:
 -            self.chunk = self.app.emit('pull-buffer')
 -        if self.eod and self.metadata and self.filename:
 -            self.write_metadata()
 -        return frames, eod
 -
  class Mp3EncoderSubprocess(object):
      """MP3 encoder in a subprocess pipe"""