linux-v4l2: Add helper function to set dv timing
Add a helper function to set the dv timing for the input.
This commit is contained in:
parent
bcf8400137
commit
99b6a018cc
@ -254,3 +254,22 @@ int_fast32_t v4l2_enum_dv_timing(int_fast32_t dev, struct v4l2_dv_timings *dvt,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int_fast32_t v4l2_set_dv_timing(int_fast32_t dev, int *timing)
|
||||
{
|
||||
if (!dev || !timing)
|
||||
return -1;
|
||||
|
||||
if (*timing == -1)
|
||||
return 0;
|
||||
|
||||
struct v4l2_dv_timings dvt;
|
||||
|
||||
if (v4l2_enum_dv_timing(dev, &dvt, *timing) < 0)
|
||||
return -1;
|
||||
|
||||
if (v4l2_ioctl(dev, VIDIOC_S_DV_TIMINGS, &dvt) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -281,6 +281,17 @@ int_fast32_t v4l2_set_standard(int_fast32_t dev, int *standard);
|
||||
*/
|
||||
int_fast32_t v4l2_enum_dv_timing(int_fast32_t dev, struct v4l2_dv_timings *dvt,
|
||||
int index);
|
||||
/**
|
||||
* Set a dv timing on the device
|
||||
*
|
||||
* Currently standard will not be changed on success or error.
|
||||
*
|
||||
* @param dev handle to the v4l2 device
|
||||
* @param timing index of the timing to use or -1 to leave as is
|
||||
*
|
||||
* @return negative on failure
|
||||
*/
|
||||
int_fast32_t v4l2_set_dv_timing(int_fast32_t dev, int *timing);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user