summaryrefslogtreecommitdiffstats
path: root/stream/tvi_v4l2.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/tvi_v4l2.c')
-rw-r--r--stream/tvi_v4l2.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 0742135740..c890d7a51e 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -780,6 +780,14 @@ static int control(priv_t *priv, int cmd, void *arg)
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_CHK_WIDTH:
return TVI_CONTROL_TRUE;
+ case TVI_CONTROL_VID_SET_WIDTH_HEIGHT:
+ if (getfmt(priv) < 0) return TVI_CONTROL_FALSE;
+ priv->format.fmt.pix.width = ((int *)arg)[0];
+ priv->format.fmt.pix.height = ((int *)arg)[1];
+ priv->format.fmt.pix.field = V4L2_FIELD_ANY;
+ if (ioctl(priv->video_fd, VIDIOC_S_FMT, &priv->format) < 0)
+ return TVI_CONTROL_FALSE;
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_WIDTH:
if (getfmt(priv) < 0) return TVI_CONTROL_FALSE;
priv->format.fmt.pix.width = *(int *)arg;
@@ -1126,7 +1134,7 @@ static int uninit(priv_t *priv)
struct v4l2_buffer buf;
/* get performance */
- frames = 1 + lrintf((double)(priv->curr_frame - priv->first_frame) / (1e6 * getfps(priv)));
+ frames = 1 + lrintf((double)(priv->curr_frame - priv->first_frame) / 1e6 * getfps(priv));
dropped = frames - priv->frames;
/* turn off streaming */