]> git.parisson.com Git - timeside.git/commitdiff
streaming bug : clean-up unnecessary code changes
authorThomas Fillon <thomas@parisson.com>
Fri, 14 Feb 2014 09:46:02 +0000 (10:46 +0100)
committerThomas Fillon <thomas@parisson.com>
Fri, 14 Feb 2014 09:46:02 +0000 (10:46 +0100)
timeside/encoder/core.py
timeside/encoder/mp3.py

index 7ba78233f6bb6522c065b0dd553c0eb3c60d758c..f89acc3798670f6efd5adfb180451a604472b0da 100644 (file)
@@ -1,7 +1,10 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 #
-# Copyright (c) 2012 Paul Brossier <piem@piem.org>
+# Copyright (C) 2007-2014 Parisson SARL
+# Copyright (c) 2006-2014 Guillaume Pellerin <pellerin@parisson.com>
+# Copyright (c) 2010-2014 Paul Brossier <piem@piem.org>
+# Copyright (c) 2013-2014 Thomas Fillon <thomas@parisson.com>
 
 # This file is part of TimeSide.
 
@@ -20,9 +23,9 @@
 
 
 from timeside.core import Processor, implements, interfacedoc
-from timeside.component import implements, abstract
+from timeside.component import abstract
 from timeside.api import IEncoder
-from timeside.tools import *
+from timeside.tools import numpy_array_to_gst_buffer
 
 #from gst import _gst as gst
 import pygst
@@ -192,4 +195,4 @@ if __name__ == "__main__":
     # Run doctest from __main__ and unittest from test_analyzer_preprocessors
     from tests import test_encoding, test_transcoding
     from tests.unit_timeside import run_test_module
-    run_test_module([test_encoding, test_transcoding])
\ No newline at end of file
+    run_test_module([test_encoding, test_transcoding])
index d1b1053d619f82c23528b3d5f2e035ca9045d95b..2d5addcd46f78a4c56a87e021d12c26aa73fcbaf 100644 (file)
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2007-2012 Parisson SARL
-# Copyright (c) 2006-2012 Guillaume Pellerin <pellerin@parisson.com>
-# Copyright (c) 2010-2012 Paul Brossier <piem@piem.org>
+# Copyright (C) 2007-2014 Parisson SARL
+# Copyright (c) 2006-2014 Guillaume Pellerin <pellerin@parisson.com>
+# Copyright (c) 2010-2014 Paul Brossier <piem@piem.org>
 # Copyright (c) 2009-2010 Olivier Guilyardi <olivier@samalyse.com>
-
+# Copyright (c) 2013-2014 Thomas Fillon <thomas@parisson.com>
 
 # This file is part of TimeSide.
 
 
 # Authors: Guillaume Pellerin <yomguy@parisson.com>
 #          Paul Brossier <piem@piem.org>
+#          Thomas Fillon <thomas@parisson.com>
 
 from timeside.core import implements, interfacedoc
 from timeside.encoder.core import GstEncoder
 from timeside.api import IEncoder
-from timeside.tools import *
 
 import mutagen
 
+
 class Mp3Encoder(GstEncoder):
     """ gstreamer-based mp3 encoder """
     implements(IEncoder)
 
     @interfacedoc
-    def setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None):
-        super(Mp3Encoder, self).setup(channels, samplerate, blocksize, totalframes)
+    def setup(self, channels=None, samplerate=None, blocksize=None,
+              totalframes=None):
+        super(Mp3Encoder, self).setup(channels, samplerate, blocksize,
+                                      totalframes)
 
         self.pipe = '''appsrc name=src
                   ! audioconvert ! audioresample
@@ -48,11 +51,11 @@ class Mp3Encoder(GstEncoder):
 
         if self.filename and self.streaming:
             self.pipe += ''' ! tee name=t
-            ! queue2 ! filesink location=%s
-            t. ! queue! appsink name=app sync=False
+            ! queue ! filesink location=%s
+            t. ! queue! appsink name=app sync=False
             ''' % self.filename
 
-        elif self.filename :
+        elif self.filename:
             self.pipe += '! filesink location=%s async=False sync=False ' % self.filename
         else:
             self.pipe += '! queue ! appsink name=app sync=False'
@@ -94,7 +97,7 @@ class Mp3Encoder(GstEncoder):
         id3 = id3.ID3(self.filename)
         for tag in self.metadata.keys():
             value = self.metadata[tag]
-            frame = mutagen.id3.Frames[tag](3,value)
+            frame = mutagen.id3.Frames[tag](3, value)
             try:
                 id3.add(frame)
             except:
@@ -103,4 +106,3 @@ class Mp3Encoder(GstEncoder):
             id3.save()
         except:
             raise IOError('EncoderError: cannot write tags')
-