linux-v4l2: Add helper function for video standard

Add a helper function to get/set the video standard for the input.
This commit is contained in:
fryshorts
2015-02-23 21:08:57 +01:00
parent a9df1d921a
commit 7dc9069c1b
2 changed files with 28 additions and 0 deletions

View File

@@ -220,3 +220,19 @@ int_fast32_t v4l2_set_framerate(int_fast32_t dev, int *framerate)
par.parm.capture.timeperframe.denominator);
return 0;
}
int_fast32_t v4l2_set_standard(int_fast32_t dev, int *standard)
{
if (!dev || !standard)
return -1;
if (*standard == -1) {
if (v4l2_ioctl(dev, VIDIOC_G_STD, standard) < 0)
return -1;
} else {
if (v4l2_ioctl(dev, VIDIOC_S_STD, standard) < 0)
return -1;
}
return 0;
}

View File

@@ -258,6 +258,18 @@ int_fast32_t v4l2_set_format(int_fast32_t dev, int *resolution,
*/
int_fast32_t v4l2_set_framerate(int_fast32_t dev, int *framerate);
/**
* Set a video standard on the device.
*
* If the action succeeds standard is set to the used video standard id.
*
* @param dev handle to the v4l2 device
* @param standard id of the standard to use or -1 to leave as is
*
* @return negative on failure
*/
int_fast32_t v4l2_set_standard(int_fast32_t dev, int *standard);
#ifdef __cplusplus
}
#endif