예제 #1
0
progressDialog::progressDialog(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags){

    ui.setupUi(this);

    Consumer *c = new Consumer();
    Producer *p = new Producer();

    Thread *t1 = new Thread(0);
    Thread *t2 = new Thread(0);

    connect(this,SIGNAL(begin(bool)),c,SLOT(startReceiving(bool)));
    connect(c,SIGNAL(initiate(bool)),p,SLOT(produce(bool)));
    connect(p,SIGNAL(sendPacket(const QByteArray,bool)),c,SLOT(receiveFrame(const QByteArray,bool)));
    connect(ui.pushButton,SIGNAL(clicked(bool)),this,SLOT(_begin(bool)));
    connect(p,SIGNAL(halt(bool)),c,SLOT(startReceiving(bool)));
	connect(c,SIGNAL(blockDone()),p,SLOT(frameData()));
	connect(c,SIGNAL(measure(bool)),p,SLOT(measurement(bool)),Qt::DirectConnection);
	connect(c,SIGNAL(openDialog()),this,SLOT(startDlg()));
	connect(c,SIGNAL(closeDialog()),this,SLOT(closeDlg()));
	connect(p,SIGNAL(setDlgMax(int)),this,SLOT(setMaxVal(int)));
	connect(p,SIGNAL(setDlgVal(int)),this,SLOT(setVal(int)));
	connect(p,SIGNAL(setSeconds(int)),this,SLOT(setSecondsRemaining(int)));

    c->moveToThread(t1);
    p->moveToThread(t2);

    t1->start();
    t2->start();
}
예제 #2
0
/* Execute the ImageAnalyzer using the GPU.
 * Params:
 * 	@frame			the frame to be processed
 * 	@trackProcess	if we want to add timeStamps to the frame.timestamp
 * Returns the errCode
 */
errCode ImageAnalyzer::processImageOnGPU(Frame &frame, bool trackProcess)
{
	std::list<const ImageProcessor*>::iterator it = mImageProcessors.begin();
	errCode err = NO_ERROR;

	debug("Start to process frame on GPU\n");

	// Creates the cv::GpuMat structure
	cv::gpu::GpuMat frameData(frame.data);

	for(; it != mImageProcessors.end(); ++it){
		const ImageProcessor *imgProc = *it;

		// some log :)
		debug("Processing frame with: %s\n", imgProc->getName().c_str());

		if(trackProcess){
			frame.timestamp.addTimestamp("Processing with " + imgProc->getName());
		}

		err = imgProc->processData(frameData);
		if(err != NO_ERROR){
			debug("Some error occurred during the processing of the data %d\t%s\n",
					err, imgProc->getName().c_str());
			return err;
		}
	}

	// restores the data to the frame
	frame.data = frameData;

	frame.timestamp.addTimestamp("Finishing processing data on GPU");

	return NO_ERROR;
}
예제 #3
0
void FramesCreatorTest::shouldWriteDataToFrame()
{
  QByteArray data;
  EXPECT_CALL(*mockFramesFactory, create(QByteArray("header data"))).WillOnce(Return(mockFrame));
  EXPECT_CALL(*mockFrame, frameData()).Times(AnyNumber()).WillRepeatedly(Return(&data));
  EXPECT_CALL(*mockFrame, totalbytes()).Times(AnyNumber()).WillRepeatedly(Return(100));

  framesCreator->createNewFrame(QByteArray("header data"));
  framesCreator->addFramesData(QByteArray("Any data to write into the frame"));
  QCOMPARE(data, QByteArray("Any data to write into the frame"));
}
예제 #4
0
void CameraWorker::doWork()
{
    if (!cam.isOpened())
        return;

    if (!cam.read(frame))
    {
        qDebug() << "CameraWorker: Cannot read frame";
        return;
    }

    QByteArray frameData(reinterpret_cast<char*>(frame.data), frame.total() * frame.channels());

    emit newFrameAvailable(VideoFrame{frameData, QSize(frame.cols, frame.rows), VideoFrame::BGR});
}
예제 #5
0
void FramesCreatorTest::shouldReportRemainingBytes()
{
  QByteArray data;
  EXPECT_CALL(*mockFramesFactory, create(QByteArray("header data"))).WillOnce(Return(mockFrame));
  EXPECT_CALL(*mockFrame, totalbytes()).Times(AnyNumber()).WillRepeatedly(Return(1024));
  EXPECT_CALL(*mockFrame, frameData()).Times(AnyNumber()).WillRepeatedly(Return(&data));
  
  framesCreator->createNewFrame(QByteArray("header data"));
  
  QCOMPARE(framesCreator->remainingBytesForCurrentFrame(), (quint64) 1024);
  data.append("1234567890");
  QCOMPARE(framesCreator->remainingBytesForCurrentFrame(), (quint64) (1024-10) );
  data.append("123456789012345");
  QCOMPARE(framesCreator->remainingBytesForCurrentFrame(), (quint64) (1024-10-15) );
}
예제 #6
0
void
MP3Demuxer::SlowSeek(Microseconds aTime) {
  if (!aTime) {
    FastSeek(aTime);
    return;
  }

  if (Duration(mFrameIndex) > aTime) {
    FastSeek(aTime);
  }

  nsRefPtr<MediaRawData> frameData(GetNext());
  while (frameData && Duration(mFrameIndex + 1) < aTime) {
    frameData = GetNext();
  }
}
예제 #7
0
void FramesCreatorTest::shouldEmitProcessedFrameSignalWhenNoMoreBytesAreRemaining()
{
  QByteArray data;
  QSignalSpy spy(framesCreator, SIGNAL(frameProcessed(Frame*)));

  EXPECT_CALL(*mockFramesFactory, create(QByteArray("header data"))).WillOnce(Return(mockFrame));
  EXPECT_CALL(*mockFrame, frameData()).Times(AnyNumber()).WillRepeatedly(Return(&data));
  EXPECT_CALL(*mockFrame, totalbytes()).Times(AnyNumber()).WillRepeatedly(Return(10));

  framesCreator->createNewFrame(QByteArray("header data"));
  
  framesCreator->addFramesData(QByteArray("12345"));
  QCOMPARE(spy.count(), 0);
  framesCreator->addFramesData(QByteArray("12345"));
  QCOMPARE(framesCreator->remainingBytesForCurrentFrame(), (quint64)0);
  QCOMPARE(spy.count(), 1);
}
예제 #8
0
PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
                                        const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
{
    if (!m_webFrame)
        return 0;

    QWebFrameData frameData(m_frame->page(), m_frame, ownerElement, name);

    if (url.isEmpty())
        frameData.url = blankURL();
    else
        frameData.url = url;

    frameData.referrer = referrer;
    frameData.allowsScrolling = allowsScrolling;
    frameData.marginWidth = marginWidth;
    frameData.marginHeight = marginHeight;

    QPointer<QWebFrame> webFrame = new QWebFrame(m_webFrame, &frameData);
    // The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
    if (!webFrame->d->frame->page()) {
        frameData.frame.release();
        ASSERT(webFrame.isNull());
        return 0;
    }

    emit m_webFrame->page()->frameCreated(webFrame);

    // ### set override encoding if we have one

    frameData.frame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, frameData.frame.get());

    // The frame's onload handler may have removed it from the document.
    if (!frameData.frame->tree()->parent())
        return 0;

    return frameData.frame.release();
}
예제 #9
0
void* SequentialFile::append(size_t size) {
  void* location = getFreeSpace(size);
  frameData(location, size);
  return location;
}