Hi, I am trying to read mjpeg stream from an ip camera,
I am using QHttp to connect to the camera, and on readyRead signal I execute this function, Hint:: I know that ONEIMAGE is the boundry that separates an image from another one.
QString data(arr);
bool found = data.contains("----ONEIMAGE----");
if(!found) //I am still reading the same image
{
imageData= imageData.append(data);
}
else // I have finished reading the image and another image is received
{
QImage image;
//remove the headers
QStringList l2= imageData.split("\n\r");
if(l2.size()>1)
{
imageData= l2[1];
QByteArray arrd= l2[1].toAscii();
if (image.loadFromData(arrd))
{
QPixmap pixmap = QPixmap::fromImage(image);
ui.label->setPixmap(pixmap);
}
}
imageData.clear();
imageData.append(data);
}
But it's not working it can't parse the QByteArray (imageData) into a QImage
Bookmarks