Commit 6016af82 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

[media] v4l2: use __u32 rather than enums in ioctl() structs

V4L2 uses the enum type in IOCTL arguments in IOCTLs that were defined until
the use of enum was considered less than ideal. Recently Rémi Denis-Courmont
brought up the issue by proposing a patch to convert the enums to unsigned:

<URL:http://www.spinics.net/lists/linux-media/msg46167.html>

This sparked a long discussion where another solution to the issue was
proposed: two sets of IOCTL structures, one with __u32 and the other with
enums, and conversion code between the two:

<URL:http://www.spinics.net/lists/linux-media/msg47168.html>

Both approaches implement a complete solution that resolves the problem. The
first one is simple but requires assuming enums and __u32 are the same in
size (so we won't break the ABI) while the second one is more complex and
less clean but does not require making that assumption.

The issue boils down to whether enums are fundamentally different from __u32
or not, and can the former be substituted by the latter. During the
discussion it was concluded that the __u32 has the same size as enums on all
archs Linux is supported: it has not been shown that replacing those enums
in IOCTL arguments would break neither source or binary compatibility. If no
such reason is found, just replacing the enums with __u32s is the way to go.

This is what this patch does. This patch is slightly different from Remi's
first RFC (link above): it uses __u32 instead of unsigned and also changes
the arguments of VIDIOC_G_PRIORITY and VIDIOC_S_PRIORITY.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 121b3ddb
...@@ -543,12 +543,13 @@ and can range from zero to the number of buffers allocated ...@@ -543,12 +543,13 @@ and can range from zero to the number of buffers allocated
with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.</entry> with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; <structfield>count</structfield>) minus one.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry></entry> <entry></entry>
<entry>Type of the buffer, same as &v4l2-format; <entry>Type of the buffer, same as &v4l2-format;
<structfield>type</structfield> or &v4l2-requestbuffers; <structfield>type</structfield> or &v4l2-requestbuffers;
<structfield>type</structfield>, set by the application.</entry> <structfield>type</structfield>, set by the application. See <xref
linkend="v4l2-buf-type" /></entry>
</row> </row>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
...@@ -568,7 +569,7 @@ refers to an input stream, applications when an output stream.</entry> ...@@ -568,7 +569,7 @@ refers to an input stream, applications when an output stream.</entry>
linkend="buffer-flags" />.</entry> linkend="buffer-flags" />.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-field;</entry> <entry>__u32</entry>
<entry><structfield>field</structfield></entry> <entry><structfield>field</structfield></entry>
<entry></entry> <entry></entry>
<entry>Indicates the field order of the image in the <entry>Indicates the field order of the image in the
...@@ -630,11 +631,12 @@ bandwidth. These devices identify by not enumerating any video ...@@ -630,11 +631,12 @@ bandwidth. These devices identify by not enumerating any video
standards, see <xref linkend="standard" />.</para></entry> standards, see <xref linkend="standard" />.</para></entry>
</row> </row>
<row> <row>
<entry>&v4l2-memory;</entry> <entry>__u32</entry>
<entry><structfield>memory</structfield></entry> <entry><structfield>memory</structfield></entry>
<entry></entry> <entry></entry>
<entry>This field must be set by applications and/or drivers <entry>This field must be set by applications and/or drivers
in accordance with the selected I/O method.</entry> in accordance with the selected I/O method. See <xref linkend="v4l2-memory"
/></entry>
</row> </row>
<row> <row>
<entry>union</entry> <entry>union</entry>
......
...@@ -94,16 +94,18 @@ information.</para> ...@@ -94,16 +94,18 @@ information.</para>
<entry>The number of buffers requested or granted.</entry> <entry>The number of buffers requested or granted.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-memory;</entry> <entry>__u32</entry>
<entry><structfield>memory</structfield></entry> <entry><structfield>memory</structfield></entry>
<entry>Applications set this field to <entry>Applications set this field to
<constant>V4L2_MEMORY_MMAP</constant> or <constant>V4L2_MEMORY_MMAP</constant> or
<constant>V4L2_MEMORY_USERPTR</constant>.</entry> <constant>V4L2_MEMORY_USERPTR</constant>. See <xref linkend="v4l2-memory"
/></entry>
</row> </row>
<row> <row>
<entry>&v4l2-format;</entry> <entry>__u32</entry>
<entry><structfield>format</structfield></entry> <entry><structfield>format</structfield></entry>
<entry>Filled in by the application, preserved by the driver.</entry> <entry>Filled in by the application, preserved by the driver.
See <xref linkend="v4l2-format" />.</entry>
</row> </row>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
......
...@@ -65,7 +65,7 @@ output.</para> ...@@ -65,7 +65,7 @@ output.</para>
&cs-str; &cs-str;
<tbody valign="top"> <tbody valign="top">
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>Type of the data stream, set by the application. <entry>Type of the data stream, set by the application.
Only these types are valid here: Only these types are valid here:
...@@ -73,7 +73,7 @@ Only these types are valid here: ...@@ -73,7 +73,7 @@ Only these types are valid here:
<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>, <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
<constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
and higher.</entry> and higher. See <xref linkend="v4l2-buf-type" />.</entry>
</row> </row>
<row> <row>
<entry>struct <link linkend="v4l2-rect-crop">v4l2_rect</link></entry> <entry>struct <link linkend="v4l2-rect-crop">v4l2_rect</link></entry>
......
...@@ -71,7 +71,7 @@ the application. This is in no way related to the <structfield> ...@@ -71,7 +71,7 @@ the application. This is in no way related to the <structfield>
pixelformat</structfield> field.</entry> pixelformat</structfield> field.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>Type of the data stream, set by the application. <entry>Type of the data stream, set by the application.
Only these types are valid here: Only these types are valid here:
...@@ -81,7 +81,7 @@ Only these types are valid here: ...@@ -81,7 +81,7 @@ Only these types are valid here:
<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>, <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE</constant>,
<constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
and higher.</entry> and higher. See <xref linkend="v4l2-buf-type" />.</entry>
</row> </row>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
......
...@@ -100,14 +100,14 @@ changed and <constant>VIDIOC_S_CROP</constant> returns the ...@@ -100,14 +100,14 @@ changed and <constant>VIDIOC_S_CROP</constant> returns the
&cs-str; &cs-str;
<tbody valign="top"> <tbody valign="top">
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>Type of the data stream, set by the application. <entry>Type of the data stream, set by the application.
Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>, Only these types are valid here: <constant>V4L2_BUF_TYPE_VIDEO_CAPTURE</constant>,
<constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>, <constant>V4L2_BUF_TYPE_VIDEO_OUTPUT</constant>,
<constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver <constant>V4L2_BUF_TYPE_VIDEO_OVERLAY</constant>, and custom (driver
defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant> defined) types with code <constant>V4L2_BUF_TYPE_PRIVATE</constant>
and higher.</entry> and higher. See <xref linkend="v4l2-buf-type" />.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-rect;</entry> <entry>&v4l2-rect;</entry>
......
...@@ -116,7 +116,7 @@ this ioctl.</para> ...@@ -116,7 +116,7 @@ this ioctl.</para>
<colspec colname="c4" /> <colspec colname="c4" />
<tbody valign="top"> <tbody valign="top">
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry></entry> <entry></entry>
<entry>Type of the data stream, see <xref <entry>Type of the data stream, see <xref
......
...@@ -95,14 +95,14 @@ the &v4l2-output; <structfield>modulator</structfield> field and the ...@@ -95,14 +95,14 @@ the &v4l2-output; <structfield>modulator</structfield> field and the
&v4l2-modulator; <structfield>index</structfield> field.</entry> &v4l2-modulator; <structfield>index</structfield> field.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-tuner-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>The tuner type. This is the same value as in the <entry>The tuner type. This is the same value as in the
&v4l2-tuner; <structfield>type</structfield> field. The type must be set &v4l2-tuner; <structfield>type</structfield> field. See The type must be set
to <constant>V4L2_TUNER_RADIO</constant> for <filename>/dev/radioX</filename> to <constant>V4L2_TUNER_RADIO</constant> for <filename>/dev/radioX</filename>
device nodes, and to <constant>V4L2_TUNER_ANALOG_TV</constant> device nodes, and to <constant>V4L2_TUNER_ANALOG_TV</constant>
for all others. The field is not applicable to modulators, &ie; ignored for all others. The field is not applicable to modulators, &ie; ignored
by drivers.</entry> by drivers. See <xref linkend="v4l2-tuner-type" /></entry>
</row> </row>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
......
...@@ -75,11 +75,12 @@ devices.</para> ...@@ -75,11 +75,12 @@ devices.</para>
&cs-ustr; &cs-ustr;
<tbody valign="top"> <tbody valign="top">
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry></entry> <entry></entry>
<entry>The buffer (stream) type, same as &v4l2-format; <entry>The buffer (stream) type, same as &v4l2-format;
<structfield>type</structfield>, set by the application.</entry> <structfield>type</structfield>, set by the application. See <xref
linkend="v4l2-buf-type" /></entry>
</row> </row>
<row> <row>
<entry>union</entry> <entry>union</entry>
......
...@@ -148,7 +148,7 @@ using the &VIDIOC-S-FMT; ioctl as described in <xref ...@@ -148,7 +148,7 @@ using the &VIDIOC-S-FMT; ioctl as described in <xref
<structfield>service_lines</structfield>[1][0] to zero.</entry> <structfield>service_lines</structfield>[1][0] to zero.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>Type of the data stream, see <xref <entry>Type of the data stream, see <xref
linkend="v4l2-buf-type" />. Should be linkend="v4l2-buf-type" />. Should be
......
...@@ -107,7 +107,7 @@ user.<!-- FIXME Video inputs already have a name, the purpose of this ...@@ -107,7 +107,7 @@ user.<!-- FIXME Video inputs already have a name, the purpose of this
field is not quite clear.--></para></entry> field is not quite clear.--></para></entry>
</row> </row>
<row> <row>
<entry>&v4l2-tuner-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry spanname="hspan">Type of the tuner, see <xref <entry spanname="hspan">Type of the tuner, see <xref
linkend="v4l2-tuner-type" />.</entry> linkend="v4l2-tuner-type" />.</entry>
......
...@@ -127,7 +127,7 @@ the first control with a higher ID. Drivers which do not support this ...@@ -127,7 +127,7 @@ the first control with a higher ID. Drivers which do not support this
flag yet always return an &EINVAL;.</entry> flag yet always return an &EINVAL;.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-ctrl-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>Type of control, see <xref <entry>Type of control, see <xref
linkend="v4l2-ctrl-type" />.</entry> linkend="v4l2-ctrl-type" />.</entry>
......
...@@ -92,18 +92,19 @@ streamoff.--></para> ...@@ -92,18 +92,19 @@ streamoff.--></para>
<entry>The number of buffers requested or granted.</entry> <entry>The number of buffers requested or granted.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-buf-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>Type of the stream or buffers, this is the same <entry>Type of the stream or buffers, this is the same
as the &v4l2-format; <structfield>type</structfield> field. See <xref as the &v4l2-format; <structfield>type</structfield> field. See <xref
linkend="v4l2-buf-type" /> for valid values.</entry> linkend="v4l2-buf-type" /> for valid values.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-memory;</entry> <entry>__u32</entry>
<entry><structfield>memory</structfield></entry> <entry><structfield>memory</structfield></entry>
<entry>Applications set this field to <entry>Applications set this field to
<constant>V4L2_MEMORY_MMAP</constant> or <constant>V4L2_MEMORY_MMAP</constant> or
<constant>V4L2_MEMORY_USERPTR</constant>.</entry> <constant>V4L2_MEMORY_USERPTR</constant>. See <xref linkend="v4l2-memory"
/>.</entry>
</row> </row>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
......
...@@ -73,10 +73,11 @@ same value as in the &v4l2-input; <structfield>tuner</structfield> ...@@ -73,10 +73,11 @@ same value as in the &v4l2-input; <structfield>tuner</structfield>
field and the &v4l2-tuner; <structfield>index</structfield> field.</entry> field and the &v4l2-tuner; <structfield>index</structfield> field.</entry>
</row> </row>
<row> <row>
<entry>&v4l2-tuner-type;</entry> <entry>__u32</entry>
<entry><structfield>type</structfield></entry> <entry><structfield>type</structfield></entry>
<entry>The tuner type. This is the same value as in the <entry>The tuner type. This is the same value as in the
&v4l2-tuner; <structfield>type</structfield> field.</entry> &v4l2-tuner; <structfield>type</structfield> field. See <xref
linkend="v4l2-tuner-type" /></entry>
</row> </row>
<row> <row>
<entry>__u32</entry> <entry>__u32</entry>
......
...@@ -37,7 +37,7 @@ struct v4l2_clip32 { ...@@ -37,7 +37,7 @@ struct v4l2_clip32 {
struct v4l2_window32 { struct v4l2_window32 {
struct v4l2_rect w; struct v4l2_rect w;
enum v4l2_field field; __u32 field; /* enum v4l2_field */
__u32 chromakey; __u32 chromakey;
compat_caddr_t clips; /* actually struct v4l2_clip32 * */ compat_caddr_t clips; /* actually struct v4l2_clip32 * */
__u32 clipcount; __u32 clipcount;
...@@ -147,7 +147,7 @@ static inline int put_v4l2_sliced_vbi_format(struct v4l2_sliced_vbi_format *kp, ...@@ -147,7 +147,7 @@ static inline int put_v4l2_sliced_vbi_format(struct v4l2_sliced_vbi_format *kp,
} }
struct v4l2_format32 { struct v4l2_format32 {
enum v4l2_buf_type type; __u32 type; /* enum v4l2_buf_type */
union { union {
struct v4l2_pix_format pix; struct v4l2_pix_format pix;
struct v4l2_pix_format_mplane pix_mp; struct v4l2_pix_format_mplane pix_mp;
...@@ -170,7 +170,7 @@ struct v4l2_format32 { ...@@ -170,7 +170,7 @@ struct v4l2_format32 {
struct v4l2_create_buffers32 { struct v4l2_create_buffers32 {
__u32 index; __u32 index;
__u32 count; __u32 count;
enum v4l2_memory memory; __u32 memory; /* enum v4l2_memory */
struct v4l2_format32 format; struct v4l2_format32 format;
__u32 reserved[8]; __u32 reserved[8];
}; };
...@@ -311,16 +311,16 @@ struct v4l2_plane32 { ...@@ -311,16 +311,16 @@ struct v4l2_plane32 {
struct v4l2_buffer32 { struct v4l2_buffer32 {
__u32 index; __u32 index;
enum v4l2_buf_type type; __u32 type; /* enum v4l2_buf_type */
__u32 bytesused; __u32 bytesused;
__u32 flags; __u32 flags;
enum v4l2_field field; __u32 field; /* enum v4l2_field */
struct compat_timeval timestamp; struct compat_timeval timestamp;
struct v4l2_timecode timecode; struct v4l2_timecode timecode;
__u32 sequence; __u32 sequence;
/* memory location */ /* memory location */
enum v4l2_memory memory; __u32 memory; /* enum v4l2_memory */
union { union {
__u32 offset; __u32 offset;
compat_long_t userptr; compat_long_t userptr;
......
...@@ -292,10 +292,10 @@ struct v4l2_pix_format { ...@@ -292,10 +292,10 @@ struct v4l2_pix_format {
__u32 width; __u32 width;
__u32 height; __u32 height;
__u32 pixelformat; __u32 pixelformat;
enum v4l2_field field; __u32 field; /* enum v4l2_field */
__u32 bytesperline; /* for padding, zero if unused */ __u32 bytesperline; /* for padding, zero if unused */
__u32 sizeimage; __u32 sizeimage;
enum v4l2_colorspace colorspace; __u32 colorspace; /* enum v4l2_colorspace */
__u32 priv; /* private data, depends on pixelformat */ __u32 priv; /* private data, depends on pixelformat */
}; };
...@@ -432,7 +432,7 @@ struct v4l2_pix_format { ...@@ -432,7 +432,7 @@ struct v4l2_pix_format {
*/ */
struct v4l2_fmtdesc { struct v4l2_fmtdesc {
__u32 index; /* Format number */ __u32 index; /* Format number */
enum v4l2_buf_type type; /* buffer type */ __u32 type; /* enum v4l2_buf_type */
__u32 flags; __u32 flags;
__u8 description[32]; /* Description string */ __u8 description[32]; /* Description string */
__u32 pixelformat; /* Format fourcc */ __u32 pixelformat; /* Format fourcc */
...@@ -573,8 +573,8 @@ struct v4l2_jpegcompression { ...@@ -573,8 +573,8 @@ struct v4l2_jpegcompression {
*/ */
struct v4l2_requestbuffers { struct v4l2_requestbuffers {
__u32 count; __u32 count;
enum v4l2_buf_type type; __u32 type; /* enum v4l2_buf_type */
enum v4l2_memory memory; __u32 memory; /* enum v4l2_memory */
__u32 reserved[2]; __u32 reserved[2];
}; };
...@@ -610,15 +610,17 @@ struct v4l2_plane { ...@@ -610,15 +610,17 @@ struct v4l2_plane {
/** /**
* struct v4l2_buffer - video buffer info * struct v4l2_buffer - video buffer info
* @index: id number of the buffer * @index: id number of the buffer
* @type: buffer type (type == *_MPLANE for multiplanar buffers) * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for
* multiplanar buffers);
* @bytesused: number of bytes occupied by data in the buffer (payload); * @bytesused: number of bytes occupied by data in the buffer (payload);
* unused (set to 0) for multiplanar buffers * unused (set to 0) for multiplanar buffers
* @flags: buffer informational flags * @flags: buffer informational flags
* @field: field order of the image in the buffer * @field: enum v4l2_field; field order of the image in the buffer
* @timestamp: frame timestamp * @timestamp: frame timestamp
* @timecode: frame timecode * @timecode: frame timecode
* @sequence: sequence count of this frame * @sequence: sequence count of this frame
* @memory: the method, in which the actual video data is passed * @memory: enum v4l2_memory; the method, in which the actual video data is
* passed
* @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
* offset from the start of the device memory for this plane, * offset from the start of the device memory for this plane,
* (or a "cookie" that should be passed to mmap() as offset) * (or a "cookie" that should be passed to mmap() as offset)
...@@ -636,16 +638,16 @@ struct v4l2_plane { ...@@ -636,16 +638,16 @@ struct v4l2_plane {
*/ */
struct v4l2_buffer { struct v4l2_buffer {
__u32 index; __u32 index;
enum v4l2_buf_type type; __u32 type;
__u32 bytesused; __u32 bytesused;
__u32 flags; __u32 flags;
enum v4l2_field field; __u32 field;
struct timeval timestamp; struct timeval timestamp;
struct v4l2_timecode timecode; struct v4l2_timecode timecode;
__u32 sequence; __u32 sequence;
/* memory location */ /* memory location */
enum v4l2_memory memory; __u32 memory;
union { union {
__u32 offset; __u32 offset;
unsigned long userptr; unsigned long userptr;
...@@ -708,7 +710,7 @@ struct v4l2_clip { ...@@ -708,7 +710,7 @@ struct v4l2_clip {
struct v4l2_window { struct v4l2_window {
struct v4l2_rect w; struct v4l2_rect w;
enum v4l2_field field; __u32 field; /* enum v4l2_field */
__u32 chromakey; __u32 chromakey;
struct v4l2_clip __user *clips; struct v4l2_clip __user *clips;
__u32 clipcount; __u32 clipcount;
...@@ -745,14 +747,14 @@ struct v4l2_outputparm { ...@@ -745,14 +747,14 @@ struct v4l2_outputparm {
* I N P U T I M A G E C R O P P I N G * I N P U T I M A G E C R O P P I N G
*/ */
struct v4l2_cropcap { struct v4l2_cropcap {
enum v4l2_buf_type type; __u32 type; /* enum v4l2_buf_type */
struct v4l2_rect bounds; struct v4l2_rect bounds;
struct v4l2_rect defrect; struct v4l2_rect defrect;
struct v4l2_fract pixelaspect; struct v4l2_fract pixelaspect;
}; };
struct v4l2_crop { struct v4l2_crop {
enum v4l2_buf_type type; __u32 type; /* enum v4l2_buf_type */
struct v4l2_rect c; struct v4l2_rect c;
}; };
...@@ -1040,7 +1042,7 @@ struct v4l2_input { ...@@ -1040,7 +1042,7 @@ struct v4l2_input {
__u8 name[32]; /* Label */ __u8 name[32]; /* Label */
__u32 type; /* Type of input */ __u32 type; /* Type of input */
__u32 audioset; /* Associated audios (bitfield) */ __u32 audioset; /* Associated audios (bitfield) */
__u32 tuner; /* Associated tuner */ __u32 tuner; /* enum v4l2_tuner_type */
v4l2_std_id std; v4l2_std_id std;
__u32 status; __u32 status;
__u32 capabilities; __u32 capabilities;
...@@ -1157,7 +1159,7 @@ enum v4l2_ctrl_type { ...@@ -1157,7 +1159,7 @@ enum v4l2_ctrl_type {
/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
struct v4l2_queryctrl { struct v4l2_queryctrl {
__u32 id; __u32 id;
enum v4l2_ctrl_type type; __u32 type; /* enum v4l2_ctrl_type */
__u8 name[32]; /* Whatever */ __u8 name[32]; /* Whatever */
__s32 minimum; /* Note signedness */ __s32 minimum; /* Note signedness */
__s32 maximum; __s32 maximum;
...@@ -1792,7 +1794,7 @@ enum v4l2_jpeg_chroma_subsampling { ...@@ -1792,7 +1794,7 @@ enum v4l2_jpeg_chroma_subsampling {
struct v4l2_tuner { struct v4l2_tuner {
__u32 index; __u32 index;
__u8 name[32]; __u8 name[32];
enum v4l2_tuner_type type; __u32 type; /* enum v4l2_tuner_type */
__u32 capability; __u32 capability;
__u32 rangelow; __u32 rangelow;
__u32 rangehigh; __u32 rangehigh;
...@@ -1842,14 +1844,14 @@ struct v4l2_modulator { ...@@ -1842,14 +1844,14 @@ struct v4l2_modulator {
struct v4l2_frequency { struct v4l2_frequency {
__u32 tuner; __u32 tuner;
enum v4l2_tuner_type type; __u32 type; /* enum v4l2_tuner_type */
__u32 frequency; __u32 frequency;
__u32 reserved[8]; __u32 reserved[8];
}; };
struct v4l2_hw_freq_seek { struct v4l2_hw_freq_seek {
__u32 tuner; __u32 tuner;
enum v4l2_tuner_type type; __u32 type; /* enum v4l2_tuner_type */
__u32 seek_upward; __u32 seek_upward;
__u32 wrap_around; __u32 wrap_around;
__u32 spacing; __u32 spacing;
...@@ -2060,7 +2062,7 @@ struct v4l2_sliced_vbi_cap { ...@@ -2060,7 +2062,7 @@ struct v4l2_sliced_vbi_cap {
(equals frame lines 313-336 for 625 line video (equals frame lines 313-336 for 625 line video
standards, 263-286 for 525 line standards) */ standards, 263-286 for 525 line standards) */
__u16 service_lines[2][24]; __u16 service_lines[2][24];
enum v4l2_buf_type type; __u32 type; /* enum v4l2_buf_type */
__u32 reserved[3]; /* must be 0 */ __u32 reserved[3]; /* must be 0 */
}; };
...@@ -2141,8 +2143,8 @@ struct v4l2_plane_pix_format { ...@@ -2141,8 +2143,8 @@ struct v4l2_plane_pix_format {
* @width: image width in pixels * @width: image width in pixels
* @height: image height in pixels * @height: image height in pixels
* @pixelformat: little endian four character code (fourcc) * @pixelformat: little endian four character code (fourcc)
* @field: field order (for interlaced video) * @field: enum v4l2_field; field order (for interlaced video)
* @colorspace: supplemental to pixelformat * @colorspace: enum v4l2_colorspace; supplemental to pixelformat
* @plane_fmt: per-plane information * @plane_fmt: per-plane information
* @num_planes: number of planes for this format * @num_planes: number of planes for this format
*/ */
...@@ -2150,8 +2152,8 @@ struct v4l2_pix_format_mplane { ...@@ -2150,8 +2152,8 @@ struct v4l2_pix_format_mplane {
__u32 width; __u32 width;
__u32 height; __u32 height;
__u32 pixelformat; __u32 pixelformat;
enum v4l2_field field; __u32 field;
enum v4l2_colorspace colorspace; __u32 colorspace;
struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
__u8 num_planes; __u8 num_planes;
...@@ -2160,7 +2162,7 @@ struct v4l2_pix_format_mplane { ...@@ -2160,7 +2162,7 @@ struct v4l2_pix_format_mplane {
/** /**
* struct v4l2_format - stream data format * struct v4l2_format - stream data format
* @type: type of the data stream * @type: enum v4l2_buf_type; type of the data stream
* @pix: definition of an image format * @pix: definition of an image format
* @pix_mp: definition of a multiplanar image format * @pix_mp: definition of a multiplanar image format
* @win: definition of an overlaid image * @win: definition of an overlaid image
...@@ -2169,7 +2171,7 @@ struct v4l2_pix_format_mplane { ...@@ -2169,7 +2171,7 @@ struct v4l2_pix_format_mplane {
* @raw_data: placeholder for future extensions and custom formats * @raw_data: placeholder for future extensions and custom formats
*/ */
struct v4l2_format { struct v4l2_format {
enum v4l2_buf_type type; __u32 type;
union { union {
struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
...@@ -2183,7 +2185,7 @@ struct v4l2_format { ...@@ -2183,7 +2185,7 @@ struct v4l2_format {
/* Stream type-dependent parameters /* Stream type-dependent parameters
*/ */
struct v4l2_streamparm { struct v4l2_streamparm {
enum v4l2_buf_type type; __u32 type; /* enum v4l2_buf_type */
union { union {
struct v4l2_captureparm capture; struct v4l2_captureparm capture;
struct v4l2_outputparm output; struct v4l2_outputparm output;
...@@ -2296,14 +2298,14 @@ struct v4l2_dbg_chip_ident { ...@@ -2296,14 +2298,14 @@ struct v4l2_dbg_chip_ident {
* @index: on return, index of the first created buffer * @index: on return, index of the first created buffer
* @count: entry: number of requested buffers, * @count: entry: number of requested buffers,
* return: number of created buffers * return: number of created buffers
* @memory: buffer memory type * @memory: enum v4l2_memory; buffer memory type
* @format: frame format, for which buffers are requested * @format: frame format, for which buffers are requested
* @reserved: future extensions * @reserved: future extensions
*/ */
struct v4l2_create_buffers { struct v4l2_create_buffers {
__u32 index; __u32 index;
__u32 count; __u32 count;
enum v4l2_memory memory; __u32 memory;
struct v4l2_format format; struct v4l2_format format;
__u32 reserved[8]; __u32 reserved[8];
}; };
...@@ -2360,8 +2362,8 @@ struct v4l2_create_buffers { ...@@ -2360,8 +2362,8 @@ struct v4l2_create_buffers {
#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) #define VIDIOC_G_PRIORITY _IOR('V', 67, __u32) /* enum v4l2_priority */
#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) #define VIDIOC_S_PRIORITY _IOW('V', 68, __u32) /* enum v4l2_priority */
#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) #define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
#define VIDIOC_LOG_STATUS _IO('V', 70) #define VIDIOC_LOG_STATUS _IO('V', 70)
#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) #define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment