There have been many changes in QtMultimedia between Qt5 and Qt6. With QMediaFormat::supportedAudioCodecs, we get a list of QMediaFormat::AudioCodec supported by the system.
Now we should get the QMediaFormat::AudioCodec that is used by a given file.
For that, it seems possible to use QMediaPlayer::metaData but unfortunately, on all the files I tested, the metadata does not contain QMediaFormat::AudioCodec or I don't know how to retrieve this value. In Qt5, it looks QMediaContent was suitable to get media information but it has been removed in Qt6.