0

要使下面的代码工作:

#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呢?

4

1 回答 1

0

我解决了。丑陋的插件是必需的。sudo pacman -S gst-plugins-ugly

于 2017-12-18T09:12:51.437 回答