Now when I'm trying to create QCamera object in run() function I got "A data abort exception has occurred accessing 0x48".
Code:
void CCameraCallback::run() {
if (!pCamera && !pImageCapture) {
QByteArray lvCameraDevices = QCamera::availableDevices()[1];
pCamera = new QCamera(lvCameraDevices, this); /* error occurs on this line */
pCamera->setCaptureMode(QCamera::CaptureStillImage);
pImageCapture = new QCameraImageCapture(pCamera);
pImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
pImageCapture->setBufferFormat(QVideoFrame::Format_Jpeg);
QObject::connect(
pImageCapture, SIGNAL( imageAvailable(int, QVideoFrame)),
this, SLOT(onBufferAvailable(int, QVideoFrame))
);
}
if (pCamera->state() == QCamera::ActiveState) pCamera->stop();
pCamera->start();
pCamera->searchAndLock();
pImageCapture->capture();
}