Add mp3 codec to qt-project

I am really new to Qt development as well as audio codecs. I recently found a way to play mp3 sound using QSound. I want to play it in my qt project using QAudioOutput, but there is no mp3 codec in the QAudioDeviceInfo :: supportCodecs () code.

I tried installing the mp3 codec, but it is still not listed in QAudioDeviceInfo :: supportedCodecs (). How to add codec to QAudioDeviceInfo :: supportedCodecs ()?

+5
source share
1 answer

By definition, it QAudioDeviceInfoprovides an interface for querying audio devices and their functionality. This means that any codec returned QAudioDeviceInfo::supportedCodecs()is a codec format that the device can play directly, and is likely to be a raw audio format, for example pcm. On the other hand, the mp3software decoder must go through first, so it will not be on this list.

Take a look at the sample media player for reference. It should be able to play mp3 and other formats. The project should be available in the source directory or the Qt directory on your computer, or in the demo folder , or examples .

, , , . Player, Player::addToPlaylist()

ps: , Qt 4, Qt 5.

:

Windows Media mp3, mp3 Qt, Player, , . , Windows mp3.

+3