classification
Title: Support Apple AIFF-C pseudo compression in aifc.py
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: serhiy.storchaka, thruston, xiang.zhang
Priority: normal Keywords:

Created on 2017-04-15 18:44 by thruston, last changed 2017-04-16 21:50 by thruston.

Pull Requests
URL Status Linked Edit
PR 1156 open thruston, 2017-04-15 18:46
Messages (4)
msg291727 - (view) Author: Toby Thurston (thruston) Date: 2017-04-15 18:44
aifc.py fails to open AIFF files containing the compression type "sowt" in the COMM chunk with an "unsupported compression type" error.

This compression type is an Apple specific extension that signals that the data is not actually compressed but is stored uncompressed in little Endian order.  

Supporting it would require a trivial change to allow the compression type as a byte-string and to add a do-nothing _convert routine. 

This would allow aifc.py to be used with AIFF files on Apple macOS.
msg291761 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-16 17:26
Anyway, such a function addition could only get into 3.7.
msg291762 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-16 17:29
Seems the "sowt" compression is not just a no-op operation. Perhaps it should change a byte order.

Needed tests and test files for the new compression.
msg291766 - (view) Author: Toby Thurston (thruston) Date: 2017-04-16 21:50
I think it's probably better as a no-op.  Currently in my patch I just put 

    return data

You could do

    return data[::-1]

to reverse the sample, so that it came out as big endian, but if you leave it as a no-op then the data is returned in the native format for Intel Mac OS, which is the whole point of the "sowt" encoding.  Either way, the user can easily reverse the data in a `unpack` format if they want to, but in my own testing it seemed easier and simpler just to leave it in the native format. Then basically "it just works".

The patch as I've proposed it works fine on my MacOS boxes, but I have only tested it with AIFF-C files from one source.
History
Date User Action Args
2017-04-16 21:50:03thrustonsetmessages: + msg291766
2017-04-16 17:29:15serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg291762

assignee: serhiy.storchaka
stage: patch review
2017-04-16 17:27:10xiang.zhangsetcomponents: + Library (Lib), - Extension Modules
versions: + Python 3.7, - Python 3.6
2017-04-16 17:26:51xiang.zhangsetnosy: + xiang.zhang
messages: + msg291761
2017-04-15 18:46:28thrustonsetpull_requests: + pull_request1287
2017-04-15 18:44:39thrustoncreate