xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/vidioc-g-output.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_OUTPUT:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun**************************************
7*4882a593Smuzhiyunioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT
8*4882a593Smuzhiyun**************************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunVIDIOC_G_OUTPUT - VIDIOC_S_OUTPUT - Query or select the current video output
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: VIDIOC_G_OUTPUT
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_G_OUTPUT, int *argp)``
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun.. c:macro:: VIDIOC_S_OUTPUT
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_S_OUTPUT, int *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 an integer with output index.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunDescription
36*4882a593Smuzhiyun===========
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunTo query the current video output applications call the
39*4882a593Smuzhiyun:ref:`VIDIOC_G_OUTPUT <VIDIOC_G_OUTPUT>` ioctl with a pointer to an integer where the driver
40*4882a593Smuzhiyunstores the number of the output, as in the struct
41*4882a593Smuzhiyun:c:type:`v4l2_output` ``index`` field. This ioctl will
42*4882a593Smuzhiyunfail only when there are no video outputs, returning the ``EINVAL`` error
43*4882a593Smuzhiyuncode.
44*4882a593Smuzhiyun
45*4882a593SmuzhiyunTo select a video output applications store the number of the desired
46*4882a593Smuzhiyunoutput in an integer and call the :ref:`VIDIOC_S_OUTPUT <VIDIOC_G_OUTPUT>` ioctl with a
47*4882a593Smuzhiyunpointer to this integer. Side effects are possible. For example outputs
48*4882a593Smuzhiyunmay support different video standards, so the driver may implicitly
49*4882a593Smuzhiyunswitch the current standard. standard. Because of these possible side
50*4882a593Smuzhiyuneffects applications must select an output before querying or
51*4882a593Smuzhiyunnegotiating any other parameters.
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunInformation about video outputs is available using the
54*4882a593Smuzhiyun:ref:`VIDIOC_ENUMOUTPUT` ioctl.
55*4882a593Smuzhiyun
56*4882a593SmuzhiyunReturn Value
57*4882a593Smuzhiyun============
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
60*4882a593Smuzhiyunappropriately. The generic error codes are described at the
61*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunEINVAL
64*4882a593Smuzhiyun    The number of the video output is out of bounds, or there are no
65*4882a593Smuzhiyun    video outputs at all.
66