Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 225367 | Differences between
and this patch

Collapse All | Expand All

(-)a/gui.c (-2 / +14 lines)
Lines 28-33 Link Here
28
#include <sys/stat.h>
28
#include <sys/stat.h>
29
#include <sys/file.h>
29
#include <sys/file.h>
30
#include <string.h>
30
#include <string.h>
31
#include <SDL/SDL.h>
31
32
32
#include "gui.h"
33
#include "gui.h"
33
#include "utils.h"
34
#include "utils.h"
Lines 80-86 Link Here
80
    return 0;
81
    return 0;
81
}
82
}
82
83
83
int creatButt(int width, int height)
84
int creatButt(int width, int height, int sdl_format)
84
{
85
{
85
    int wOrg = 0;
86
    int wOrg = 0;
86
    int hOrg = 0;
87
    int hOrg = 0;
Lines 89-95 Link Here
89
	printf(" alloc jpeg Button fail !!\n");
90
	printf(" alloc jpeg Button fail !!\n");
90
	goto err;
91
	goto err;
91
    }
92
    }
92
    YUYVbutt = (unsigned char *) calloc(1, width * height << 1);
93
    size_t size = width * height << 1;
94
    YUYVbutt = (unsigned char *) calloc(1, size);
93
    if (!YUYVbutt) {
95
    if (!YUYVbutt) {
94
	printf(" alloc Button fail !!\n");
96
	printf(" alloc Button fail !!\n");
95
	goto err;
97
	goto err;
Lines 99-104 Link Here
99
	printf(" resize Button fail !!\n");
101
	printf(" resize Button fail !!\n");
100
	goto err;
102
	goto err;
101
    }
103
    }
104
    if (sdl_format == SDL_UYVY_OVERLAY) {
105
	// byte swap
106
	int i;
107
        char tmp;
108
	for (i=0; i<size; i++) {
109
		tmp = YUYVbutt[i];
110
		YUYVbutt[i++] = YUYVbutt[i];
111
		YUYVbutt[i] = tmp;
112
	}
113
    } 
102
    return 0;
114
    return 0;
103
  err:
115
  err:
104
    exit(0);
116
    exit(0);
(-)a/gui.h (-1 / +1 lines)
Lines 23-27 Link Here
23
23
24
extern unsigned char *YUYVbutt;
24
extern unsigned char *YUYVbutt;
25
25
26
int creatButt(int width, int height);
26
int creatButt(int width, int height, int sdl_format);
27
int destroyButt(void);
27
int destroyButt(void);
(-)a/luvcview.c (-3 / +8 lines)
Lines 220-225 Link Here
220
    const char *videodevice = NULL;
220
    const char *videodevice = NULL;
221
    const char *mode = NULL;
221
    const char *mode = NULL;
222
    int format = V4L2_PIX_FMT_MJPEG;
222
    int format = V4L2_PIX_FMT_MJPEG;
223
    int sdl_format = SDL_YUY2_OVERLAY;
223
    int i;
224
    int i;
224
    int grabmethod = 1;
225
    int grabmethod = 1;
225
    int width = 320;
226
    int width = 320;
