Imported Debian patch 0.6-1
Simon Chopin
11 years ago
0 | 0 |
Metadata-Version: 1.0
|
1 | 1 |
Name: audioread
|
2 | |
Version: 0.5
|
|
2 |
Version: 0.6
|
3 | 3 |
Summary: multi-library, cross-platform audio decoding
|
4 | 4 |
Home-page: https://github.com/sampsyo/audioread
|
5 | 5 |
Author: Adrian Sampson
|
|
70 | 70 |
Version History
|
71 | 71 |
---------------
|
72 | 72 |
|
|
73 |
0.6
|
|
74 |
Make FFmpeg timeout more robust.
|
|
75 |
Dump FFmpeg output on timeout.
|
|
76 |
Fix a nondeterministic hang in the Gstreamer backend.
|
|
77 |
Fix a file descriptor leak in the MAD backend.
|
|
78 |
|
73 | 79 |
0.5
|
74 | 80 |
Fix crash when FFmpeg fails to report a duration.
|
75 | 81 |
Fix a hang when FFmpeg fills up its stderr output buffer.
|
62 | 62 |
Version History
|
63 | 63 |
---------------
|
64 | 64 |
|
|
65 |
0.6
|
|
66 |
Make FFmpeg timeout more robust.
|
|
67 |
Dump FFmpeg output on timeout.
|
|
68 |
Fix a nondeterministic hang in the Gstreamer backend.
|
|
69 |
Fix a file descriptor leak in the MAD backend.
|
|
70 |
|
65 | 71 |
0.5
|
66 | 72 |
Fix crash when FFmpeg fails to report a duration.
|
67 | 73 |
Fix a hang when FFmpeg fills up its stderr output buffer.
|
18 | 18 |
import re
|
19 | 19 |
import threading
|
20 | 20 |
import select
|
|
21 |
import time
|
21 | 22 |
|
22 | 23 |
class FFmpegError(Exception):
|
23 | 24 |
pass
|
|
72 | 73 |
|
73 | 74 |
# Start a separate thread to read the rest of the data from
|
74 | 75 |
# stderr.
|
75 | |
stderr_reader = ReaderThread(self.proc.stderr)
|
76 | |
stderr_reader.start()
|
|
76 |
self.stderr_reader = ReaderThread(self.proc.stderr)
|
|
77 |
self.stderr_reader.start()
|
77 | 78 |
|
78 | 79 |
def read_data(self, block_size=4096, timeout=10.0):
|
79 | 80 |
"""Read blocks of raw PCM data from the file."""
|
80 | 81 |
# Read from stdout on this thread.
|
|
82 |
start_time = time.time()
|
81 | 83 |
while True:
|
82 | 84 |
# Wait for data to be available or a timeout.
|
83 | 85 |
rready, _, xready = select.select((self.proc.stdout,),
|
84 | 86 |
(), (self.proc.stdout,),
|
85 | 87 |
timeout)
|
|
88 |
end_time = time.time()
|
86 | 89 |
if not rready and not xready:
|
87 | |
raise ReadTimeoutError()
|
|
90 |
if end_time - start_time >= timeout:
|
|
91 |
# Nothing interesting has happened for a while --
|
|
92 |
# FFmpeg is probably hanging.
|
|
93 |
raise ReadTimeoutError(
|
|
94 |
'ffmpeg output: %s' %
|
|
95 |
''.join(self.stderr_reader.data)
|
|
96 |
)
|
|
97 |
else:
|
|
98 |
# Keep waiting.
|
|
99 |
continue
|
|
100 |
start_time = end_time
|
88 | 101 |
|
89 | 102 |
data = self.proc.stdout.read(block_size)
|
90 | 103 |
if not data:
|
105 | 105 |
def __init__(self):
|
106 | 106 |
super(MainLoopThread, self).__init__()
|
107 | 107 |
self.loop = gobject.MainLoop()
|
108 | |
self.running = False
|
109 | 108 |
self.daemon = True
|
110 | 109 |
|
111 | 110 |
def run(self):
|
112 | |
self.running = True
|
113 | 111 |
self.loop.run()
|
114 | 112 |
|
115 | 113 |
|
|
201 | 199 |
self.read_exc = None
|
202 | 200 |
|
203 | 201 |
# Return as soon as the stream is ready!
|
|
202 |
self.running = True
|
204 | 203 |
self.pipeline.set_state(gst.STATE_PLAYING)
|
205 | 204 |
self.ready_sem.acquire()
|
206 | 205 |
if self.read_exc:
|
207 | 206 |
# An error occurred before the stream became ready.
|
208 | 207 |
self.close(True)
|
209 | 208 |
raise self.read_exc
|
210 | |
self.running = True
|
211 | 209 |
|
212 | 210 |
|
213 | 211 |
# Gstreamer callbacks.
|
|
253 | 251 |
# Sent when the pads are done adding (i.e., there are no more
|
254 | 252 |
# streams in the file). If we haven't gotten at least one
|
255 | 253 |
# decodable stream, raise an exception.
|
256 | |
if not self.running and not self._got_a_pad:
|
|
254 |
if not self._got_a_pad:
|
257 | 255 |
self.read_exc = NoStreamError()
|
258 | |
self.ready_sem.release()
|
|
256 |
self.ready_sem.release() # No effect if we've already started.
|
259 | 257 |
|
260 | 258 |
def _new_buffer(self, sink):
|
261 | 259 |
if self.running:
|
20 | 20 |
class MadAudioFile(object):
|
21 | 21 |
"""MPEG audio file decoder using the MAD library."""
|
22 | 22 |
def __init__(self, filename):
|
23 | |
self.mf = mad.MadFile(filename)
|
|
23 |
self.fp = open(filename, 'rb')
|
|
24 |
self.mf = mad.MadFile(self.fp)
|
24 | 25 |
if not self.mf.total_time(): # Indicates a failed open.
|
25 | 26 |
raise UnsupportedError()
|
26 | 27 |
|
27 | 28 |
def close(self):
|
|
29 |
if hasattr(self, 'fp'):
|
|
30 |
self.fp.close()
|
28 | 31 |
if hasattr(self, 'mf'):
|
29 | 32 |
del self.mf
|
30 | 33 |
|
|
0 |
audioread (0.6-1) unstable; urgency=low
|
|
1 |
|
|
2 |
* New upstream release
|
|
3 |
|
|
4 |
-- Simon Chopin <chopin.simon@gmail.com> Fri, 01 Jun 2012 14:06:51 +0200
|
|
5 |
|
0 | 6 |
audioread (0.5-1) unstable; urgency=low
|
1 | 7 |
|
2 | 8 |
* New upstream release
|
19 | 19 |
return open(path).read()
|
20 | 20 |
|
21 | 21 |
setup(name='audioread',
|
22 | |
version='0.5',
|
|
22 |
version='0.6',
|
23 | 23 |
description='multi-library, cross-platform audio decoding',
|
24 | 24 |
author='Adrian Sampson',
|
25 | 25 |
author_email='adrian@radbox.org',
|