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.
This commit is contained in:
SPRESENSE
2024-01-22 17:09:41 +09:00
committed by Alin Jerpelea
parent 8f0ed67339
commit ae970a8ed3
+28 -20
View File
@@ -839,6 +839,7 @@ static int initialize_scene_parameter(FAR video_mng_t *vmng,
return -ENOMEM; return -ENOMEM;
} }
sp->mode = mode;
sp->brightness = get_default_value(vmng, IMGSENSOR_ID_BRIGHTNESS); sp->brightness = get_default_value(vmng, IMGSENSOR_ID_BRIGHTNESS);
sp->contrast = get_default_value(vmng, IMGSENSOR_ID_CONTRAST); sp->contrast = get_default_value(vmng, IMGSENSOR_ID_CONTRAST);
sp->saturation = get_default_value(vmng, IMGSENSOR_ID_SATURATION); 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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_BACKLIGHT */ #endif /* CONFIG_VIDEO_SCENE_BACKLIGHT */
#ifdef CONFIG_VIDEO_SCENE_BEACHSNOW #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_BEACHSNOW */ #endif /* CONFIG_VIDEO_SCENE_BEACHSNOW */
#ifdef CONFIG_VIDEO_SCENE_CANDLELIGHT #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_CANDLELIGHT */ #endif /* CONFIG_VIDEO_SCENE_CANDLELIGHT */
#ifdef CONFIG_VIDEO_SCENE_DAWNDUSK #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_DAWNDUSK */ #endif /* CONFIG_VIDEO_SCENE_DAWNDUSK */
#ifdef CONFIG_VIDEO_SCENE_FALLCOLORS #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_FALLCOLORS */ #endif /* CONFIG_VIDEO_SCENE_FALLCOLORS */
#ifdef CONFIG_VIDEO_SCENE_FIREWORKS #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_FIREWORKS */ #endif /* CONFIG_VIDEO_SCENE_FIREWORKS */
#ifdef CONFIG_VIDEO_SCENE_LANDSCAPE #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_LANDSCAPE */ #endif /* CONFIG_VIDEO_SCENE_LANDSCAPE */
#ifdef CONFIG_VIDEO_SCENE_NIGHT #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_NIGHT */ #endif /* CONFIG_VIDEO_SCENE_NIGHT */
#ifdef CONFIG_VIDEO_SCENE_PARTYINDOOR #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_PARTYINDOOR */ #endif /* CONFIG_VIDEO_SCENE_PARTYINDOOR */
#ifdef CONFIG_VIDEO_SCENE_PORTRAIT #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_PORTRAIT */ #endif /* CONFIG_VIDEO_SCENE_PORTRAIT */
#ifdef CONFIG_VIDEO_SCENE_SPORTS #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_SPORTS */ #endif /* CONFIG_VIDEO_SCENE_SPORTS */
#ifdef CONFIG_VIDEO_SCENE_SUNSET #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_SUNSET */ #endif /* CONFIG_VIDEO_SCENE_SUNSET */
#ifdef CONFIG_VIDEO_SCENE_TEXT #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++]); &vmng->video_scene_param[vmng->video_scence_num++]);
#endif /* CONFIG_VIDEO_SCENE_TEXT */ #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 < ctrls->count;
cnt++, control++) cnt++, control++)
{ {
ret = IMGSENSOR_GET_VALUE(priv->imgsensor, if (control->id == V4L2_CID_SCENE_MODE)
control->id,
control->size,
(imgsensor_value_t *)&control->value64);
if (ret < 0)
{ {
/* 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; ctrls->error_idx = cnt;
return ret; return ret;
}
} }
} }