front with correct orient & camera params
authorPaul Kocialkowski <contact@paulk.fr>
Tue, 29 Jan 2013 10:50:18 +0000 (11:50 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Tue, 29 Jan 2013 10:50:18 +0000 (11:50 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
exynos_camera.c
exynos_camera.h

index 8a7fe87..d045d9d 100644 (file)
@@ -48,7 +48,7 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
                .rotation = 0,
                .hflip = 0,
                .vflip = 0,
-               .camera_picture_format = V4L2_PIX_FMT_JPEG,
+               .picture_format = V4L2_PIX_FMT_JPEG,
                .params = {
                        .preview_size_values = "640x480,720x480,800x480,800x450,352x288,320x240,176x144",
                        .preview_size = "640x480",
@@ -79,11 +79,11 @@ struct exynos_camera_preset exynos_camera_presets_galaxys2[] = {
        {
                .name = "S5K5BAFX",
                .facing = CAMERA_FACING_FRONT,
-               .orientation = 90,
+               .orientation = 270,
                .rotation = 0,
-               .hflip = 1,
-               .vflip = 1,
-               .camera_picture_format = V4L2_PIX_FMT_YUYV,
+               .hflip = 0,
+               .vflip = 0,
+               .picture_format = V4L2_PIX_FMT_YUYV,
                .params = {
                        .preview_size_values = "640x480,352x288,320x240,176x144",
                        .preview_size = "640x480",
@@ -265,6 +265,12 @@ int exynos_camera_params_init(struct exynos_camera *exynos_camera, int id)
        if (exynos_camera == NULL || id >= exynos_camera->config->presets_count)
                return -EINVAL;
 
+       // Camera params
+       exynos_camera->camera_rotation = exynos_camera->config->presets[id].rotation;
+       exynos_camera->camera_hflip = exynos_camera->config->presets[id].hflip;
+       exynos_camera->camera_vflip = exynos_camera->config->presets[id].vflip;
+       exynos_camera->camera_picture_format = exynos_camera->config->presets[id].picture_format;
+
        // Preview
        exynos_param_string_set(exynos_camera, "preview-size-values",
                exynos_camera->config->presets[id].params.preview_size_values);
@@ -303,9 +309,6 @@ int exynos_camera_params_init(struct exynos_camera *exynos_camera, int id)
        exynos_param_int_set(exynos_camera, "jpeg-quality",
                exynos_camera->config->presets[id].params.jpeg_quality);
 
-       if (exynos_camera->config->presets[id].camera_picture_format != 0)
-               exynos_camera->camera_picture_format = exynos_camera->config->presets[id].camera_picture_format;
-
        // Zoom
        if (exynos_camera->config->presets[id].params.zoom_supported == 1) {
                exynos_param_string_set(exynos_camera, "zoom-supported", "true");
@@ -620,8 +623,7 @@ int exynos_camera_preview_start(struct exynos_camera *exynos_camera)
        int rc;
        int i;
 
-       if (exynos_camera->config == NULL || exynos_camera->config->presets == NULL ||
-               exynos_camera->camera_id >= exynos_camera->config->presets_count)
+       if (exynos_camera->config == NULL)
                return -EINVAL;
 
        if (exynos_camera->preview_enabled) {
@@ -717,24 +719,22 @@ int exynos_camera_preview_start(struct exynos_camera *exynos_camera)
                }
        }
 
-       id = exynos_camera->camera_id;
-
        rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_ROTATION,
-               exynos_camera->config->presets[i].rotation);
+               exynos_camera->camera_rotation);
        if (rc < 0) {
                LOGE("%s: s ctrl failed!", __func__);
                return -1;
        }
 
        rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_HFLIP,
-               exynos_camera->config->presets[id].hflip);
+               exynos_camera->camera_hflip);
        if (rc < 0) {
                LOGE("%s: s ctrl failed!", __func__);
                return -1;
        }
 
        rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_VFLIP,
-               exynos_camera->config->presets[id].vflip);
+               exynos_camera->camera_vflip);
        if (rc < 0) {
                LOGE("%s: s ctrl failed!", __func__);
                return -1;
@@ -1941,8 +1941,6 @@ int exynos_camera_open(const struct hw_module_t* module, const char *camera_id,
        if (id >= exynos_camera->config->presets_count)
                goto error_preset;
 
-       exynos_camera->camera_id = id;
-
        rc = exynos_camera_init(exynos_camera, id);
        if (rc < 0) {
                LOGE("%s: Unable to init camera", __func__);
index 9c97753..a1fbce1 100644 (file)
@@ -100,7 +100,7 @@ struct exynos_camera_preset {
        int hflip;
        int vflip;
 
-       int camera_picture_format;
+       int picture_format;
 
        struct exynos_camera_params params;
 };
@@ -135,8 +135,6 @@ struct exynos_camera {
        struct exynos_camera_callbacks callbacks;
        int messages_enabled;
 
-       int camera_id;
-
        gralloc_module_t *gralloc;
 
        // Preview
@@ -166,13 +164,18 @@ struct exynos_camera {
        camera_memory_t *picture_memory;
        int picture_buffer_length;
 
+       // Camera params
+       int camera_rotation;
+       int camera_hflip;
+       int camera_vflip;
+       int camera_picture_format;
+
        // Params
        int preview_width;
        int preview_height;
        int preview_format;
        float preview_format_bpp;
        int preview_fps;
-       int camera_picture_format;
        int picture_width;
        int picture_height;
        int picture_format;