1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
*** src/webcam.cpp.orig Thu Jul 26 11:46:12 2001
--- src/webcam.cpp Thu Jul 26 11:50:00 2001
*************** void * GM_cam_capture_thread (GM_window_
*** 80,101 ****
int len;
void *pic;
GdkRectangle update_rec;
struct video_window vid_win;
update_rec.x = 0;
update_rec.y = 0;
update_rec.width = 176;
update_rec.height = 144;
vid_win.width = 176;
vid_win.height = 144;
!
// if video device not opened
if (gw->dev == -1)
gw->dev = open("/dev/video", O_RDWR);
ioctl (gw->dev, VIDIOCSWIN, &vid_win);
pic = malloc (176* 144 * 3);
--- 80,107 ----
int len;
void *pic;
GdkRectangle update_rec;
+ #ifdef __linux__
struct video_window vid_win;
+ #endif
update_rec.x = 0;
update_rec.y = 0;
update_rec.width = 176;
update_rec.height = 144;
+ #ifdef __linux__
vid_win.width = 176;
vid_win.height = 144;
! #endif
// if video device not opened
if (gw->dev == -1)
gw->dev = open("/dev/video", O_RDWR);
+
+ #ifdef __linux__
ioctl (gw->dev, VIDIOCSWIN, &vid_win);
+ #endif
pic = malloc (176* 144 * 3);
*************** void * GM_cam_capture_thread (GM_window_
*** 132,138 ****
--- 138,146 ----
int GM_cam_info (GM_window_widgets *gw, GtkWidget *text)
{
+ #ifdef __linux__
struct video_capability vid_cap;
+ #endif
char *maxh, *maxw, *minh, *minw;
int was_opened = 1;
*************** int GM_cam_info (GM_window_widgets *gw,
*** 148,153 ****
--- 156,162 ----
was_opened = 0; // webcam was not opened, so we will close it
}
+ #ifdef __linux__
ioctl (gw->dev, VIDIOCGCAP, &vid_cap);
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL,
*************** int GM_cam_info (GM_window_widgets *gw,
*** 176,181 ****
--- 185,191 ----
else
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL,
"\n Can not capture : ", -1);
+ #endif
if (was_opened == 0)
{
*************** void GM_cam_set_params (GM_window_widget
*** 196,202 ****
--- 206,214 ----
int brightness, int colour, int contrast)
{
int was_opened = 1;
+ #ifdef __linux__
struct video_picture vid_pic;
+ #endif
// If the webcam device is not opened, then open it
if (gw->dev == -1)
*************** void GM_cam_set_params (GM_window_widget
*** 206,211 ****
--- 218,224 ----
}
// Read the current values
+ #ifdef __linux__
ioctl (gw->dev, VIDIOCGPICT, &vid_pic);
vid_pic.whiteness = (int) whiteness * 256;
*************** void GM_cam_set_params (GM_window_widget
*** 214,219 ****
--- 227,233 ----
vid_pic.contrast = (int) contrast * 256;
ioctl (gw->dev, VIDIOCSPICT, &vid_pic);
+ #endif
if (was_opened == 0)
{
*************** void GM_cam_get_params (GM_window_widget
*** 227,233 ****
--- 241,249 ----
int *brightness, int *colour, int *contrast)
{
int was_opened = 1;
+ #ifdef __linux__
struct video_picture vid_pic;
+ #endif
// If the webcam device is not opened, then open it
if (gw->dev == -1)
*************** void GM_cam_get_params (GM_window_widget
*** 237,248 ****
--- 253,266 ----
}
// Read the current values
+ #ifdef __linux__
ioctl (gw->dev, VIDIOCGPICT, &vid_pic);
*whiteness = (int) vid_pic.whiteness / 256;
*brightness = (int) vid_pic.brightness / 256;
*colour = (int) vid_pic.colour / 256;
*contrast = (int) vid_pic.contrast / 256;
+ #endif
if (was_opened == 0)
{
|