要使下面的代码工作:
#include <QApplication>
#include <QPushButton>
#include <QMediaPlayer>
#include <iostream>
int main(int argc, char **argv) {
QApplication application(argc, argv);
QPushButton button("Click Me");
button.show();
auto player = new QMediaPlayer;
player->setMedia(QUrl::fromLocalFile("/home/bj/m/y.wma"));
player->setVolume(50);
QObject::connect(&button, &QPushButton::clicked, [player](bool) {
std::cout << "xxx" << std::endl;
player->play();
});
return application.exec();
}
现在这段代码可以通过安装播放 mp3 了gst-libav
。但是怎么玩wma呢?