Linux 2.6.33-rc8
[linux-2.6/lguest.git] / Documentation / DocBook / v4l / vidioc-enumstd.xml
blob95803fe2c8e4336a8e110d87a0570d1de98ef378
1 <refentry id="vidioc-enumstd">
2   <refmeta>
3     <refentrytitle>ioctl VIDIOC_ENUMSTD</refentrytitle>
4     &manvol;
5   </refmeta>
7   <refnamediv>
8     <refname>VIDIOC_ENUMSTD</refname>
9     <refpurpose>Enumerate supported video standards</refpurpose>
10   </refnamediv>
12   <refsynopsisdiv>
13     <funcsynopsis>
14       <funcprototype>
15         <funcdef>int <function>ioctl</function></funcdef>
16         <paramdef>int <parameter>fd</parameter></paramdef>
17         <paramdef>int <parameter>request</parameter></paramdef>
18         <paramdef>struct v4l2_standard *<parameter>argp</parameter></paramdef>
19       </funcprototype>
20     </funcsynopsis>
21   </refsynopsisdiv>
23   <refsect1>
24     <title>Arguments</title>
26     <variablelist>
27       <varlistentry>
28         <term><parameter>fd</parameter></term>
29         <listitem>
30           <para>&fd;</para>
31         </listitem>
32       </varlistentry>
33       <varlistentry>
34         <term><parameter>request</parameter></term>
35         <listitem>
36           <para>VIDIOC_ENUMSTD</para>
37         </listitem>
38       </varlistentry>
39       <varlistentry>
40         <term><parameter>argp</parameter></term>
41         <listitem>
42           <para></para>
43         </listitem>
44       </varlistentry>
45     </variablelist>
46   </refsect1>
48   <refsect1>
49     <title>Description</title>
51     <para>To query the attributes of a video standard,
52 especially a custom (driver defined) one, applications initialize the
53 <structfield>index</structfield> field of &v4l2-standard; and call the
54 <constant>VIDIOC_ENUMSTD</constant> ioctl with a pointer to this
55 structure. Drivers fill the rest of the structure or return an
56 &EINVAL; when the index is out of bounds. To enumerate all standards
57 applications shall begin  at index zero, incrementing by one until the
58 driver returns <errorcode>EINVAL</errorcode>. Drivers may enumerate a
59 different set of standards after switching the video input or
60 output.<footnote>
61         <para>The supported standards may overlap and we need an
62 unambiguous set to find the current standard returned by
63 <constant>VIDIOC_G_STD</constant>.</para>
64       </footnote></para>
66     <table pgwide="1" frame="none" id="v4l2-standard">
67       <title>struct <structname>v4l2_standard</structname></title>
68       <tgroup cols="3">
69         &cs-str;
70         <tbody valign="top">
71           <row>
72             <entry>__u32</entry>
73             <entry><structfield>index</structfield></entry>
74             <entry>Number of the video standard, set by the
75 application.</entry>
76           </row>
77           <row>
78             <entry>&v4l2-std-id;</entry>
79             <entry><structfield>id</structfield></entry>
80             <entry>The bits in this field identify the standard as
81 one of the common standards listed in <xref linkend="v4l2-std-id" />,
82 or if bits 32 to 63 are set as custom standards. Multiple bits can be
83 set if the hardware does not distinguish between these standards,
84 however separate indices do not indicate the opposite. The
85 <structfield>id</structfield> must be unique. No other enumerated
86 <structname>v4l2_standard</structname> structure, for this input or
87 output anyway, can contain the same set of bits.</entry>
88           </row>
89           <row>
90             <entry>__u8</entry>
91             <entry><structfield>name</structfield>[24]</entry>
92             <entry>Name of the standard, a NUL-terminated ASCII
93 string, for example: "PAL-B/G", "NTSC Japan". This information is
94 intended for the user.</entry>
95           </row>
96           <row>
97             <entry>&v4l2-fract;</entry>
98             <entry><structfield>frameperiod</structfield></entry>
99             <entry>The frame period (not field period) is numerator
100 / denominator. For example M/NTSC has a frame period of 1001 /
101 30000 seconds.</entry>
102           </row>
103           <row>
104             <entry>__u32</entry>
105             <entry><structfield>framelines</structfield></entry>
106             <entry>Total lines per frame including blanking,
107 e.&nbsp;g. 625 for B/PAL.</entry>
108           </row>
109           <row>
110             <entry>__u32</entry>
111             <entry><structfield>reserved</structfield>[4]</entry>
112             <entry>Reserved for future extensions. Drivers must set
113 the array to zero.</entry>
114           </row>
115         </tbody>
116       </tgroup>
117     </table>
119     <table pgwide="1" frame="none" id="v4l2-fract">
120       <title>struct <structname>v4l2_fract</structname></title>
121       <tgroup cols="3">
122         &cs-str;
123         <tbody valign="top">
124           <row>
125             <entry>__u32</entry>
126             <entry><structfield>numerator</structfield></entry>
127             <entry></entry>
128           </row>
129           <row>
130             <entry>__u32</entry>
131             <entry><structfield>denominator</structfield></entry>
132             <entry></entry>
133           </row>
134         </tbody>
135       </tgroup>
136     </table>
138     <table pgwide="1" frame="none" id="v4l2-std-id">
139       <title>typedef <structname>v4l2_std_id</structname></title>
140       <tgroup cols="3">
141         &cs-str;
142         <tbody valign="top">
143           <row>
144             <entry>__u64</entry>
145             <entry><structfield>v4l2_std_id</structfield></entry>
146             <entry>This type is a set, each bit representing another
147 video standard as listed below and in <xref
148 linkend="video-standards" />. The 32 most significant bits are reserved
149 for custom (driver defined) video standards.</entry>
150           </row>
151         </tbody>
152       </tgroup>
153     </table>
155     <para><programlisting>
156 #define V4L2_STD_PAL_B          ((v4l2_std_id)0x00000001)
157 #define V4L2_STD_PAL_B1         ((v4l2_std_id)0x00000002)
158 #define V4L2_STD_PAL_G          ((v4l2_std_id)0x00000004)
159 #define V4L2_STD_PAL_H          ((v4l2_std_id)0x00000008)
160 #define V4L2_STD_PAL_I          ((v4l2_std_id)0x00000010)
161 #define V4L2_STD_PAL_D          ((v4l2_std_id)0x00000020)
162 #define V4L2_STD_PAL_D1         ((v4l2_std_id)0x00000040)
163 #define V4L2_STD_PAL_K          ((v4l2_std_id)0x00000080)
165 #define V4L2_STD_PAL_M          ((v4l2_std_id)0x00000100)
166 #define V4L2_STD_PAL_N          ((v4l2_std_id)0x00000200)
167 #define V4L2_STD_PAL_Nc         ((v4l2_std_id)0x00000400)
168 #define V4L2_STD_PAL_60         ((v4l2_std_id)0x00000800)
169 </programlisting></para><para><constant>V4L2_STD_PAL_60</constant> is
170 a hybrid standard with 525 lines, 60 Hz refresh rate, and PAL color
171 modulation with a 4.43 MHz color subcarrier. Some PAL video recorders
172 can play back NTSC tapes in this mode for display on a 50/60 Hz agnostic
173 PAL TV.</para><para><programlisting>
174 #define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)
175 #define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)
176 #define V4L2_STD_NTSC_443       ((v4l2_std_id)0x00004000)
177 </programlisting></para><para><constant>V4L2_STD_NTSC_443</constant>
178 is a hybrid standard with 525 lines, 60 Hz refresh rate, and NTSC
179 color modulation with a 4.43 MHz color
180 subcarrier.</para><para><programlisting>
181 #define V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)
183 #define V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
184 #define V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
185 #define V4L2_STD_SECAM_G        ((v4l2_std_id)0x00040000)
186 #define V4L2_STD_SECAM_H        ((v4l2_std_id)0x00080000)
187 #define V4L2_STD_SECAM_K        ((v4l2_std_id)0x00100000)
188 #define V4L2_STD_SECAM_K1       ((v4l2_std_id)0x00200000)
189 #define V4L2_STD_SECAM_L        ((v4l2_std_id)0x00400000)
190 #define V4L2_STD_SECAM_LC       ((v4l2_std_id)0x00800000)
192 /* ATSC/HDTV */
193 #define V4L2_STD_ATSC_8_VSB     ((v4l2_std_id)0x01000000)
194 #define V4L2_STD_ATSC_16_VSB    ((v4l2_std_id)0x02000000)
195 </programlisting></para><para><!-- ATSC proposal by Mark McClelland,
196 video4linux-list@redhat.com on 17 Oct 2002
197 --><constant>V4L2_STD_ATSC_8_VSB</constant> and
198 <constant>V4L2_STD_ATSC_16_VSB</constant> are U.S. terrestrial digital
199 TV standards. Presently the V4L2 API does not support digital TV. See
200 also the Linux DVB API at <ulink
201 url="http://linuxtv.org">http://linuxtv.org</ulink>.</para>
202 <para><programlisting>
203 #define V4L2_STD_PAL_BG         (V4L2_STD_PAL_B         |\
204                                  V4L2_STD_PAL_B1        |\
205                                  V4L2_STD_PAL_G)
206 #define V4L2_STD_B              (V4L2_STD_PAL_B         |\
207                                  V4L2_STD_PAL_B1        |\
208                                  V4L2_STD_SECAM_B)
209 #define V4L2_STD_GH             (V4L2_STD_PAL_G         |\
210                                  V4L2_STD_PAL_H         |\
211                                  V4L2_STD_SECAM_G       |\
212                                  V4L2_STD_SECAM_H)
213 #define V4L2_STD_PAL_DK         (V4L2_STD_PAL_D         |\
214                                  V4L2_STD_PAL_D1        |\
215                                  V4L2_STD_PAL_K)
216 #define V4L2_STD_PAL            (V4L2_STD_PAL_BG        |\
217                                  V4L2_STD_PAL_DK        |\
218                                  V4L2_STD_PAL_H         |\
219                                  V4L2_STD_PAL_I)
220 #define V4L2_STD_NTSC           (V4L2_STD_NTSC_M        |\
221                                  V4L2_STD_NTSC_M_JP     |\
222                                  V4L2_STD_NTSC_M_KR)
223 #define V4L2_STD_MN             (V4L2_STD_PAL_M         |\
224                                  V4L2_STD_PAL_N         |\
225                                  V4L2_STD_PAL_Nc        |\
226                                  V4L2_STD_NTSC)
227 #define V4L2_STD_SECAM_DK       (V4L2_STD_SECAM_D       |\
228                                  V4L2_STD_SECAM_K       |\
229                                  V4L2_STD_SECAM_K1)
230 #define V4L2_STD_DK             (V4L2_STD_PAL_DK        |\
231                                  V4L2_STD_SECAM_DK)
233 #define V4L2_STD_SECAM          (V4L2_STD_SECAM_B       |\
234                                  V4L2_STD_SECAM_G       |\
235                                  V4L2_STD_SECAM_H       |\
236                                  V4L2_STD_SECAM_DK      |\
237                                  V4L2_STD_SECAM_L       |\
238                                  V4L2_STD_SECAM_LC)
240 #define V4L2_STD_525_60         (V4L2_STD_PAL_M         |\
241                                  V4L2_STD_PAL_60        |\
242                                  V4L2_STD_NTSC          |\
243                                  V4L2_STD_NTSC_443)
244 #define V4L2_STD_625_50         (V4L2_STD_PAL           |\
245                                  V4L2_STD_PAL_N         |\
246                                  V4L2_STD_PAL_Nc        |\
247                                  V4L2_STD_SECAM)
249 #define V4L2_STD_UNKNOWN        0
250 #define V4L2_STD_ALL            (V4L2_STD_525_60        |\
251                                  V4L2_STD_625_50)
252 </programlisting></para>
254     <table pgwide="1" id="video-standards" orient="land">
255       <title>Video Standards (based on [<xref linkend="itu470" />])</title>
256       <tgroup cols="12" colsep="1" rowsep="1" align="center">
257         <colspec colname="c1" align="left" />
258         <colspec colname="c2" />
259         <colspec colname="c3" />
260         <colspec colname="c4" />
261         <colspec colname="c5" />
262         <colspec colnum="7" colname="c7" />
263         <colspec colnum="9" colname="c9" />
264         <colspec colnum="12" colname="c12" />
265         <spanspec namest="c2" nameend="c3" spanname="m" align="center" />
266         <spanspec namest="c4" nameend="c12" spanname="x" align="center" />
267         <spanspec namest="c5" nameend="c7" spanname="b" align="center" />
268         <spanspec namest="c9" nameend="c12" spanname="s" align="center" />
269         <thead>
270           <row>
271             <entry>Characteristics</entry>
272             <entry><para>M/NTSC<footnote><para>Japan uses a standard
273 similar to M/NTSC
274 (V4L2_STD_NTSC_M_JP).</para></footnote></para></entry>
275             <entry>M/PAL</entry>
276             <entry><para>N/PAL<footnote><para> The values in
277 brackets apply to the combination N/PAL a.k.a.
278 N<subscript>C</subscript> used in Argentina
279 (V4L2_STD_PAL_Nc).</para></footnote></para></entry>
280             <entry align="center">B, B1, G/PAL</entry>
281             <entry align="center">D, D1, K/PAL</entry>
282             <entry align="center">H/PAL</entry>
283             <entry align="center">I/PAL</entry>
284             <entry align="center">B, G/SECAM</entry>
285             <entry align="center">D, K/SECAM</entry>
286             <entry align="center">K1/SECAM</entry>
287             <entry align="center">L/SECAM</entry>
288           </row>
289         </thead>
290         <tbody valign="top">
291           <row>
292             <entry>Frame lines</entry>
293             <entry spanname="m">525</entry>
294             <entry spanname="x">625</entry>
295           </row>
296           <row>
297             <entry>Frame period (s)</entry>
298             <entry spanname="m">1001/30000</entry>
299             <entry spanname="x">1/25</entry>
300           </row>
301           <row>
302             <entry>Chrominance sub-carrier frequency (Hz)</entry>
303             <entry>3579545 &plusmn;&nbsp;10</entry>
304             <entry>3579611.49 &plusmn;&nbsp;10</entry>
305             <entry>4433618.75 &plusmn;&nbsp;5 (3582056.25
306 &plusmn;&nbsp;5)</entry>
307             <entry spanname="b">4433618.75 &plusmn;&nbsp;5</entry>
308             <entry>4433618.75 &plusmn;&nbsp;1</entry>
309             <entry spanname="s">f<subscript>OR</subscript>&nbsp;=
310 4406250 &plusmn;&nbsp;2000, f<subscript>OB</subscript>&nbsp;= 4250000
311 &plusmn;&nbsp;2000</entry>
312           </row>
313           <row>
314             <entry>Nominal radio-frequency channel bandwidth
315 (MHz)</entry>
316             <entry>6</entry>
317             <entry>6</entry>
318             <entry>6</entry>
319             <entry>B: 7; B1, G: 8</entry>
320             <entry>8</entry>
321             <entry>8</entry>
322             <entry>8</entry>
323             <entry>8</entry>
324             <entry>8</entry>
325             <entry>8</entry>
326             <entry>8</entry>
327           </row>
328           <row>
329             <entry>Sound carrier relative to vision carrier
330 (MHz)</entry>
331             <entry>+&nbsp;4.5</entry>
332             <entry>+&nbsp;4.5</entry>
333             <entry>+&nbsp;4.5</entry>
334             <entry><para>+&nbsp;5.5 &plusmn;&nbsp;0.001
335 <footnote><para>In the Federal Republic of Germany, Austria, Italy,
336 the Netherlands, Slovakia and Switzerland a system of two sound
337 carriers is used, the frequency of the second carrier being
338 242.1875&nbsp;kHz above the frequency of the first sound carrier. For
339 stereophonic sound transmissions a similar system is used in
340 Australia.</para></footnote> <footnote><para>New Zealand uses a sound
341 carrier displaced 5.4996 &plusmn;&nbsp;0.0005 MHz from the vision
342 carrier.</para></footnote> <footnote><para>In Denmark, Finland, New
343 Zealand, Sweden and Spain a system of two sound carriers is used. In
344 Iceland, Norway and Poland the same system is being introduced. The
345 second carrier is 5.85&nbsp;MHz above the vision carrier and is DQPSK
346 modulated with 728&nbsp;kbit/s sound and data multiplex. (NICAM
347 system)</para></footnote> <footnote><para>In the United Kingdom, a
348 system of two sound carriers is used. The second sound carrier is
349 6.552&nbsp;MHz above the vision carrier and is DQPSK modulated with a
350 728&nbsp;kbit/s sound and data multiplex able to carry two sound
351 channels. (NICAM system)</para></footnote></para></entry>
352             <entry>+&nbsp;6.5 &plusmn;&nbsp;0.001</entry>
353             <entry>+&nbsp;5.5</entry>
354             <entry>+&nbsp;5.9996 &plusmn;&nbsp;0.0005</entry>
355             <entry>+&nbsp;5.5 &plusmn;&nbsp;0.001</entry>
356             <entry>+&nbsp;6.5 &plusmn;&nbsp;0.001</entry>
357             <entry>+&nbsp;6.5</entry>
358             <entry><para>+&nbsp;6.5 <footnote><para>In France, a
359 digital carrier 5.85 MHz away from the vision carrier may be used in
360 addition to the main sound carrier. It is modulated in differentially
361 encoded QPSK with a 728 kbit/s sound and data multiplexer capable of
362 carrying two sound channels. (NICAM
363 system)</para></footnote></para></entry>
364           </row>
365         </tbody>
366       </tgroup>
367     </table>
368   </refsect1>
370   <refsect1>
371     &return-value;
373     <variablelist>
374       <varlistentry>
375         <term><errorcode>EINVAL</errorcode></term>
376         <listitem>
377           <para>The &v4l2-standard; <structfield>index</structfield>
378 is out of bounds.</para>
379         </listitem>
380       </varlistentry>
381     </variablelist>
382   </refsect1>
383 </refentry>
385 <!--
386 Local Variables:
387 mode: sgml
388 sgml-parent-document: "v4l2.sgml"
389 indent-tabs-mode: nil
390 End: