Merge branch 'pm-cpufreq'
[cascardo/linux.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 .. c:function:: int ioctl( int fd, VIDIOC_G_AUDIO, struct v4l2_audio *argp )
19     :name: VIDIOC_G_AUDIO
20
21 .. c:function:: int ioctl( int fd, VIDIOC_S_AUDIO, const struct v4l2_audio *argp )
22     :name: VIDIOC_S_AUDIO
23
24
25 Arguments
26 =========
27
28 ``fd``
29     File descriptor returned by :ref:`open() <func-open>`.
30
31 ``argp``
32
33
34 Description
35 ===========
36
37 To query the current audio input applications zero out the ``reserved``
38 array of a struct :c:type:`v4l2_audio` and call the
39 :ref:`VIDIOC_G_AUDIO <VIDIOC_G_AUDIO>` ioctl with a pointer to this structure. Drivers fill
40 the rest of the structure or return an ``EINVAL`` error code when the device
41 has no audio inputs, or none which combine with the current video input.
42
43 Audio inputs have one writable property, the audio mode. To select the
44 current audio input *and* change the audio mode, applications initialize
45 the ``index`` and ``mode`` fields, and the ``reserved`` array of a
46 struct :c:type:`v4l2_audio` structure and call the :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>`
47 ioctl. Drivers may switch to a different audio mode if the request
48 cannot be satisfied. However, this is a write-only ioctl, it does not
49 return the actual new audio mode.
50
51
52 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
53
54 .. c:type:: v4l2_audio
55
56 .. flat-table:: struct v4l2_audio
57     :header-rows:  0
58     :stub-columns: 0
59     :widths:       1 1 2
60
61     * - __u32
62       - ``index``
63       - Identifies the audio input, set by the driver or application.
64     * - __u8
65       - ``name``\ [32]
66       - Name of the audio input, a NUL-terminated ASCII string, for
67         example: "Line In". This information is intended for the user,
68         preferably the connector label on the device itself.
69     * - __u32
70       - ``capability``
71       - Audio capability flags, see :ref:`audio-capability`.
72     * - __u32
73       - ``mode``
74       - Audio mode flags set by drivers and applications (on
75         :ref:`VIDIOC_S_AUDIO <VIDIOC_G_AUDIO>` ioctl), see :ref:`audio-mode`.
76     * - __u32
77       - ``reserved``\ [2]
78       - Reserved for future extensions. Drivers and applications must set
79         the array to zero.
80
81
82
83 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
84
85 .. _audio-capability:
86
87 .. flat-table:: Audio Capability Flags
88     :header-rows:  0
89     :stub-columns: 0
90     :widths:       3 1 4
91
92     * - ``V4L2_AUDCAP_STEREO``
93       - 0x00001
94       - This is a stereo input. The flag is intended to automatically
95         disable stereo recording etc. when the signal is always monaural.
96         The API provides no means to detect if stereo is *received*,
97         unless the audio input belongs to a tuner.
98     * - ``V4L2_AUDCAP_AVL``
99       - 0x00002
100       - Automatic Volume Level mode is supported.
101
102
103
104 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
105
106 .. _audio-mode:
107
108 .. flat-table:: Audio Mode Flags
109     :header-rows:  0
110     :stub-columns: 0
111     :widths:       3 1 4
112
113     * - ``V4L2_AUDMODE_AVL``
114       - 0x00001
115       - AVL mode is on.
116
117
118 Return Value
119 ============
120
121 On success 0 is returned, on error -1 and the ``errno`` variable is set
122 appropriately. The generic error codes are described at the
123 :ref:`Generic Error Codes <gen-errors>` chapter.
124
125 EINVAL
126     No audio inputs combine with the current video input, or the number
127     of the selected audio input is out of bounds or it does not combine.