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 75a0a08a4dd3d487b858e7e4ff7a8f7e4b753970
Author: SPRESENSE <41312067+sprese...@users.noreply.github.com>
AuthorDate: Wed Oct 11 20:53:43 2023 +0900

    drivers/video: Modify control id definition
    
    Modify control id definition to avoid duplication even if
    the control ids belong to the same control class.
    Also, not refer to control class in driver.
---
 drivers/video/video.c                |  34 +++------
 include/nuttx/video/imgsensor.h      |  86 ++++++++++-----------
 include/nuttx/video/video_controls.h | 142 +++++++++++++++++++++--------------
 include/sys/videoio.h                |   6 +-
 4 files changed, 142 insertions(+), 126 deletions(-)

diff --git a/drivers/video/video.c b/drivers/video/video.c
index 105e2d8745..069445ca30 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -53,8 +53,6 @@
 
 #define VIDEO_REMAINING_CAPNUM_INFINITY (-1)
 
-#define VIDEO_ID(x, y) (((x) << 16) | (y))
-
 /****************************************************************************
  * Private Types
  ****************************************************************************/
@@ -2157,8 +2155,7 @@ static int video_query_ext_ctrl(FAR struct video_mng_s 
*vmng,
   attr->nr_of_dims = 0;
   memset(attr->dims, 0, sizeof(attr->dims));
 
-  if (attr->ctrl_class == V4L2_CTRL_CLASS_CAMERA &&
-      attr->id == V4L2_CID_SCENE_MODE)
+  if (attr->id == V4L2_CID_SCENE_MODE)
     {
       /* Scene mode is processed in only video driver. */
 
@@ -2172,9 +2169,7 @@ static int video_query_ext_ctrl(FAR struct video_mng_s 
*vmng,
     }
   else
     {
-      ret = IMGSENSOR_GET_SUPPORTED_VALUE(vmng->imgsensor,
-              VIDEO_ID(attr->ctrl_class, attr->id),
-              &value);
+      ret = IMGSENSOR_GET_SUPPORTED_VALUE(vmng->imgsensor, attr->id, &value);
       if (ret < 0)
         {
           return ret;
@@ -2209,8 +2204,7 @@ static int video_query_ext_ctrl(FAR struct video_mng_s 
*vmng,
             break;
         }
 
-      set_parameter_name(VIDEO_ID(attr->ctrl_class, attr->id),
-                         attr->name);
+      set_parameter_name(attr->id, attr->name);
     }
 
   return OK;
@@ -2229,8 +2223,7 @@ static int video_querymenu(FAR video_mng_t *vmng,
       return -EINVAL;
     }
 
-  if (menu->ctrl_class == V4L2_CTRL_CLASS_CAMERA &&
-      menu->id == V4L2_CID_SCENE_MODE)
+  if (menu->id == V4L2_CID_SCENE_MODE)
     {
       /* Scene mode is processed in only video driver. */
 
@@ -2244,8 +2237,8 @@ static int video_querymenu(FAR video_mng_t *vmng,
   else
     {
       ret = IMGSENSOR_GET_SUPPORTED_VALUE(vmng->imgsensor,
-              VIDEO_ID(menu->ctrl_class, menu->id),
-              &value);
+                                          menu->id,
+                                          &value);
       if (ret < 0)
         {
           return ret;
@@ -2351,7 +2344,7 @@ static int video_g_ext_ctrls(FAR struct video_mng_s *priv,
        cnt++, control++)
     {
       ret = IMGSENSOR_GET_VALUE(priv->imgsensor,
-              VIDEO_ID(ctrls->ctrl_class, control->id),
+              control->id,
               control->size,
               (imgsensor_value_t *)&control->value64);
       if (ret < 0)
@@ -2488,15 +2481,14 @@ static int video_s_ext_ctrls(FAR struct video_mng_s 
*priv,
        cnt < ctrls->count;
        cnt++, control++)
     {
-      if (ctrls->ctrl_class == V4L2_CTRL_CLASS_CAMERA &&
-          control->id == V4L2_CID_SCENE_MODE)
+      if (control->id == V4L2_CID_SCENE_MODE)
         {
           ret = reflect_scene_parameter(priv, control->value);
         }
       else
         {
           ret = IMGSENSOR_SET_VALUE(priv->imgsensor,
-                  VIDEO_ID(ctrls->ctrl_class, control->id),
+                  control->id,
                   control->size,
                   (imgsensor_value_t)control->value64);
           if (ret == 0)
@@ -2504,7 +2496,7 @@ static int video_s_ext_ctrls(FAR struct video_mng_s *priv,
               if (priv->video_scene_mode == V4L2_SCENE_MODE_NONE)
                 {
                   save_scene_param(priv, V4L2_SCENE_MODE_NONE,
-                    VIDEO_ID(ctrls->ctrl_class, control->id),
+                    control->id,
                     control);
                 }
             }
@@ -2745,7 +2737,7 @@ static int video_g_ext_ctrls_scene(FAR video_mng_t *vmng,
        cnt++, control++)
     {
       ret = read_scene_param(vmng, ctrls->mode,
-               VIDEO_ID(ctrls->control.ctrl_class, control->id),
+               control->id,
                control);
       if (ret != OK)
         {
@@ -3060,9 +3052,7 @@ static int video_s_ext_ctrls_scene(FAR struct video_mng_s 
*vmng,
        cnt < ctrls->control.count;
        cnt++, control++)
     {
-      ret = save_scene_param(vmng, ctrls->mode,
-               VIDEO_ID(ctrls->control.ctrl_class, control->id),
-               control);
+      ret = save_scene_param(vmng, ctrls->mode, control->id, control);
       if (ret != OK)
         {
           ctrls->control.error_idx = cnt;
diff --git a/include/nuttx/video/imgsensor.h b/include/nuttx/video/imgsensor.h
index 36fa9baef1..b643e86603 100644
--- a/include/nuttx/video/imgsensor.h
+++ b/include/nuttx/video/imgsensor.h
@@ -34,49 +34,49 @@
 
 /* Camera parameter IDs */
 
-#define IMGSENSOR_ID_BRIGHTNESS           (0x00000000)
-#define IMGSENSOR_ID_CONTRAST             (0x00000001)
-#define IMGSENSOR_ID_SATURATION           (0x00000002)
-#define IMGSENSOR_ID_HUE                  (0x00000003)
-#define IMGSENSOR_ID_AUTO_WHITE_BALANCE   (0x00000004)
-#define IMGSENSOR_ID_RED_BALANCE          (0x00000005)
-#define IMGSENSOR_ID_BLUE_BALANCE         (0x00000006)
-#define IMGSENSOR_ID_GAMMA                (0x00000007)
-#define IMGSENSOR_ID_GAMMA_CURVE          (0x00000008)
-#define IMGSENSOR_ID_EXPOSURE             (0x00000009)
-#define IMGSENSOR_ID_HFLIP_VIDEO          (0x0000000a)
-#define IMGSENSOR_ID_VFLIP_VIDEO          (0x0000000b)
-#define IMGSENSOR_ID_HFLIP_STILL          (0x0000000c)
-#define IMGSENSOR_ID_VFLIP_STILL          (0x0000000d)
-#define IMGSENSOR_ID_SHARPNESS            (0x0000000e)
-#define IMGSENSOR_ID_COLOR_KILLER         (0x0000000f)
-#define IMGSENSOR_ID_COLORFX              (0x00000010)
-#define IMGSENSOR_ID_AUTOBRIGHTNESS       (0x00000011)
-#define IMGSENSOR_ID_ROTATE               (0x00000012)
-#define IMGSENSOR_ID_EXPOSURE_AUTO        (0x00010000)
-#define IMGSENSOR_ID_EXPOSURE_ABSOLUTE    (0x00010001)
-#define IMGSENSOR_ID_FOCUS_ABSOLUTE       (0x00010002)
-#define IMGSENSOR_ID_FOCUS_RELATIVE       (0x00010003)
-#define IMGSENSOR_ID_FOCUS_AUTO           (0x00010004)
-#define IMGSENSOR_ID_ZOOM_ABSOLUTE        (0x00010005)
-#define IMGSENSOR_ID_ZOOM_RELATIVE        (0x00010006)
-#define IMGSENSOR_ID_ZOOM_CONTINUOUS      (0x00010007)
-#define IMGSENSOR_ID_IRIS_ABSOLUTE        (0x00010008)
-#define IMGSENSOR_ID_IRIS_RELATIVE        (0x00010009)
-#define IMGSENSOR_ID_AUTO_N_PRESET_WB     (0x0001000a)
-#define IMGSENSOR_ID_WIDE_DYNAMIC_RANGE   (0x0001000b)
-#define IMGSENSOR_ID_IMG_STABILIZATION    (0x0001000c)
-#define IMGSENSOR_ID_ISO_SENSITIVITY      (0x0001000d)
-#define IMGSENSOR_ID_ISO_SENSITIVITY_AUTO (0x0001000e)
-#define IMGSENSOR_ID_EXPOSURE_METERING    (0x0001000f)
-#define IMGSENSOR_ID_SPOT_POSITION        (0x00010016)
-#define IMGSENSOR_ID_3A_LOCK              (0x00010011)
-#define IMGSENSOR_ID_AUTO_FOCUS_START     (0x00010012)
-#define IMGSENSOR_ID_AUTO_FOCUS_STOP      (0x00010013)
-#define IMGSENSOR_ID_3A_PARAMETER         (0x00010014)
-#define IMGSENSOR_ID_3A_STATUS            (0x00010015)
-#define IMGSENSOR_ID_FLASH_LED_MODE       (0x00020000)
-#define IMGSENSOR_ID_JPEG_QUALITY         (0x00030000)
+#define IMGSENSOR_ID_BRIGHTNESS           V4L2_CID_BRIGHTNESS
+#define IMGSENSOR_ID_CONTRAST             V4L2_CID_CONTRAST
+#define IMGSENSOR_ID_SATURATION           V4L2_CID_SATURATION
+#define IMGSENSOR_ID_HUE                  V4L2_CID_HUE
+#define IMGSENSOR_ID_AUTO_WHITE_BALANCE   V4L2_CID_AUTO_WHITE_BALANCE
+#define IMGSENSOR_ID_RED_BALANCE          V4L2_CID_RED_BALANCE
+#define IMGSENSOR_ID_BLUE_BALANCE         V4L2_CID_BLUE_BALANCE
+#define IMGSENSOR_ID_GAMMA                V4L2_CID_GAMMA
+#define IMGSENSOR_ID_GAMMA_CURVE          V4L2_CID_GAMMA_CURVE
+#define IMGSENSOR_ID_EXPOSURE             V4L2_CID_EXPOSURE
+#define IMGSENSOR_ID_HFLIP_VIDEO          V4L2_CID_HFLIP
+#define IMGSENSOR_ID_VFLIP_VIDEO          V4L2_CID_VFLIP
+#define IMGSENSOR_ID_HFLIP_STILL          V4L2_CID_HFLIP_STILL
+#define IMGSENSOR_ID_VFLIP_STILL          V4L2_CID_VFLIP_STILL
+#define IMGSENSOR_ID_SHARPNESS            V4L2_CID_SHARPNESS
+#define IMGSENSOR_ID_COLOR_KILLER         V4L2_CID_COLOR_KILLER
+#define IMGSENSOR_ID_COLORFX              V4L2_CID_COLORFX
+#define IMGSENSOR_ID_AUTOBRIGHTNESS       V4L2_CID_AUTOBRIGHTNESS
+#define IMGSENSOR_ID_ROTATE               V4L2_CID_ROTATE
+#define IMGSENSOR_ID_EXPOSURE_AUTO        V4L2_CID_EXPOSURE_AUTO
+#define IMGSENSOR_ID_EXPOSURE_ABSOLUTE    V4L2_CID_EXPOSURE_ABSOLUTE
+#define IMGSENSOR_ID_FOCUS_ABSOLUTE       V4L2_CID_FOCUS_ABSOLUTE
+#define IMGSENSOR_ID_FOCUS_RELATIVE       V4L2_CID_FOCUS_RELATIVE
+#define IMGSENSOR_ID_FOCUS_AUTO           V4L2_CID_FOCUS_AUTO
+#define IMGSENSOR_ID_ZOOM_ABSOLUTE        V4L2_CID_ZOOM_ABSOLUTE
+#define IMGSENSOR_ID_ZOOM_RELATIVE        V4L2_CID_ZOOM_RELATIVE
+#define IMGSENSOR_ID_ZOOM_CONTINUOUS      V4L2_CID_ZOOM_CONTINUOUS
+#define IMGSENSOR_ID_IRIS_ABSOLUTE        V4L2_CID_IRIS_ABSOLUTE
+#define IMGSENSOR_ID_IRIS_RELATIVE        V4L2_CID_IRIS_RELATIVE
+#define IMGSENSOR_ID_AUTO_N_PRESET_WB     V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE
+#define IMGSENSOR_ID_WIDE_DYNAMIC_RANGE   V4L2_CID_WIDE_DYNAMIC_RANGE
+#define IMGSENSOR_ID_IMG_STABILIZATION    V4L2_CID_IMAGE_STABILIZATION
+#define IMGSENSOR_ID_ISO_SENSITIVITY      V4L2_CID_ISO_SENSITIVITY
+#define IMGSENSOR_ID_ISO_SENSITIVITY_AUTO V4L2_CID_ISO_SENSITIVITY_AUTO
+#define IMGSENSOR_ID_EXPOSURE_METERING    V4L2_CID_EXPOSURE_METERING
+#define IMGSENSOR_ID_SPOT_POSITION        
V4L2_CID_EXPOSURE_METERING_SPOT_POSITION
+#define IMGSENSOR_ID_3A_LOCK              V4L2_CID_3A_LOCK
+#define IMGSENSOR_ID_AUTO_FOCUS_START     V4L2_CID_AUTO_FOCUS_START
+#define IMGSENSOR_ID_AUTO_FOCUS_STOP      V4L2_CID_AUTO_FOCUS_STOP
+#define IMGSENSOR_ID_3A_PARAMETER         V4L2_CID_3A_PARAMETER
+#define IMGSENSOR_ID_3A_STATUS            V4L2_CID_3A_STATUS
+#define IMGSENSOR_ID_FLASH_LED_MODE       V4L2_CID_FLASH_LED_MODE
+#define IMGSENSOR_ID_JPEG_QUALITY         V4L2_CID_JPEG_COMPRESSION_QUALITY
 #define IMGSENSOR_ID_CLIP_VIDEO           (0xFFFF0000)
 #define IMGSENSOR_ID_CLIP_STILL           (0xFFFF0001)
 
diff --git a/include/nuttx/video/video_controls.h 
b/include/nuttx/video/video_controls.h
index 17324ea4bb..492d02bed0 100644
--- a/include/nuttx/video/video_controls.h
+++ b/include/nuttx/video/video_controls.h
@@ -31,30 +31,47 @@
 
 /* Control classes */
 
-#define V4L2_CTRL_CLASS_USER      (0x0000) /* Old-style 'user' controls */
-#define V4L2_CTRL_CLASS_CAMERA    (0x0001) /* Camera class controls */
-#define V4L2_CTRL_CLASS_FLASH     (0x0002) /* Camera flash controls */
-#define V4L2_CTRL_CLASS_JPEG      (0x0003) /* JPEG-compression controls */
+#define V4L2_CTRL_CLASS_USER      (0x0100) /* Old-style 'user' controls */
+#define V4L2_CTRL_CLASS_CAMERA    (0x0200) /* Camera class controls */
+#define V4L2_CTRL_CLASS_FLASH     (0x0300) /* Camera flash controls */
+#define V4L2_CTRL_CLASS_JPEG      (0x0400) /* JPEG-compression controls */
+
+#define USER_CID(v)   (V4L2_CTRL_CLASS_USER + (v))
+#define CAMERA_CID(v) (V4L2_CTRL_CLASS_CAMERA + (v))
+#define FLASH_CID(v)  (V4L2_CTRL_CLASS_FLASH + (v))
+#define JPEG_CID(v)   (V4L2_CTRL_CLASS_JPEG + (v))
 
 /* User-class control IDs */
 
-#define V4L2_CID_BRIGHTNESS         (0)    /* Brightness */
-#define V4L2_CID_CONTRAST           (1)    /* Contrast   */
-#define V4L2_CID_SATURATION         (2)    /* Saturation */
-#define V4L2_CID_HUE                (3)    /* Hue        */
-#define V4L2_CID_AUTO_WHITE_BALANCE (4)    /* AWB        */
-#define V4L2_CID_RED_BALANCE        (5)    /* Red balance */
-#define V4L2_CID_BLUE_BALANCE       (6)    /* Blue balance */
-#define V4L2_CID_GAMMA              (7)    /* Gamma value adjustment */
-#define V4L2_CID_GAMMA_CURVE        (8)    /* Gamma curve adjustment */
-#define V4L2_CID_EXPOSURE           (9)    /* Exposure value */
-#define V4L2_CID_HFLIP              (10)   /* Mirror horizontally(VIDEO) */
-#define V4L2_CID_VFLIP              (11)   /* Mirror vertically(VIDEO) */
-#define V4L2_CID_HFLIP_STILL        (12)   /* Mirror horizontally(STILL) */
-#define V4L2_CID_VFLIP_STILL        (13)   /* Mirror vertically(STILL) */
-#define V4L2_CID_SHARPNESS          (14)   /* Sharpness */
-#define V4L2_CID_COLOR_KILLER       (15)   /* Color killer */
-#define V4L2_CID_COLORFX            (16)   /* Color effect */
+#define V4L2_CID_BRIGHTNESS           USER_CID(0)    /* Brightness */
+#define V4L2_CID_CONTRAST             USER_CID(1)    /* Contrast   */
+#define V4L2_CID_SATURATION           USER_CID(2)    /* Saturation */
+#define V4L2_CID_HUE                  USER_CID(3)    /* Hue        */
+#define V4L2_CID_AUTO_WHITE_BALANCE   USER_CID(4)    /* AWB        */
+#define V4L2_CID_RED_BALANCE          USER_CID(5)    /* Red balance */
+#define V4L2_CID_BLUE_BALANCE         USER_CID(6)    /* Blue balance */
+#define V4L2_CID_GAMMA                USER_CID(7)    /* Gamma value adjustment 
*/
+#define V4L2_CID_GAMMA_CURVE          USER_CID(8)    /* Gamma curve adjustment 
*/
+#define V4L2_CID_EXPOSURE             USER_CID(9)    /* Exposure value */
+
+/* Mirror horizontally(VIDEO) */
+
+#define V4L2_CID_HFLIP                USER_CID(10)
+
+/* Mirror vertically(VIDEO) */
+
+#define V4L2_CID_VFLIP                USER_CID(11)
+
+/* Mirror horizontally(STILL) */
+
+#define V4L2_CID_HFLIP_STILL          USER_CID(12)
+
+/* Mirror vertically(STILL) */
+
+#define V4L2_CID_VFLIP_STILL          USER_CID(13)
+#define V4L2_CID_SHARPNESS            USER_CID(14)   /* Sharpness */
+#define V4L2_CID_COLOR_KILLER         USER_CID(15)   /* Color killer */
+#define V4L2_CID_COLORFX              USER_CID(16)   /* Color effect */
 
 /* Enumeration for V4L2_CID_COLORFX */
 
@@ -78,12 +95,13 @@ enum v4l2_colorfx
   V4L2_COLORFX_SET_CBCR            = 15,   /* Set CbCr */
   V4L2_COLORFX_PASTEL              = 16    /* Pastel */
 };
-#define V4L2_CID_AUTOBRIGHTNESS     (17)   /* Auto brightness */
-#define V4L2_CID_ROTATE             (18)   /* Rotation */
+
+#define V4L2_CID_AUTOBRIGHTNESS       USER_CID(17)   /* Auto brightness */
+#define V4L2_CID_ROTATE               USER_CID(18)   /* Rotation */
 
 /* Camera class control IDs */
 
-#define V4L2_CID_EXPOSURE_AUTO      (0)    /* Auto exposure */
+#define V4L2_CID_EXPOSURE_AUTO        CAMERA_CID(0)  /* Auto exposure */
 
 /* Enumeration for V4L2_CID_EXPOSURE_AUTO */
 
@@ -105,20 +123,23 @@ enum v4l2_exposure_auto_type
 
   V4L2_EXPOSURE_APERTURE_PRIORITY  = 3
 };
-#define V4L2_CID_EXPOSURE_ABSOLUTE  (1)    /* Exposure time */
 
-#define V4L2_CID_FOCUS_ABSOLUTE     (2)    /* Focus */
-#define V4L2_CID_FOCUS_RELATIVE     (3)    /* Focus */
-#define V4L2_CID_FOCUS_AUTO         (4)    /* Auto focus */
+#define V4L2_CID_EXPOSURE_ABSOLUTE    CAMERA_CID(1) /* Exposure time */
+
+#define V4L2_CID_FOCUS_ABSOLUTE       CAMERA_CID(2) /* Focus */
+#define V4L2_CID_FOCUS_RELATIVE       CAMERA_CID(3) /* Focus */
+#define V4L2_CID_FOCUS_AUTO           CAMERA_CID(4) /* Auto focus */
+
+#define V4L2_CID_ZOOM_ABSOLUTE        CAMERA_CID(5) /* Zoom(absolute)  */
+#define V4L2_CID_ZOOM_RELATIVE        CAMERA_CID(6) /* Zoom(relative)  */
+#define V4L2_CID_ZOOM_CONTINUOUS      CAMERA_CID(7) /* Continuous zoom */
 
-#define V4L2_CID_ZOOM_ABSOLUTE      (5)    /* Zoom(absolute)  */
-#define V4L2_CID_ZOOM_RELATIVE      (6)    /* Zoom(relative)  */
-#define V4L2_CID_ZOOM_CONTINUOUS    (7)    /* Continuous zoom */
+#define V4L2_CID_IRIS_ABSOLUTE        CAMERA_CID(8) /* Iris(absolute) */
+#define V4L2_CID_IRIS_RELATIVE        CAMERA_CID(9) /* Iris(relative) */
 
-#define V4L2_CID_IRIS_ABSOLUTE      (8)    /* Iris(absolute) */
-#define V4L2_CID_IRIS_RELATIVE      (9)    /* Iris(relative) */
+/* Preset white balance */
 
-#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (10) /* Preset white balance */
+#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE CAMERA_CID(10)
 
 /* Enumeration for V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE */
 
@@ -136,11 +157,16 @@ enum v4l2_auto_n_preset_white_balance
   V4L2_WHITE_BALANCE_SHADE         = 9, /* Shade */
 };
 
-#define V4L2_CID_WIDE_DYNAMIC_RANGE   (11) /* Wide dynamic range */
-#define V4L2_CID_IMAGE_STABILIZATION  (12) /* Image stabilization */
+#define V4L2_CID_WIDE_DYNAMIC_RANGE   CAMERA_CID(11) /* Wide dynamic range */
+
+/* Image stabilization */
+
+#define V4L2_CID_IMAGE_STABILIZATION  CAMERA_CID(12)
+#define V4L2_CID_ISO_SENSITIVITY      CAMERA_CID(13) /* ISO sensitivity */
+
+/* Auto ISO sensitivity */
 
-#define V4L2_CID_ISO_SENSITIVITY      (13) /* ISO sensitivity */
-#define V4L2_CID_ISO_SENSITIVITY_AUTO (14) /* Auto ISO sensitivity */
+#define V4L2_CID_ISO_SENSITIVITY_AUTO CAMERA_CID(14)
 
 /* Enumeration for V4L2_CID_ISO_SENSITIVITY_AUTO */
 
@@ -150,7 +176,7 @@ enum v4l2_iso_sensitivity_auto_type
   V4L2_ISO_SENSITIVITY_AUTO    = 1,  /* Automatic */
 };
 
-#define V4L2_CID_EXPOSURE_METERING    (15)    /* Exposure metering */
+#define V4L2_CID_EXPOSURE_METERING    CAMERA_CID(15) /* Exposure metering */
 
 /* Enumeration for V4L2_CID_EXPOSURE_METERING */
 
@@ -162,7 +188,7 @@ enum v4l2_exposure_metering
   V4L2_EXPOSURE_METERING_MATRIX          = 3, /* Matrix */
 };
 
-#define V4L2_CID_SCENE_MODE     (16)   /* Scene selection */
+#define V4L2_CID_SCENE_MODE           CAMERA_CID(16) /* Scene selection */
 
 /* Enumeration for V4L2_CID_SCENE_MODE */
 
@@ -185,31 +211,31 @@ enum v4l2_scene_mode
   V4L2_SCENE_MODE_MAX          = 14    /* Max number */
 };
 
-#define V4L2_CID_3A_LOCK         (17)     /* Lock 3A */
-#define V4L2_LOCK_EXPOSURE       (1 << 0) /* Exposure bit for
-                                           *   V4L2_CID_3A_LOCK */
-#define V4L2_LOCK_WHITE_BALANCE  (1 << 1) /* White balance bit for
-                                           *   V4L2_CID_3A_LOCK */
-#define V4L2_LOCK_FOCUS          (1 << 2) /* Focus bit for
-                                           *   V4L2_CID_3A_LOCK */
+#define V4L2_CID_3A_LOCK              CAMERA_CID(17) /* Lock 3A */
+#define V4L2_LOCK_EXPOSURE            (1 << 0)       /* Exposure bit for
+                                                      *   V4L2_CID_3A_LOCK */
+#define V4L2_LOCK_WHITE_BALANCE       (1 << 1)       /* White balance bit for
+                                                      *   V4L2_CID_3A_LOCK */
+#define V4L2_LOCK_FOCUS               (1 << 2)       /* Focus bit for
+                                                      *   V4L2_CID_3A_LOCK */
 
-#define V4L2_CID_AUTO_FOCUS_START (18)    /* Start single AF */
-#define V4L2_CID_AUTO_FOCUS_STOP  (19)    /* Stop single AF */
+#define V4L2_CID_AUTO_FOCUS_START     CAMERA_CID(18) /* Start single AF */
+#define V4L2_CID_AUTO_FOCUS_STOP      CAMERA_CID(19) /* Stop single AF */
 
-#define V4L2_CID_3A_PARAMETER        (20)     /* 3A parameter     */
-#define V4L2_CID_3A_STATUS           (21)     /* 3A status        */
-#define V4L2_3A_STATUS_STABLE        (0)      /* 3A  is stable    */
-#define V4L2_3A_STATUS_AE_OPERATING  (1 << 0) /* AE  is operating */
-#define V4L2_3A_STATUS_AWB_OPERATING (1 << 1) /* AWB is operating */
-#define V4L2_3A_STATUS_AF_OPERATING  (1 << 2) /* AF  is operating */
+#define V4L2_CID_3A_PARAMETER         CAMERA_CID(20) /* 3A parameter     */
+#define V4L2_CID_3A_STATUS            CAMERA_CID(21) /* 3A status        */
+#define V4L2_3A_STATUS_STABLE         (0)            /* 3A  is stable    */
+#define V4L2_3A_STATUS_AE_OPERATING   (1 << 0)       /* AE  is operating */
+#define V4L2_3A_STATUS_AWB_OPERATING  (1 << 1)       /* AWB is operating */
+#define V4L2_3A_STATUS_AF_OPERATING   (1 << 2)       /* AF  is operating */
 
 /* Spot position in spot exposure metering */
 
-#define V4L2_CID_EXPOSURE_METERING_SPOT_POSITION (22)
+#define V4L2_CID_EXPOSURE_METERING_SPOT_POSITION CAMERA_CID(22)
 
 /* Flash and privacy (indicator) light controls */
 
-#define V4L2_CID_FLASH_LED_MODE   (0)
+#define V4L2_CID_FLASH_LED_MODE       FLASH_CID(0)
 
 /* Enumeration for V4L2_CID_FLASH_LED_MODE */
 
@@ -222,6 +248,6 @@ enum v4l2_flash_led_mode
 
 /* JPEG-class control IDs */
 
-#define V4L2_CID_JPEG_COMPRESSION_QUALITY (0) /* JPEG quality */
+#define V4L2_CID_JPEG_COMPRESSION_QUALITY JPEG_CID(0) /* JPEG quality */
 
 #endif /* __INCLUDE_NUTTX_VIDEO_VIDEO_CONTROLS_H */
diff --git a/include/sys/videoio.h b/include/sys/videoio.h
index 1576bd51c9..939c01da12 100644
--- a/include/sys/videoio.h
+++ b/include/sys/videoio.h
@@ -1141,7 +1141,7 @@ enum v4l2_ctrl_type
 
 struct v4l2_queryctrl
 {
-  uint16_t   ctrl_class;               /* Control class */
+  uint16_t   ctrl_class;               /* Control class(not used) */
   uint16_t   id;                       /* Control id */
   uint16_t   type;                     /* enum #v4l2_ctrl_type */
   char       name[32];                 /* Name of control */
@@ -1153,7 +1153,7 @@ struct v4l2_queryctrl
 
 struct v4l2_query_ext_ctrl
 {
-  uint16_t   ctrl_class;               /* Control class */
+  uint16_t   ctrl_class;               /* Control class(not used) */
   uint16_t   id;                       /* Control id */
   uint16_t   type;                     /* enum #v4l2_ctrl_type */
   char       name[32];                 /* Name of control */
@@ -1170,7 +1170,7 @@ struct v4l2_query_ext_ctrl
 
 struct v4l2_querymenu
 {
-  uint16_t   ctrl_class;    /* Camera control class */
+  uint16_t   ctrl_class;    /* Camera control class(not used) */
   uint16_t   id;            /* Camera control id    */
   uint32_t   index;         /* Index of menu.       */
   union

Reply via email to