You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/12/01 12:34:39 UTC
[GitHub] [nuttx] PeterBee97 opened a new pull request, #7749: drivers/video: add support for YUV formats
PeterBee97 opened a new pull request, #7749:
URL: https://github.com/apache/nuttx/pull/7749
## Summary
Add definitions for two YUV formats used by most USB cameras and v4l2loopback. Also add a function for calculating video buffer sizes.
## Impact
Currently no impact
## Testing
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #7749: drivers/video: add support for YUV formats
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#discussion_r1037062351
##########
drivers/video/video.c:
##########
@@ -1466,6 +1475,22 @@ static int validate_frame_setting(enum v4l2_buf_type type,
return g_video_data_ops->validate_frame_setting(nr_fmt, df, &di);
}
+static size_t video_fmt_buf_size(video_format_t *vf)
Review Comment:
no place call this function?
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] PeterBee97 commented on a diff in pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
PeterBee97 commented on code in PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#discussion_r1037795560
##########
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:
I have rewritten then into enums so that the code position is still good for reference while not breaking NuttX rules.
##########
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:
I have rewritten them into enums so that the code position is still good for reference while not breaking NuttX rules.
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#discussion_r1037702770
##########
drivers/video/video.c:
##########
@@ -1053,6 +1065,18 @@ static int video_close(FAR struct file *filep)
return ret;
}
+static ssize_t video_read(FAR struct file *filep, FAR char *buffer,
+ size_t buflen)
+{
+ return -ENOTSUP;
+}
+
+static ssize_t video_write(FAR struct file *filep, FAR const char *buffer,
+ size_t buflen)
Review Comment:
```suggestion
static ssize_t video_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
```
##########
include/nuttx/video/video.h:
##########
@@ -214,17 +271,167 @@ extern "C"
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
#define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1 << 31))
-/* YUV 4:2:2 */
-
-#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y')
-
-/* RGB565 */
-
-#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P')
-
-/* JFIF JPEG */
-
-#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G')
+/* RGB formats */
+
+#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1')
+#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4')
+#define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2')
+#define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2')
+#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O')
+#define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5')
+#define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5')
+#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P')
+#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q')
+#define V4L2_PIX_FMT_ARGB555X v4l2_fourcc_be('A', 'R', '1', '5')
+#define V4L2_PIX_FMT_XRGB555X v4l2_fourcc_be('X', 'R', '1', '5')
+#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R')
+#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H')
+#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3')
+#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3')
+#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4')
+#define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4')
+#define V4L2_PIX_FMT_XBGR32 v4l2_fourcc('X', 'R', '2', '4')
+#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4')
+#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4')
+#define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4')
Review Comment:
```suggestion
#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1')
#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4')
#define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2')
#define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2')
#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O')
#define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5')
#define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5')
#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P')
#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q')
#define V4L2_PIX_FMT_ARGB555X v4l2_fourcc_be('A', 'R', '1', '5')
#define V4L2_PIX_FMT_XRGB555X v4l2_fourcc_be('X', 'R', '1', '5')
#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R')
#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H')
#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3')
#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3')
#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4')
#define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4')
#define V4L2_PIX_FMT_XBGR32 v4l2_fourcc('X', 'R', '2', '4')
#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4')
#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4')
#define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4')
```
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] PeterBee97 commented on a diff in pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
PeterBee97 commented on code in PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#discussion_r1037795157
##########
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:
Not really, our driver does not support any input format standards(NTSC, PAL, etc.) so we should return 0 here. It is the same behavior as that on my USB camera. Changing it to >0 while not supporting ENUMINPUT will cause application such as FFmpeg to fail.
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] PeterBee97 commented on a diff in pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
PeterBee97 commented on code in PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#discussion_r1037797335
##########
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:
Same as above
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 merged pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7749:
URL: https://github.com/apache/nuttx/pull/7749
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] PeterBee97 commented on pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
PeterBee97 commented on PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#issuecomment-1335388269
> Yes, I think the headers files are not covered by GPL license. But it is important to clarify to avoid issues in the future. Maybe adding this info that the file header is based on FreeBSD will bring peace of mind.
Added.
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#discussion_r1037895346
##########
drivers/video/video.c:
##########
@@ -1547,6 +1595,24 @@ static int video_try_fmt(FAR struct video_mng_s *priv,
&type_inf->frame_interval);
}
+static int video_g_fmt(FAR struct video_mng_s *priv,
+ FAR struct v4l2_format *fmt)
+{
+ FAR video_type_inf_t *type_inf;
+
+ type_inf = get_video_type_inf(priv, fmt->type);
+ if (type_inf == NULL)
+ {
+ return -EINVAL;
+ }
+
Review Comment:
let's zero fmt to ensure the unsupported field get a fixed value
##########
include/nuttx/video/video.h:
##########
@@ -259,6 +461,126 @@ extern "C"
#define V4L2_BUF_FLAG_ERROR (0x0001)
+/* Values for v4l2_std_id */
+
+/* one bit for each */
+#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
+#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
+#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
+#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
+#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
+#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
+#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
+#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
+
+#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
+#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
+#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
+#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
+
+#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */
+#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */
+#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
+#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */
+
+#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
+#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
+#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
+#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
+#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
+#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
+#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
+#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
+
+/* ATSC/HDTV */
+#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
+#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
+
+/* Some macros to merge video standards in order to make live easier for the
+ * drivers and V4L2 applications
+ */
+
+/* "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
+ * Missing here.
+ */
+#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
+ V4L2_STD_NTSC_M_JP |\
Review Comment:
```suggestion
V4L2_STD_NTSC_M_JP | \
```
##########
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/sys/videoio.h:
##########
@@ -0,0 +1 @@
+#include <nuttx/video/video.h>
Review Comment:
add apache copyright
##########
include/nuttx/video/video.h:
##########
@@ -259,6 +461,126 @@ extern "C"
#define V4L2_BUF_FLAG_ERROR (0x0001)
+/* Values for v4l2_std_id */
+
+/* one bit for each */
+#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
+#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
+#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
+#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
+#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
+#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
+#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
+#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
+
+#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
+#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
+#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
+#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
+
+#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */
+#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */
+#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
+#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */
+
+#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
+#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
+#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
+#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
+#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
+#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
+#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
+#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
+
+/* ATSC/HDTV */
+#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
+#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
+
+/* Some macros to merge video standards in order to make live easier for the
+ * drivers and V4L2 applications
+ */
+
+/* "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
+ * Missing here.
+ */
+#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
+ V4L2_STD_NTSC_M_JP |\
+ V4L2_STD_NTSC_M_KR)
+/* Secam macros */
+#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
+ V4L2_STD_SECAM_K |\
Review Comment:
algin and add space before \ for all similar macro
##########
drivers/video/video.c:
##########
@@ -1053,6 +1065,18 @@ static int video_close(FAR struct file *filep)
return ret;
}
+static ssize_t video_read(FAR struct file *filep, FAR char *buffer,
+ size_t buflen)
+{
+ return -ENOTSUP;
+}
+
+static ssize_t video_write(FAR struct file *filep, FAR const char *buffer,
+ size_t buflen)
Review Comment:
unresolved
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] acassis commented on pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
acassis commented on PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#issuecomment-1334226046
@PeterBee97 @xiaoxiang781216 these headers files seem to be a direct copy of Linux V4L2 header that is GPL: https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/videodev.html
Please take care when using GPL code as reference, this is a gray area, otherwise we will need to change our license from Apache to GPL! I suggest asking support from Apache lawyers (@justinmclean does Apache have license lawyer?).
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] PeterBee97 commented on pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
PeterBee97 commented on PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#issuecomment-1334719072
> @PeterBee97 @xiaoxiang781216 these headers files seem to be a direct copy of Linux V4L2 header that is GPL: https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/videodev.html
>
> Please take care when using GPL code as reference, this is a gray area, otherwise we will need to change our license from Apache to GPL! I suggest asking support from Apache lawyers (@justinmclean does Apache have license lawyer?).
Hi Alan,
Actually my direct reference of the change is from the BSD kernel: https://github.com/freebsd/freebsd-src/blob/373ffc62c158e52cde86a5b934ab4a51307f9f2e/sys/contrib/v4l/videodev2.h . It is almost the same as Linux headers, though. And the V4L2 by its name is from Linux, so I called it "Linux standard" in the title. Is that OK with the license issue?
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#issuecomment-1334740464
@PeterBee97 thanks for clarifying the reference source. Since our declaration (implementation is still different) come from FreeBSD, I think that the concern about license should disappear.:)
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] acassis commented on pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
acassis commented on PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#issuecomment-1335102490
Yes, I think the headers files are not covered by GPL license. But it is important to clarify to avoid issues in the future. Maybe adding this info that the file header is based on FreeBSD will bring peace of mind.
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #7749:
URL: https://github.com/apache/nuttx/pull/7749#issuecomment-1334687230
> @PeterBee97 @xiaoxiang781216 these headers files seem to be a direct copy of Linux V4L2 header that is GPL: https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/videodev.html
>
> Please take care when using GPL code as reference, this is a gray area, otherwise we will need to change our license from Apache to GPL! I suggest asking support from Apache lawyers (@justinmclean does Apache have license lawyer?).
Yes, the symbols are same as Linux to keep the compatibility, but the implementation is written from the scratch. Is the API prototype also covered by license?
BTW, I guess the original interface design is influenced by v4l2(of course, the implementation is totally different and write from scratch), @masayuki2009 could you confirm it?
This patch just follow this direction to make it more compatibility by adding more symbols and implementation.
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #7749: drivers/video: enhance v4l2 compatibility
Posted by GitBox <gi...@apache.org>.
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org