On Tue, 2006-07-25 at 18:19 +0200, Maciej Bliziński wrote:
> On Tue, 2006-07-04 at 22:11 +0200, Laurent Pinchart wrote:
> > Anyway the problem with the v4l2 input module is that it doesn't set the 
> > v4l2_buffer.memory field before calling VIDIOC_QBUF and VIDIOC_DQBUF 
> > (libmpdemux/tvi_v4l2.c, lines 881, 1401, 1425 and 1519).
> > 
> > That would only take a few minutes to fix. Could you submit the request to 
> > Martin Olschewski ?

Martin's patch fixes the problem, please see the attachment (3kB).
I think it will be submitted to MPlayer's source trunk.

However, to encode the video, the tuner.patch for the UVC driver is
still needed, otherwise mencoder dies from a floating point exception.
But, as Laurent asks, one problem at a time. ;-)

-- 
Maciej Bliziński <[EMAIL PROTECTED]>
http://automatthias.wordpress.com
--- libmpdemux/tvi_v4l2.c.orig	2006-07-25 14:18:18.000000000 +0200
+++ libmpdemux/tvi_v4l2.c	2006-07-25 14:17:52.000000000 +0200
@@ -415,6 +415,11 @@
     v4l2_std_id id;
     int i=0;
 
+    /* Don't call VIDIOC_G_STD if we haven't got a tuner. */
+    if (! priv->capability.capabilities & V4L2_CAP_TUNER) {
+	priv->standard.index = 0;
+	return -1;
+    }
     if (ioctl(priv->video_fd, VIDIOC_G_STD, &id) < 0) {
 	mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl get standard failed: %s\n",
 	       info.short_name, strerror(errno));
@@ -875,7 +880,8 @@
 
 	/* unqueue all remaining buffers */
 	memset(&buf,0,sizeof(buf));
-	buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	buf.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	buf.memory = V4L2_MEMORY_MMAP;
 	while (!ioctl(priv->video_fd, VIDIOC_DQBUF, &buf));
     }
 
@@ -1250,7 +1256,7 @@
 	request.count = BUFFER_COUNT;
     }
     
-    request.type  = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+    request.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE;
     request.memory = V4L2_MEMORY_MMAP;
     if (ioctl(priv->video_fd, VIDIOC_REQBUFS, &request) < 0) {
 	mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl request buffers failed: %s\n",
@@ -1268,9 +1274,9 @@
     /* map and queue buffers */
     for (i = 0; i < request.count; i++) {
 	memset(&priv->map[i].buf,0,sizeof(priv->map[i].buf));
-	priv->map[i].buf.index = i;
-	priv->map[i].buf.type  = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	priv->map[i].buf.memory  = V4L2_MEMORY_MMAP;
+	priv->map[i].buf.index  = i;
+	priv->map[i].buf.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	priv->map[i].buf.memory = V4L2_MEMORY_MMAP;
 	if (ioctl(priv->video_fd, VIDIOC_QUERYBUF, &(priv->map[i].buf)) < 0) {
 	    mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl query buffer failed: %s\n",
 		   info.short_name, strerror(errno));
@@ -1290,6 +1296,7 @@
 	/* count up to make sure this is correct everytime */
 	priv->mapcount++;
 
+	priv->map[i].buf.memory = V4L2_MEMORY_MMAP;
 	if (ioctl(priv->video_fd, VIDIOC_QBUF, &(priv->map[i].buf)) < 0) {
 	    mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl queue buffer failed: %s\n",
 		   info.short_name, strerror(errno));
@@ -1394,7 +1401,8 @@
 	}
 
 	memset(&buf,0,sizeof(buf));
-	buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	buf.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	buf.memory = V4L2_MEMORY_MMAP;
 	ret = ioctl(priv->video_fd, VIDIOC_DQBUF, &buf);
 
 	if (ret < 0) {
@@ -1419,6 +1427,7 @@
 		    return 0;
 		}
 		if ((buf.flags & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_DONE)) == V4L2_BUF_FLAG_MAPPED) {
+		    priv->map[i].buf.memory = V4L2_MEMORY_MMAP;
 		    if (ioctl(priv->video_fd, VIDIOC_QBUF, &(priv->map[i].buf)) < 0) {
 			mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl queue buffer failed: %s\n",
 			       info.short_name, strerror(errno));
@@ -1513,6 +1522,7 @@
 	    priv->video_tail = (priv->video_tail+1)%priv->video_buffer_size_current;
 	    priv->video_cnt++;
 	}
+	priv->map[i].buf.memory = V4L2_MEMORY_MMAP;
 	if (ioctl(priv->video_fd, VIDIOC_QBUF, &buf) < 0) {
 	    mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl queue buffer failed: %s\n",
 		   info.short_name, strerror(errno));
_______________________________________________
Linux-uvc-devel mailing list
Linux-uvc-devel@lists.berlios.de
http://bat.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to