This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit ae970a8ed3e42f38718413fa9dc67c83d3cf630f Author: SPRESENSE <41312067+sprese...@users.noreply.github.com> AuthorDate: Mon Jan 22 17:09:41 2024 +0900 drivers/video: Fix bug that can not use scene mode Because the mode is set in scene parameter table, All scene modes was recognized as disabled. --- drivers/video/video.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/video/video.c b/drivers/video/video.c index c66e24a0aa..a661e9e5b5 100644 --- a/drivers/video/video.c +++ b/drivers/video/video.c @@ -839,6 +839,7 @@ static int initialize_scene_parameter(FAR video_mng_t *vmng, return -ENOMEM; } + sp->mode = mode; sp->brightness = get_default_value(vmng, IMGSENSOR_ID_BRIGHTNESS); sp->contrast = get_default_value(vmng, IMGSENSOR_ID_CONTRAST); sp->saturation = get_default_value(vmng, IMGSENSOR_ID_SATURATION); @@ -898,51 +899,51 @@ static void initialize_scenes_parameter(FAR video_mng_t *vmng) &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_BACKLIGHT */ #ifdef CONFIG_VIDEO_SCENE_BEACHSNOW - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_BEACHSNOW, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_BEACH_SNOW, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_BEACHSNOW */ #ifdef CONFIG_VIDEO_SCENE_CANDLELIGHT - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_CANDLELIGHT, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_CANDLE_LIGHT, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_CANDLELIGHT */ #ifdef CONFIG_VIDEO_SCENE_DAWNDUSK - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_DAWNDUSK, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_DAWN_DUSK, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_DAWNDUSK */ #ifdef CONFIG_VIDEO_SCENE_FALLCOLORS - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_FALLCOLORS, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_FALL_COLORS, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_FALLCOLORS */ #ifdef CONFIG_VIDEO_SCENE_FIREWORKS - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_FIREWORKS, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_FIREWORKS, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_FIREWORKS */ #ifdef CONFIG_VIDEO_SCENE_LANDSCAPE - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_LANDSCAPE, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_LANDSCAPE, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_LANDSCAPE */ #ifdef CONFIG_VIDEO_SCENE_NIGHT - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_NIGHT, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_NIGHT, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_NIGHT */ #ifdef CONFIG_VIDEO_SCENE_PARTYINDOOR - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_PARTYINDOOR, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_PARTY_INDOOR, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_PARTYINDOOR */ #ifdef CONFIG_VIDEO_SCENE_PORTRAIT - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_PORTRAIT, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_PORTRAIT, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_PORTRAIT */ #ifdef CONFIG_VIDEO_SCENE_SPORTS - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_SPORTS, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_SPORTS, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_SPORTS */ #ifdef CONFIG_VIDEO_SCENE_SUNSET - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_SUNSET, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_SUNSET, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_SUNSET */ #ifdef CONFIG_VIDEO_SCENE_TEXT - initialize_scene_parameter(vmng, CONFIG_VIDEO_SCENE_TEXT, + initialize_scene_parameter(vmng, V4L2_SCENE_MODE_TEXT, &vmng->video_scene_param[vmng->video_scence_num++]); #endif /* CONFIG_VIDEO_SCENE_TEXT */ } @@ -2344,16 +2345,23 @@ static int video_g_ext_ctrls(FAR struct video_mng_s *priv, cnt < ctrls->count; cnt++, control++) { - ret = IMGSENSOR_GET_VALUE(priv->imgsensor, - control->id, - control->size, - (imgsensor_value_t *)&control->value64); - if (ret < 0) + if (control->id == V4L2_CID_SCENE_MODE) { - /* Set cnt in that error occurred */ + control->value = priv->video_scene_mode; + } + else + { + ret = IMGSENSOR_GET_VALUE(priv->imgsensor, + control->id, + control->size, + (imgsensor_value_t *)&control->value64); + if (ret < 0) + { + /* Set cnt in that error occurred */ - ctrls->error_idx = cnt; - return ret; + ctrls->error_idx = cnt; + return ret; + } } }