Results 1 to 5 of 5

Thread: Read MJPEG Stream from an ip cam

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Read MJPEG Stream from an ip cam

    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
    Last edited by mennaSiam; 3rd October 2010 at 09:05.

Similar Threads

  1. get network stream with QNetworkAccessManager
    By Remco in forum Qt Programming
    Replies: 0
    Last Post: 26th August 2010, 16:25
  2. Xml stream
    By rk0747 in forum Qt Programming
    Replies: 3
    Last Post: 9th February 2010, 18:10
  3. Non-blocking stream read
    By akiross in forum Qt Programming
    Replies: 3
    Last Post: 16th April 2009, 11:07
  4. QGraphicScene to stream
    By phannent in forum Newbie
    Replies: 2
    Last Post: 28th June 2008, 09:43
  5. Creating a QMovie from mjpeg
    By forrestfsu in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2007, 22:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.