]> git.parisson.com Git - timeside.git/commitdiff
add self.pipe to vorbis enc
authoryomguy <yomguy@parisson.com>
Thu, 14 Apr 2011 13:52:15 +0000 (13:52 +0000)
committeryomguy <yomguy@parisson.com>
Thu, 14 Apr 2011 13:52:15 +0000 (13:52 +0000)
timeside/decoder/core.py
timeside/encoder/ogg.py
timeside/tests/api/test_lolevel_streaming_vorbis.py

index 481b9cfe4e6805c63866a58cb367d1d54ffa3aab..11aae1c4071e076a40ab7ccc12915b2f65ae8afe 100644 (file)
@@ -24,7 +24,7 @@
 
 from timeside.core import Processor, implements, interfacedoc
 from timeside.api import IDecoder
-from numpy import array, frombuffer, getbuffer, float32
+from numpy import array, frombuffer, getbuffer, float32, append
 import Queue
 
 import pygst
@@ -59,7 +59,7 @@ class FileDecoder(Processor):
         
         # the output data format we want
         caps = "audio/x-raw-float, width=32"
-        self.pipeline = gst.parse_launch('''uridecodebin uri="%s" 
+        self.pipeline = gst.parse_launch('''uridecodebin uri="%s" name=src
             ! audioconvert
             ! %s
             ! appsink name=sink sync=False ''' % (self.uri, caps))
@@ -67,7 +67,10 @@ class FileDecoder(Processor):
         self.sink = self.pipeline.get_by_name('sink')
         self.sink.set_property('emit-signals', True)
         # adjust length of emitted buffers
-        self.sink.set_property('blocksize', 16384)
+#        self.sink.set_property('blocksize', self.buffer_size)
+        self.src = self.pipeline.get_by_name('src')
+#        self.src.set_property('use-buffering', True)
+#        self.src.set_property('buffer_size', self.buffer_size)
         # start pipeline
         self.pipeline.set_state(gst.STATE_PLAYING)
 
@@ -86,7 +89,7 @@ class FileDecoder(Processor):
     @interfacedoc
     def process(self, frames = None, eod = False):
         try:
-            buf = self.sink.emit('pull-buffer')
+            buf = self.sink.emit('pull-buffer')                
         except SystemError, e:
             # should never happen
             print 'SystemError', e
index 647e16eaf8f156a2943576d45f649b49d6b95e00..84eb61603994124333812d2c775e250a9f9f9764 100644 (file)
@@ -53,24 +53,24 @@ class VorbisEncoder(Processor):
         super(VorbisEncoder, self).setup(channels, samplerate, nframes)
         # TODO open file for writing
         # the output data format we want        
-        pipe = ''' appsrc name=src
+        self.pipe = ''' appsrc name=src
                   ! audioconvert 
                   ! vorbisenc
                   ! oggmux
                   '''
         if self.filename and self.streaming:
-            pipe += '''
+            self.pipe += '''
             ! tee name=t
             ! queue ! appsink name=app sync=False
             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 sync=False '
             
-        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
index 39a265246520395259adefd1142041f05e5322a4..ecc3d3f908d9c126788306072da628098d83f432 100644 (file)
@@ -29,6 +29,8 @@ streaming=True
 encoder = VorbisEncoder(dest1, streaming=True)
 encoder.setup(channels=channels, samplerate=samplerate)
 
+print encoder.pipe
+
 while True:
     encoder.process(*decoder.process())
     if streaming: