Name

VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS — Get or set DV timings for input or output

Synopsis

int ioctl(int fd,
 int request,
 struct v4l2_dv_timings *argp);
 

Arguments

fd

File descriptor returned by open().

request

VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS

argp

Description

To set DV timings for the input or output, applications use the VIDIOC_S_DV_TIMINGS ioctl and to get the current timings, applications use the VIDIOC_G_DV_TIMINGS ioctl. The detailed timing information is filled in using the structure struct v4l2_dv_timings. These ioctls take a pointer to the struct v4l2_dv_timings structure as argument. If the ioctl is not supported or the timing values are not correct, the driver returns EINVAL error code.

The linux/v4l2-dv-timings.h header can be used to get the timings of the formats in the [CEA-861-E] and [VESA DMT] standards. If the current input or output does not support DV timings (e.g. if VIDIOC_ENUMINPUT does not set the V4L2_IN_CAP_DV_TIMINGS flag), then ENODATA error code is returned.

Return Value

On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.

EINVAL

This ioctl is not supported, or the VIDIOC_S_DV_TIMINGS parameter was unsuitable.

ENODATA

Digital video timings are not supported for this input or output.

EBUSY

The device is busy and therefore can not change the timings.

Table A.53. struct v4l2_bt_timings

__u32widthWidth of the active video in pixels.
__u32heightHeight of the active video frame in lines. So for interlaced formats the height of the active video in each field is height/2.
__u32interlacedProgressive (0) or interlaced (1)
__u32polaritiesThis is a bit mask that defines polarities of sync signals. bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_HSYNC_POS_POL) is for horizontal sync polarity. If the bit is set (1) it is positive polarity and if is cleared (0), it is negative polarity.
__u64pixelclockPixel clock in Hz. Ex. 74.25MHz->74250000
__u32hfrontporchHorizontal front porch in pixels
__u32hsyncHorizontal sync length in pixels
__u32hbackporchHorizontal back porch in pixels
__u32vfrontporchVertical front porch in lines. For interlaced formats this refers to the odd field (aka field 1).
__u32vsyncVertical sync length in lines. For interlaced formats this refers to the odd field (aka field 1).
__u32vbackporchVertical back porch in lines. For interlaced formats this refers to the odd field (aka field 1).
__u32il_vfrontporchVertical front porch in lines for the even field (aka field 2) of interlaced field formats. Must be 0 for progressive formats.
__u32il_vsyncVertical sync length in lines for the even field (aka field 2) of interlaced field formats. Must be 0 for progressive formats.
__u32il_vbackporchVertical back porch in lines for the even field (aka field 2) of interlaced field formats. Must be 0 for progressive formats.
__u32standardsThe video standard(s) this format belongs to. This will be filled in by the driver. Applications must set this to 0. See Table A.56, “DV BT Timing standards” for a list of standards.
__u32flagsSeveral flags giving more information about the format. See Table A.57, “DV BT Timing flags” for a description of the flags.

Table A.54. struct v4l2_dv_timings

__u32type Type of DV timings as listed in Table A.55, “DV Timing types”.
union  
 struct v4l2_bt_timingsbtTimings defined by BT.656/1120 specifications
 __u32reserved[32] 

Table A.55. DV Timing types

Timing typevalueDescription
   
V4L2_DV_BT_656_11200BT.656/1120 timings

Table A.56. DV BT Timing standards

Timing standardDescription
  
V4L2_DV_BT_STD_CEA861The timings follow the CEA-861 Digital TV Profile standard
V4L2_DV_BT_STD_DMTThe timings follow the VESA Discrete Monitor Timings standard
V4L2_DV_BT_STD_CVTThe timings follow the VESA Coordinated Video Timings standard
V4L2_DV_BT_STD_GTFThe timings follow the VESA Generalized Timings Formula standard

Table A.57. DV BT Timing flags

FlagDescription
  
V4L2_DV_FL_REDUCED_BLANKINGCVT/GTF specific: the timings use reduced blanking (CVT) or the 'Secondary GTF' curve (GTF). In both cases the horizontal and/or vertical blanking intervals are reduced, allowing a higher resolution over the same bandwidth. This is a read-only flag, applications must not set this.
V4L2_DV_FL_CAN_REDUCE_FPSCEA-861 specific: set for CEA-861 formats with a framerate that is a multiple of six. These formats can be optionally played at 1 / 1.001 speed to be compatible with 60 Hz based standards such as NTSC and PAL-M that use a framerate of 29.97 frames per second. If the transmitter can't generate such frequencies, then the flag will also be cleared. This is a read-only flag, applications must not set this.
V4L2_DV_FL_REDUCED_FPSCEA-861 specific: only valid for video transmitters, the flag is cleared by receivers. It is also only valid for formats with the V4L2_DV_FL_CAN_REDUCE_FPS flag set, for other formats the flag will be cleared by the driver. If the application sets this flag, then the pixelclock used to set up the transmitter is divided by 1.001 to make it compatible with NTSC framerates. If the transmitter can't generate such frequencies, then the flag will also be cleared.
V4L2_DV_FL_HALF_LINESpecific to interlaced formats: if set, then field 1 (aka the odd field) is really one half-line longer and field 2 (aka the even field) is really one half-line shorter, so each field has exactly the same number of half-lines. Whether half-lines can be detected or used depends on the hardware.