From 8ddb1329c924cdec1b1954748e81a169caafc4d0 Mon Sep 17 00:00:00 2001 From: krepa098 Date: Wed, 8 Oct 2014 16:19:42 +0200 Subject: [PATCH] cleanup --- widget/camera.cpp | 13 +++++++------ widget/selfcamview.cpp | 14 +++++--------- widget/selfcamview.h | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/widget/camera.cpp b/widget/camera.cpp index b27836e3e..7b2aa6a0c 100644 --- a/widget/camera.cpp +++ b/widget/camera.cpp @@ -317,15 +317,16 @@ void SelfCamWorker::probeResolutions() for (QSize res : propbeRes) { - _setProp(CV_CAP_PROP_FRAME_WIDTH, res.width()); - _setProp(CV_CAP_PROP_FRAME_HEIGHT, res.height()); + cam.set(CV_CAP_PROP_FRAME_WIDTH, res.width()); + cam.set(CV_CAP_PROP_FRAME_HEIGHT, res.height()); - double w = _getProp(CV_CAP_PROP_FRAME_WIDTH); - double h = _getProp(CV_CAP_PROP_FRAME_HEIGHT); + double w = cam.get(CV_CAP_PROP_FRAME_WIDTH); + double h = cam.get(CV_CAP_PROP_FRAME_HEIGHT); - qDebug() << "PROBING:" << res << " got " << w << h; + //qDebug() << "PROBING:" << res << " got " << w << h; - resolutions.append(QSize(w,h)); + if (!resolutions.contains(QSize(w,h))) + resolutions.append(QSize(w,h)); } unsubscribe(); diff --git a/widget/selfcamview.cpp b/widget/selfcamview.cpp index 9f6373c82..71f63664e 100644 --- a/widget/selfcamview.cpp +++ b/widget/selfcamview.cpp @@ -29,7 +29,7 @@ SelfCamView::SelfCamView(VideoSource *Source, QWidget* parent) , program(nullptr) , textureId(0) , pboAllocSize(0) - , useNewFrame(false) + , uploadFrame(false) , hasSubscribed(false) { qDebug()<<"NEW VideoSurface:"<resolution(); @@ -78,8 +78,6 @@ void SelfCamView::initializeGL() void SelfCamView::paintGL() { - //qDebug() << "PainterThread" << QThread::currentThreadId(); - if (!pbo) { qDebug() << "Creating pbo, program"; @@ -125,7 +123,7 @@ void SelfCamView::paintGL() } - if (useNewFrame) + if (uploadFrame) { source->lock(); void* frame = source->getData(); @@ -158,6 +156,8 @@ void SelfCamView::paintGL() glBindTexture(GL_TEXTURE_2D, 0); pbo->release(); + + uploadFrame = false; } // render pbo @@ -187,15 +187,11 @@ void SelfCamView::paintGL() program->disableAttributeArray(0); program->release(); - - //glFlush(); - - useNewFrame = false; } void SelfCamView::updateGL() { - useNewFrame = true; + uploadFrame = true; QGLWidget::updateGL(); } diff --git a/widget/selfcamview.h b/widget/selfcamview.h index 8337ee8cd..8c3be62df 100644 --- a/widget/selfcamview.h +++ b/widget/selfcamview.h @@ -50,7 +50,7 @@ private: GLuint textureId; int pboAllocSize; QSize res; - bool useNewFrame; + bool uploadFrame; bool hasSubscribed; };