PyAV-Org / PyAV

Pythonic bindings for FFmpeg's libraries.
https://pyav.basswood-io.com/
BSD 3-Clause "New" or "Revised" License
2.39k stars 354 forks source link

`AudioLayout` constructor with an `AudioLayout` instance is broken #1434

Closed jlaine closed 3 weeks ago

jlaine commented 3 weeks ago

Overview

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:

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__