162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci.. c:namespace:: V4L 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci.. _VIDIOC_QUERY_DV_TIMINGS: 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci***************************** 762306a36Sopenharmony_ciioctl VIDIOC_QUERY_DV_TIMINGS 862306a36Sopenharmony_ci***************************** 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciName 1162306a36Sopenharmony_ci==== 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciVIDIOC_QUERY_DV_TIMINGS - VIDIOC_SUBDEV_QUERY_DV_TIMINGS - Sense the DV preset received by the current input 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciSynopsis 1662306a36Sopenharmony_ci======== 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_QUERY_DV_TIMINGS 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp)`` 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_QUERY_DV_TIMINGS 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp)`` 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciArguments 2762306a36Sopenharmony_ci========= 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci``fd`` 3062306a36Sopenharmony_ci File descriptor returned by :c:func:`open()`. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci``argp`` 3362306a36Sopenharmony_ci Pointer to struct :c:type:`v4l2_dv_timings`. 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciDescription 3662306a36Sopenharmony_ci=========== 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciThe hardware may be able to detect the current DV timings automatically, 3962306a36Sopenharmony_cisimilar to sensing the video standard. To do so, applications call 4062306a36Sopenharmony_ci:ref:`VIDIOC_QUERY_DV_TIMINGS` with a pointer to a struct 4162306a36Sopenharmony_ci:c:type:`v4l2_dv_timings`. Once the hardware detects 4262306a36Sopenharmony_cithe timings, it will fill in the timings structure. 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci.. note:: 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci Drivers shall *not* switch timings automatically if new 4762306a36Sopenharmony_ci timings are detected. Instead, drivers should send the 4862306a36Sopenharmony_ci ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support this) and expect 4962306a36Sopenharmony_ci that userspace will take action by calling :ref:`VIDIOC_QUERY_DV_TIMINGS`. 5062306a36Sopenharmony_ci The reason is that new timings usually mean different buffer sizes as 5162306a36Sopenharmony_ci well, and you cannot change buffer sizes on the fly. In general, 5262306a36Sopenharmony_ci applications that receive the Source Change event will have to call 5362306a36Sopenharmony_ci :ref:`VIDIOC_QUERY_DV_TIMINGS`, and if the detected timings are valid they 5462306a36Sopenharmony_ci will have to stop streaming, set the new timings, allocate new buffers 5562306a36Sopenharmony_ci and start streaming again. 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ciIf the timings could not be detected because there was no signal, then 5862306a36Sopenharmony_ciENOLINK is returned. If a signal was detected, but it was unstable and 5962306a36Sopenharmony_cithe receiver could not lock to the signal, then ``ENOLCK`` is returned. If 6062306a36Sopenharmony_cithe receiver could lock to the signal, but the format is unsupported 6162306a36Sopenharmony_ci(e.g. because the pixelclock is out of range of the hardware 6262306a36Sopenharmony_cicapabilities), then the driver fills in whatever timings it could find 6362306a36Sopenharmony_ciand returns ``ERANGE``. In that case the application can call 6462306a36Sopenharmony_ci:ref:`VIDIOC_DV_TIMINGS_CAP` to compare the 6562306a36Sopenharmony_cifound timings with the hardware's capabilities in order to give more 6662306a36Sopenharmony_ciprecise feedback to the user. 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ciReturn Value 6962306a36Sopenharmony_ci============ 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 7262306a36Sopenharmony_ciappropriately. The generic error codes are described at the 7362306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciENODATA 7662306a36Sopenharmony_ci Digital video timings are not supported for this input or output. 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ciENOLINK 7962306a36Sopenharmony_ci No timings could be detected because no signal was found. 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ciENOLCK 8262306a36Sopenharmony_ci The signal was unstable and the hardware could not lock on to it. 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ciERANGE 8562306a36Sopenharmony_ci Timings were found, but they are out of range of the hardware 8662306a36Sopenharmony_ci capabilities. 87