xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-g-audioout.rst (revision 54f38fcae536ea202ce7d6a359521492fba30c1f)
1*54f38fcaSMauro Carvalho Chehab.. Permission is granted to copy, distribute and/or modify this
2*54f38fcaSMauro Carvalho Chehab.. document under the terms of the GNU Free Documentation License,
3*54f38fcaSMauro Carvalho Chehab.. Version 1.1 or any later version published by the Free Software
4*54f38fcaSMauro Carvalho Chehab.. Foundation, with no Invariant Sections, no Front-Cover Texts
5*54f38fcaSMauro Carvalho Chehab.. and no Back-Cover Texts. A copy of the license is included at
6*54f38fcaSMauro Carvalho Chehab.. Documentation/userspace-api/media/fdl-appendix.rst.
7*54f38fcaSMauro Carvalho Chehab..
8*54f38fcaSMauro Carvalho Chehab.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9*54f38fcaSMauro Carvalho Chehab
10*54f38fcaSMauro Carvalho Chehab.. _VIDIOC_G_AUDOUT:
11*54f38fcaSMauro Carvalho Chehab
12*54f38fcaSMauro Carvalho Chehab**************************************
13*54f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT
14*54f38fcaSMauro Carvalho Chehab**************************************
15*54f38fcaSMauro Carvalho Chehab
16*54f38fcaSMauro Carvalho ChehabName
17*54f38fcaSMauro Carvalho Chehab====
18*54f38fcaSMauro Carvalho Chehab
19*54f38fcaSMauro Carvalho ChehabVIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output
20*54f38fcaSMauro Carvalho Chehab
21*54f38fcaSMauro Carvalho Chehab
22*54f38fcaSMauro Carvalho ChehabSynopsis
23*54f38fcaSMauro Carvalho Chehab========
24*54f38fcaSMauro Carvalho Chehab
25*54f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp )
26*54f38fcaSMauro Carvalho Chehab    :name: VIDIOC_G_AUDOUT
27*54f38fcaSMauro Carvalho Chehab
28*54f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp )
29*54f38fcaSMauro Carvalho Chehab    :name: VIDIOC_S_AUDOUT
30*54f38fcaSMauro Carvalho Chehab
31*54f38fcaSMauro Carvalho Chehab
32*54f38fcaSMauro Carvalho ChehabArguments
33*54f38fcaSMauro Carvalho Chehab=========
34*54f38fcaSMauro Carvalho Chehab
35*54f38fcaSMauro Carvalho Chehab``fd``
36*54f38fcaSMauro Carvalho Chehab    File descriptor returned by :ref:`open() <func-open>`.
37*54f38fcaSMauro Carvalho Chehab
38*54f38fcaSMauro Carvalho Chehab``argp``
39*54f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`v4l2_audioout`.
40*54f38fcaSMauro Carvalho Chehab
41*54f38fcaSMauro Carvalho Chehab
42*54f38fcaSMauro Carvalho ChehabDescription
43*54f38fcaSMauro Carvalho Chehab===========
44*54f38fcaSMauro Carvalho Chehab
45*54f38fcaSMauro Carvalho ChehabTo query the current audio output applications zero out the ``reserved``
46*54f38fcaSMauro Carvalho Chehabarray of a struct :c:type:`v4l2_audioout` and call the
47*54f38fcaSMauro Carvalho Chehab``VIDIOC_G_AUDOUT`` ioctl with a pointer to this structure. Drivers fill
48*54f38fcaSMauro Carvalho Chehabthe rest of the structure or return an ``EINVAL`` error code when the device
49*54f38fcaSMauro Carvalho Chehabhas no audio inputs, or none which combine with the current video
50*54f38fcaSMauro Carvalho Chehaboutput.
51*54f38fcaSMauro Carvalho Chehab
52*54f38fcaSMauro Carvalho ChehabAudio outputs have no writable properties. Nevertheless, to select the
53*54f38fcaSMauro Carvalho Chehabcurrent audio output applications can initialize the ``index`` field and
54*54f38fcaSMauro Carvalho Chehab``reserved`` array (which in the future may contain writable properties)
55*54f38fcaSMauro Carvalho Chehabof a struct :c:type:`v4l2_audioout` structure and call the
56*54f38fcaSMauro Carvalho Chehab``VIDIOC_S_AUDOUT`` ioctl. Drivers switch to the requested output or
57*54f38fcaSMauro Carvalho Chehabreturn the ``EINVAL`` error code when the index is out of bounds. This is a
58*54f38fcaSMauro Carvalho Chehabwrite-only ioctl, it does not return the current audio output attributes
59*54f38fcaSMauro Carvalho Chehabas ``VIDIOC_G_AUDOUT`` does.
60*54f38fcaSMauro Carvalho Chehab
61*54f38fcaSMauro Carvalho Chehab.. note::
62*54f38fcaSMauro Carvalho Chehab
63*54f38fcaSMauro Carvalho Chehab   Connectors on a TV card to loop back the received audio signal
64*54f38fcaSMauro Carvalho Chehab   to a sound card are not audio outputs in this sense.
65*54f38fcaSMauro Carvalho Chehab
66*54f38fcaSMauro Carvalho Chehab
67*54f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_audioout
68*54f38fcaSMauro Carvalho Chehab
69*54f38fcaSMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
70*54f38fcaSMauro Carvalho Chehab
71*54f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_audioout
72*54f38fcaSMauro Carvalho Chehab    :header-rows:  0
73*54f38fcaSMauro Carvalho Chehab    :stub-columns: 0
74*54f38fcaSMauro Carvalho Chehab    :widths:       1 1 2
75*54f38fcaSMauro Carvalho Chehab
76*54f38fcaSMauro Carvalho Chehab    * - __u32
77*54f38fcaSMauro Carvalho Chehab      - ``index``
78*54f38fcaSMauro Carvalho Chehab      - Identifies the audio output, set by the driver or application.
79*54f38fcaSMauro Carvalho Chehab    * - __u8
80*54f38fcaSMauro Carvalho Chehab      - ``name``\ [32]
81*54f38fcaSMauro Carvalho Chehab      - Name of the audio output, a NUL-terminated ASCII string, for
82*54f38fcaSMauro Carvalho Chehab	example: "Line Out". This information is intended for the user,
83*54f38fcaSMauro Carvalho Chehab	preferably the connector label on the device itself.
84*54f38fcaSMauro Carvalho Chehab    * - __u32
85*54f38fcaSMauro Carvalho Chehab      - ``capability``
86*54f38fcaSMauro Carvalho Chehab      - Audio capability flags, none defined yet. Drivers must set this
87*54f38fcaSMauro Carvalho Chehab	field to zero.
88*54f38fcaSMauro Carvalho Chehab    * - __u32
89*54f38fcaSMauro Carvalho Chehab      - ``mode``
90*54f38fcaSMauro Carvalho Chehab      - Audio mode, none defined yet. Drivers and applications (on
91*54f38fcaSMauro Carvalho Chehab	``VIDIOC_S_AUDOUT``) must set this field to zero.
92*54f38fcaSMauro Carvalho Chehab    * - __u32
93*54f38fcaSMauro Carvalho Chehab      - ``reserved``\ [2]
94*54f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Drivers and applications must set
95*54f38fcaSMauro Carvalho Chehab	the array to zero.
96*54f38fcaSMauro Carvalho Chehab
97*54f38fcaSMauro Carvalho Chehab
98*54f38fcaSMauro Carvalho ChehabReturn Value
99*54f38fcaSMauro Carvalho Chehab============
100*54f38fcaSMauro Carvalho Chehab
101*54f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
102*54f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
103*54f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
104*54f38fcaSMauro Carvalho Chehab
105*54f38fcaSMauro Carvalho ChehabEINVAL
106*54f38fcaSMauro Carvalho Chehab    No audio outputs combine with the current video output, or the
107*54f38fcaSMauro Carvalho Chehab    number of the selected audio output is out of bounds or it does not
108*54f38fcaSMauro Carvalho Chehab    combine.
109