]> git.parisson.com Git - timeside.git/commitdiff
bugfixes
authoryomguy <yomguy@parisson.com>
Fri, 4 Mar 2011 11:35:47 +0000 (11:35 +0000)
committeryomguy <yomguy@parisson.com>
Fri, 4 Mar 2011 11:35:47 +0000 (11:35 +0000)
timeside/encoder/flac.py
timeside/encoder/mp3.py
timeside/encoder/ogg.py
timeside/encoder/wav.py

index 0cb6e0337b6159f9826adeec028eb1a55d7d9fcb..632e5457043df4a8b1d70eca3e4255c84ba85221 100644 (file)
@@ -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
index 6baba1217dfb7573a9e820809f0ce82254b88138..76ab4250acf683da1652bc02900064c980fcd398 100644 (file)
@@ -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 """
index 1d2bbb6dd03ed52e78512904c6a3133ad74651b5..fe84fe36eff079fa2d44d72a5c9434af372c116b 100644 (file)
@@ -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 :
index 1ff5a1b4ba97c43cea78bf3dfd4387e75da4a421..c60521b6e62a7ba790d664e2fec635f8a6425774 100644 (file)
@@ -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