commit python-audioread for openSUSE:Factory
Hello community, here is the log from the commit of package python-audioread for openSUSE:Factory checked in at 2017-09-29 11:57:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-audioread (Old) and /work/SRC/openSUSE:Factory/.python-audioread.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-audioread" Fri Sep 29 11:57:15 2017 rev:2 rq:529152 version:2.1.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-audioread/python-audioread.changes 2017-08-24 18:51:01.337050691 +0200 +++ /work/SRC/openSUSE:Factory/.python-audioread.new/python-audioread.changes 2017-09-29 11:57:16.842775717 +0200 @@ -1,0 +2,15 @@ +Thu Sep 28 07:21:03 UTC 2017 - alarrosa@suse.com + +- Update to 2.1.5 + * Properly clean up the file handle when a backend fails to decode a file. + * Fix parsing of "N.M" channel counts in the FFmpeg backend. + * Avoid a crash in the raw backend when a file uses an unsupported + number of bits per sample (namely, 24-bit samples in Python < 3.4). + * Add a __version__ value to the package. + +------------------------------------------------------------------- +Sat Aug 12 21:19:28 UTC 2017 - jengelh@inai.de + +- Trim author list and redundant license info. Improve summary. + +------------------------------------------------------------------- Old: ---- audioread-2.1.4.tar.gz New: ---- audioread-2.1.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-audioread.spec ++++++ --- /var/tmp/diff_new_pack.hiDH14/_old 2017-09-29 11:57:17.570673080 +0200 +++ /var/tmp/diff_new_pack.hiDH14/_new 2017-09-29 11:57:17.574672516 +0200 @@ -18,9 +18,9 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-audioread -Version: 2.1.4 +Version: 2.1.5 Release: 0 -Summary: multi-library, cross-platform audio decoding +Summary: Wrapper for audio decoding via selectable backends License: MIT Group: Development/Languages/Python Url: https://github.com/sampsyo/audioread @@ -42,9 +42,6 @@ - The standard library wave, aifc, and sunau modules (for uncompressed audio formats). -audioread is by Adrian Sampson. It is made available under the MIT -license. An alternative to this module is decoder.py. - %prep %setup -q -n audioread-%{version} ++++++ audioread-2.1.4.tar.gz -> audioread-2.1.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/PKG-INFO new/audioread-2.1.5/PKG-INFO --- old/audioread-2.1.4/PKG-INFO 2016-06-26 02:58:11.000000000 +0200 +++ new/audioread-2.1.5/PKG-INFO 2017-06-10 22:41:46.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: audioread -Version: 2.1.4 +Version: 2.1.5 Summary: multi-library, cross-platform audio decoding Home-page: https://github.com/sampsyo/audioread Author: Adrian Sampson @@ -43,10 +43,10 @@ do_something(buf) Buffers in the file can be accessed by iterating over the object returned from - ``audio_open``. Each buffer is a ``buffer`` or ``str`` object containing raw - **16-bit little-endian signed integer PCM data**. (Currently, these PCM format - parameters are not configurable, but this could be added to most of the - backends.) + ``audio_open``. Each buffer is a bytes-like object (``buffer``, ``bytes``, or + ``bytearray``) containing raw **16-bit little-endian signed integer PCM + data**. (Currently, these PCM format parameters are not configurable, but this + could be added to most of the backends.) Additional values are available as fields on the audio file object: @@ -73,6 +73,13 @@ Version History --------------- + 2.1.5 + Properly clean up the file handle when a backend fails to decode a file. + Fix parsing of "N.M" channel counts in the FFmpeg backend (thanks to @piem). + Avoid a crash in the raw backend when a file uses an unsupported number of + bits per sample (namely, 24-bit samples in Python < 3.4). + Add a ``__version__`` value to the package. + 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. @@ -187,3 +194,4 @@ Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/README.rst new/audioread-2.1.5/README.rst --- old/audioread-2.1.4/README.rst 2016-06-12 22:01:53.000000000 +0200 +++ new/audioread-2.1.5/README.rst 2017-04-14 04:47:27.000000000 +0200 @@ -35,10 +35,10 @@ do_something(buf) Buffers in the file can be accessed by iterating over the object returned from -``audio_open``. Each buffer is a ``buffer`` or ``str`` object containing raw -**16-bit little-endian signed integer PCM data**. (Currently, these PCM format -parameters are not configurable, but this could be added to most of the -backends.) +``audio_open``. Each buffer is a bytes-like object (``buffer``, ``bytes``, or +``bytearray``) containing raw **16-bit little-endian signed integer PCM +data**. (Currently, these PCM format parameters are not configurable, but this +could be added to most of the backends.) Additional values are available as fields on the audio file object: @@ -65,6 +65,13 @@ Version History --------------- +2.1.5 + Properly clean up the file handle when a backend fails to decode a file. + Fix parsing of "N.M" channel counts in the FFmpeg backend (thanks to @piem). + Avoid a crash in the raw backend when a file uses an unsupported number of + bits per sample (namely, 24-bit samples in Python < 3.4). + Add a ``__version__`` value to the package. + 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. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/audioread/__init__.py new/audioread-2.1.5/audioread/__init__.py --- old/audioread-2.1.4/audioread/__init__.py 2016-06-12 21:42:10.000000000 +0200 +++ new/audioread-2.1.5/audioread/__init__.py 2017-04-14 04:46:23.000000000 +0200 @@ -14,6 +14,8 @@ """Decode audio files.""" +from .version import version as __version__ # noqa + class DecodeError(Exception): """The base exception class for all decoding errors raised by this diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/audioread/ffdec.py new/audioread-2.1.5/audioread/ffdec.py --- old/audioread-2.1.4/audioread/ffdec.py 2016-06-12 21:59:55.000000000 +0200 +++ new/audioread-2.1.5/audioread/ffdec.py 2017-03-14 13:30:08.000000000 +0100 @@ -231,9 +231,9 @@ if mode == 'stereo': self.channels = 2 else: - match = re.match(r'(\d+) ', mode) - if match: - self.channels = int(match.group(1)) + cmatch = re.match(r'(\d+)\.?(\d)?', mode) + if cmatch: + self.channels = sum(map(int, cmatch.group().split('.'))) else: self.channels = 1 else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/audioread/macca.py new/audioread-2.1.5/audioread/macca.py --- old/audioread-2.1.4/audioread/macca.py 2014-04-01 00:54:53.000000000 +0200 +++ new/audioread-2.1.5/audioread/macca.py 2017-03-14 13:29:46.000000000 +0100 @@ -8,7 +8,7 @@ # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: -# +# # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. @@ -26,12 +26,15 @@ def _load_framework(name): return ctypes.cdll.LoadLibrary(ctypes.util.find_library(name)) + + _coreaudio = _load_framework('AudioToolbox') _corefoundation = _load_framework('CoreFoundation') -# Convert CFStrings to C strings. +# Convert CFStrings to C strings. _corefoundation.CFStringGetCStringPtr.restype = ctypes.c_char_p -_corefoundation.CFStringGetCStringPtr.argtypes = [ctypes.c_void_p, ctypes.c_int] +_corefoundation.CFStringGetCStringPtr.argtypes = [ctypes.c_void_p, + ctypes.c_int] # Free memory. _corefoundation.CFRelease.argtypes = [ctypes.c_void_p] @@ -82,6 +85,7 @@ num |= ord(char) << shift return num + PROP_FILE_DATA_FORMAT = multi_char_literal('ffmt') PROP_CLIENT_DATA_FORMAT = multi_char_literal('cfmt') PROP_LENGTH = multi_char_literal('#frm') @@ -107,6 +111,7 @@ msg = 'error %i' % code super(MacError, self).__init__(msg) + def check(err): """If err is nonzero, raise a MacError exception.""" if err == ERROR_NOT_FOUND: @@ -127,6 +132,7 @@ if _corefoundation: _corefoundation.CFRelease(self._obj) + class CFURL(CFObject): def __init__(self, filename): if not isinstance(filename, bytes): @@ -136,7 +142,7 @@ 0, filename, len(filename), False ) super(CFURL, self).__init__(url) - + def __str__(self): cfstr = _corefoundation.CFURLGetString(self._obj) out = _corefoundation.CFStringGetCStringPtr(cfstr, 0) @@ -159,6 +165,7 @@ ("mReserved", ctypes.c_uint), ] + class AudioBuffer(ctypes.Structure): _fields_ = [ ("mNumberChannels", ctypes.c_uint), @@ -166,6 +173,7 @@ ("mData", ctypes.c_void_p), ] + class AudioBufferList(ctypes.Structure): _fields_ = [ ("mNumberBuffers", ctypes.c_uint), @@ -295,7 +303,8 @@ buflist = AudioBufferList() buflist.mNumberBuffers = 1 - buflist.mBuffers[0].mNumberChannels = self._client_fmt.mChannelsPerFrame + buflist.mBuffers[0].mNumberChannels = \ + self._client_fmt.mChannelsPerFrame buflist.mBuffers[0].mDataByteSize = blocksize buflist.mBuffers[0].mData = ctypes.cast(buf, ctypes.c_void_p) @@ -303,14 +312,14 @@ check(_coreaudio.ExtAudioFileRead( self._obj, ctypes.byref(frames), ctypes.byref(buflist) )) - + assert buflist.mNumberBuffers == 1 size = buflist.mBuffers[0].mDataByteSize if not size: break data = ctypes.cast(buflist.mBuffers[0].mData, - ctypes.POINTER(ctypes.c_char)) + ctypes.POINTER(ctypes.c_char)) blob = data[:size] yield blob @@ -324,9 +333,10 @@ if _coreaudio: self.close() - # Context manager. + # Context manager methods. def __enter__(self): return self + def __exit__(self, exc_type, exc_val, exc_tb): self.close() return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/audioread/maddec.py new/audioread-2.1.5/audioread/maddec.py --- old/audioread-2.1.4/audioread/maddec.py 2014-04-01 00:54:53.000000000 +0200 +++ new/audioread-2.1.5/audioread/maddec.py 2017-01-07 23:20:41.000000000 +0100 @@ -8,7 +8,7 @@ # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: -# +# # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. @@ -16,15 +16,18 @@ import mad from . import DecodeError + class UnsupportedError(DecodeError): """The file is not readable by MAD.""" + class MadAudioFile(object): """MPEG audio file decoder using the MAD library.""" def __init__(self, filename): self.fp = open(filename, 'rb') self.mf = mad.MadFile(self.fp) - if not self.mf.total_time(): # Indicates a failed open. + if not self.mf.total_time(): # Indicates a failed open. + self.fp.close() raise UnsupportedError() def close(self): @@ -46,7 +49,7 @@ def samplerate(self): """Sample rate in Hz.""" return self.mf.samplerate() - + @property def duration(self): """Length of the audio in seconds (a float).""" @@ -75,6 +78,7 @@ # Context manager. def __enter__(self): return self + def __exit__(self, exc_type, exc_val, exc_tb): self.close() return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/audioread/rawread.py new/audioread-2.1.5/audioread/rawread.py --- old/audioread-2.1.4/audioread/rawread.py 2016-06-12 21:42:10.000000000 +0200 +++ new/audioread-2.1.5/audioread/rawread.py 2017-03-14 20:49:13.000000000 +0100 @@ -18,13 +18,25 @@ import sunau import audioop import struct +import sys from . import DecodeError +# Produce two-byte (16-bit) output samples. TARGET_WIDTH = 2 +# Python 3.4 added support for 24-bit (3-byte) samples. +if sys.version_info > (3, 4, 0): + SUPPORTED_WIDTHS = (1, 2, 3, 4) +else: + SUPPORTED_WIDTHS = (1, 2, 4) + class UnsupportedError(DecodeError): - """File is neither an AIFF nor a WAV file.""" + """File is not an AIFF, WAV, or Au file.""" + + +class BitWidthError(DecodeError): + """The file uses an unsupported bit width.""" def byteswap(s): @@ -42,8 +54,8 @@ class RawAudioFile(object): - """An AIFF or WAV file that can be read by the Python standard - library modules ``wave`` and ``aifc``. + """An AIFF, WAV, or Au file that can be read by the Python standard + library modules ``wave``, ``aifc``, and ``sunau``. """ def __init__(self, filename): self._fh = open(filename, 'rb') @@ -51,34 +63,45 @@ try: self._file = aifc.open(self._fh) except aifc.Error: - # Return to the beginning of the file to try the WAV reader. + # Return to the beginning of the file to try the next reader. self._fh.seek(0) else: self._needs_byteswap = True + self._check() return try: self._file = wave.open(self._fh) except wave.Error: - # Return to the beginning of the file to try the next reader self._fh.seek(0) pass else: self._needs_byteswap = False + self._check() return try: self._file = sunau.open(self._fh) except sunau.Error: - # Return to the beginning of the file to try the next reader self._fh.seek(0) pass else: self._needs_byteswap = True + self._check() return + # None of the three libraries could open the file. + self._fh.close() raise UnsupportedError() + def _check(self): + """Check that the files' parameters allow us to decode it and + raise an error otherwise. + """ + if self._file.getsampwidth() not in SUPPORTED_WIDTHS: + self.close() + raise BitWidthError() + def close(self): """Close the underlying file.""" self._file.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/audioread/version.py new/audioread-2.1.5/audioread/version.py --- old/audioread-2.1.4/audioread/version.py 1970-01-01 01:00:00.000000000 +0100 +++ new/audioread-2.1.5/audioread/version.py 2017-06-10 22:41:29.000000000 +0200 @@ -0,0 +1,18 @@ +# This file is part of audioread. +# Copyright 2017, Adrian Sampson. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +"""Version data for the audioread package.""" + +version = '2.1.5' +short_version = '2.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/audioread-2.1.4/setup.py new/audioread-2.1.5/setup.py --- old/audioread-2.1.4/setup.py 2016-06-12 22:02:14.000000000 +0200 +++ new/audioread-2.1.5/setup.py 2017-04-14 04:44:40.000000000 +0200 @@ -14,6 +14,9 @@ import os from distutils.core import setup +import imp + +version = imp.load_source('audioread.version', 'audioread/version.py') def _read(fn): @@ -22,7 +25,7 @@ setup(name='audioread', - version='2.1.4', + version=version.version, description='multi-library, cross-platform audio decoding', author='Adrian Sampson', author_email='adrian@radbox.org', @@ -44,5 +47,6 @@ 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', ], )
participants (1)
-
root@hilbert.suse.de