From ec27ebf6b7ae96b7ba0897075cb0adfc63679587 Mon Sep 17 00:00:00 2001 From: henry Date: Sun, 29 Dec 2002 23:10:08 +0000 Subject: [PATCH] allow utilization of more v4l buffers, patch by Carsten Schulz git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8651 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/tvi_v4l.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libmpdemux/tvi_v4l.c b/libmpdemux/tvi_v4l.c index 771d36346d..ac2cac401d 100644 --- a/libmpdemux/tvi_v4l.c +++ b/libmpdemux/tvi_v4l.c @@ -1224,19 +1224,19 @@ static void *video_grabber(void *data) 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 @@ static void *video_grabber(void *data) } 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 @@ static void *video_grabber(void *data) 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; + } + } }