Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
int main(int argc, char *argv[])
{
    QMediaPlayer player;

    QVideoWidget videoWidget;
    player->setVideoOutput(videoWidget);

    videoWidget->show();
    player.setMedia(QUrl::fromLocalFile());
    player->play();

    return a.exec();
}