Lines 22-28
static int mypalette;
Link Here
|
22 |
#include <fcntl.h> |
22 |
#include <fcntl.h> |
23 |
#include <dirent.h> |
23 |
#include <dirent.h> |
24 |
#include <unistd.h> |
24 |
#include <unistd.h> |
25 |
#include <linux/videodev.h> |
25 |
#include "libv4l1.h" |
26 |
#include <sys/ioctl.h> |
26 |
#include <sys/ioctl.h> |
27 |
|
27 |
|
28 |
static struct video_window x_vidwin; |
28 |
static struct video_window x_vidwin; |
Lines 92-105
static char **get_vloopback_devices(void
Link Here
|
92 |
for(i=0; i < n && ndevices < MAX_DEVICES-1; i++ ) { |
92 |
for(i=0; i < n && ndevices < MAX_DEVICES-1; i++ ) { |
93 |
sprintf( devname, "/dev/%s", namelist[i]->d_name ); |
93 |
sprintf( devname, "/dev/%s", namelist[i]->d_name ); |
94 |
|
94 |
|
95 |
if( ( fd = open( devname, O_RDONLY | O_NONBLOCK ) ) == -1 ) { |
95 |
if( ( fd = v4l1_open( devname, O_RDONLY | O_NONBLOCK ) ) == -1 ) { |
96 |
// could not open device |
96 |
// could not open device |
97 |
continue; |
97 |
continue; |
98 |
} |
98 |
} |
99 |
|
99 |
|
100 |
if( ioctl( fd, VIDIOCGCAP, &v4lcap ) < 0 ) { |
100 |
if( v4l1_ioctl( fd, VIDIOCGCAP, &v4lcap ) < 0 ) { |
101 |
// not a video device |
101 |
// not a video device |
102 |
close( fd ); |
102 |
v4l1_close( fd ); |
103 |
continue; |
103 |
continue; |
104 |
} |
104 |
} |
105 |
|
105 |
|
Lines 108-118
static char **get_vloopback_devices(void
Link Here
|
108 |
|
108 |
|
109 |
if( (v4lcap.type & VID_TYPE_CAPTURE ) ) { |
109 |
if( (v4lcap.type & VID_TYPE_CAPTURE ) ) { |
110 |
// is an output device |
110 |
// is an output device |
111 |
close( fd ); |
111 |
v4l1_close( fd ); |
112 |
continue; |
112 |
continue; |
113 |
} |
113 |
} |
114 |
|
114 |
|
115 |
close( fd ); |
115 |
v4l1_close( fd ); |
116 |
devnames[ndevices++]=strdup(devname); |
116 |
devnames[ndevices++]=strdup(devname); |
117 |
//fprintf(stderr,"got %s\n",devname); |
117 |
//fprintf(stderr,"got %s\n",devname); |
118 |
} |
118 |
} |
Lines 250-263
boolean init_screen (int width, int heig
Link Here
|
250 |
|
250 |
|
251 |
if (vdevname==NULL) return FALSE; |
251 |
if (vdevname==NULL) return FALSE; |
252 |
|
252 |
|
253 |
vdevfd=open(vdevname, O_WRONLY); |
253 |
vdevfd=v4l1_open(vdevname, O_WRONLY); |
254 |
|
254 |
|
255 |
if (vdevfd==-1) { |
255 |
if (vdevfd==-1) { |
256 |
fprintf (stderr, "vloopback output: cannot open %s %s\n",vdevname,strerror(errno)); |
256 |
fprintf (stderr, "vloopback output: cannot open %s %s\n",vdevname,strerror(errno)); |
257 |
return FALSE; |
257 |
return FALSE; |
258 |
} |
258 |
} |
259 |
|
259 |
|
260 |
if( ioctl(vdevfd, VIDIOCGPICT, &x_vidpic) == -1) { |
260 |
if( v4l1_ioctl(vdevfd, VIDIOCGPICT, &x_vidpic) == -1) { |
261 |
fprintf (stderr, "vloopback output: cannot get palette for %s\n",vdevname); |
261 |
fprintf (stderr, "vloopback output: cannot get palette for %s\n",vdevname); |
262 |
return FALSE; |
262 |
return FALSE; |
263 |
} |
263 |
} |
Lines 265-277
boolean init_screen (int width, int heig
Link Here
|
265 |
if (mypalette==WEED_PALETTE_RGB24) x_vidpic.palette=VIDEO_PALETTE_RGB24; |
265 |
if (mypalette==WEED_PALETTE_RGB24) x_vidpic.palette=VIDEO_PALETTE_RGB24; |
266 |
else if (mypalette==WEED_PALETTE_UYVY) x_vidpic.palette=VIDEO_PALETTE_UYVY; |
266 |
else if (mypalette==WEED_PALETTE_UYVY) x_vidpic.palette=VIDEO_PALETTE_UYVY; |
267 |
|
267 |
|
268 |
if( ioctl(vdevfd, VIDIOCSPICT, &x_vidpic) == -1) { |
268 |
if( v4l1_ioctl(vdevfd, VIDIOCSPICT, &x_vidpic) == -1) { |
269 |
fprintf (stderr, "vloopback output: cannot set palette for %s\n",vdevname); |
269 |
fprintf (stderr, "vloopback output: cannot set palette for %s\n",vdevname); |
270 |
return FALSE; |
270 |
return FALSE; |
271 |
} |
271 |
} |
272 |
|
272 |
|
273 |
|
273 |
|
274 |
if( ioctl(vdevfd, VIDIOCGWIN, &x_vidwin) == -1) { |
274 |
if( v4l1_ioctl(vdevfd, VIDIOCGWIN, &x_vidwin) == -1) { |
275 |
fprintf (stderr, "vloopback output: cannot get dimensions for %s\n",vdevname); |
275 |
fprintf (stderr, "vloopback output: cannot get dimensions for %s\n",vdevname); |
276 |
return FALSE; |
276 |
return FALSE; |
277 |
} |
277 |
} |
Lines 279-285
boolean init_screen (int width, int heig
Link Here
|
279 |
x_vidwin.width=width; |
279 |
x_vidwin.width=width; |
280 |
x_vidwin.height=height; |
280 |
x_vidwin.height=height; |
281 |
|
281 |
|
282 |
if( ioctl(vdevfd, VIDIOCSWIN, &x_vidwin) == -1) { |
282 |
if( v4l1_ioctl(vdevfd, VIDIOCSWIN, &x_vidwin) == -1) { |
283 |
fprintf (stderr, "vloopback output: cannot set dimensions for %s\n",vdevname); |
283 |
fprintf (stderr, "vloopback output: cannot set dimensions for %s\n",vdevname); |
284 |
return FALSE; |
284 |
return FALSE; |
285 |
} |
285 |
} |
Lines 306-312
boolean render_frame (int hsize, int vsi
Link Here
|
306 |
|
306 |
|
307 |
void exit_screen (int16_t mouse_x, int16_t mouse_y) { |
307 |
void exit_screen (int16_t mouse_x, int16_t mouse_y) { |
308 |
int xval=0; |
308 |
int xval=0; |
309 |
if (vdevfd!=-1) xval=close(vdevfd); |
309 |
if (vdevfd!=-1) xval=v4l1_close(vdevfd); |
310 |
if (vdevname!=NULL) free(vdevname); |
310 |
if (vdevname!=NULL) free(vdevname); |
311 |
} |
311 |
} |
312 |
|
312 |
|