Merge tag 'xtensa-20161005' of git://github.com/jcmvbkbc/linux-xtensa
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / vidioc-g-audio.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _VIDIOC_G_AUDIO:
4
5 ************************************
6 ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO
7 ************************************
8
9 Name
10 ====
11
12 VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and its attributes
13
14
15 Synopsis
16 ========
17
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_audio *argp )
19
20 .. cpp:function:: int ioctl( int fd, int request, const struct v4l2_audio *argp )
21
22
23 Arguments
24 =========
25
26 ``fd``
27     File descriptor returned by :ref:`open() <func-open>`.
28
29 ``request``
30     VIDIOC_G_AUDIO, VIDIOC_S_AUDIO
31
32 ``argp``
33
34
35 Description
36 ===========
37
38 To query the current audio input applications zero out the ``reserved``
39 array of a struct :ref:`v4l2_audio <v4l2-audio>` and call the
40 :ref:`VIDIOC_G_AUDIO <VIDIOC_G_AUDIO>` ioctl with a pointer to this structure. Drivers fill
41 the rest of the structure or return an ``EINVAL`` error code when the device
42 has no audio inputs, or none which combine with the current video input.
43
44 Audio inputs have one writable property, the audio mode. To select the
45 current audio input *and* change the audio mode, applications initialize
46 the ``index`` and ``mode`` fields, and the ``reserved`` array of a
47 :ref:`struct v4l2_audio <v4l2-audio>` structure and call the :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>`
48 ioctl. Drivers may switch to a different audio mode if the request
49 cannot be satisfied. However, this is a write-only ioctl, it does not
50 return the actual new audio mode.
51
52
53 .. _v4l2-audio:
54
55 .. flat-table:: struct v4l2_audio
56     :header-rows:  0
57     :stub-columns: 0
58     :widths:       1 1 2
59
60
61     -  .. row 1
62
63        -  __u32
64
65        -  ``index``
66
67        -  Identifies the audio input, set by the driver or application.
68
69     -  .. row 2
70
71        -  __u8
72
73        -  ``name``\ [32]
74
75        -  Name of the audio input, a NUL-terminated ASCII string, for
76           example: "Line In". This information is intended for the user,
77           preferably the connector label on the device itself.
78
79     -  .. row 3
80
81        -  __u32
82
83        -  ``capability``
84
85        -  Audio capability flags, see :ref:`audio-capability`.
86
87     -  .. row 4
88
89        -  __u32
90
91        -  ``mode``
92
93        -  Audio mode flags set by drivers and applications (on
94           :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` ioctl), see :ref:`audio-mode`.
95
96     -  .. row 5
97
98        -  __u32
99
100        -  ``reserved``\ [2]
101
102        -  Reserved for future extensions. Drivers and applications must set
103           the array to zero.
104
105
106
107 .. _audio-capability:
108
109 .. flat-table:: Audio Capability Flags
110     :header-rows:  0
111     :stub-columns: 0
112     :widths:       3 1 4
113
114
115     -  .. row 1
116
117        -  ``V4L2_AUDCAP_STEREO``
118
119        -  0x00001
120
121        -  This is a stereo input. The flag is intended to automatically
122           disable stereo recording etc. when the signal is always monaural.
123           The API provides no means to detect if stereo is *received*,
124           unless the audio input belongs to a tuner.
125
126     -  .. row 2
127
128        -  ``V4L2_AUDCAP_AVL``
129
130        -  0x00002
131
132        -  Automatic Volume Level mode is supported.
133
134
135
136 .. _audio-mode:
137
138 .. flat-table:: Audio Mode Flags
139     :header-rows:  0
140     :stub-columns: 0
141     :widths:       3 1 4
142
143
144     -  .. row 1
145
146        -  ``V4L2_AUDMODE_AVL``
147
148        -  0x00001
149
150        -  AVL mode is on.
151
152
153 Return Value
154 ============
155
156 On success 0 is returned, on error -1 and the ``errno`` variable is set
157 appropriately. The generic error codes are described at the
158 :ref:`Generic Error Codes <gen-errors>` chapter.
159
160 EINVAL
161     No audio inputs combine with the current video input, or the number
162     of the selected audio input is out of bounds or it does not combine.