The AudioLayout constructor states it accepts an int, a str or and AudioLayout in its constructor, but this last variant is broken and raises an exception. This is particularly bad because several classes rely on the AudioLayout constructor to accept an int, str or AudioLayout argument for instance:
The AudioFrame constructor's layout argument.
The AudioCodecContext.layout setter. This is really bad, because the property is documented as being of type AudioLayout.. but it's impossible to set an AudioLayout!
Expected behavior
from av import AudioLayout
layout1 = AudioLayout("stereo")
layout2 = AudioLayout(layout1)
assert layout1.name == layout2.name
Actual behavior
An exception is raised while trying to construct layout2:
Traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "av/audio/layout.pyx", line 79, in av.audio.layout.AudioLayout.__init__
Overview
The
AudioLayout
constructor states it accepts anint
, astr
or andAudioLayout
in its constructor, but this last variant is broken and raises an exception. This is particularly bad because several classes rely on theAudioLayout
constructor to accept anint
,str
orAudioLayout
argument for instance:AudioFrame
constructor'slayout
argument.AudioCodecContext.layout
setter. This is really bad, because the property is documented as being of typeAudioLayout
.. but it's impossible to set anAudioLayout
!Expected behavior
Actual behavior
An exception is raised while trying to construct layout2:
Traceback: