File xawtv-3.95-bpl.patch of Package xawtv

diff -Nrbu xawtv-3.95/console/v4l-conf.c xawtv-3.95-OK/console/v4l-conf.c
--- xawtv-3.95/console/v4l-conf.c	2008-08-26 19:37:34.000000000 +0400
+++ xawtv-3.95-OK/console/v4l-conf.c	2008-08-26 19:39:28.000000000 +0400
@@ -53,6 +53,7 @@
 int    v4l2       = 1;
 int    user_bpp   = 0;
 int    user_shift = 0;
+int    user_bpl   = 0;
 void   *user_base = NULL;
 char   *display   = NULL;
 char   *fbdev     = NULL;
@@ -385,7 +386,15 @@
     }
     if (yuv)
 	fb.fmt.pixelformat = V4L2_PIX_FMT_YUYV;
+    /* Prefer an already configured bpl (if it makes sense) over our found bpl
+       if we did not find a base as our bpl is not very reliable when we did
+       not find a base */
+    if (user_bpl || d->base ||
+            fb.fmt.bytesperline < (fb.fmt.width * ((d->bpp + 7) / 8)))
     fb.fmt.bytesperline = d->bpl;
+    else
+        fprintf(stderr,"WARNING: keeping fbuf pitch at: %d, as no base addr was detected\n",
+            (int)fb.fmt.bytesperline);
     fb.fmt.sizeimage = fb.fmt.height * fb.fmt.bytesperline;
     if (NULL != d->base)
 	fb.base   = d->base;
@@ -498,7 +507,7 @@
     
     /* parse options */
     for (;;) {
-	if (-1 == (c = getopt(argc, argv, "hyq12d:c:b:s:fa:")))
+	if (-1 == (c = getopt(argc, argv, "hyq12d:c:b:s:fa:p:")))
 	    break;
 	switch (c) {
 	case 'q':
@@ -543,6 +552,14 @@
 		exit(1);
 	    }
 	    break;
+	case 'p':
+	    if (0 == getuid()) {
+		sscanf(optarg,"%d",&user_bpl);
+	    } else {
+		fprintf(stderr,"only root is allowed to use the -p option\n");
+		exit(1);
+	    }
+	    break;
 	case 'h':
 	default:
 	    fprintf(stderr,
@@ -560,6 +577,8 @@
 		    "    -a <addr> set framebuffer address to <addr>\n"
 		    "              (in hex, root only, successful autodetect\n"
 		    "               will overwrite this address)\n"
+		    "    -p <pitch> set framebuffer pitch to <pitch> bytes\n"
+		    "              (decimal, root only)\n"
 		    "    -1        force v4l API\n"
 		    "    -2        force v4l2 API\n",
 		    argv[0],
@@ -626,6 +645,9 @@
 	(d.depth  == 15 || d.depth  == 16))
 	d.depth = user_bpp;
 
+    if (user_bpl)
+        d.bpl = user_bpl;
+
     if (verbose) {
 	fprintf(stderr,"mode: %dx%d, depth=%d, bpp=%d, bpl=%d, ",
 		d.width,d.height,d.depth,d.bpp,d.bpl);
diff -Nrbu xawtv-3.95/man/v4l-conf.8 xawtv-3.95-OK/man/v4l-conf.8
--- xawtv-3.95/man/v4l-conf.8	2008-08-26 19:37:34.000000000 +0400
+++ xawtv-3.95-OK/man/v4l-conf.8	2008-08-26 19:45:02.000000000 +0400
@@ -62,6 +62,11 @@
 autodetected value, this switch is only useful if autodetect doesn't
 work because the X-Server lacks DGA support.  You can put this into
 /etc/conf.modules, as "post-install bttv ..." for example.
+.TP 4
+\fB-p\fP pitch
+Set framebuffer pitch to \fBpitch\fP bytes.  The value should be specified
+in decimal. Allowed for root only. (Currently it is a distro-specific option
+added by Fedora).
 .SH BUGS
 Hope I haven't any security flaws in there.  If you find one, drop me a 
 note.  Mails with patches are preferred :-)
openSUSE Build Service is sponsored by