scene mode
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 2 Feb 2013 22:44:20 +0000 (23:44 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Sat, 2 Feb 2013 22:44:20 +0000 (23:44 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
exynos_camera.c
exynos_camera.h

index d127ffe..72236dd 100644 (file)
@@ -102,6 +102,9 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
 
                        .whitebalance = "auto",
                        .whitebalance_values = "auto,incandescent,fluorescent,daylight,cloudy-daylight",
+
+                       .scene_mode = "auto",
+                       .scene_mode_values = "auto,portrait,landscape,night,beach,snow,sunset,fireworks,sports,party,candlelight,dusk-dawn,fall-color,back-light,text",
                },
        },
        {
@@ -157,6 +160,9 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
 
                        .whitebalance = NULL,
                        .whitebalance_values = NULL,
+
+                       .scene_mode = NULL,
+                       .scene_mode_values = NULL,
                },
        },
 };
@@ -405,6 +411,12 @@ int exynos_camera_params_init(struct exynos_camera *exynos_camera, int id)
        exynos_param_string_set(exynos_camera, "whitebalance-values",
                exynos_camera->config->presets[id].params.whitebalance_values);
 
+       // Scene mode
+       exynos_param_string_set(exynos_camera, "scene-mode",
+               exynos_camera->config->presets[id].params.scene_mode);
+       exynos_param_string_set(exynos_camera, "scene-mode-values",
+               exynos_camera->config->presets[id].params.scene_mode_values);
+
        // Camera
        exynos_param_float_set(exynos_camera, "focal-length",
                exynos_camera->config->presets[id].focal_length);
@@ -474,6 +486,9 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
        char *whitebalance_string;
        int whitebalance;
 
+       char *scene_mode_string;
+       int scene_mode;
+
        char *metering_string;
        int metering;
 
@@ -794,6 +809,50 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera)
                }
        }
 
+       // Scene mode
+       scene_mode_string = exynos_param_string_get(exynos_camera, "scene-mode");
+       if (scene_mode_string != NULL) {
+               if (strcmp(scene_mode_string, "auto") == 0)
+                       scene_mode = SCENE_MODE_NONE;
+               else if (strcmp(scene_mode_string, "portrait") == 0)
+                       scene_mode = SCENE_MODE_PORTRAIT;
+               else if (strcmp(scene_mode_string, "landscape") == 0)
+                       scene_mode = SCENE_MODE_LANDSCAPE;
+               else if (strcmp(scene_mode_string, "night") == 0)
+                       scene_mode = SCENE_MODE_NIGHTSHOT;
+               else if (strcmp(scene_mode_string, "beach") == 0)
+                       scene_mode = SCENE_MODE_BEACH_SNOW;
+               else if (strcmp(scene_mode_string, "snow") == 0)
+                       scene_mode = SCENE_MODE_BEACH_SNOW;
+               else if (strcmp(scene_mode_string, "sunset") == 0)
+                       scene_mode = SCENE_MODE_SUNSET;
+               else if (strcmp(scene_mode_string, "fireworks") == 0)
+                       scene_mode = SCENE_MODE_FIREWORKS;
+               else if (strcmp(scene_mode_string, "sports") == 0)
+                       scene_mode = SCENE_MODE_SPORTS;
+               else if (strcmp(scene_mode_string, "party") == 0)
+                       scene_mode = SCENE_MODE_PARTY_INDOOR;
+               else if (strcmp(scene_mode_string, "candlelight") == 0)
+                       scene_mode = SCENE_MODE_CANDLE_LIGHT;
+               else if (strcmp(scene_mode_string, "dusk-dawn") == 0)
+                       scene_mode = SCENE_MODE_DUSK_DAWN;
+               else if (strcmp(scene_mode_string, "fall-color") == 0)
+                       scene_mode = SCENE_MODE_FALL_COLOR;
+               else if (strcmp(scene_mode_string, "back-light") == 0)
+                       scene_mode = SCENE_MODE_BACK_LIGHT;
+               else if (strcmp(scene_mode_string, "text") == 0)
+                       scene_mode = SCENE_MODE_TEXT;
+               else
+                       scene_mode = SCENE_MODE_NONE;
+
+               if (scene_mode != exynos_camera->scene_mode || force) {
+                       exynos_camera->scene_mode = scene_mode;
+                       rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_SCENE_MODE, scene_mode);
+                       if (rc < 0)
+                               LOGE("%s: s ctrl failed!", __func__);
+               }
+       }
+
        // Metering
        metering_string = exynos_param_string_get(exynos_camera, "metering");
        if (metering_string != NULL) {
index e4d8ea1..932d756 100644 (file)
@@ -116,6 +116,9 @@ struct exynos_camera_params {
 
        char *whitebalance;
        char *whitebalance_values;
+
+       char *scene_mode;
+       char *scene_mode_values;
 };
 
 struct exynos_camera_preset {
@@ -235,6 +238,7 @@ struct exynos_camera {
        int flash_mode;
        int exposure_compensation;
        int whitebalance;
+       int scene_mode;
        int metering;
 };