Unable to set PixelFormat for QCamera on iOS
-
Hi,
I am trying to make an iOS app using the back facing camera to run on iPad Air. Although, it seems like I can't set the PixelFormat I want. I am using the following code to construct the camera and change it's internal parameters:
QCamera * camera; QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); foreach (const QCameraInfo &cameraInfo, cameras) { if (cameraInfo.position() == QCamera::BackFace){ camera = new QCamera(cameraInfo); } } QList<QCameraViewfinderSettings> ff = camera->supportedViewfinderSettings(); for (int i = 0 ; i < ff.length() ; i++){ qInfo() << i << ":" << ff[i].resolution() << "," << ff[i].pixelFormat(); } camera->setViewfinderSettings(ff[14]); qInfo() << "Output format of camera:" << camera->viewfinderSettings().pixelFormat();
The output given is:
0 : QSize(192, 144) , Format_NV12
1 : QSize(192, 144) , Format_ARGB32
2 : QSize(352, 288) , Format_NV12
3 : QSize(352, 288) , Format_ARGB32
4 : QSize(480, 360) , Format_NV12
5 : QSize(480, 360) , Format_ARGB32
6 : QSize(640, 480) , Format_NV12
7 : QSize(640, 480) , Format_ARGB32
8 : QSize(960, 540) , Format_NV12
9 : QSize(960, 540) , Format_ARGB32
10 : QSize(1280, 720) , Format_NV12
11 : QSize(1280, 720) , Format_ARGB32
12 : QSize(1920, 1080) , Format_NV12
13 : QSize(1920, 1080) , Format_ARGB32
14 : QSize(2592, 1936) , Format_NV12
15 : QSize(2592, 1936) , Format_ARGB32
Output format of camera: Format_ARGB32So, even though I explicitly set the the camera's ViewFinderSettings to NV12 (element 14 in the list), the value in the camera's ViewFinder after the operation is still ARGB32. What is going on here? Am I forgetting something? Do I need to reset the camera after changing the parameters or something similar? Otherwise is this a know bug? If so, is it specific to this device? In any case, would there be a workaround?
Thank you in advance for your help!
E.