Lines 269-274 Link Here
269
	    if (strncmp(mode, "yuv", 3) == 0) {
270
	    if (strncmp(mode, "yuv", 3) == 0) {
270
		format = V4L2_PIX_FMT_YUYV;
271
		format = V4L2_PIX_FMT_YUYV;
271
272
273
		} else if (strncmp(mode, "uyvy", 4) == 0) {
274
		format = V4L2_PIX_FMT_UYVY;
275
		sdl_format = SDL_UYVY_OVERLAY;
276
272
	    } else if (strncmp(mode, "jpg", 3) == 0) {
277
	    } else if (strncmp(mode, "jpg", 3) == 0) {
273
		format = V4L2_PIX_FMT_MJPEG;
278
		format = V4L2_PIX_FMT_MJPEG;
274
279
Lines 345-351 Link Here
345
	    printf("-d	/dev/videoX       use videoX device\n");
350
	    printf("-d	/dev/videoX       use videoX device\n");
346
	    printf("-g	use read method for grab instead mmap \n");
351
	    printf("-g	use read method for grab instead mmap \n");
347
	    printf("-w	disable SDL hardware accel. \n");
352
	    printf("-w	disable SDL hardware accel. \n");
348
	    printf("-f	video format  default jpg  others options are yuv jpg \n");
353
	    printf("-f	video format  default jpg  others options are yuv uyvy jpg \n");
349
	    printf("-i	fps           use specified frame interval \n");
354
	    printf("-i	fps           use specified frame interval \n");
350
	    printf("-s	widthxheight      use specified input size \n");
355
	    printf("-s	widthxheight      use specified input size \n");
351
	    printf("-c	enable raw frame capturing for the first frame\n");
356
	    printf("-c	enable raw frame capturing for the first frame\n");
Lines 447-453 Link Here
447
452
448
    overlay =
453
    overlay =
449
	SDL_CreateYUVOverlay(videoIn->width, videoIn->height + 32,
454
	SDL_CreateYUVOverlay(videoIn->width, videoIn->height + 32,
450
			     SDL_YUY2_OVERLAY, pscreen);
455
			     sdl_format, pscreen);
451
    p = (unsigned char *) overlay->pixels[0];
456
    p = (unsigned char *) overlay->pixels[0];
452
    drect.x = 0;
457
    drect.x = 0;
453
    drect.y = 0;
458
    drect.y = 0;
Lines 466-472 Link Here
466
initLut();
471
initLut();
467
    SDL_WM_SetCaption(title_act[A_VIDEO].title, NULL);
472
    SDL_WM_SetCaption(title_act[A_VIDEO].title, NULL);
468
    lasttime = SDL_GetTicks();
473
    lasttime = SDL_GetTicks();
469
    creatButt(videoIn->width, 32);
474
    creatButt(videoIn->width, 32, sdl_format);
470
    SDL_LockYUVOverlay(overlay);
475
    SDL_LockYUVOverlay(overlay);
471
    memcpy(p + (videoIn->width * (videoIn->height) * 2), YUYVbutt,
476
    memcpy(p + (videoIn->width * (videoIn->height) * 2), YUYVbutt,
472
	   videoIn->width * 64);
477
	   videoIn->width * 64);
(-)a/v4l2uvc.c (+2 lines)
Lines 125-130 Link Here
125
							   8) * 2);
125
							   8) * 2);
126
	break;
126
	break;
127
    case V4L2_PIX_FMT_YUYV:
127
    case V4L2_PIX_FMT_YUYV:
128
    case V4L2_PIX_FMT_UYVY:
128
	vd->framebuffer =
129
	vd->framebuffer =
129
	    (unsigned char *) calloc(1, (size_t) vd->framesizeIn);
130
	    (unsigned char *) calloc(1, (size_t) vd->framesizeIn);
130
	break;
131
	break;
Lines 572-577 Link Here
572
	    printf("bytes in used %d \n", vd->buf.bytesused);
573
	    printf("bytes in used %d \n", vd->buf.bytesused);
573
	break;
574
	break;
574
    case V4L2_PIX_FMT_YUYV:
575
    case V4L2_PIX_FMT_YUYV:
576
    case V4L2_PIX_FMT_UYVY:
575
	if (vd->buf.bytesused > vd->framesizeIn)
577
	if (vd->buf.bytesused > vd->framesizeIn)
576
	    memcpy(vd->framebuffer, vd->mem[vd->buf.index],
578
	    memcpy(vd->framebuffer, vd->mem[vd->buf.index],
577
		   (size_t) vd->framesizeIn);
579
		   (size_t) vd->framesizeIn);

Return to bug 225367