本文整理汇总了C++中QMediaPlayer::setVideoOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ QMediaPlayer::setVideoOutput方法的具体用法?C++ QMediaPlayer::setVideoOutput怎么用?C++ QMediaPlayer::setVideoOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMediaPlayer
的用法示例。
在下文中一共展示了QMediaPlayer::setVideoOutput方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QApplication a(argc, argv);
const QString fileAbsPath = a.arguments().at(1);
qDebug("Opening %s...", qPrintable(fileAbsPath));
QMediaPlayer p;
p.setMedia(QMediaContent(QUrl(fileAbsPath)));
QGraphicsVideoItem* item = new QGraphicsVideoItem;
QGraphicsScene* scene = new QGraphicsScene;
scene->addText("TEST");
p.setVideoOutput(item);
scene->addItem(item);
scene->addRect(0, 0, 100, 100, QPen(Qt::red), QBrush(Qt::red));
item->setPos(0, 0);
//QImage image(1920, 1080, QImage::Format_ARGB32);
//image.fill(Qt::blue);
//QPainter painter(&image);
//painter.setRenderHint(QPainter::Antialiasing);
//scene->render(&painter);
QGraphicsView view(scene);
//view.scene()->addItem(item);
view.setViewport(new QOpenGLWidget);
view.show();
p.play();
return a.exec();
}
示例2: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QVideoWidget *videoOutputWidget = new QVideoWidget();
QMediaPlayer *player = new QMediaPlayer();
QVideoProbe *probe = new QVideoProbe();
DemoCoq* demo = new DemoCoq();
QTimer* timer = new QTimer();
probe->setSource(player);
player->setMedia(QUrl::fromLocalFile("C:/Users/louis/Desktop/Cinefeel/Video.avi"));
player->setVideoOutput(videoOutputWidget);
videoOutputWidget->show();
player->play();
demo->connect(timer, SIGNAL(timeout()), SLOT(updateColor()));
timer->start(1000 / 10);
demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
// demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
// demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
// demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
//demo.launch();
VideoDebugger *videoDebugger = new VideoDebugger((QObject *)0, true);
QObject::connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), videoDebugger, SLOT(mediaCheck(QMediaPlayer::MediaStatus)));
QObject::connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), videoDebugger, SLOT(processFrame(QVideoFrame)));
return a.exec();
}
示例3: main
int main(int argc, char *argv[])
{
QMediaPlayer player;
QVideoWidget videoWidget;
player->setVideoOutput(videoWidget);
videoWidget->show();
player.setMedia(QUrl::fromLocalFile());
player->play();
return a.exec();
}