You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Conception/mjpg_streamer/getpixmap.cpp

45 lines
834 B

1 year ago
#include "getpixmap.h"
#include <QDebug>
GetPixmap::GetPixmap(QObject *parent) :
QObject(parent)
{
}
GetPixmap::~GetPixmap()
{
}
void GetPixmap::mjpeg_streamer_reply(QNetworkReply *reply)
{
QByteArray byteArr = reply->readAll();
QPixmap pix;
pix.loadFromData(byteArr);
emit get_getOnePixmap(pix);
manager->get(*request);
reply->deleteLater();
}
void GetPixmap::run()
{
QString url;
url.append("http://" + get_ipAddr + ":" + get_port + "/?action=snapshot");
qDebug() << url;
// qDebug() << "ipAddr:" << get_ipAddr;
// qDebug() << "port:" << get_port;
manager = new QNetworkAccessManager();
request = new QNetworkRequest(QUrl(url));
connect(manager,SIGNAL(finished(QNetworkReply*)), this, SLOT(mjpeg_streamer_reply(QNetworkReply*)));
manager->get(*request);
}