Lines 66-72
Link Here
|
66 |
everybody else can update theirs from the config window */ |
66 |
everybody else can update theirs from the config window */ |
67 |
|
67 |
|
68 |
int fix_color=1; |
68 |
int fix_color=1; |
69 |
int hue=47104, contrast=65280, brightness=65280, colour=17152; |
69 |
int hue=32767, contrast=32767, brightness=32767, colour=32767; |
70 |
|
70 |
|
71 |
unsigned char* grab_one(int *, int *); |
71 |
unsigned char* grab_one(int *, int *); |
72 |
int grab_init(); |
72 |
int grab_init(); |
Lines 163-168
Link Here
|
163 |
if (contrast > -1) grab_pic.contrast=contrast; |
163 |
if (contrast > -1) grab_pic.contrast=contrast; |
164 |
if (brightness > -1) grab_pic.brightness=brightness; |
164 |
if (brightness > -1) grab_pic.brightness=brightness; |
165 |
if (colour > -1) grab_pic.colour=colour; |
165 |
if (colour > -1) grab_pic.colour=colour; |
|
|
166 |
/* hardcoded... */ |
167 |
grab_pic.depth = 24; |
168 |
grab_pic.palette = VIDEO_PALETTE_RGB24; |
169 |
|
166 |
if (ioctl(grab_fd, VIDIOCSPICT, &grab_pic) == -1) { |
170 |
if (ioctl(grab_fd, VIDIOCSPICT, &grab_pic) == -1) { |
167 |
show_error_dialog("An error occurred at 'ioctl VIDIOCSPICT'.\nCould not set camera properties."); |
171 |
show_error_dialog("An error occurred at 'ioctl VIDIOCSPICT'.\nCould not set camera properties."); |
168 |
return; |
172 |
return; |
Lines 189-194
Link Here
|
189 |
|
193 |
|
190 |
|
194 |
|
191 |
int grab_init() { |
195 |
int grab_init() { |
|
|
196 |
static struct video_mbuf mbuf; |
192 |
if ((grab_fd = open(v_device,O_RDWR)) == -1 ) { |
197 |
if ((grab_fd = open(v_device,O_RDWR)) == -1 ) { |
193 |
show_error_dialog("Could not open Video4Linux device.\nThe device may already be in use."); |
198 |
show_error_dialog("Could not open Video4Linux device.\nThe device may already be in use."); |
194 |
return 0; |
199 |
return 0; |
Lines 206-212
Link Here
|
206 |
return 0; |
211 |
return 0; |
207 |
} |
212 |
} |
208 |
|
213 |
|
209 |
|
|
|
210 |
/* The line below cannot work: we must force use of RGB24 for |
214 |
/* The line below cannot work: we must force use of RGB24 for |
211 |
PNM image creation */ |
215 |
PNM image creation */ |
212 |
/* grab_buf.format=grab_pic.palette; */ |
216 |
/* grab_buf.format=grab_pic.palette; */ |
Lines 222-228
Link Here
|
222 |
grab_buf.width = x; |
226 |
grab_buf.width = x; |
223 |
grab_buf.height = y; |
227 |
grab_buf.height = y; |
224 |
grab_size = x * y * w; |
228 |
grab_size = x * y * w; |
225 |
grab_data = mmap(0,grab_size,PROT_READ|PROT_WRITE,MAP_SHARED,grab_fd,0); |
229 |
set_picture(); |
|
|
230 |
|
231 |
if (ioctl (grab_fd, VIDIOCGMBUF, &mbuf) < 0) { |
232 |
show_error_dialog("An error occurred at 'ioctl VIDIOCGMBUF'."); |
233 |
return 0; |
234 |
} |
235 |
if ((grab_data = mmap(0, mbuf.size, PROT_READ|PROT_WRITE, MAP_SHARED, |
236 |
grab_fd,0)) == MAP_FAILED) { |
237 |
perror("mmap"); |
238 |
show_error_dialog("An error occurred at 'mmap'."); |
239 |
return 0; |
240 |
} |
226 |
return(1); |
241 |
return(1); |
227 |
} |
242 |
} |
228 |
|
243 |
|