1 |
lu_zero 11/11/18 11:15:22 |
2 |
|
3 |
Modified: guvcview-1.5.1-loops.patch |
4 |
Log: |
5 |
Trim away cosmetics |
6 |
|
7 |
(Portage version: 2.1.10.35/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.2 media-video/guvcview/files/guvcview-1.5.1-loops.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/guvcview/files/guvcview-1.5.1-loops.patch?rev=1.2&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/guvcview/files/guvcview-1.5.1-loops.patch?rev=1.2&content-type=text/plain |
14 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-video/guvcview/files/guvcview-1.5.1-loops.patch?r1=1.1&r2=1.2 |
15 |
|
16 |
Index: guvcview-1.5.1-loops.patch |
17 |
=================================================================== |
18 |
RCS file: /var/cvsroot/gentoo-x86/media-video/guvcview/files/guvcview-1.5.1-loops.patch,v |
19 |
retrieving revision 1.1 |
20 |
retrieving revision 1.2 |
21 |
diff -u -r1.1 -r1.2 |
22 |
--- guvcview-1.5.1-loops.patch 18 Nov 2011 11:02:35 -0000 1.1 |
23 |
+++ guvcview-1.5.1-loops.patch 18 Nov 2011 11:15:22 -0000 1.2 |
24 |
@@ -1,935 +1,22 @@ |
25 |
---- guvcview-src-1.5.1.orig/src/v4l2_controls.c 2011-11-18 11:42:46.213631997 +0100 |
26 |
-+++ guvcview-src-1.5.1/src/v4l2_controls.c 2011-11-18 11:46:06.978623600 +0100 |
27 |
-@@ -39,22 +39,22 @@ |
28 |
- #include "v4l2_dyna_ctrls.h" |
29 |
- #include "callbacks.h" |
30 |
- |
31 |
--/* |
32 |
-+/* |
33 |
- * don't use xioctl for control query when using V4L2_CTRL_FLAG_NEXT_CTRL |
34 |
- */ |
35 |
- static int query_ioctl(int hdevice, int current_ctrl, struct v4l2_queryctrl *ctrl) |
36 |
- { |
37 |
- int ret = 0; |
38 |
- int tries = 4; |
39 |
-- do |
40 |
-+ do |
41 |
- { |
42 |
-- if(ret) |
43 |
-+ if(ret) |
44 |
- ctrl->id = current_ctrl | V4L2_CTRL_FLAG_NEXT_CTRL; |
45 |
- ret = v4l2_ioctl(hdevice, VIDIOC_QUERYCTRL, ctrl); |
46 |
-- } |
47 |
-+ } |
48 |
- while (ret && tries-- && |
49 |
- ((errno == EIO || errno == EPIPE || errno == ETIMEDOUT))); |
50 |
-- |
51 |
-+ |
52 |
- return(ret); |
53 |
- } |
54 |
- |
55 |
-@@ -88,27 +88,27 @@ |
56 |
- Control *first = NULL; |
57 |
- Control *current = NULL; |
58 |
- Control *control = NULL; |
59 |
-- |
60 |
-+ |
61 |
- int n = 0; |
62 |
- struct v4l2_queryctrl queryctrl={0}; |
63 |
- struct v4l2_querymenu querymenu={0}; |
64 |
- |
65 |
- int currentctrl = 0; |
66 |
- queryctrl.id = 0 | V4L2_CTRL_FLAG_NEXT_CTRL; |
67 |
-- |
68 |
-- if ((ret=query_ioctl (hdevice, currentctrl, &queryctrl)) == 0) |
69 |
-+ |
70 |
-+ if ((ret=query_ioctl (hdevice, currentctrl, &queryctrl)) == 0) |
71 |
- { |
72 |
- // The driver supports the V4L2_CTRL_FLAG_NEXT_CTRL flag |
73 |
- queryctrl.id = 0; |
74 |
- currentctrl= queryctrl.id; |
75 |
- queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; |
76 |
- |
77 |
-- while((ret = query_ioctl(hdevice, currentctrl, &queryctrl)), ret ? errno != EINVAL : 1) |
78 |
-+ while((ret = query_ioctl(hdevice, currentctrl, &queryctrl)), ret ? errno != EINVAL : 1) |
79 |
- { |
80 |
- struct v4l2_querymenu *menu = NULL; |
81 |
-- |
82 |
-+ |
83 |
- // Prevent infinite loop for buggy V4L2_CTRL_FLAG_NEXT_CTRL implementations |
84 |
-- if(ret && queryctrl.id <= currentctrl) |
85 |
-+ if(ret && queryctrl.id <= currentctrl) |
86 |
- { |
87 |
- printf("buggy V4L2_CTRL_FLAG_NEXT_CTRL flag implementation (workaround enabled)\n"); |
88 |
- // increment the control id manually |
89 |
-@@ -118,13 +118,13 @@ |
90 |
- } |
91 |
- else if ((queryctrl.id == V4L2_CTRL_FLAG_NEXT_CTRL) || (!ret && queryctrl.id == currentctrl)) |
92 |
- { |
93 |
-- printf("buggy V4L2_CTRL_FLAG_NEXT_CTRL flag implementation (failed enumeration for id=0x%08x)\n", |
94 |
-+ printf("buggy V4L2_CTRL_FLAG_NEXT_CTRL flag implementation (failed enumeration for id=0x%08x)\n", |
95 |
- queryctrl.id); |
96 |
- // stop control enumeration |
97 |
- *num_ctrls = n; |
98 |
- return first; |
99 |
- } |
100 |
-- |
101 |
-+ |
102 |
- currentctrl = queryctrl.id; |
103 |
- // skip if control failed |
104 |
- if (ret) |
105 |
-@@ -132,14 +132,14 @@ |
106 |
- printf("Control 0x%08x failed to query\n", queryctrl.id); |
107 |
- goto next_control; |
108 |
- } |
109 |
-- |
110 |
-+ |
111 |
- // skip if control is disabled |
112 |
- if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) |
113 |
- { |
114 |
- printf("Disabling control 0x%08x\n", queryctrl.id); |
115 |
- goto next_control; |
116 |
- } |
117 |
-- |
118 |
-+ |
119 |
- //check menu items if needed |
120 |
- if(queryctrl.type == V4L2_CTRL_TYPE_MENU) |
121 |
- { |
122 |
-@@ -147,18 +147,18 @@ |
123 |
- int ret = 0; |
124 |
- for (querymenu.index = queryctrl.minimum; |
125 |
- querymenu.index <= queryctrl.maximum; |
126 |
-- querymenu.index++) |
127 |
-+ querymenu.index++) |
128 |
- { |
129 |
- querymenu.id = queryctrl.id; |
130 |
- ret = xioctl (hdevice, VIDIOC_QUERYMENU, &querymenu); |
131 |
- if (ret < 0) |
132 |
-- continue; |
133 |
-- |
134 |
-+ continue; |
135 |
-+ |
136 |
- if(!menu) |
137 |
- menu = g_new0(struct v4l2_querymenu, i+1); |
138 |
- else |
139 |
-- menu = g_renew(struct v4l2_querymenu, menu, i+1); |
140 |
-- |
141 |
-+ menu = g_renew(struct v4l2_querymenu, menu, i+1); |
142 |
-+ |
143 |
- memcpy(&(menu[i]), &querymenu, sizeof(struct v4l2_querymenu)); |
144 |
- i++; |
145 |
- } |
146 |
-@@ -166,26 +166,26 @@ |
147 |
- menu = g_new0(struct v4l2_querymenu, i+1); |
148 |
- else |
149 |
- menu = g_renew(struct v4l2_querymenu, menu, i+1); |
150 |
-- |
151 |
-+ |
152 |
- menu[i].id = querymenu.id; |
153 |
- menu[i].index = queryctrl.maximum+1; |
154 |
- menu[i].name[0] = 0; |
155 |
- } |
156 |
-- |
157 |
-+ |
158 |
- // Add the control to the linked list |
159 |
- control = calloc (1, sizeof(Control)); |
160 |
- memcpy(&(control->control), &queryctrl, sizeof(struct v4l2_queryctrl)); |
161 |
- control->class = (control->control.id & 0xFFFF0000); |
162 |
- //add the menu adress (NULL if not a menu) |
163 |
- control->menu = menu; |
164 |
--#ifndef DISABLE_STRING_CONTROLS |
165 |
-+#ifndef DISABLE_STRING_CONTROLS |
166 |
- //allocate a string with max size if needed |
167 |
- if(control->control.type == V4L2_CTRL_TYPE_STRING) |
168 |
- control->string = calloc(control->control.maximum + 1, sizeof(char)); |
169 |
- else |
170 |
- #endif |
171 |
- control->string = NULL; |
172 |
-- |
173 |
-+ |
174 |
- if(first != NULL) |
175 |
- { |
176 |
- current->next = control; |
177 |
-@@ -196,9 +196,9 @@ |
178 |
- first = control; |
179 |
- current = first; |
180 |
- } |
181 |
-- |
182 |
-+ |
183 |
- n++; |
184 |
-- |
185 |
-+ |
186 |
- next_control: |
187 |
- queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; |
188 |
- } |
189 |
-@@ -207,15 +207,15 @@ |
190 |
- { |
191 |
- printf("NEXT_CTRL flag not supported\n"); |
192 |
- int currentctrl; |
193 |
-- for(currentctrl = V4L2_CID_BASE; currentctrl < V4L2_CID_LASTP1; currentctrl++) |
194 |
-+ for(currentctrl = V4L2_CID_BASE; currentctrl < V4L2_CID_LASTP1; currentctrl++) |
195 |
- { |
196 |
- struct v4l2_querymenu *menu = NULL; |
197 |
- queryctrl.id = currentctrl; |
198 |
- ret = xioctl(hdevice, VIDIOC_QUERYCTRL, &queryctrl); |
199 |
-- |
200 |
-+ |
201 |
- if (ret || (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) ) |
202 |
- continue; |
203 |
-- |
204 |
-+ |
205 |
- //check menu items if needed |
206 |
- if(queryctrl.type == V4L2_CTRL_TYPE_MENU) |
207 |
- { |
208 |
-@@ -223,18 +223,18 @@ |
209 |
- int ret = 0; |
210 |
- for (querymenu.index = queryctrl.minimum; |
211 |
- querymenu.index <= queryctrl.maximum; |
212 |
-- querymenu.index++) |
213 |
-+ querymenu.index++) |
214 |
- { |
215 |
- querymenu.id = queryctrl.id; |
216 |
- ret = xioctl (hdevice, VIDIOC_QUERYMENU, &querymenu); |
217 |
- if (ret < 0) |
218 |
-- break; |
219 |
-- |
220 |
-+ break; |
221 |
-+ |
222 |
- if(!menu) |
223 |
- menu = g_new0(struct v4l2_querymenu, i+1); |
224 |
- else |
225 |
-- menu = g_renew(struct v4l2_querymenu, menu, i+1); |
226 |
-- |
227 |
-+ menu = g_renew(struct v4l2_querymenu, menu, i+1); |
228 |
-+ |
229 |
- memcpy(&(menu[i]), &querymenu, sizeof(struct v4l2_querymenu)); |
230 |
- i++; |
231 |
- } |
232 |
-@@ -242,21 +242,21 @@ |
233 |
- menu = g_new0(struct v4l2_querymenu, i+1); |
234 |
- else |
235 |
- menu = g_renew(struct v4l2_querymenu, menu, i+1); |
236 |
-- |
237 |
-+ |
238 |
- menu[i].id = querymenu.id; |
239 |
- menu[i].index = queryctrl.maximum+1; |
240 |
- menu[i].name[0] = 0; |
241 |
-- |
242 |
-+ |
243 |
- } |
244 |
-- |
245 |
-+ |
246 |
- // Add the control to the linked list |
247 |
- control = calloc (1, sizeof(Control)); |
248 |
- memcpy(&(control->control), &queryctrl, sizeof(struct v4l2_queryctrl)); |
249 |
-- |
250 |
-+ |
251 |
- control->class = 0x00980000; |
252 |
- //add the menu adress (NULL if not a menu) |
253 |
- control->menu = menu; |
254 |
-- |
255 |
-+ |
256 |
- if(first != NULL) |
257 |
- { |
258 |
- current->next = control; |
259 |
-@@ -267,11 +267,11 @@ |
260 |
- first = control; |
261 |
- current = first; |
262 |
- } |
263 |
-- |
264 |
-+ |
265 |
- n++; |
266 |
- } |
267 |
-- |
268 |
-- for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;queryctrl.id++) |
269 |
-+ |
270 |
-+ for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;queryctrl.id++) |
271 |
- { |
272 |
- struct v4l2_querymenu *menu = NULL; |
273 |
- ret = xioctl(hdevice, VIDIOC_QUERYCTRL, &queryctrl); |
274 |
-@@ -279,7 +279,7 @@ |
275 |
- break; |
276 |
- else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) |
277 |
- continue; |
278 |
-- |
279 |
-+ |
280 |
- //check menu items if needed |
281 |
- if(queryctrl.type == V4L2_CTRL_TYPE_MENU) |
282 |
- { |
283 |
-@@ -287,18 +287,18 @@ |
284 |
- int ret = 0; |
285 |
- for (querymenu.index = queryctrl.minimum; |
286 |
- querymenu.index <= queryctrl.maximum; |
287 |
-- querymenu.index++) |
288 |
-+ querymenu.index++) |
289 |
- { |
290 |
- querymenu.id = queryctrl.id; |
291 |
- ret = xioctl (hdevice, VIDIOC_QUERYMENU, &querymenu); |
292 |
- if (ret < 0) |
293 |
-- break; |
294 |
-- |
295 |
-+ break; |
296 |
-+ |
297 |
- if(!menu) |
298 |
- menu = g_new0(struct v4l2_querymenu, i+1); |
299 |
- else |
300 |
-- menu = g_renew(struct v4l2_querymenu, menu, i+1); |
301 |
-- |
302 |
-+ menu = g_renew(struct v4l2_querymenu, menu, i+1); |
303 |
-+ |
304 |
- memcpy(&(menu[i]), &querymenu, sizeof(struct v4l2_querymenu)); |
305 |
- i++; |
306 |
- } |
307 |
-@@ -306,19 +306,19 @@ |
308 |
- menu = g_new0(struct v4l2_querymenu, i+1); |
309 |
- else |
310 |
- menu = g_renew(struct v4l2_querymenu, menu, i+1); |
311 |
-- |
312 |
-+ |
313 |
- menu[i].id = querymenu.id; |
314 |
- menu[i].index = queryctrl.maximum+1; |
315 |
- menu[i].name[0] = 0; |
316 |
- } |
317 |
-- |
318 |
-+ |
319 |
- // Add the control to the linked list |
320 |
- control = calloc (1, sizeof(Control)); |
321 |
- memcpy(&(control->control), &queryctrl, sizeof(struct v4l2_queryctrl)); |
322 |
- control->class = 0x00980000; |
323 |
- //add the menu adress (NULL if not a menu) |
324 |
- control->menu = menu; |
325 |
-- |
326 |
-+ |
327 |
- if(first != NULL) |
328 |
- { |
329 |
- current->next = control; |
330 |
-@@ -333,7 +333,7 @@ |
331 |
- n++; |
332 |
- } |
333 |
- } |
334 |
-- |
335 |
-+ |
336 |
- *num_ctrls = n; |
337 |
- return first; |
338 |
- } |
339 |
-@@ -342,85 +342,85 @@ |
340 |
- * called when setting controls |
341 |
- */ |
342 |
- static void update_ctrl_flags(Control *control_list, int id) |
343 |
--{ |
344 |
-- switch (id) |
345 |
-+{ |
346 |
-+ switch (id) |
347 |
- { |
348 |
- case V4L2_CID_EXPOSURE_AUTO: |
349 |
- { |
350 |
- Control *ctrl_this = get_ctrl_by_id(control_list, id ); |
351 |
- if(ctrl_this == NULL) |
352 |
- break; |
353 |
-- |
354 |
-- switch (ctrl_this->value) |
355 |
-+ |
356 |
-+ switch (ctrl_this->value) |
357 |
- { |
358 |
- case V4L2_EXPOSURE_AUTO: |
359 |
- { |
360 |
- //printf("auto\n"); |
361 |
-- Control *ctrl_that = get_ctrl_by_id(control_list, |
362 |
-+ Control *ctrl_that = get_ctrl_by_id(control_list, |
363 |
- V4L2_CID_IRIS_ABSOLUTE ); |
364 |
- if (ctrl_that) |
365 |
- ctrl_that->control.flags |= V4L2_CTRL_FLAG_GRABBED; |
366 |
-- |
367 |
-- ctrl_that = get_ctrl_by_id(control_list, |
368 |
-+ |
369 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
370 |
- V4L2_CID_IRIS_RELATIVE ); |
371 |
- if (ctrl_that) |
372 |
- ctrl_that->control.flags |= V4L2_CTRL_FLAG_GRABBED; |
373 |
-- ctrl_that = get_ctrl_by_id(control_list, |
374 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
375 |
- V4L2_CID_EXPOSURE_ABSOLUTE ); |
376 |
- if (ctrl_that) |
377 |
- ctrl_that->control.flags |= V4L2_CTRL_FLAG_GRABBED; |
378 |
- } |
379 |
- break; |
380 |
-- |
381 |
-+ |
382 |
- case V4L2_EXPOSURE_APERTURE_PRIORITY: |
383 |
- { |
384 |
- //printf("AP\n"); |
385 |
-- Control *ctrl_that = get_ctrl_by_id(control_list, |
386 |
-+ Control *ctrl_that = get_ctrl_by_id(control_list, |
387 |
- V4L2_CID_EXPOSURE_ABSOLUTE ); |
388 |
- if (ctrl_that) |
389 |
- ctrl_that->control.flags |= V4L2_CTRL_FLAG_GRABBED; |
390 |
-- ctrl_that = get_ctrl_by_id(control_list, |
391 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
392 |
- V4L2_CID_IRIS_ABSOLUTE ); |
393 |
- if (ctrl_that) |
394 |
- ctrl_that->control.flags &= !(V4L2_CTRL_FLAG_GRABBED); |
395 |
-- ctrl_that = get_ctrl_by_id(control_list, |
396 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
397 |
- V4L2_CID_IRIS_RELATIVE ); |
398 |
- if (ctrl_that) |
399 |
- ctrl_that->control.flags &= !(V4L2_CTRL_FLAG_GRABBED); |
400 |
- } |
401 |
- break; |
402 |
-- |
403 |
-+ |
404 |
- case V4L2_EXPOSURE_SHUTTER_PRIORITY: |
405 |
- { |
406 |
- //printf("SP\n"); |
407 |
-- Control *ctrl_that = get_ctrl_by_id(control_list, |
408 |
-+ Control *ctrl_that = get_ctrl_by_id(control_list, |
409 |
- V4L2_CID_IRIS_ABSOLUTE ); |
410 |
- if (ctrl_that) |
411 |
- ctrl_that->control.flags |= V4L2_CTRL_FLAG_GRABBED; |
412 |
-- |
413 |
-- ctrl_that = get_ctrl_by_id(control_list, |
414 |
-+ |
415 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
416 |
- V4L2_CID_IRIS_RELATIVE ); |
417 |
- if (ctrl_that) |
418 |
- ctrl_that->control.flags |= V4L2_CTRL_FLAG_GRABBED; |
419 |
-- ctrl_that = get_ctrl_by_id(control_list, |
420 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
421 |
- V4L2_CID_EXPOSURE_ABSOLUTE ); |
422 |
- if (ctrl_that) |
423 |
- ctrl_that->control.flags &= !(V4L2_CTRL_FLAG_GRABBED); |
424 |
- } |
425 |
- break; |
426 |
-- |
427 |
-+ |
428 |
- default: |
429 |
- { |
430 |
- //printf("manual\n"); |
431 |
-- Control *ctrl_that = get_ctrl_by_id(control_list, |
432 |
-+ Control *ctrl_that = get_ctrl_by_id(control_list, |
433 |
- V4L2_CID_EXPOSURE_ABSOLUTE ); |
434 |
- if (ctrl_that) |
435 |
- ctrl_that->control.flags &= !(V4L2_CTRL_FLAG_GRABBED); |
436 |
-- ctrl_that = get_ctrl_by_id(control_list, |
437 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
438 |
- V4L2_CID_IRIS_ABSOLUTE ); |
439 |
- if (ctrl_that) |
440 |
- ctrl_that->control.flags &= !(V4L2_CTRL_FLAG_GRABBED); |
441 |
-- ctrl_that = get_ctrl_by_id(control_list, |
442 |
-+ ctrl_that = get_ctrl_by_id(control_list, |
443 |
- V4L2_CID_IRIS_RELATIVE ); |
444 |
- if (ctrl_that) |
445 |
- ctrl_that->control.flags &= !(V4L2_CTRL_FLAG_GRABBED); |
446 |
-@@ -435,13 +435,13 @@ |
447 |
- Control *ctrl_this = get_ctrl_by_id(control_list, id ); |
448 |
- if(ctrl_this == NULL) |
449 |
- break; |
450 |
-- if(ctrl_this->value > 0) |
451 |
-+ if(ctrl_this->value > 0) |
452 |
- { |
453 |
- Control *ctrl_that = get_ctrl_by_id(control_list, |
454 |
- V4L2_CID_FOCUS_ABSOLUTE); |
455 |
- if (ctrl_that) |
456 |
- ctrl_that->control.flags |= V4L2_CTRL_FLAG_GRABBED; |
457 |
-- |
458 |
-+ |
459 |
- ctrl_that = get_ctrl_by_id(control_list, |
460 |
- V4L2_CID_FOCUS_RELATIVE); |
461 |
- if (ctrl_that) |
462 |
-@@ -453,7 +453,7 @@ |
463 |
- V4L2_CID_FOCUS_ABSOLUTE); |
464 |
- if (ctrl_that) |
465 |
- ctrl_that->control.flags &= !(V4L2_CTRL_FLAG_GRABBED); |
466 |
-- |
467 |
-+ |
468 |
- ctrl_that = get_ctrl_by_id(control_list, |
469 |
- V4L2_CID_FOCUS_RELATIVE); |
470 |
- if (ctrl_that) |
471 |
-@@ -461,13 +461,13 @@ |
472 |
- } |
473 |
- } |
474 |
- break; |
475 |
-- |
476 |
-+ |
477 |
- case V4L2_CID_HUE_AUTO: |
478 |
- { |
479 |
- Control *ctrl_this = get_ctrl_by_id(control_list, id ); |
480 |
- if(ctrl_this == NULL) |
481 |
- break; |
482 |
-- if(ctrl_this->value > 0) |
483 |
-+ if(ctrl_this->value > 0) |
484 |
- { |
485 |
- Control *ctrl_that = get_ctrl_by_id(control_list, |
486 |
- V4L2_CID_HUE); |
487 |
-@@ -489,7 +489,7 @@ |
488 |
- Control *ctrl_this = get_ctrl_by_id(control_list, id ); |
489 |
- if(ctrl_this == NULL) |
490 |
- break; |
491 |
-- |
492 |
-+ |
493 |
- if(ctrl_this->value > 0) |
494 |
- { |
495 |
- Control *ctrl_that = get_ctrl_by_id(control_list, |
496 |
-@@ -533,11 +533,11 @@ |
497 |
- Control *current = control_list; |
498 |
- Control *next = current->next; |
499 |
- int done = 0; |
500 |
-- |
501 |
-+ |
502 |
- while(!done) |
503 |
- { |
504 |
- update_ctrl_flags(control_list, current->control.id); |
505 |
-- |
506 |
-+ |
507 |
- if(next == NULL) |
508 |
- done = 1; |
509 |
- else |
510 |
-@@ -579,7 +579,7 @@ |
511 |
- g_signal_handlers_block_by_func(GTK_TOGGLE_BUTTON(current->widget), |
512 |
- G_CALLBACK (check_changed), all_data); |
513 |
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (current->widget), |
514 |
-- current->value ? TRUE : FALSE); |
515 |
-+ current->value ? TRUE : FALSE); |
516 |
- //enable widget signals |
517 |
- g_signal_handlers_unblock_by_func(GTK_TOGGLE_BUTTON(current->widget), |
518 |
- G_CALLBACK (check_changed), all_data); |
519 |
-@@ -588,20 +588,20 @@ |
520 |
- if(!(is_special_case_control(current->control.id))) |
521 |
- { |
522 |
- //disable widget signals |
523 |
-- g_signal_handlers_block_by_func(GTK_SCALE (current->widget), |
524 |
-+ g_signal_handlers_block_by_func(GTK_SCALE (current->widget), |
525 |
- G_CALLBACK (slider_changed), all_data); |
526 |
- gtk_range_set_value (GTK_RANGE (current->widget), current->value); |
527 |
-- //enable widget signals |
528 |
-- g_signal_handlers_unblock_by_func(GTK_SCALE (current->widget), |
529 |
-+ //enable widget signals |
530 |
-+ g_signal_handlers_unblock_by_func(GTK_SCALE (current->widget), |
531 |
- G_CALLBACK (slider_changed), all_data); |
532 |
- if(current->spinbutton) |
533 |
-- { |
534 |
-+ { |
535 |
- //disable widget signals |
536 |
-- g_signal_handlers_block_by_func(GTK_SPIN_BUTTON(current->spinbutton), |
537 |
-- G_CALLBACK (spin_changed), all_data); |
538 |
-+ g_signal_handlers_block_by_func(GTK_SPIN_BUTTON(current->spinbutton), |
539 |
-+ G_CALLBACK (spin_changed), all_data); |
540 |
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(current->spinbutton), current->value); |
541 |
- //enable widget signals |
542 |
-- g_signal_handlers_unblock_by_func(GTK_SPIN_BUTTON(current->spinbutton), |
543 |
-+ g_signal_handlers_unblock_by_func(GTK_SPIN_BUTTON(current->spinbutton), |
544 |
- G_CALLBACK (spin_changed), all_data); |
545 |
- } |
546 |
- } |
547 |
-@@ -609,27 +609,27 @@ |
548 |
- case V4L2_CTRL_TYPE_MENU: |
549 |
- { |
550 |
- //disable widget signals |
551 |
-- g_signal_handlers_block_by_func(GTK_COMBO_BOX_TEXT(current->widget), |
552 |
-+ g_signal_handlers_block_by_func(GTK_COMBO_BOX_TEXT(current->widget), |
553 |
- G_CALLBACK (combo_changed), all_data); |
554 |
- //get new index |
555 |
- int j = 0; |
556 |
- int def = 0; |
557 |
-- for (j = 0; current->menu[j].index <= current->control.maximum; j++) |
558 |
-+ for (j = 0; current->menu[j].index <= current->control.maximum; j++) |
559 |
- { |
560 |
- if(current->value == current->menu[j].index) |
561 |
- def = j; |
562 |
- } |
563 |
-- |
564 |
-+ |
565 |
- gtk_combo_box_set_active(GTK_COMBO_BOX(current->widget), def); |
566 |
-- //enable widget signals |
567 |
-- g_signal_handlers_unblock_by_func(GTK_COMBO_BOX_TEXT(current->widget), |
568 |
-+ //enable widget signals |
569 |
-+ g_signal_handlers_unblock_by_func(GTK_COMBO_BOX_TEXT(current->widget), |
570 |
- G_CALLBACK (combo_changed), all_data); |
571 |
- break; |
572 |
- } |
573 |
- default: |
574 |
- break; |
575 |
- } |
576 |
-- } |
577 |
-+ } |
578 |
- if((current->control.flags & V4L2_CTRL_FLAG_GRABBED) || |
579 |
- (current->control.flags & V4L2_CTRL_FLAG_DISABLED)) |
580 |
- { |
581 |
-@@ -649,7 +649,7 @@ |
582 |
- if(current->spinbutton) |
583 |
- gtk_widget_set_sensitive (current->spinbutton, TRUE); |
584 |
- } |
585 |
-- |
586 |
-+ |
587 |
- if(next == NULL) |
588 |
- done = 1; |
589 |
- else |
590 |
-@@ -663,26 +663,26 @@ |
591 |
- /* |
592 |
- * creates the control associated widgets for all controls in the list |
593 |
- */ |
594 |
-- |
595 |
-+ |
596 |
- void create_control_widgets(Control *control_list, void *all_data, int control_only, int verbose) |
597 |
--{ |
598 |
-+{ |
599 |
- struct ALL_DATA *data = (struct ALL_DATA *) all_data; |
600 |
- struct vdIn *videoIn = data->videoIn; |
601 |
- Control *current = control_list; |
602 |
- Control *next = current->next; |
603 |
- int done = 0; |
604 |
- int i = 0; |
605 |
-- |
606 |
-+ |
607 |
- while(!done) |
608 |
- { |
609 |
-- if (verbose) |
610 |
-+ if (verbose) |
611 |
- { |
612 |
- g_printf("control[%d]: 0x%x",i ,current->control.id); |
613 |
- g_printf (" %s, %d:%d:%d, default %d\n", current->control.name, |
614 |
- current->control.minimum, current->control.maximum, current->control.step, |
615 |
- current->control.default_value); |
616 |
- } |
617 |
-- |
618 |
-+ |
619 |
- if(!current->control.step) current->control.step = 1; |
620 |
- gchar *tmp; |
621 |
- tmp = g_strdup_printf ("%s:", gettext((char *) current->control.name)); |
622 |
-@@ -690,10 +690,10 @@ |
623 |
- g_free(tmp); |
624 |
- gtk_widget_show (current->label); |
625 |
- gtk_misc_set_alignment (GTK_MISC (current->label), 1, 0.5); |
626 |
-- |
627 |
-+ |
628 |
- switch(current->control.type) |
629 |
- { |
630 |
--#ifndef DISABLE_STRING_CONTROLS |
631 |
-+#ifndef DISABLE_STRING_CONTROLS |
632 |
- case V4L2_CTRL_TYPE_STRING: |
633 |
- //text box and set button |
634 |
- break; |
635 |
-@@ -701,20 +701,20 @@ |
636 |
- case V4L2_CTRL_TYPE_INTEGER64: |
637 |
- //slider |
638 |
- break; |
639 |
-- |
640 |
-+ |
641 |
- case V4L2_CTRL_TYPE_BUTTON: |
642 |
- { |
643 |
- current->widget = gtk_button_new_with_label(" "); |
644 |
- gtk_widget_show (current->widget); |
645 |
-- |
646 |
-- g_object_set_data (G_OBJECT (current->widget), "control_info", |
647 |
-+ |
648 |
-+ g_object_set_data (G_OBJECT (current->widget), "control_info", |
649 |
- GINT_TO_POINTER(current->control.id)); |
650 |
-- |
651 |
-+ |
652 |
- g_signal_connect (GTK_BUTTON(current->widget), "clicked", |
653 |
- G_CALLBACK (button_clicked), all_data); |
654 |
- } |
655 |
- break; |
656 |
-- |
657 |
-+ |
658 |
- case V4L2_CTRL_TYPE_INTEGER: |
659 |
- { |
660 |
- switch (current->control.id) |
661 |
-@@ -737,47 +737,47 @@ |
662 |
- PanTilt1 = gtk_button_new_with_label(_("Down")); |
663 |
- PanTilt2 = gtk_button_new_with_label(_("Up")); |
664 |
- } |
665 |
-- |
666 |
-+ |
667 |
- gtk_widget_show (PanTilt1); |
668 |
- gtk_widget_show (PanTilt2); |
669 |
- gtk_box_pack_start(GTK_BOX(current->widget),PanTilt1,TRUE,TRUE,2); |
670 |
- gtk_box_pack_start(GTK_BOX(current->widget),PanTilt2,TRUE,TRUE,2); |
671 |
-- |
672 |
-- g_object_set_data (G_OBJECT (PanTilt1), "control_info", |
673 |
-+ |
674 |
-+ g_object_set_data (G_OBJECT (PanTilt1), "control_info", |
675 |
- GINT_TO_POINTER(current->control.id)); |
676 |
-- g_object_set_data (G_OBJECT (PanTilt2), "control_info", |
677 |
-+ g_object_set_data (G_OBJECT (PanTilt2), "control_info", |
678 |
- GINT_TO_POINTER(current->control.id)); |
679 |
-- |
680 |
-+ |
681 |
- g_signal_connect (GTK_BUTTON(PanTilt1), "clicked", |
682 |
- G_CALLBACK (button_PanTilt1_clicked), all_data); |
683 |
- g_signal_connect (GTK_BUTTON(PanTilt2), "clicked", |
684 |
- G_CALLBACK (button_PanTilt2_clicked), all_data); |
685 |
- |
686 |
- gtk_widget_show (current->widget); |
687 |
-- |
688 |
-+ |
689 |
- current->spinbutton = gtk_spin_button_new_with_range(-256, 256, 64); |
690 |
- /*can't edit the spin value by hand*/ |
691 |
- gtk_editable_set_editable(GTK_EDITABLE(current->spinbutton),FALSE); |
692 |
-- |
693 |
-+ |
694 |
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(current->spinbutton), 128); |
695 |
- gtk_widget_show (current->spinbutton); |
696 |
- }; |
697 |
- break; |
698 |
-- |
699 |
-+ |
700 |
- case V4L2_CID_PAN_RESET: |
701 |
- case V4L2_CID_TILT_RESET: |
702 |
- { |
703 |
- current->widget = gtk_button_new_with_label(" "); |
704 |
- gtk_widget_show (current->widget); |
705 |
-- |
706 |
-- g_object_set_data (G_OBJECT (current->widget), "control_info", |
707 |
-+ |
708 |
-+ g_object_set_data (G_OBJECT (current->widget), "control_info", |
709 |
- GINT_TO_POINTER(current->control.id)); |
710 |
-- |
711 |
-+ |
712 |
- g_signal_connect (GTK_BUTTON(current->widget), "clicked", |
713 |
- G_CALLBACK (button_clicked), all_data); |
714 |
- }; |
715 |
- break; |
716 |
-- |
717 |
-+ |
718 |
- case V4L2_CID_LED1_MODE_LOGITECH: |
719 |
- { |
720 |
- /*turn it into a menu control*/ |
721 |
-@@ -796,15 +796,15 @@ |
722 |
- _("Auto")); |
723 |
- gtk_combo_box_set_active (GTK_COMBO_BOX(current->widget), current->value); |
724 |
- gtk_widget_show (current->widget); |
725 |
-- |
726 |
-- g_object_set_data (G_OBJECT (current->widget), "control_info", |
727 |
-+ |
728 |
-+ g_object_set_data (G_OBJECT (current->widget), "control_info", |
729 |
- GINT_TO_POINTER(current->control.id)); |
730 |
- //connect signal |
731 |
- g_signal_connect (GTK_COMBO_BOX_TEXT(current->widget), "changed", |
732 |
- G_CALLBACK (combo_changed), all_data); |
733 |
- }; |
734 |
- break; |
735 |
-- |
736 |
-+ |
737 |
- case V4L2_CID_RAW_BITS_PER_PIXEL_LOGITECH: |
738 |
- { |
739 |
- /*turn it into a menu control*/ |
740 |
-@@ -815,18 +815,18 @@ |
741 |
- gtk_combo_box_text_append_text ( |
742 |
- GTK_COMBO_BOX_TEXT (current->widget), |
743 |
- _("12 bit")); |
744 |
-- |
745 |
-+ |
746 |
- gtk_combo_box_set_active (GTK_COMBO_BOX(current->widget), current->value); |
747 |
- gtk_widget_show (current->widget); |
748 |
-- |
749 |
-- g_object_set_data (G_OBJECT (current->widget), "control_info", |
750 |
-+ |
751 |
-+ g_object_set_data (G_OBJECT (current->widget), "control_info", |
752 |
- GINT_TO_POINTER(current->control.id)); |
753 |
- //connect signal |
754 |
- g_signal_connect (GTK_COMBO_BOX_TEXT(current->widget), "changed", |
755 |
- G_CALLBACK (combo_changed), all_data); |
756 |
- }; |
757 |
- break; |
758 |
-- |
759 |
-+ |
760 |
- default: //standard case - hscale |
761 |
- { |
762 |
- /* check for valid range */ |
763 |
-@@ -839,19 +839,19 @@ |
764 |
- gtk_scale_set_draw_value (GTK_SCALE (current->widget), FALSE); |
765 |
- gtk_range_set_round_digits(GTK_RANGE (current->widget), 0); |
766 |
- gtk_widget_show (current->widget); |
767 |
-- |
768 |
-+ |
769 |
- current->spinbutton = gtk_spin_button_new_with_range( |
770 |
- current->control.minimum, |
771 |
- current->control.maximum, |
772 |
- current->control.step); |
773 |
- /*can't edit the spin value by hand*/ |
774 |
- gtk_editable_set_editable(GTK_EDITABLE(current->spinbutton),FALSE); |
775 |
-- |
776 |
-+ |
777 |
- gtk_range_set_value (GTK_RANGE (current->widget), current->value); |
778 |
- gtk_spin_button_set_value (GTK_SPIN_BUTTON(current->spinbutton), current->value); |
779 |
- gtk_widget_show (current->spinbutton); |
780 |
-- |
781 |
-- g_object_set_data (G_OBJECT (current->widget), "control_info", |
782 |
-+ |
783 |
-+ g_object_set_data (G_OBJECT (current->widget), "control_info", |
784 |
- GINT_TO_POINTER(current->control.id)); |
785 |
- g_object_set_data (G_OBJECT (current->spinbutton), "control_info", |
786 |
- GINT_TO_POINTER(current->control.id)); |
787 |
-@@ -870,7 +870,7 @@ |
788 |
- }; |
789 |
- }; |
790 |
- break; |
791 |
-- |
792 |
-+ |
793 |
- case V4L2_CTRL_TYPE_MENU: |
794 |
- { |
795 |
- if(current->menu) |
796 |
-@@ -878,9 +878,9 @@ |
797 |
- int j = 0; |
798 |
- int def = 0; |
799 |
- current->widget = gtk_combo_box_text_new (); |
800 |
-- for (j = 0; current->menu[j].index <= current->control.maximum; j++) |
801 |
-+ for (j = 0; current->menu[j].index <= current->control.maximum; j++) |
802 |
- { |
803 |
-- if (verbose) |
804 |
-+ if (verbose) |
805 |
- printf("adding menu entry %d: %d, %s\n",j, current->menu[j].index, current->menu[j].name); |
806 |
- gtk_combo_box_text_append_text ( |
807 |
- GTK_COMBO_BOX_TEXT (current->widget), |
808 |
-@@ -888,11 +888,11 @@ |
809 |
- if(current->value == current->menu[j].index) |
810 |
- def = j; |
811 |
- } |
812 |
-- |
813 |
-+ |
814 |
- gtk_combo_box_set_active (GTK_COMBO_BOX(current->widget), def); |
815 |
- gtk_widget_show (current->widget); |
816 |
-- |
817 |
-- g_object_set_data (G_OBJECT (current->widget), "control_info", |
818 |
-+ |
819 |
-+ g_object_set_data (G_OBJECT (current->widget), "control_info", |
820 |
- GINT_TO_POINTER(current->control.id)); |
821 |
- //connect signal |
822 |
- g_signal_connect (GTK_COMBO_BOX_TEXT(current->widget), "changed", |
823 |
-@@ -900,11 +900,11 @@ |
824 |
- } |
825 |
- } |
826 |
- break; |
827 |
-- |
828 |
-+ |
829 |
- case V4L2_CTRL_TYPE_BOOLEAN: |
830 |
- { |
831 |
- if(current->control.id ==V4L2_CID_DISABLE_PROCESSING_LOGITECH) |
832 |
-- { |
833 |
-+ { |
834 |
- //a little hack :D we use the spin widget as a combo |
835 |
- current->spinbutton = gtk_combo_box_text_new (); |
836 |
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(current->spinbutton), |
837 |
-@@ -915,30 +915,30 @@ |
838 |
- "BGBG... | GRGR..."); |
839 |
- gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(current->spinbutton), |
840 |
- "RGRG... | GBGB..."); |
841 |
-- |
842 |
-+ |
843 |
- gtk_combo_box_set_active(GTK_COMBO_BOX(current->spinbutton), 0); |
844 |
- |
845 |
- gtk_widget_show (current->spinbutton); |
846 |
-- |
847 |
-+ |
848 |
- g_signal_connect (GTK_COMBO_BOX_TEXT (current->spinbutton), "changed", |
849 |
- G_CALLBACK (pix_ord_changed), all_data); |
850 |
-- |
851 |
-+ |
852 |
- videoIn->isbayer = (current->value ? TRUE : FALSE); |
853 |
- } |
854 |
-- |
855 |
-+ |
856 |
- current->widget = gtk_check_button_new(); |
857 |
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (current->widget), |
858 |
- current->value ? TRUE : FALSE); |
859 |
- gtk_widget_show (current->widget); |
860 |
-- |
861 |
-- g_object_set_data (G_OBJECT (current->widget), "control_info", |
862 |
-+ |
863 |
-+ g_object_set_data (G_OBJECT (current->widget), "control_info", |
864 |
- GINT_TO_POINTER(current->control.id)); |
865 |
- //connect signal |
866 |
- g_signal_connect (GTK_TOGGLE_BUTTON(current->widget), "toggled", |
867 |
- G_CALLBACK (check_changed), all_data); |
868 |
- } |
869 |
- break; |
870 |
-- |
871 |
-+ |
872 |
- default: |
873 |
- printf("control type: 0x%08x not supported\n", current->control.type); |
874 |
- break; |
875 |
-@@ -952,7 +952,7 @@ |
876 |
- next = current->next; |
877 |
- } |
878 |
- } |
879 |
-- |
880 |
-+ |
881 |
- update_widget_state(control_list, all_data); |
882 |
- } |
883 |
- |
884 |
-@@ -992,23 +992,23 @@ |
885 |
- int count = 0; |
886 |
+--- guvcview-src-1.5.1.orig/src/v4l2_controls.c 2011-11-18 12:12:53.049556430 +0100 |
887 |
++++ guvcview-src-1.5.1/src/v4l2_controls.c 2011-11-18 12:13:00.095556136 +0100 |
888 |
+@@ -993,10 +993,10 @@ |
889 |
int i = 0; |
890 |
int done = 0; |
891 |
-- |
892 |
+ |
893 |
- while(!done) |
894 |
-- { |
895 |
-+ |
896 |
+ for(; next != NULL; current = next, next = current->next) |
897 |
-+ { |
898 |
+ { |
899 |
if(current->control.flags & V4L2_CTRL_FLAG_WRITE_ONLY) |
900 |
- goto next_control; |
901 |
-- |
902 |
+ continue; |
903 |
-+ |
904 |
+ |
905 |
clist[count].id = current->control.id; |
906 |
--#ifndef DISABLE_STRING_CONTROLS |
907 |
-+#ifndef DISABLE_STRING_CONTROLS |
908 |
- clist[count].size = 0; |
909 |
- if(current->control.type == V4L2_CTRL_TYPE_STRING) |
910 |
- { |
911 |
- clist[count].size = current->control.maximum + 1; |
912 |
-- clist[count].string = current->string; |
913 |
-+ clist[count].string = current->string; |
914 |
- } |
915 |
- #endif |
916 |
- count++; |
917 |
-- |
918 |
-+ |
919 |
- if((next == NULL) || (next->class != current->class)) |
920 |
- { |
921 |
- struct v4l2_ext_controls ctrls = {0}; |
922 |
-@@ -1036,7 +1036,7 @@ |
923 |
- } |
924 |
- else |
925 |
- { |
926 |
-- printf(" using VIDIOC_G_EXT_CTRLS on single controls for class: 0x%08x\n", |
927 |
-+ printf(" using VIDIOC_G_EXT_CTRLS on single controls for class: 0x%08x\n", |
928 |
- current->class); |
929 |
- for(i=0;i < count; i++) |
930 |
- { |
931 |
-@@ -1049,7 +1049,7 @@ |
932 |
- } |
933 |
- } |
934 |
- } |
935 |
-- |
936 |
-+ |
937 |
- //fill in the values on the control list |
938 |
- for(i=0; i<count; i++) |
939 |
- { |
940 |
-@@ -1061,7 +1061,7 @@ |
941 |
- } |
942 |
- switch(ctrl->control.type) |
943 |
- { |
944 |
--#ifndef DISABLE_STRING_CONTROLS |
945 |
-+#ifndef DISABLE_STRING_CONTROLS |
946 |
- case V4L2_CTRL_TYPE_STRING: |
947 |
- //string gets set on VIDIOC_G_EXT_CTRLS |
948 |
- //add the maximum size to value |
949 |
-@@ -1073,29 +1073,20 @@ |
950 |
- break; |
951 |
- default: |
952 |
- ctrl->value = clist[i].value; |
953 |
-- //printf("control %i [0x%08x] = %i\n", |
954 |
-+ //printf("control %i [0x%08x] = %i\n", |
955 |
- // i, clist[i].id, clist[i].value); |
956 |
- break; |
957 |
- } |
958 |
- } |
959 |
-- |
960 |
-+ |
961 |
+ #ifndef DISABLE_STRING_CONTROLS |
962 |
+@@ -1081,15 +1081,6 @@ |
963 |
+ |
964 |
count = 0; |
965 |
-- |
966 |
+ |
967 |
- if(next == NULL) |
968 |
- done = 1; |
969 |
- } |
970 |
@@ -939,280 +26,36 @@ |
971 |
- { |
972 |
- current = next; |
973 |
- next = current->next; |
974 |
-+ |
975 |
} |
976 |
} |
977 |
-- |
978 |
-+ |
979 |
- update_ctrl_list_flags(control_list); |
980 |
-- update_widget_state(control_list, all_data); |
981 |
-- |
982 |
-+ update_widget_state(control_list, all_data); |
983 |
-+ |
984 |
- } |
985 |
- |
986 |
- /* |
987 |
-@@ -1106,12 +1097,12 @@ |
988 |
- { |
989 |
- Control *control = get_ctrl_by_id(control_list, id ); |
990 |
- int ret = 0; |
991 |
-- |
992 |
-+ |
993 |
- if(!control) |
994 |
- return (-1); |
995 |
- if(control->control.flags & V4L2_CTRL_FLAG_WRITE_ONLY) |
996 |
- return (-1); |
997 |
-- |
998 |
-+ |
999 |
- if( control->class == V4L2_CTRL_CLASS_USER) |
1000 |
- { |
1001 |
- struct v4l2_control ctrl; |
1002 |
-@@ -1121,23 +1112,23 @@ |
1003 |
- ret = xioctl(hdevice, VIDIOC_G_CTRL, &ctrl); |
1004 |
- if(ret) |
1005 |
- printf("control id: 0x%08x failed to get value (error %i)\n", |
1006 |
-- ctrl.id, ret); |
1007 |
-+ ctrl.id, ret); |
1008 |
- else |
1009 |
- control->value = ctrl.value; |
1010 |
- } |
1011 |
- else |
1012 |
- { |
1013 |
-- //printf(" using VIDIOC_G_EXT_CTRLS on single controls for class: 0x%08x\n", |
1014 |
-+ //printf(" using VIDIOC_G_EXT_CTRLS on single controls for class: 0x%08x\n", |
1015 |
- // current->class); |
1016 |
- struct v4l2_ext_controls ctrls = {0}; |
1017 |
- struct v4l2_ext_control ctrl = {0}; |
1018 |
- ctrl.id = control->control.id; |
1019 |
--#ifndef DISABLE_STRING_CONTROLS |
1020 |
-+#ifndef DISABLE_STRING_CONTROLS |
1021 |
- ctrl.size = 0; |
1022 |
- if(control->control.type == V4L2_CTRL_TYPE_STRING) |
1023 |
- { |
1024 |
- ctrl.size = control->control.maximum + 1; |
1025 |
-- ctrl.string = control->string; |
1026 |
-+ ctrl.string = control->string; |
1027 |
- } |
1028 |
- #endif |
1029 |
- ctrls.count = 1; |
1030 |
-@@ -1150,7 +1141,7 @@ |
1031 |
- { |
1032 |
- switch(control->control.type) |
1033 |
- { |
1034 |
--#ifndef DISABLE_STRING_CONTROLS |
1035 |
-+#ifndef DISABLE_STRING_CONTROLS |
1036 |
- case V4L2_CTRL_TYPE_STRING: |
1037 |
- //string gets set on VIDIOC_G_EXT_CTRLS |
1038 |
- //add the maximum size to value |
1039 |
-@@ -1162,21 +1153,21 @@ |
1040 |
- break; |
1041 |
- default: |
1042 |
- control->value = ctrl.value; |
1043 |
-- //printf("control %i [0x%08x] = %i\n", |
1044 |
-+ //printf("control %i [0x%08x] = %i\n", |
1045 |
- // i, clist[i].id, clist[i].value); |
1046 |
- break; |
1047 |
- } |
1048 |
- } |
1049 |
-- } |
1050 |
-- |
1051 |
-+ } |
1052 |
-+ |
1053 |
- update_ctrl_flags(control_list, id); |
1054 |
- update_widget_state(control_list, all_data); |
1055 |
-- |
1056 |
-+ |
1057 |
- return (ret); |
1058 |
- } |
1059 |
- |
1060 |
- /* |
1061 |
-- * Goes through the control list and tries to set the controls values |
1062 |
-+ * Goes through the control list and tries to set the controls values |
1063 |
- */ |
1064 |
- void set_ctrl_values (int hdevice, Control *control_list, int num_controls) |
1065 |
- { |
1066 |
-@@ -1187,16 +1178,16 @@ |
1067 |
- int count = 0; |
1068 |
+ |
1069 |
+@@ -1188,10 +1179,10 @@ |
1070 |
int i = 0; |
1071 |
int done = 0; |
1072 |
-- |
1073 |
+ |
1074 |
- while(!done) |
1075 |
-+ |
1076 |
+ for(; next != NULL; current = next, next = current->next) |
1077 |
{ |
1078 |
if(current->control.flags & V4L2_CTRL_FLAG_READ_ONLY) |
1079 |
- goto next_control; |
1080 |
-- |
1081 |
+ continue; |
1082 |
-+ |
1083 |
+ |
1084 |
clist[count].id = current->control.id; |
1085 |
switch (current->control.type) |
1086 |
- { |
1087 |
--#ifndef DISABLE_STRING_CONTROLS |
1088 |
-+#ifndef DISABLE_STRING_CONTROLS |
1089 |
- case V4L2_CTRL_TYPE_STRING: |
1090 |
- clist[count].size = current->value; |
1091 |
- clist[count].string = current->string; |
1092 |
-@@ -1210,7 +1201,7 @@ |
1093 |
- break; |
1094 |
- } |
1095 |
- count++; |
1096 |
-- |
1097 |
-+ |
1098 |
- if((next == NULL) || (next->class != current->class)) |
1099 |
- { |
1100 |
- struct v4l2_ext_controls ctrls = {0}; |
1101 |
-@@ -1239,13 +1230,13 @@ |
1102 |
- clist[i].id, ctrl->control.name, ret); |
1103 |
- else |
1104 |
- printf("control(0x%08x) failed to set (error %i)\n", |
1105 |
-- clist[i].id, ret); |
1106 |
-+ clist[i].id, ret); |
1107 |
- } |
1108 |
- } |
1109 |
- } |
1110 |
- else |
1111 |
- { |
1112 |
-- printf(" using VIDIOC_S_EXT_CTRLS on single controls for class: 0x%08x\n", |
1113 |
-+ printf(" using VIDIOC_S_EXT_CTRLS on single controls for class: 0x%08x\n", |
1114 |
- current->class); |
1115 |
- for(i=0;i < count; i++) |
1116 |
- { |
1117 |
-@@ -1265,23 +1256,13 @@ |
1118 |
- } |
1119 |
- } |
1120 |
- } |
1121 |
-- |
1122 |
-- |
1123 |
-- |
1124 |
-- count = 0; |
1125 |
+@@ -1269,16 +1260,6 @@ |
1126 |
+ |
1127 |
+ |
1128 |
+ count = 0; |
1129 |
- |
1130 |
- if(next == NULL) |
1131 |
- done = 1; |
1132 |
- } |
1133 |
- |
1134 |
+- |
1135 |
-next_control: |
1136 |
- if(!done) |
1137 |
- { |
1138 |
- current = next; |
1139 |
- next = current->next; |
1140 |
-+ |
1141 |
-+ |
1142 |
-+ count = 0; |
1143 |
- } |
1144 |
- } |
1145 |
-- |
1146 |
-+ |
1147 |
- //update list with real values |
1148 |
- //get_ctrl_values (hdevice, control_list, num_controls); |
1149 |
- } |
1150 |
-@@ -1294,7 +1275,7 @@ |
1151 |
- Control *current = control_list; |
1152 |
- Control *next = current->next; |
1153 |
- int done = 0; |
1154 |
-- |
1155 |
-+ |
1156 |
- while(!done) |
1157 |
- { |
1158 |
- if(current->control.flags & V4L2_CTRL_FLAG_READ_ONLY) |
1159 |
-@@ -1308,10 +1289,10 @@ |
1160 |
- } |
1161 |
- continue; |
1162 |
- } |
1163 |
-- //printf("setting 0x%08X to %i\n",current->control.id, current->control.default_value); |
1164 |
-+ //printf("setting 0x%08X to %i\n",current->control.id, current->control.default_value); |
1165 |
- switch (current->control.type) |
1166 |
- { |
1167 |
--#ifndef DISABLE_STRING_CONTROLS |
1168 |
-+#ifndef DISABLE_STRING_CONTROLS |
1169 |
- case V4L2_CTRL_TYPE_STRING: |
1170 |
- break; |
1171 |
- #endif |
1172 |
-@@ -1324,7 +1305,7 @@ |
1173 |
- current->value = current->control.default_value; |
1174 |
- break; |
1175 |
} |
1176 |
-- |
1177 |
-+ |
1178 |
- if(next == NULL) |
1179 |
- done = 1; |
1180 |
- else |
1181 |
-@@ -1333,10 +1314,10 @@ |
1182 |
- next = current->next; |
1183 |
- } |
1184 |
- } |
1185 |
-- |
1186 |
-+ |
1187 |
- set_ctrl_values (hdevice, control_list, num_controls); |
1188 |
- get_ctrl_values (hdevice, control_list, num_controls, all_data); |
1189 |
-- |
1190 |
-+ |
1191 |
- } |
1192 |
- |
1193 |
- /* |
1194 |
-@@ -1346,7 +1327,7 @@ |
1195 |
- { |
1196 |
- Control *control = get_ctrl_by_id(control_list, id ); |
1197 |
- int ret = 0; |
1198 |
-- |
1199 |
-+ |
1200 |
- if(!control) |
1201 |
- return (-1); |
1202 |
- if(control->control.flags & V4L2_CTRL_FLAG_READ_ONLY) |
1203 |
-@@ -1362,14 +1343,14 @@ |
1204 |
- } |
1205 |
- else |
1206 |
- { |
1207 |
-- //printf(" using VIDIOC_G_EXT_CTRLS on single controls for class: 0x%08x\n", |
1208 |
-+ //printf(" using VIDIOC_G_EXT_CTRLS on single controls for class: 0x%08x\n", |
1209 |
- // current->class); |
1210 |
- struct v4l2_ext_controls ctrls = {0}; |
1211 |
- struct v4l2_ext_control ctrl = {0}; |
1212 |
- ctrl.id = control->control.id; |
1213 |
- switch (control->control.type) |
1214 |
- { |
1215 |
--#ifndef DISABLE_STRING_CONTROLS |
1216 |
-+#ifndef DISABLE_STRING_CONTROLS |
1217 |
- case V4L2_CTRL_TYPE_STRING: |
1218 |
- ctrl.size = control->value; |
1219 |
- ctrl.string = control->string; |
1220 |
-@@ -1389,11 +1370,11 @@ |
1221 |
- printf("control id: 0x%08x failed to set (error %i)\n", |
1222 |
- ctrl.id, ret); |
1223 |
- } |
1224 |
-- |
1225 |
-+ |
1226 |
- //update real value |
1227 |
- get_ctrl(hdevice, control_list, id, NULL); |
1228 |
-- |
1229 |
-- return (ret); |
1230 |
-+ |
1231 |
-+ return (ret); |
1232 |
- } |
1233 |
- |
1234 |
- /* |
1235 |
-@@ -1424,19 +1405,19 @@ |
1236 |
- { |
1237 |
- Control *ctrl = NULL; |
1238 |
- int id = V4L2_CID_TILT_RELATIVE; |
1239 |
-- if (is_pan) |
1240 |
-+ if (is_pan) |
1241 |
- id = V4L2_CID_PAN_RELATIVE; |
1242 |
-- |
1243 |
-+ |
1244 |
- ctrl = get_ctrl_by_id(control_list, id ); |
1245 |
-- |
1246 |
-+ |
1247 |
- if (ctrl && ctrl->spinbutton) |
1248 |
- { |
1249 |
-- |
1250 |
-+ |
1251 |
- ctrl->value = direction * gtk_spin_button_get_value_as_int ( |
1252 |
- GTK_SPIN_BUTTON(ctrl->spinbutton)); |
1253 |
- set_ctrl(hdevice, control_list, id); |
1254 |
} |
1255 |
-- |
1256 |
-+ |
1257 |
- } |
1258 |
- |
1259 |
- |
1260 |
+ |