1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
This commit is contained in:
krepa098 2014-10-08 17:08:11 +02:00
parent e29865bf3f
commit a5b6f15358
2 changed files with 4 additions and 12 deletions

View File

@ -71,23 +71,17 @@ void Camera::unsubscribe()
}
}
cv::Mat Camera::getLastFrame()
{
return currFrame;
}
vpx_image Camera::getLastVPXImage()
{
mutex.lock();
cv::Mat3b frame = getLastFrame();
lock();
vpx_image img;
int w = frame.size().width, h = frame.size().height;
int w = currFrame.size().width, h = currFrame.size().height;
vpx_img_alloc(&img, VPX_IMG_FMT_I420, w, h, 1); // I420 == YUV420P, same as YV12 with U and V switched
size_t i=0, j=0;
for( int line = 0; line < h; ++line )
{
const cv::Vec3b *srcrow = frame[line];
const cv::Vec3b *srcrow = currFrame[line];
if( !(line % 2) )
{
for( int x = 0; x < w; x += 2 )
@ -122,7 +116,7 @@ vpx_image Camera::getLastVPXImage()
}
}
}
mutex.unlock();
unlock();
return img;
}

View File

@ -46,8 +46,6 @@ public:
~Camera();
static Camera* getInstance(); ///< Returns the global widget's Camera instance
cv::Mat getLastFrame(); ///< Get the last captured frame
vpx_image getLastVPXImage(); ///< Convert the last frame to a vpx_image (can be expensive !)
QList<QSize> getSupportedResolutions();