doc-rst: customize RTD theme, captions & inline literal
[deliverable/linux.git] / Documentation / linux_tv / media / v4l / vidioc-enum-fmt.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
af4a4d0d 3.. _VIDIOC_ENUM_FMT:
5377d91f
MH
4
5*********************
6ioctl VIDIOC_ENUM_FMT
7*********************
8
586027ce
MCC
9NAME
10====
5377d91f 11
586027ce 12VIDIOC_ENUM_FMT - Enumerate image formats
5377d91f 13
586027ce 14SYNOPSIS
5377d91f
MH
15========
16
b7e67f6c 17.. cpp:function:: int ioctl( int fd, int request, struct v4l2_fmtdesc *argp )
5377d91f 18
586027ce
MCC
19
20ARGUMENTS
5377d91f
MH
21=========
22
23``fd``
24 File descriptor returned by :ref:`open() <func-open>`.
25
26``request``
27 VIDIOC_ENUM_FMT
28
29``argp``
30
31
586027ce 32DESCRIPTION
5377d91f
MH
33===========
34
35To enumerate image formats applications initialize the ``type`` and
36``index`` field of struct :ref:`v4l2_fmtdesc <v4l2-fmtdesc>` and call
2212ff25 37the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers
cdb4af0f 38fill the rest of the structure or return an ``EINVAL`` error code. All
5377d91f 39formats are enumerable by beginning at index zero and incrementing by
cdb4af0f 40one until ``EINVAL`` is returned.
5377d91f
MH
41
42Note that after switching input or output the list of enumerated image
43formats may be different.
44
45
46.. _v4l2-fmtdesc:
47
48.. flat-table:: struct v4l2_fmtdesc
49 :header-rows: 0
50 :stub-columns: 0
51 :widths: 1 1 2
52
53
54 - .. row 1
55
56 - __u32
57
58 - ``index``
59
60 - Number of the format in the enumeration, set by the application.
0579e6e3 61 This is in no way related to the ``pixelformat`` field.
5377d91f
MH
62
63 - .. row 2
64
65 - __u32
66
67 - ``type``
68
69 - Type of the data stream, set by the application. Only these types
0579e6e3
MCC
70 are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``,
71 ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``,
72 ``V4L2_BUF_TYPE_VIDEO_OUTPUT``,
73 ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and
74 ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :ref:`v4l2-buf-type`.
5377d91f
MH
75
76 - .. row 3
77
78 - __u32
79
80 - ``flags``
81
82 - See :ref:`fmtdesc-flags`
83
84 - .. row 4
85
86 - __u8
87
88 - ``description``\ [32]
89
90 - Description of the format, a NUL-terminated ASCII string. This
0579e6e3 91 information is intended for the user, for example: "YUV 4:2:2".
5377d91f
MH
92
93 - .. row 5
94
95 - __u32
96
97 - ``pixelformat``
98
99 - The image format identifier. This is a four character code as
0579e6e3 100 computed by the v4l2_fourcc() macro:
5377d91f
MH
101
102 - .. row 6
103
104 - :cspan:`2`
105
106
0579e6e3
MCC
107 .. _v4l2-fourcc:
108 .. code-block:: c
5377d91f 109
0579e6e3 110 #define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))
5377d91f 111
0579e6e3
MCC
112 Several image formats are already defined by this specification in
113 :ref:`pixfmt`. Note these codes are not the same as those used
114 in the Windows world.
5377d91f
MH
115
116 - .. row 7
117
118 - __u32
119
120 - ``reserved``\ [4]
121
122 - Reserved for future extensions. Drivers must set the array to
0579e6e3 123 zero.
5377d91f
MH
124
125
126
127.. _fmtdesc-flags:
128
129.. flat-table:: Image Format Description Flags
130 :header-rows: 0
131 :stub-columns: 0
132 :widths: 3 1 4
133
134
135 - .. row 1
136
137 - ``V4L2_FMT_FLAG_COMPRESSED``
138
139 - 0x0001
140
141 - This is a compressed format.
142
143 - .. row 2
144
145 - ``V4L2_FMT_FLAG_EMULATED``
146
147 - 0x0002
148
149 - This format is not native to the device but emulated through
0579e6e3
MCC
150 software (usually libv4l2), where possible try to use a native
151 format instead for better performance.
5377d91f
MH
152
153
586027ce 154RETURN VALUE
5377d91f
MH
155============
156
157On success 0 is returned, on error -1 and the ``errno`` variable is set
158appropriately. The generic error codes are described at the
159:ref:`Generic Error Codes <gen-errors>` chapter.
160
161EINVAL
162 The struct :ref:`v4l2_fmtdesc <v4l2-fmtdesc>` ``type`` is not
163 supported or the ``index`` is out of bounds.
This page took 0.037839 seconds and 5 git commands to generate.