【发布时间】:2016-02-08 02:03:25
【问题描述】:
我有一个小型 QT 应用程序,可以从本地存储播放视频,当我运行它时,视频阻塞且速度很慢,我使用的是 gstreamer 0.1...但是当我从终端运行它并明确说使用 gstreamer 运行时在 gpu 上它工作正常。
如何从 QT 调整它在 GPU 上运行的代码... 我的代码示例...
QApplication app(argc, argv);
QGraphicsView *graphicsView = new QGraphicsView;
QMediaPlayer *player = new QMediaPlayer;
QGraphicsScene *scene = new QGraphicsScene;
graphicsView->setScene(scene);
graphicsView->setMinimumSize(800,480);
QGraphicsVideoItem *item = new QGraphicsVideoItem;
player->setVideoOutput(item);
graphicsView->scene()->addItem(item);
graphicsView->show();
player->setMedia(QUrl::fromLocalFile("/path/to/my/file"));
QTransform mirror;
mirror.scale(-1,1);
item->setTransform(mirror);
player->play();
return app.exec();
}
【问题讨论】:
-
并非所有应用都可以在 GPU 上运行。只有视频编解码器。
-
好的,我该怎么做? :/ 你能给我举个例子吗?
-
不,我不知道细节。也许看看OpenCL。但这可能需要你几个月的工作......但如果
gstreamer能够做到,请尝试使用它。