changeset 2814:37fc45a05082

doublebuffeing SYNC fixed
author arpi
date Sun, 11 Nov 2001 02:20:39 +0000
parents d6d88771f5ef
children c9b4ab4321c2
files libmpdemux/tvi_v4l.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l.c	Sun Nov 11 02:04:41 2001 +0000
+++ b/libmpdemux/tvi_v4l.c	Sun Nov 11 02:20:39 2001 +0000
@@ -657,19 +657,20 @@
 static int grab_video_frame(priv_t *priv, char *buffer, int len)
 {
     int frame = priv->queue % priv->nbuf;
+    int nextframe = (priv->queue+1) % priv->nbuf;
 
     printf("grab_video_frame(priv=%p, buffer=%p, len=%d\n",
 	priv, buffer, len);
 
     printf("buf: %p + frame: %d => %p\n",
-	priv->buf, frame, &priv->buf[frame]);
-    if (ioctl(priv->fd, VIDIOCMCAPTURE, &priv->buf[frame]) == -1)
+	priv->buf, nextframe, &priv->buf[nextframe]);
+    if (ioctl(priv->fd, VIDIOCMCAPTURE, &priv->buf[nextframe]) == -1)
     {
 	printf("ioctl mcapture failed: %s\n", strerror(errno));
 	return(0);
     }
     
-    if (ioctl(priv->fd, VIDIOCSYNC, &priv->buf[frame]) == -1)
+    if (ioctl(priv->fd, VIDIOCSYNC, &priv->buf[frame].frame) == -1)
 	printf("ioctl sync failed: %s\n", strerror(errno));
     priv->queue++;