diff --git a/plugins/linux-v4l2/v4l2-helpers.c b/plugins/linux-v4l2/v4l2-helpers.c index ffb8eedf0..2c824e55c 100644 --- a/plugins/linux-v4l2/v4l2-helpers.c +++ b/plugins/linux-v4l2/v4l2-helpers.c @@ -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; +} diff --git a/plugins/linux-v4l2/v4l2-helpers.h b/plugins/linux-v4l2/v4l2-helpers.h index 79facf1cd..5ee28fd4a 100644 --- a/plugins/linux-v4l2/v4l2-helpers.h +++ b/plugins/linux-v4l2/v4l2-helpers.h @@ -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