diff options
Diffstat (limited to 'libmpdemux/tvi_v4l.c')
-rw-r--r-- | libmpdemux/tvi_v4l.c | 29 |
1 files 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; + } + } } |