15 #include <boost/array.hpp>
18 #include <vtkImageData.h>
19 #include <vtkImageImport.h>
20 #include <vtkPNGReader.h>
29 : mImageWidth(width), mImageHeight(height), mImageColorDepth(depth), mImageImport(
vtkImageImportPtr::New())
31 mImportInitialized =
false;
32 mStartWhenConnected =
false;
34 mImageImport->SetDataScalarTypeToUnsignedChar();
35 mImageImport->SetNumberOfScalarComponents(3);
40 mPollTimer =
new QTimer(
this);
41 mPollTimer->setInterval(40);
45 mImageData = mImageImport->GetOutput();
66 return mImageImport->GetOutput();
71 return (
double) mSource.
timestamp().toMSecsSinceEpoch();
77 return "NOT YET IMPLEMENTED";
83 return QString(
"%1 and %2").arg(
isConnected() ?
"Connected" :
"Not connected").arg(
isStreaming() ?
"streaming" :
"not streaming");;
90 mStartWhenConnected =
true;
93 mStartWhenConnected =
false;
106 mStartWhenConnected =
false;
140 unsigned char* buffer = (
unsigned char*) mSource.
isNew();
144 mTimeStamp = mSource.
timestamp().currentMSecsSinceEpoch();
147 Q_UNUSED(numChannels);
150 mImageImport->SetDataExtentToWholeExtent();
152 mImageImport->SetImportVoidPointer(buffer);
153 mImageImport->Update();
154 mImportInitialized =
true;
165 mConnected = mSource.
attach(key);
169 connect(mPollTimer, SIGNAL(timeout()),
this, SLOT(serverPollSlot()));
172 if (mStartWhenConnected)
188 disconnect(mPollTimer, SIGNAL(timeout()),
this, SLOT(serverPollSlot()));
199 void VideoSourceSHM::serverPollSlot()
206 mImageImport->SetDataSpacing(resolution, resolution, 1);