Package: luvcview
Version: 1:0.2.4-1
Severity: wishlist
Tags: patch

Now, luvcview supports only the video format of YUYV/yuv and MJPG/jpg.
The device of UVC might use other video formats. 
For example, Macbook iSight is UYVY format. 

I attach patch. This patch support UYVY format.
I tested on Macbook iSight only display. 

Please apply this patch.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-1-686-bigmem (SMP w/2 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages luvcview depends on:
ii  libc6                         2.7-11     GNU C Library: Shared libraries
ii  libsdl1.2debian               1.2.13-2   Simple DirectMedia Layer

luvcview recommends no packages.

-- no debconf information


-- 
Nobuhiro Iwamatsu
--- ./luvcview.c	2008-05-17 19:43:58.000000000 +0900
+++ ./luvcview.c	2008-05-17 19:49:29.000000000 +0900
@@ -220,6 +220,7 @@
 	const char *videodevice = NULL;
 	const char *mode = NULL;
 	int format = V4L2_PIX_FMT_MJPEG;
+	int sdl_format =  SDL_YUY2_OVERLAY;
 	int i;
 	int grabmethod = 1;
 	int width = 640;
@@ -266,6 +267,9 @@
 
 			if (strcasecmp(mode, "yuv") == 0 || strcasecmp(mode, "YUYV") == 0) {
 				format = V4L2_PIX_FMT_YUYV;
+			} else if (strcasecmp(mode, "uyvy") == 0 || strcasecmp(mode, "UYVY") == 0) {
+				format = V4L2_PIX_FMT_UYVY;
+				sdl_format = SDL_UYVY_OVERLAY;
 			} else if (strcasecmp(mode, "jpg") == 0 || strcasecmp(mode, "MJPG") == 0) {
 				format = V4L2_PIX_FMT_MJPEG;
 			} else {
@@ -344,7 +348,7 @@
 			printf("-d	/dev/videoX       use videoX device\n");
 			printf("-g	use read method for grab instead mmap\n");
 			printf("-w	disable SDL hardware accel.\n");
-			printf("-f	choose video format (YUYV/yuv and MJPG/jpg are valid, MJPG is default)\n");
+			printf("-f	choose video format (YUYV/yuv, UYVY/uyvy and MJPG/jpg are valid, MJPG is default)\n");
 			printf("-i	fps           use specified frame interval\n");
 			printf("-s	widthxheight      use specified input size\n");
 			printf("-c	enable raw frame capturing for the first frame\n");
@@ -448,7 +452,7 @@
 
 	overlay =
 		SDL_CreateYUVOverlay(videoIn->width, videoIn->height + 32,
-				SDL_YUY2_OVERLAY, pscreen);
+				sdl_format, pscreen);
 	p = (unsigned char *) overlay->pixels[0];
 	drect.x = 0;
 	drect.y = 0;
--- ./v4l2uvc.c	2008-05-17 19:52:13.000000000 +0900
+++ ./v4l2uvc.c	2008-05-17 19:55:35.000000000 +0900
@@ -132,6 +132,7 @@
 							   8) * 2);
 	break;
     case V4L2_PIX_FMT_YUYV:
+    case V4L2_PIX_FMT_UYVY:
 	vd->framebuffer =
 	    (unsigned char *) calloc(1, (size_t) vd->framesizeIn);
 	break;
@@ -367,7 +368,9 @@
 			requested_format_found = 1;
 			break;
 		}
-		if(device_formats[i] == V4L2_PIX_FMT_MJPEG || device_formats[i] == V4L2_PIX_FMT_YUYV)
+		if(device_formats[i] == V4L2_PIX_FMT_MJPEG || device_formats[i] == V4L2_PIX_FMT_YUYV
+			|| V4L2_PIX_FMT_UYVY == device_formats[i])
+
 			fallback_format = i;
 	}
 	if(requested_format_found) {
@@ -641,6 +644,7 @@
 	    printf("bytes in used %d\n", vd->buf.bytesused);
 	break;
     case V4L2_PIX_FMT_YUYV:
+    case V4L2_PIX_FMT_UYVY:
 	if (vd->buf.bytesused > vd->framesizeIn)
 	    memcpy(vd->framebuffer, vd->mem[vd->buf.index],
 		   (size_t) vd->framesizeIn);

Reply via email to