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