From 68b5618882edcea72b7a23bcddf0daee1968139d Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Fri, 14 Feb 2014 10:46:02 +0100 Subject: [PATCH] streaming bug : clean-up unnecessary code changes --- timeside/encoder/core.py | 11 +++++++---- timeside/encoder/mp3.py | 26 ++++++++++++++------------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/timeside/encoder/core.py b/timeside/encoder/core.py index 7ba7823..f89acc3 100644 --- a/timeside/encoder/core.py +++ b/timeside/encoder/core.py @@ -1,7 +1,10 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# Copyright (c) 2012 Paul Brossier +# Copyright (C) 2007-2014 Parisson SARL +# Copyright (c) 2006-2014 Guillaume Pellerin +# Copyright (c) 2010-2014 Paul Brossier +# Copyright (c) 2013-2014 Thomas Fillon # 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]) diff --git a/timeside/encoder/mp3.py b/timeside/encoder/mp3.py index d1b1053..2d5addc 100644 --- a/timeside/encoder/mp3.py +++ b/timeside/encoder/mp3.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2007-2012 Parisson SARL -# Copyright (c) 2006-2012 Guillaume Pellerin -# Copyright (c) 2010-2012 Paul Brossier +# Copyright (C) 2007-2014 Parisson SARL +# Copyright (c) 2006-2014 Guillaume Pellerin +# Copyright (c) 2010-2014 Paul Brossier # Copyright (c) 2009-2010 Olivier Guilyardi - +# Copyright (c) 2013-2014 Thomas Fillon # This file is part of TimeSide. @@ -23,21 +23,24 @@ # Authors: Guillaume Pellerin # Paul Brossier +# Thomas Fillon 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. ! queue2 ! 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') - -- 2.39.5