#include "StreamReader.hpp" StreamReader::StreamReader(PvDevice *Device, PvStream *Stream, PvPipeline *Pipeline) { this->Device = Device; this->Stream = Stream; this->Pipeline = Pipeline; } void StreamReader::run() { while (!isInterruptionRequested()) { PvBuffer *lBuffer = NULL; PvResult lOperationResult; // wait for this to unblock before called in event loop // Retrieve next buffer PvResult lResult = Pipeline->RetrieveNextBuffer(&lBuffer, 1000, &lOperationResult); if (lResult.IsOK()) { if (lOperationResult.IsOK()) { PvPayloadType lType; // If the buffer contains an image, display width and height. uint32_t lWidth = 0, lHeight = 0; lType = lBuffer->GetPayloadType(); if (lType == PvPayloadTypeImage) { // Get image specific buffer interface. PvImage *lImage = lBuffer->GetImage(); // Read width, height. lWidth = lImage->GetWidth(); lHeight = lImage->GetHeight(); emit NewImage(lWidth, lHeight, lImage->GetDataPointer()); } else { qWarning() << " (buffer does not contain image)"; } } else { qInfo() << lOperationResult.GetCodeString().GetAscii() << "\r"; } // Re-queue the buffer in the stream object Stream->QueueBuffer(lBuffer); } else { // Retrieve buffer failure qCritical() << lResult.GetCodeString().GetAscii() << "\r"; } } }