From dc2661880db66fc2fb8282ecc9e98f44bd281cca Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Mon, 20 Jan 2014 09:42:45 +0100 Subject: [PATCH] Minor changes in live and file decoder and audiosink encoder --- timeside/decoder/file.py | 5 +++-- timeside/decoder/live.py | 7 ++++--- timeside/encoder/audiosink.py | 6 ++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/timeside/decoder/file.py b/timeside/decoder/file.py index 389a707..8d012a3 100644 --- a/timeside/decoder/file.py +++ b/timeside/decoder/file.py @@ -111,7 +111,7 @@ class FileDecoder(Decoder): if self.is_segment: # Create the pipe with Gnonlin gnlurisource - self.pipe = ''' gnlurisource uri={uri} + self.pipe = ''' gnlurisource name=src uri={uri} start=0 duration={uri_duration} media-start={uri_start} @@ -125,7 +125,7 @@ class FileDecoder(Decoder): # convert uri_start and uri_duration to nanoseconds else: # Create the pipe with standard Gstreamer uridecodbin - self.pipe = ''' uridecodebin name=uridecodebin uri={uri} + self.pipe = ''' uridecodebin name=src uri={uri} ! audioconvert name=audioconvert ! audioresample ! appsink name=sink sync=False async=True @@ -147,6 +147,7 @@ class FileDecoder(Decoder): width=(int)32, rate=(int)%s""" % (caps_channels, caps_samplerate)) + self.src = self.pipeline.get_by_name('src') self.conv = self.pipeline.get_by_name('audioconvert') self.conv.get_pad("sink").connect("notify::caps", self._notify_caps_cb) diff --git a/timeside/decoder/live.py b/timeside/decoder/live.py index 4c7e5c6..539575f 100644 --- a/timeside/decoder/live.py +++ b/timeside/decoder/live.py @@ -62,11 +62,12 @@ class LiveDecoder(Decoder): >>> import timeside - >>> live = timeside.decoder.LiveDecoder(num_buffers=25) + >>> live = timeside.decoder.LiveDecoder(num_buffers=5) >>> a = timeside.analyzer.Waveform() - >>> e = timeside.encoder.Mp3Encoder('test_live.mp3', overwrite=True) + >>> e = timeside.encoder.Mp3Encoder('/tmp/test_live.mp3', + ... overwrite=True) >>> pipe = (live | a | e) - >>> pipe.run() + >>> pipe.run() # doctest: +SKIP >>> import matplotlib.pyplot as plt # doctest: +SKIP >>> plt.plot(a.results['waveform_analyzer'].time, # doctest: +SKIP diff --git a/timeside/encoder/audiosink.py b/timeside/encoder/audiosink.py index f60d128..9372ce6 100644 --- a/timeside/encoder/audiosink.py +++ b/timeside/encoder/audiosink.py @@ -25,7 +25,6 @@ from timeside.encoder.core import GstEncoder from timeside.api import IEncoder from timeside.tools import * - class AudioSink(GstEncoder): """ gstreamer-based Audio Sink @@ -43,8 +42,7 @@ class AudioSink(GstEncoder): implements(IEncoder) def __init__(self, output_sink='autoaudiosink'): - """ - """ + super(GstEncoder, self).__init__() self.streaming = False @@ -100,4 +98,4 @@ class AudioSink(GstEncoder): if __name__ == "__main__": import doctest - doctest.testmod() \ No newline at end of file + doctest.testmod() -- 2.39.5