changeset 8650:cf1d4f48aecf

allow utilization of more v4l buffers, patch by Carsten Schulz <carsten@gnocchi.dialup.fu-berlin.de>
author henry
date Sun, 29 Dec 2002 23:10:08 +0000
parents 0c258b964b08
children 50701f34a161
files libmpdemux/tvi_v4l.c
diffstat 1 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l.c	Sun Dec 29 22:12:20 2002 +0000
+++ b/libmpdemux/tvi_v4l.c	Sun Dec 29 23:10:08 2002 +0000
@@ -1224,19 +1224,19 @@
     priv_t *priv = (priv_t*)data;
     struct timeval curtime;
     long long skew, prev_skew, xskew, interval, prev_interval;
-    int frame, nextframe;
+    int frame;
     int i;
     int first = 1;
     int framecount;
 
     /* start the capture process */
-    if (ioctl(priv->video_fd, VIDIOCMCAPTURE, &priv->buf[0]) == -1)
-    {
-	mp_msg(MSGT_TV, MSGL_ERR, "\nioctl mcapture failed: %s\n", strerror(errno));
+
+    for (i=0; i < priv->nbuf; i++) {
+	if (ioctl(priv->video_fd, VIDIOCMCAPTURE, &priv->buf[i]) == -1)
+	{
+	    mp_msg(MSGT_TV, MSGL_ERR, "\nioctl mcapture failed: %s\n", strerror(errno));
+	}
     }
-    while (ioctl(priv->video_fd, VIDIOCSYNC, &priv->buf[1].frame) < 0 &&
-	   (errno == EAGAIN || errno == EINTR));
-    mp_dbg(MSGT_TV, MSGL_DBG3, "\npicture sync failed\n");
 
     prev_interval = 0;
     prev_skew = 0;
@@ -1255,14 +1255,7 @@
 	    }
 		
 	    frame = i;
-	    nextframe = (i+1)%priv->nbuf;
-	    
-	    if (ioctl(priv->video_fd, VIDIOCMCAPTURE, &priv->buf[nextframe]) == -1)
-	    {
-		mp_msg(MSGT_TV, MSGL_ERR, "\nioctl mcapture failed: %s\n", strerror(errno));
-		continue;
-	    }
-	    
+
 	    while (ioctl(priv->video_fd, VIDIOCSYNC, &priv->buf[frame].frame) < 0 &&
 		   (errno == EAGAIN || errno == EINTR));
 	    mp_dbg(MSGT_TV, MSGL_DBG3, "\npicture sync failed\n");
@@ -1355,6 +1348,12 @@
 		priv->video_cnt++;
 	    }
 
+	    if (ioctl(priv->video_fd, VIDIOCMCAPTURE, &priv->buf[frame]) == -1)
+	    {
+		mp_msg(MSGT_TV, MSGL_ERR, "\nioctl mcapture failed: %s\n", strerror(errno));
+		continue;
+	    }
+
 	}
 
     }