Skip to content

Commit

Permalink
Fix #32: ffmpeg interference with stdin stream
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Jun 12, 2016
1 parent 70e51b0 commit ea48fd7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ convert compressed audio files to WAV files.
Version History
---------------

2.1.4
Fix a bug in the FFmpeg backend where, after closing a file, the program's
standard input stream would be "broken" and wouldn't receive any input.

2.1.3
Avoid some warnings in the GStreamer backend when using modern versions of
GLib. We now require at least GLib 2.32.
Expand Down
7 changes: 6 additions & 1 deletion audioread/ffdec.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import re
import threading
import time
import os
try:
import queue
except ImportError:
Expand Down Expand Up @@ -117,10 +118,13 @@ def __init__(self, filename, block_size=4096):
)

try:
self.devnull = open(os.devnull)
self.proc = popen_multiple(
COMMANDS,
['-i', filename, '-f', 's16le', '-'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=self.devnull,
)

except OSError:
Expand Down Expand Up @@ -258,6 +262,7 @@ def close(self):
if hasattr(self, 'proc') and self.proc.returncode is None:
self.proc.kill()
self.proc.wait()
self.devnull.close()

def __del__(self):
self.close()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _read(fn):


setup(name='audioread',
version='2.1.3',
version='2.1.4',
description='multi-library, cross-platform audio decoding',
author='Adrian Sampson',
author_email='adrian@radbox.org',
Expand Down

0 comments on commit ea48fd7

Please sign in to comment.