gst-python: Can't set channel positions with GstAudio.AudioInfo.set_format
Submitted by Vladislav Glinsky
Link to original bug (#794162)
Description
Hello, I'm trying to rewrite basic tutorial #8
(https://gstreamer.freedesktop.org/documentation/tutorials/basic/short-cutting-the-pipeline.html) in Python and in original C code we have lines:
GstAudioInfo info;
gst_audio_info_set_format(&info, GST_AUDIO_FORMAT_S16, SAMPLE_RATE, 1, NULL);
I've rewritten them as:
info = GstAudio.AudioInfo()
info.set_format(
format=GstAudio.AudioFormat.S16,
rate=SAMPLE_RATE,
channels=1,
position=None
)
According to documentation and source code of gst_audio_info_set_format
last parameter position
is nullable (for 1 and 2 channel setup).
Python documents type of position
argument as GstAudio.AudioChannelPosition
and nothing said if it accepts None
, so with Python code above I will get an error: "Argument 4 does not allow None as a value".
I can't pass list of GstAudio.AudioChannelPosition
instead - I will get "Expected a GstAudio.AudioChannelPosition, but got list". Isn't list of GstAudio.AudioChannelPosition
an equivalent of GstAudioChannelPosition*
?
Also it's weird why position
in C code is annotated with fixed size
of 64 when in fact 64 is the maximum size of channel positions array and channel count argument used to determine actual array size.
Version: 1.12.4