xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-g-audioout.rst (revision 059b1c5b15579b09c3787c3a3f843574233ab976)
1*059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
254f38fcaSMauro Carvalho Chehab
354f38fcaSMauro Carvalho Chehab.. _VIDIOC_G_AUDOUT:
454f38fcaSMauro Carvalho Chehab
554f38fcaSMauro Carvalho Chehab**************************************
654f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT
754f38fcaSMauro Carvalho Chehab**************************************
854f38fcaSMauro Carvalho Chehab
954f38fcaSMauro Carvalho ChehabName
1054f38fcaSMauro Carvalho Chehab====
1154f38fcaSMauro Carvalho Chehab
1254f38fcaSMauro Carvalho ChehabVIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output
1354f38fcaSMauro Carvalho Chehab
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
1854f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp )
1954f38fcaSMauro Carvalho Chehab    :name: VIDIOC_G_AUDOUT
2054f38fcaSMauro Carvalho Chehab
2154f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp )
2254f38fcaSMauro Carvalho Chehab    :name: VIDIOC_S_AUDOUT
2354f38fcaSMauro Carvalho Chehab
2454f38fcaSMauro Carvalho Chehab
2554f38fcaSMauro Carvalho ChehabArguments
2654f38fcaSMauro Carvalho Chehab=========
2754f38fcaSMauro Carvalho Chehab
2854f38fcaSMauro Carvalho Chehab``fd``
2954f38fcaSMauro Carvalho Chehab    File descriptor returned by :ref:`open() <func-open>`.
3054f38fcaSMauro Carvalho Chehab
3154f38fcaSMauro Carvalho Chehab``argp``
3254f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`v4l2_audioout`.
3354f38fcaSMauro Carvalho Chehab
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
6054f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_audioout
6154f38fcaSMauro Carvalho Chehab
6254f38fcaSMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
6354f38fcaSMauro Carvalho Chehab
6454f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_audioout
6554f38fcaSMauro Carvalho Chehab    :header-rows:  0
6654f38fcaSMauro Carvalho Chehab    :stub-columns: 0
6754f38fcaSMauro Carvalho Chehab    :widths:       1 1 2
6854f38fcaSMauro Carvalho Chehab
6954f38fcaSMauro Carvalho Chehab    * - __u32
7054f38fcaSMauro Carvalho Chehab      - ``index``
7154f38fcaSMauro Carvalho Chehab      - Identifies the audio output, set by the driver or application.
7254f38fcaSMauro Carvalho Chehab    * - __u8
7354f38fcaSMauro Carvalho Chehab      - ``name``\ [32]
7454f38fcaSMauro Carvalho Chehab      - Name of the audio output, a NUL-terminated ASCII string, for
7554f38fcaSMauro Carvalho Chehab	example: "Line Out". This information is intended for the user,
7654f38fcaSMauro Carvalho Chehab	preferably the connector label on the device itself.
7754f38fcaSMauro Carvalho Chehab    * - __u32
7854f38fcaSMauro Carvalho Chehab      - ``capability``
7954f38fcaSMauro Carvalho Chehab      - Audio capability flags, none defined yet. Drivers must set this
8054f38fcaSMauro Carvalho Chehab	field to zero.
8154f38fcaSMauro Carvalho Chehab    * - __u32
8254f38fcaSMauro Carvalho Chehab      - ``mode``
8354f38fcaSMauro Carvalho Chehab      - Audio mode, none defined yet. Drivers and applications (on
8454f38fcaSMauro Carvalho Chehab	``VIDIOC_S_AUDOUT``) must set this field to zero.
8554f38fcaSMauro Carvalho Chehab    * - __u32
8654f38fcaSMauro Carvalho Chehab      - ``reserved``\ [2]
8754f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Drivers and applications must set
8854f38fcaSMauro Carvalho Chehab	the array to zero.
8954f38fcaSMauro Carvalho Chehab
9054f38fcaSMauro Carvalho Chehab
9154f38fcaSMauro Carvalho ChehabReturn Value
9254f38fcaSMauro Carvalho Chehab============
9354f38fcaSMauro Carvalho Chehab
9454f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
9554f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
9654f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
9754f38fcaSMauro Carvalho Chehab
9854f38fcaSMauro Carvalho ChehabEINVAL
9954f38fcaSMauro Carvalho Chehab    No audio outputs combine with the current video output, or the
10054f38fcaSMauro Carvalho Chehab    number of the selected audio output is out of bounds or it does not
10154f38fcaSMauro Carvalho Chehab    combine.
102