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

Collapse All | Expand All

(-)gyach.orig/src/webcam/gyacheupload-v4l.c (-12 / +35 lines)
Lines 56-61 Link Here
56
 struct video_picture grab_pic;
56
 struct video_picture grab_pic;
57
 struct video_capability grab_cap;
57
 struct video_capability grab_cap;
58
 struct video_mmap grab_buf;
58
 struct video_mmap grab_buf;
59
 static struct video_mbuf mbuf;
60
59
 int grab_fd, grab_size;
61
 int grab_fd, grab_size;
60
 unsigned char *grab_data;
62
 unsigned char *grab_data;
61
 char *pnm_buf=NULL;
63
 char *pnm_buf=NULL;
Lines 66-72 Link Here
66
    everybody else can update theirs from the config window */
68
    everybody else can update theirs from the config window */
67
69
68
int fix_color=1;
70
int fix_color=1;
69
int hue=47104, contrast=65280, brightness=65280, colour=17152;
71
int hue=32767, contrast=32767, brightness=32767, colour=32767;
70
72
71
unsigned char* grab_one(int *, int *);
73
unsigned char* grab_one(int *, int *);
72
int grab_init();
74
int grab_init();
Lines 106-112 Link Here
106
	return;
108
	return;
107
	} 
109
	} 
108
110
109
 current_pixbuf=gdk_pixbuf_new_from_data(grabit,GDK_COLORSPACE_RGB,FALSE,8,320,240,320*grab_pic.depth/8,NULL,NULL);
111
 current_pixbuf=gdk_pixbuf_new_from_data(grabit,GDK_COLORSPACE_RGB,FALSE,8,x,y,x*grab_pic.depth/8,NULL,NULL);
110
112
111
	gtk_image_set_from_pixbuf(GTK_IMAGE(current_image), current_pixbuf);
113
	gtk_image_set_from_pixbuf(GTK_IMAGE(current_image), current_pixbuf);
112
	gdk_pixbuf_unref(current_pixbuf);
114
	gdk_pixbuf_unref(current_pixbuf);
Lines 163-168 Link Here
163
	if (contrast > -1) grab_pic.contrast=contrast;
165
	if (contrast > -1) grab_pic.contrast=contrast;
164
	if (brightness > -1) grab_pic.brightness=brightness;
166
	if (brightness > -1) grab_pic.brightness=brightness;
165
	if (colour > -1) grab_pic.colour=colour;
167
	if (colour > -1) grab_pic.colour=colour;
168
	/* hardcoded... */
169
	grab_pic.depth = 24;
170
	grab_pic.palette = VIDEO_PALETTE_RGB24;
171
166
	if (ioctl(grab_fd, VIDIOCSPICT, &grab_pic) == -1) {
172
	if (ioctl(grab_fd, VIDIOCSPICT, &grab_pic) == -1) {
167
		show_error_dialog("An error occurred at 'ioctl VIDIOCSPICT'.\nCould not set camera properties.");
173
		show_error_dialog("An error occurred at 'ioctl VIDIOCSPICT'.\nCould not set camera properties.");
168
		return; 
174
		return; 
Lines 222-228 Link Here
222
	grab_buf.width  = x;
228
	grab_buf.width  = x;
223
	grab_buf.height = y;
229
	grab_buf.height = y;
224
	grab_size = x * y * w;
230
	grab_size = x * y * w;
225
	grab_data = mmap(0,grab_size,PROT_READ|PROT_WRITE,MAP_SHARED,grab_fd,0);
231
	set_picture();
232
233
	if (ioctl (grab_fd, VIDIOCGMBUF, &mbuf) < 0) {
234
		show_error_dialog("An error occurred at 'ioctl VIDIOCGMBUF'.");
235
		return 0; 
236
		}
237
	printf("frames per capture: %i\n", mbuf.frames);
238
	if ((grab_data = mmap(0, mbuf.size, PROT_READ|PROT_WRITE, MAP_SHARED,
239
						  grab_fd,0)) == MAP_FAILED) {
240
		perror("mmap");
241
		show_error_dialog("An error occurred at 'mmap'.");
242
		return 0;
243
	}
244
245
	/* grab first frame */
246
	if (-1 == ioctl(grab_fd,VIDIOCMCAPTURE,&grab_buf)) {
247
		show_error_dialog("An error occurred at 'ioctl VIDIOCMCAPTURE'.");
248
		return 0; 
249
	}
250
	if (mbuf.frames > 1) grab_buf.frame = 1 - grab_buf.frame;
251
226
	return(1);
252
	return(1);
227
	}
253
	}
228
	
254
	
Lines 239-261 Link Here
239
unsigned char* grab_one(int *width, int *height) {
265
unsigned char* grab_one(int *width, int *height) {
240
	set_picture();
266
	set_picture();
241
267
242
	for (;;) {
243
		if (-1 == ioctl(grab_fd,VIDIOCMCAPTURE,&grab_buf)) {
268
		if (-1 == ioctl(grab_fd,VIDIOCMCAPTURE,&grab_buf)) {
244
			show_error_dialog("An error occurred at 'ioctl VIDIOCMCAPTURE'.");
269
			show_error_dialog("An error occurred at 'ioctl VIDIOCMCAPTURE'.");
245
			return NULL; 
270
			return NULL; 
246
			} else {
271
	}
272
273
	if (mbuf.frames > 1) grab_buf.frame = 1 - grab_buf.frame;
247
				if (-1 == ioctl(grab_fd,VIDIOCSYNC,&grab_buf)) {
274
				if (-1 == ioctl(grab_fd,VIDIOCSYNC,&grab_buf)) {
248
					show_error_dialog("An error occurred at 'ioctl VIDIOCSYNC'.");
275
					show_error_dialog("An error occurred at 'ioctl VIDIOCSYNC'.");
249
					return NULL; 
276
					return NULL; 
250
				} else {
277
	}
251
					if (fix_color) {fix_colour(grab_data, x, y); }
278
	if (fix_color) {fix_colour(grab_data + mbuf.offsets[grab_buf.frame], x, y); }
252
				 	*width  = grab_buf.width;
279
				 	*width  = grab_buf.width;
253
				 	*height = grab_buf.height;
280
				 	*height = grab_buf.height;
254
				 	return grab_data;
281
	return grab_data + mbuf.offsets[grab_buf.frame];
255
			 	}
256
			}
257
			
258
		}
259
}
282
}
260
283
261
284

Return to bug 76127