Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
riclu
Posts: 2
Registered: ‎01-11-2013
My Device: DevAlphaB

Camera config errors on Z10, works on DevAlphaB

Hi folks,

My app includes a camera function that starts the rear camera and selects the largest 3:4 resolution available and lets the user take a photo. The app works like a charm on my DevAlphaB. Now, a person has installed the app on a new Z10 device and reports a problem with the camera configuration. I don't have access to a Z10 myself which makes debugging this difficult. All I can say from the reported error message is that it is one of these specific calls that fail:

camera_set_photo_property(cameraHandle, CAMERA_IMGPROP_WIDTH, selectedMaxWidth, CAMERA_IMGPROP_HEIGHT, selectedMaxHeight, CAMERA_IMGPROP_JPEGQFACTOR, 99);


camera_set_photovf_property(cameraHandle, CAMERA_IMGPROP_WIDTH, selectedVfWidth, CAMERA_IMGPROP_HEIGHT, selectedVfHeight);


camera_set_photovf_property(cameraHandle, CAMERA_IMGPROP_WIN_GROUPID, groupId, CAMERA_IMGPROP_WIN_ID, id);


camera_start_photo_viewfinder(cameraHandle, NULL, NULL, NULL);



Some pseudocode to put the resolution selection in context:

1. Set jpeg frame type

camera_get_photo_frame_types(cameraHandle, CAMERA_FRAMETYPE_NUMFRAMETYPES, &numSupported, frameTypes);
...
camera_set_photo_property(cameraHandle, CAMERA_IMGPROP_FORMAT, CAMERA_FRAMETYPE_JPEG);

2. Get supported resolutions:

camera_get_photo_output_resolutions(cameraHandle, CAMERA_FRAMETYPE_JPEG, 0, &numResolutions, NULL);
...
camera_get_photo_output_resolutions(cameraHandle, CAMERA_FRAMETYPE_JPEG, numResolutions, &numResolutions, resolutions);

=> My DevAlphaB lists
[2448 , 3264]
[1836 , 3264 ]

3. Get some metrics

camera_get_physical_property(cameraHandle, CAMERA_PHYSPROP_FOCALLENGTH, &focalLength);
camera_get_physical_property(cameraHandle, CAMERA_PHYSPROP_SENSORWIDTH, &width);
camera_get_physical_property(cameraHandle, CAMERA_PHYSPROP_SENSORHEIGHT, &height);

4. Select largest resolution with a 3:4 aspect ratio, or just the largest resolution if no 3:4 found

=> Selected resolution on DevAlphaB: [2448 , 3264]

camera_set_photo_property(cameraHandle, CAMERA_IMGPROP_WIDTH, selectedMaxWidth, CAMERA_IMGPROP_HEIGHT, selectedMaxHeight, CAMERA_IMGPROP_JPEGQFACTOR, 99);

5. Get supported viewfinder resolutions

camera_get_photo_vf_resolutions(cameraHandle, 0, &numVfResolutions, NULL);
...
camera_get_photo_vf_resolutions(cameraHandle, numVfResolutions, &numVfResolutions, vfResolutions);

=> My DevAlphaB lists
[720, 1280]
[768, 1024]

6. Select first resolution with an aspect ratio that matches the selected photo resolution. If none found, just select the first

=> Selected viewfinder resolution on DevAlphaB: [768, 1024]

camera_set_photovf_property(cameraHandle, CAMERA_IMGPROP_WIDTH, selectedVfWidth, CAMERA_IMGPROP_HEIGHT, selectedVfHeight);

7. Start viewfinder
camera_set_photovf_property(cameraHandle, CAMERA_IMGPROP_WIN_GROUPID, groupId, CAMERA_IMGPROP_WIN_ID, id);
camera_start_photo_viewfinder(cameraHandle, NULL, NULL, NULL);


Anyone has any information on available photo resolutions and viewfinder resolutions on the Z10? Any ideas what could be a difference between the DevAlphaB and the Z10 regarding the camera???

Please use plain text.