xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/vidioc-g-audioout.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: V4L
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _VIDIOC_G_AUDOUT:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun**************************************
7*4882a593Smuzhiyunioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT
8*4882a593Smuzhiyun**************************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunVIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: VIDIOC_G_AUDOUT
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp)``
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun.. c:macro:: VIDIOC_S_AUDOUT
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp)``
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunArguments
27*4882a593Smuzhiyun=========
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun``fd``
30*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun``argp``
33*4882a593Smuzhiyun    Pointer to struct :c:type:`v4l2_audioout`.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunDescription
36*4882a593Smuzhiyun===========
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunTo query the current audio output applications zero out the ``reserved``
39*4882a593Smuzhiyunarray of a struct :c:type:`v4l2_audioout` and call the
40*4882a593Smuzhiyun``VIDIOC_G_AUDOUT`` ioctl with a pointer to this structure. Drivers fill
41*4882a593Smuzhiyunthe rest of the structure or return an ``EINVAL`` error code when the device
42*4882a593Smuzhiyunhas no audio inputs, or none which combine with the current video
43*4882a593Smuzhiyunoutput.
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunAudio outputs have no writable properties. Nevertheless, to select the
46*4882a593Smuzhiyuncurrent audio output applications can initialize the ``index`` field and
47*4882a593Smuzhiyun``reserved`` array (which in the future may contain writable properties)
48*4882a593Smuzhiyunof a struct :c:type:`v4l2_audioout` structure and call the
49*4882a593Smuzhiyun``VIDIOC_S_AUDOUT`` ioctl. Drivers switch to the requested output or
50*4882a593Smuzhiyunreturn the ``EINVAL`` error code when the index is out of bounds. This is a
51*4882a593Smuzhiyunwrite-only ioctl, it does not return the current audio output attributes
52*4882a593Smuzhiyunas ``VIDIOC_G_AUDOUT`` does.
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun.. note::
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun   Connectors on a TV card to loop back the received audio signal
57*4882a593Smuzhiyun   to a sound card are not audio outputs in this sense.
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun.. c:type:: v4l2_audioout
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun.. flat-table:: struct v4l2_audioout
64*4882a593Smuzhiyun    :header-rows:  0
65*4882a593Smuzhiyun    :stub-columns: 0
66*4882a593Smuzhiyun    :widths:       1 1 2
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun    * - __u32
69*4882a593Smuzhiyun      - ``index``
70*4882a593Smuzhiyun      - Identifies the audio output, set by the driver or application.
71*4882a593Smuzhiyun    * - __u8
72*4882a593Smuzhiyun      - ``name``\ [32]
73*4882a593Smuzhiyun      - Name of the audio output, a NUL-terminated ASCII string, for
74*4882a593Smuzhiyun	example: "Line Out". This information is intended for the user,
75*4882a593Smuzhiyun	preferably the connector label on the device itself.
76*4882a593Smuzhiyun    * - __u32
77*4882a593Smuzhiyun      - ``capability``
78*4882a593Smuzhiyun      - Audio capability flags, none defined yet. Drivers must set this
79*4882a593Smuzhiyun	field to zero.
80*4882a593Smuzhiyun    * - __u32
81*4882a593Smuzhiyun      - ``mode``
82*4882a593Smuzhiyun      - Audio mode, none defined yet. Drivers and applications (on
83*4882a593Smuzhiyun	``VIDIOC_S_AUDOUT``) must set this field to zero.
84*4882a593Smuzhiyun    * - __u32
85*4882a593Smuzhiyun      - ``reserved``\ [2]
86*4882a593Smuzhiyun      - Reserved for future extensions. Drivers and applications must set
87*4882a593Smuzhiyun	the array to zero.
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunReturn Value
90*4882a593Smuzhiyun============
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
93*4882a593Smuzhiyunappropriately. The generic error codes are described at the
94*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
95*4882a593Smuzhiyun
96*4882a593SmuzhiyunEINVAL
97*4882a593Smuzhiyun    No audio outputs combine with the current video output, or the
98*4882a593Smuzhiyun    number of the selected audio output is out of bounds or it does not
99*4882a593Smuzhiyun    combine.
100