jpeg quality & zoom
authorPaul Kocialkowski <contact@paulk.fr>
Tue, 29 Jan 2013 11:12:53 +0000 (12:12 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Tue, 29 Jan 2013 11:12:53 +0000 (12:12 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
exynos_camera.c

index d045d9d..ec20a23 100644 (file)
@@ -368,6 +368,13 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
        if (exynos_camera == NULL)
                return -EINVAL;
 
+       /*
+        * Params stored in exynos_camera that require an immediate ioctl should
+        * be reset after preview_stop since the driver will reset the values.
+        * However, the params should be reset by the Android framework to their
+        * original state when preview restarts.
+        */
+
        // Preview
        preview_size_string = exynos_param_string_get(exynos_camera, "preview-size");
        if (preview_size_string != NULL) {
@@ -451,15 +458,20 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
                exynos_camera->jpeg_thumbnail_quality = jpeg_thumbnail_quality;
 
        jpeg_quality = exynos_param_int_get(exynos_camera, "jpeg-quality");
-       if (jpeg_quality > 0)
+       if (jpeg_quality <= 100 && jpeg_quality >= 0 && jpeg_quality != exynos_camera->jpeg_quality) {
                exynos_camera->jpeg_quality = jpeg_quality;
+               rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAM_JPEG_QUALITY, jpeg_quality);
+               if (rc < 0)
+                       LOGE("%s: s ctrl failed!", __func__);
+       }
 
        // Zoom
        zoom_supported_string = exynos_param_string_get(exynos_camera, "zoom-supported");
        if (zoom_supported_string != NULL && strcmp(zoom_supported_string, "true") == 0) {
                zoom = exynos_param_int_get(exynos_camera, "zoom");
                max_zoom = exynos_param_int_get(exynos_camera, "max-zoom");
-               if (zoom <= max_zoom && zoom >= 0) {
+               if (zoom <= max_zoom && zoom >= 0 && zoom != exynos_camera->zoom) {
+                       exynos_camera->zoom = zoom;
                        rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_ZOOM, zoom);
                        if (rc < 0)
                                LOGE("%s: s ctrl failed!", __func__);