从 QMediaPlayer 获取 QAudioBuffer

Get QAudioBuffer from QMediaPlayer

我想使用 QMediaPlayer 构建一个音频可视化工具。我遇到了 thisQAudioProbe 不允许我将 QMediaPlayer 设置为它的来源。我相信 OSX.

可能不支持它

我也找到了 this,但我不确定如何让它与 QMediaPlayer 一起使用,因为该示例使用 QIODevice.

是否有另一种方法可以在不使用 QAudioProbe 的情况下从 QMediaPlayer 获取 QAudioBuffer?如果不是,从 QMediaPlayer 获取数据以构建可视化工具的另一种方法是什么?

如你所见here, AV Foundation backend has support neither for Audio probe, nor for Stream source. You are out of luck. You need to decode audio with some other library, for example libmpg123 or libogg, depending on the format. Then you can play it with OpenAL