• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9REL="HOME"
10TITLE="Video for Linux Two API Specification"
11HREF="book1.htm"><LINK
12REL="UP"
13TITLE="Function Reference"
14HREF="r7624.htm"><LINK
15REL="PREVIOUS"
16TITLE="ioctl VIDIOC_ENUMSTD"
17HREF="r9288.htm"><LINK
18REL="NEXT"
19TITLE="ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT"
20HREF="r9688.htm"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFFFFF"
24TEXT="#000000"
25LINK="#0000FF"
26VLINK="#840084"
27ALINK="#0000FF"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>Video for Linux Two API Specification: Revision 0.24</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="r9288.htm"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="r9688.htm"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="VIDIOC-G-AUDIO"
74></A
75>ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN9543"
80></A
81><H2
82>Name</H2
83>VIDIOC_G_AUDIO, VIDIOC_S_AUDIO&nbsp;--&nbsp;Query or select the current audio input and its
84attributes</DIV
85><DIV
86CLASS="REFSYNOPSISDIV"
87><A
88NAME="AEN9547"
89></A
90><H2
91>Synopsis</H2
92><DIV
93CLASS="FUNCSYNOPSIS"
94><P
95></P
96><A
97NAME="AEN9548"
98></A
99><P
100><CODE
101><CODE
102CLASS="FUNCDEF"
103>int ioctl</CODE
104>(int fd, int request, struct v4l2_audio *argp);</CODE
105></P
106><P
107></P
108></DIV
109><DIV
110CLASS="FUNCSYNOPSIS"
111><P
112></P
113><A
114NAME="AEN9558"
115></A
116><P
117><CODE
118><CODE
119CLASS="FUNCDEF"
120>int ioctl</CODE
121>(int fd, int request, const struct v4l2_audio *argp);</CODE
122></P
123><P
124></P
125></DIV
126></DIV
127><DIV
128CLASS="REFSECT1"
129><A
130NAME="AEN9568"
131></A
132><H2
133>Arguments</H2
134><P
135></P
136><DIV
137CLASS="VARIABLELIST"
138><DL
139><DT
140><CODE
141CLASS="PARAMETER"
142>fd</CODE
143></DT
144><DD
145><P
146>File descriptor returned by <A
147HREF="r14090.htm"
148><CODE
149CLASS="FUNCTION"
150>open()</CODE
151></A
152>.</P
153></DD
154><DT
155><CODE
156CLASS="PARAMETER"
157>request</CODE
158></DT
159><DD
160><P
161>VIDIOC_G_AUDIO, VIDIOC_S_AUDIO</P
162></DD
163><DT
164><CODE
165CLASS="PARAMETER"
166>argp</CODE
167></DT
168><DD
169><P
170></P
171></DD
172></DL
173></DIV
174></DIV
175><DIV
176CLASS="REFSECT1"
177><A
178NAME="AEN9588"
179></A
180><H2
181>Description</H2
182><P
183>To query the current audio input applications zero out the
184<CODE
185CLASS="STRUCTFIELD"
186>reserved</CODE
187> array of a struct&nbsp;<A
188HREF="r9539.htm#V4L2-AUDIO"
189>v4l2_audio</A
190>
191and call the <CODE
192CLASS="CONSTANT"
193>VIDIOC_G_AUDIO</CODE
194> ioctl with a pointer
195to this structure. Drivers fill the rest of the structure or return an
196<SPAN
197CLASS="ERRORCODE"
198>EINVAL</SPAN
199> error code when the device has no audio inputs, or none which combine
200with the current video input.</P
201><P
202>Audio inputs have one writable property, the audio mode. To
203select the current audio input <SPAN
204CLASS="emphasis"
205><I
206CLASS="EMPHASIS"
207>and</I
208></SPAN
209> change the
210audio mode, applications initialize the
211<CODE
212CLASS="STRUCTFIELD"
213>index</CODE
214> and <CODE
215CLASS="STRUCTFIELD"
216>mode</CODE
217>
218fields, and the
219<CODE
220CLASS="STRUCTFIELD"
221>reserved</CODE
222> array of a
223<CODE
224CLASS="STRUCTNAME"
225>v4l2_audio</CODE
226> structure and call the
227<CODE
228CLASS="CONSTANT"
229>VIDIOC_S_AUDIO</CODE
230> ioctl. Drivers may switch to a
231different audio mode if the request cannot be satisfied. However, this
232is a write-only ioctl, it does not return the actual new audio
233mode.</P
234><DIV
235CLASS="TABLE"
236><A
237NAME="V4L2-AUDIO"
238></A
239><P
240><B
241>Table 1. struct <CODE
242CLASS="STRUCTNAME"
243>v4l2_audio</CODE
244></B
245></P
246><TABLE
247BORDER="0"
248FRAME="void"
249WIDTH="100%"
250CLASS="CALSTABLE"
251><COL
252WIDTH="25%"
253TITLE="C1"><COL
254WIDTH="25%"
255TITLE="C2"><COL
256WIDTH="50%"
257TITLE="C3"><TBODY
258VALIGN="TOP"
259><TR
260><TD
261>__u32</TD
262><TD
263><CODE
264CLASS="STRUCTFIELD"
265>index</CODE
266></TD
267><TD
268>Identifies the audio input, set by the
269driver or application.</TD
270></TR
271><TR
272><TD
273>__u8</TD
274><TD
275><CODE
276CLASS="STRUCTFIELD"
277>name</CODE
278>[32]</TD
279><TD
280>Name of the audio input, a NUL-terminated ASCII
281string, for example: "Line In". This information is intended for the
282user, preferably the connector label on the device itself.</TD
283></TR
284><TR
285><TD
286>__u32</TD
287><TD
288><CODE
289CLASS="STRUCTFIELD"
290>capability</CODE
291></TD
292><TD
293>Audio capability flags, see <A
294HREF="r9539.htm#AUDIO-CAPABILITY"
295>Table 2</A
296>.</TD
297></TR
298><TR
299><TD
300>__u32</TD
301><TD
302><CODE
303CLASS="STRUCTFIELD"
304>mode</CODE
305></TD
306><TD
307>Audio mode flags set by drivers and applications (on
308            <CODE
309CLASS="CONSTANT"
310>VIDIOC_S_AUDIO</CODE
311> ioctl), see <A
312HREF="r9539.htm#AUDIO-MODE"
313>Table 3</A
314>.</TD
315></TR
316><TR
317><TD
318>__u32</TD
319><TD
320><CODE
321CLASS="STRUCTFIELD"
322>reserved</CODE
323>[2]</TD
324><TD
325>Reserved for future extensions. Drivers and
326applications must set the array to zero.</TD
327></TR
328></TBODY
329></TABLE
330></DIV
331><DIV
332CLASS="TABLE"
333><A
334NAME="AUDIO-CAPABILITY"
335></A
336><P
337><B
338>Table 2. Audio Capability Flags</B
339></P
340><TABLE
341BORDER="0"
342FRAME="void"
343WIDTH="100%"
344CLASS="CALSTABLE"
345><COL
346WIDTH="38%"
347TITLE="C1"><COL
348WIDTH="12%"
349TITLE="C2"><COL
350WIDTH="50%"
351TITLE="C3"><TBODY
352VALIGN="TOP"
353><TR
354><TD
355><CODE
356CLASS="CONSTANT"
357>V4L2_AUDCAP_STEREO</CODE
358></TD
359><TD
360>0x00001</TD
361><TD
362>This is a stereo input. The flag is intended to
363automatically disable stereo recording etc. when the signal is always
364monaural. The API provides no means to detect if stereo is
365<SPAN
366CLASS="emphasis"
367><I
368CLASS="EMPHASIS"
369>received</I
370></SPAN
371>, unless the audio input belongs to a
372tuner.</TD
373></TR
374><TR
375><TD
376><CODE
377CLASS="CONSTANT"
378>V4L2_AUDCAP_AVL</CODE
379></TD
380><TD
381>0x00002</TD
382><TD
383>Automatic Volume Level mode is supported.</TD
384></TR
385></TBODY
386></TABLE
387></DIV
388><DIV
389CLASS="TABLE"
390><A
391NAME="AUDIO-MODE"
392></A
393><P
394><B
395>Table 3. Audio Mode Flags</B
396></P
397><TABLE
398BORDER="0"
399FRAME="void"
400WIDTH="100%"
401CLASS="CALSTABLE"
402><COL
403WIDTH="38%"
404TITLE="C1"><COL
405WIDTH="12%"
406TITLE="C2"><COL
407WIDTH="50%"
408TITLE="C3"><TBODY
409VALIGN="TOP"
410><TR
411><TD
412><CODE
413CLASS="CONSTANT"
414>V4L2_AUDMODE_AVL</CODE
415></TD
416><TD
417>0x00001</TD
418><TD
419>AVL mode is on.</TD
420></TR
421></TBODY
422></TABLE
423></DIV
424></DIV
425><DIV
426CLASS="REFSECT1"
427><A
428NAME="AEN9671"
429></A
430><H2
431>Return Value</H2
432><P
433>On success <SPAN
434CLASS="RETURNVALUE"
435>0</SPAN
436> is returned, on error <SPAN
437CLASS="RETURNVALUE"
438>-1</SPAN
439> and the <CODE
440CLASS="VARNAME"
441>errno</CODE
442> variable is set appropriately:</P
443><P
444></P
445><DIV
446CLASS="VARIABLELIST"
447><DL
448><DT
449><SPAN
450CLASS="ERRORCODE"
451>EINVAL</SPAN
452></DT
453><DD
454><P
455>No audio inputs combine with the current video input,
456or the number of the selected audio input is out of bounds or it does
457not combine, or there are no audio inputs at all and the ioctl is not
458supported.</P
459></DD
460><DT
461><SPAN
462CLASS="ERRORCODE"
463>EBUSY</SPAN
464></DT
465><DD
466><P
467>I/O is in progress, the input cannot be
468switched.</P
469></DD
470></DL
471></DIV
472></DIV
473><DIV
474CLASS="NAVFOOTER"
475><HR
476ALIGN="LEFT"
477WIDTH="100%"><TABLE
478SUMMARY="Footer navigation table"
479WIDTH="100%"
480BORDER="0"
481CELLPADDING="0"
482CELLSPACING="0"
483><TR
484><TD
485WIDTH="33%"
486ALIGN="left"
487VALIGN="top"
488><A
489HREF="r9288.htm"
490ACCESSKEY="P"
491>Prev</A
492></TD
493><TD
494WIDTH="34%"
495ALIGN="center"
496VALIGN="top"
497><A
498HREF="book1.htm"
499ACCESSKEY="H"
500>Home</A
501></TD
502><TD
503WIDTH="33%"
504ALIGN="right"
505VALIGN="top"
506><A
507HREF="r9688.htm"
508ACCESSKEY="N"
509>Next</A
510></TD
511></TR
512><TR
513><TD
514WIDTH="33%"
515ALIGN="left"
516VALIGN="top"
517>ioctl VIDIOC_ENUMSTD</TD
518><TD
519WIDTH="34%"
520ALIGN="center"
521VALIGN="top"
522><A
523HREF="r7624.htm"
524ACCESSKEY="U"
525>Up</A
526></TD
527><TD
528WIDTH="33%"
529ALIGN="right"
530VALIGN="top"
531>ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT</TD
532></TR
533></TABLE
534></DIV
535></BODY
536></HTML
537>
538