xiaoxiang781216 commented on code in PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#discussion_r1037734150


##########
drivers/video/video.c:
##########
@@ -222,7 +222,13 @@ static int validate_frame_setting(enum v4l2_buf_type type,
 
 /* internal function for each cmds of ioctl */
 
+static ssize_t video_read(FAR struct file *filep, FAR char *buffer,
+                          size_t buflen);
+static ssize_t video_write(FAR struct file *filep, FAR const char *buffer,
+                   size_t buflen);

Review Comment:
   ```suggestion
                            size_t buflen);
   ```



##########
include/nuttx/video/video.h:
##########
@@ -641,6 +1097,89 @@ struct v4l2_querymenu
   };
 };
 
+struct v4l2_input
+{
+  uint32_t      index;       /*  Which input */
+  uint8_t       name[32];    /*  Label */
+  uint32_t      type;        /*  Type of input */
+  uint32_t      audioset;    /*  Associated audios (bitfield) */
+  uint32_t      tuner;       /*  enum v4l2_tuner_type */
+  v4l2_std_id   std;
+  uint32_t      status;
+  uint32_t      capabilities;
+  uint32_t      reserved[3];
+};
+
+/*  Values for the 'type' field */
+
+#define V4L2_INPUT_TYPE_TUNER      1
+#define V4L2_INPUT_TYPE_CAMERA     2
+#define V4L2_INPUT_TYPE_TOUCH      3
+
+/* field 'status' - general */
+
+#define V4L2_IN_ST_NO_POWER    0x00000001  /* Attached device is off */
+#define V4L2_IN_ST_NO_SIGNAL   0x00000002
+#define V4L2_IN_ST_NO_COLOR    0x00000004
+
+/* field 'status' - sensor orientation */
+
+/* If sensor is mounted upside down set both bits */
+
+#define V4L2_IN_ST_HFLIP       0x00000010 /* Frames are flipped horizontally */
+#define V4L2_IN_ST_VFLIP       0x00000020 /* Frames are flipped vertically */
+
+/* field 'status' - analog */
+
+#define V4L2_IN_ST_NO_H_LOCK   0x00000100  /* No horizontal sync lock */
+#define V4L2_IN_ST_COLOR_KILL  0x00000200  /* Color killer is active */
+#define V4L2_IN_ST_NO_V_LOCK   0x00000400  /* No vertical sync lock */
+#define V4L2_IN_ST_NO_STD_LOCK 0x00000800  /* No standard format lock */
+
+/* field 'status' - digital */
+
+#define V4L2_IN_ST_NO_SYNC     0x00010000  /* No synchronization lock */
+#define V4L2_IN_ST_NO_EQU      0x00020000  /* No equalizer lock */
+#define V4L2_IN_ST_NO_CARRIER  0x00040000  /* Carrier recovery failed */
+
+/* field 'status' - VCR and set-top box */
+
+#define V4L2_IN_ST_MACROVISION 0x01000000  /* Macrovision detected */
+#define V4L2_IN_ST_NO_ACCESS   0x02000000  /* Conditional access denied */
+#define V4L2_IN_ST_VTR         0x04000000  /* VTR time constant */
+
+/* capabilities flags */
+
+#define V4L2_IN_CAP_DV_TIMINGS        0x00000002              /* Supports 
S_DV_TIMINGS */
+#define V4L2_IN_CAP_CUSTOM_TIMINGS    V4L2_IN_CAP_DV_TIMINGS  /* For 
compatibility */
+#define V4L2_IN_CAP_STD               0x00000004              /* Supports 
S_STD */
+#define V4L2_IN_CAP_NATIVE_SIZE       0x00000008              /* Supports 
setting native size */
+
+struct v4l2_output
+{
+  uint32_t      index;           /*  Which output */
+  uint8_t       name[32];        /*  Label */
+  uint32_t      type;            /*  Type of output */
+  uint32_t      audioset;        /*  Associated audios (bitfield) */
+  uint32_t      modulator;       /*  Associated modulator */
+  v4l2_std_id   std;
+  uint32_t      capabilities;
+  uint32_t      reserved[3];
+};
+
+/*  Values for the 'type' field */
+
+#define V4L2_OUTPUT_TYPE_MODULATOR             1

Review Comment:
   move to preprocess section too



##########
include/nuttx/video/video.h:
##########
@@ -305,6 +630,136 @@ struct v4l2_selection
   struct v4l2_rect r;  /* The selection rectangle. */
 };
 
+typedef uint64_t v4l2_std_id;
+
+/* one bit for each */
+#define V4L2_STD_PAL_B          ((v4l2_std_id)0x00000001)

Review Comment:
   move all macro to preprocess section too



##########
include/nuttx/video/video.h:
##########
@@ -272,6 +479,116 @@ struct v4l2_capability
   uint32_t device_caps;  /* Device capabilities of the opened device */
 };
 
+/* Values for 'capabilities' field */

Review Comment:
   move to preprocess section too



##########
include/nuttx/video/video.h:
##########
@@ -442,6 +898,9 @@ struct v4l2_fmtdesc
   uint32_t pixelformat;                     /* Format fourcc      */
 };
 
+#define V4L2_FMT_FLAG_COMPRESSED 0x0001

Review Comment:
   move to preprocess section too



##########
include/nuttx/video/video.h:
##########
@@ -641,6 +1097,89 @@ struct v4l2_querymenu
   };
 };
 
+struct v4l2_input
+{
+  uint32_t      index;       /*  Which input */
+  uint8_t       name[32];    /*  Label */
+  uint32_t      type;        /*  Type of input */
+  uint32_t      audioset;    /*  Associated audios (bitfield) */
+  uint32_t      tuner;       /*  enum v4l2_tuner_type */
+  v4l2_std_id   std;
+  uint32_t      status;
+  uint32_t      capabilities;
+  uint32_t      reserved[3];
+};
+
+/*  Values for the 'type' field */
+
+#define V4L2_INPUT_TYPE_TUNER      1

Review Comment:
   macro need move to the preprocess section



##########
drivers/video/video.c:
##########
@@ -1076,6 +1100,30 @@ static int video_querycap(FAR struct v4l2_capability 
*cap)
   /* cap->driver needs to be NULL-terminated. */
 
   strlcpy((FAR char *)cap->driver, name, sizeof(cap->driver));
+  cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+
+  return OK;
+}
+
+static int video_g_input(FAR int *num)
+{
+  *num = 0;

Review Comment:
   should we change to:
   ```suggestion
     *num = 1;
   ```



##########
include/nuttx/video/video.h:
##########
@@ -568,6 +1019,11 @@ struct v4l2_captureparm
   uint32_t           readbuffers;   /*  # of buffers for read */
 };
 
+/*  Flags for 'capability' and 'capturemode' fields */

Review Comment:
   move to preprocess section too



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to