xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-g-audioout.rst (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _VIDIOC_G_AUDOUT:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab**************************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT
854f38fcaSMauro Carvalho Chehab**************************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_G_AUDOUT
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp)``
2154f38fcaSMauro Carvalho Chehab
22407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_S_AUDOUT
23407e84cdSMauro Carvalho Chehab
24407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp)``
2554f38fcaSMauro Carvalho Chehab
2654f38fcaSMauro Carvalho ChehabArguments
2754f38fcaSMauro Carvalho Chehab=========
2854f38fcaSMauro Carvalho Chehab
2954f38fcaSMauro Carvalho Chehab``fd``
30407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
3154f38fcaSMauro Carvalho Chehab
3254f38fcaSMauro Carvalho Chehab``argp``
3354f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`v4l2_audioout`.
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho ChehabDescription
3654f38fcaSMauro Carvalho Chehab===========
3754f38fcaSMauro Carvalho Chehab
3854f38fcaSMauro Carvalho ChehabTo query the current audio output applications zero out the ``reserved``
3954f38fcaSMauro Carvalho Chehabarray of a struct :c:type:`v4l2_audioout` and call the
4054f38fcaSMauro Carvalho Chehab``VIDIOC_G_AUDOUT`` ioctl with a pointer to this structure. Drivers fill
4154f38fcaSMauro Carvalho Chehabthe rest of the structure or return an ``EINVAL`` error code when the device
4254f38fcaSMauro Carvalho Chehabhas no audio inputs, or none which combine with the current video
4354f38fcaSMauro Carvalho Chehaboutput.
4454f38fcaSMauro Carvalho Chehab
4554f38fcaSMauro Carvalho ChehabAudio outputs have no writable properties. Nevertheless, to select the
4654f38fcaSMauro Carvalho Chehabcurrent audio output applications can initialize the ``index`` field and
4754f38fcaSMauro Carvalho Chehab``reserved`` array (which in the future may contain writable properties)
4854f38fcaSMauro Carvalho Chehabof a struct :c:type:`v4l2_audioout` structure and call the
4954f38fcaSMauro Carvalho Chehab``VIDIOC_S_AUDOUT`` ioctl. Drivers switch to the requested output or
5054f38fcaSMauro Carvalho Chehabreturn the ``EINVAL`` error code when the index is out of bounds. This is a
5154f38fcaSMauro Carvalho Chehabwrite-only ioctl, it does not return the current audio output attributes
5254f38fcaSMauro Carvalho Chehabas ``VIDIOC_G_AUDOUT`` does.
5354f38fcaSMauro Carvalho Chehab
5454f38fcaSMauro Carvalho Chehab.. note::
5554f38fcaSMauro Carvalho Chehab
5654f38fcaSMauro Carvalho Chehab   Connectors on a TV card to loop back the received audio signal
5754f38fcaSMauro Carvalho Chehab   to a sound card are not audio outputs in this sense.
5854f38fcaSMauro Carvalho Chehab
5954f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_audioout
6054f38fcaSMauro Carvalho Chehab
61*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
6254f38fcaSMauro Carvalho Chehab
6354f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_audioout
6454f38fcaSMauro Carvalho Chehab    :header-rows:  0
6554f38fcaSMauro Carvalho Chehab    :stub-columns: 0
6654f38fcaSMauro Carvalho Chehab    :widths:       1 1 2
6754f38fcaSMauro Carvalho Chehab
6854f38fcaSMauro Carvalho Chehab    * - __u32
6954f38fcaSMauro Carvalho Chehab      - ``index``
7054f38fcaSMauro Carvalho Chehab      - Identifies the audio output, set by the driver or application.
7154f38fcaSMauro Carvalho Chehab    * - __u8
7254f38fcaSMauro Carvalho Chehab      - ``name``\ [32]
7354f38fcaSMauro Carvalho Chehab      - Name of the audio output, a NUL-terminated ASCII string, for
7454f38fcaSMauro Carvalho Chehab	example: "Line Out". This information is intended for the user,
7554f38fcaSMauro Carvalho Chehab	preferably the connector label on the device itself.
7654f38fcaSMauro Carvalho Chehab    * - __u32
7754f38fcaSMauro Carvalho Chehab      - ``capability``
7854f38fcaSMauro Carvalho Chehab      - Audio capability flags, none defined yet. Drivers must set this
7954f38fcaSMauro Carvalho Chehab	field to zero.
8054f38fcaSMauro Carvalho Chehab    * - __u32
8154f38fcaSMauro Carvalho Chehab      - ``mode``
8254f38fcaSMauro Carvalho Chehab      - Audio mode, none defined yet. Drivers and applications (on
8354f38fcaSMauro Carvalho Chehab	``VIDIOC_S_AUDOUT``) must set this field to zero.
8454f38fcaSMauro Carvalho Chehab    * - __u32
8554f38fcaSMauro Carvalho Chehab      - ``reserved``\ [2]
8654f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Drivers and applications must set
8754f38fcaSMauro Carvalho Chehab	the array to zero.
8854f38fcaSMauro Carvalho Chehab
8954f38fcaSMauro Carvalho ChehabReturn Value
9054f38fcaSMauro Carvalho Chehab============
9154f38fcaSMauro Carvalho Chehab
9254f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
9354f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
9454f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
9554f38fcaSMauro Carvalho Chehab
9654f38fcaSMauro Carvalho ChehabEINVAL
9754f38fcaSMauro Carvalho Chehab    No audio outputs combine with the current video output, or the
9854f38fcaSMauro Carvalho Chehab    number of the selected audio output is out of bounds or it does not
9954f38fcaSMauro Carvalho Chehab    combine.
100