diff -ru a/gui.c b/gui.c --- a/gui.c 2006-02-07 19:16:39.000000000 +0100 +++ b/gui.c 2008-06-09 20:01:29.000000000 +0200 @@ -28,6 +28,7 @@ #include #include #include +#include #include "gui.h" #include "utils.h" @@ -80,7 +81,7 @@ return 0; } -int creatButt(int width, int height) +int creatButt(int width, int height, int sdl_format) { int wOrg = 0; int hOrg = 0; @@ -89,7 +90,8 @@ printf(" alloc jpeg Button fail !!\n"); goto err; } - YUYVbutt = (unsigned char *) calloc(1, width * height << 1); + size_t size = width * height << 1; + YUYVbutt = (unsigned char *) calloc(1, size); if (!YUYVbutt) { printf(" alloc Button fail !!\n"); goto err; @@ -99,6 +101,16 @@ printf(" resize Button fail !!\n"); goto err; } + if (sdl_format == SDL_UYVY_OVERLAY) { + // byte swap + int i; + char tmp; + for (i=0; iwidth, videoIn->height + 32, - SDL_YUY2_OVERLAY, pscreen); + sdl_format, pscreen); p = (unsigned char *) overlay->pixels[0]; drect.x = 0; drect.y = 0; @@ -466,7 +471,7 @@ initLut(); SDL_WM_SetCaption(title_act[A_VIDEO].title, NULL); lasttime = SDL_GetTicks(); - creatButt(videoIn->width, 32); + creatButt(videoIn->width, 32, sdl_format); SDL_LockYUVOverlay(overlay); memcpy(p + (videoIn->width * (videoIn->height) * 2), YUYVbutt, videoIn->width * 64); diff -ru a/v4l2uvc.c b/v4l2uvc.c --- a/v4l2uvc.c 2007-05-08 17:39:40.000000000 +0200 +++ b/v4l2uvc.c 2008-06-09 19:20:47.000000000 +0200 @@ -125,6 +125,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; @@ -572,6 +573,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);