--- trunk/src/Makefile.am	2011-04-27 11:44:23.606120207 -0500
+++ trunk.new/src/Makefile.am	2011-04-27 17:17:18.216118056 -0500
@@ -170,7 +170,7 @@ lives_exe_SOURCES = \
 	$(giw_SOURCES)
 
 lives_exe_LDADD = @GTK_LIBS_NODYNAMIC@ @X11_LIBS@ @MJPEGTOOLS_LIBS@ $(osc_LDADD) $(jack_LDADD) $(ldvgrab_LDADD) \
-	$(oil_LDADD) $(alsa_LDADD) $(pulse_LDADD) -lpthread $(libweed_LDADD) $(giw_LDADD) \
+	$(oil_LDADD) $(alsa_LDADD) $(pulse_LDADD) -lpthread $(libweed_LDADD) $(giw_LDADD) -lv4l1 \
 	@UNICAP_LIBS@
 
 AM_CFLAGS = -Wstrict-aliasing=0 $(yuv4mpeg_CFLAGS) $(ldvgrab_CFLAGS) $(dvgrab_CFLAGS) $(oil_CFLAGS) \
--- trunk/lives-plugins/plugins/playback/video/vloopback.c	2011-04-27 11:44:24.864333721 -0500
+++ trunk.new/lives-plugins/plugins/playback/video/vloopback.c	2011-04-27 16:14:05.710627385 -0500
@@ -22,7 +22,7 @@ static int mypalette;
 #include <fcntl.h>
 #include <dirent.h>
 #include <unistd.h>
-#include <linux/videodev.h>
+#include "libv4l1.h"
 #include <sys/ioctl.h>
 
 static struct video_window x_vidwin;
@@ -92,14 +92,14 @@ static char **get_vloopback_devices(void
    for(i=0; i < n && ndevices < MAX_DEVICES-1; i++ ) {
      sprintf( devname, "/dev/%s", namelist[i]->d_name );
 
-     if( ( fd = open( devname, O_RDONLY | O_NONBLOCK ) ) == -1 ) {
+     if( ( fd = v4l1_open( devname, O_RDONLY | O_NONBLOCK ) ) == -1 ) {
        // could not open device
        continue;
      }
       
-     if( ioctl( fd, VIDIOCGCAP, &v4lcap ) < 0 ) {
+     if( v4l1_ioctl( fd, VIDIOCGCAP, &v4lcap ) < 0 ) {
        // not a video device
-       close( fd );
+       v4l1_close( fd );
        continue;
      }
 
@@ -108,11 +108,11 @@ static char **get_vloopback_devices(void
 
       if( (v4lcap.type & VID_TYPE_CAPTURE ) ) {
 	// is an output device
-	close( fd );
+	v4l1_close( fd );
 	continue;
       }
 
-      close( fd );
+      v4l1_close( fd );
       devnames[ndevices++]=strdup(devname);
       //fprintf(stderr,"got %s\n",devname);
    }
@@ -250,14 +250,14 @@ boolean init_screen (int width, int heig
 
   if (vdevname==NULL) return FALSE;
 
-  vdevfd=open(vdevname, O_WRONLY);
+  vdevfd=v4l1_open(vdevname, O_WRONLY);
 
   if (vdevfd==-1) {
     fprintf (stderr, "vloopback output: cannot open %s %s\n",vdevname,strerror(errno));
     return FALSE;
   }
 
-  if( ioctl(vdevfd, VIDIOCGPICT, &x_vidpic) == -1) {
+  if( v4l1_ioctl(vdevfd, VIDIOCGPICT, &x_vidpic) == -1) {
     fprintf (stderr, "vloopback output: cannot get palette for %s\n",vdevname);
     return FALSE;
   }
@@ -265,13 +265,13 @@ boolean init_screen (int width, int heig
   if (mypalette==WEED_PALETTE_RGB24) x_vidpic.palette=VIDEO_PALETTE_RGB24;
   else if (mypalette==WEED_PALETTE_UYVY) x_vidpic.palette=VIDEO_PALETTE_UYVY;
 
-  if( ioctl(vdevfd, VIDIOCSPICT, &x_vidpic) == -1) {
+  if( v4l1_ioctl(vdevfd, VIDIOCSPICT, &x_vidpic) == -1) {
     fprintf (stderr, "vloopback output: cannot set palette for %s\n",vdevname);
     return FALSE;
   }
 
 
-  if( ioctl(vdevfd, VIDIOCGWIN, &x_vidwin) == -1) {
+  if( v4l1_ioctl(vdevfd, VIDIOCGWIN, &x_vidwin) == -1) {
     fprintf (stderr, "vloopback output: cannot get dimensions for %s\n",vdevname);
     return FALSE;
   }
@@ -279,7 +279,7 @@ boolean init_screen (int width, int heig
   x_vidwin.width=width;
   x_vidwin.height=height;
 
-  if( ioctl(vdevfd, VIDIOCSWIN, &x_vidwin) == -1) {
+  if( v4l1_ioctl(vdevfd, VIDIOCSWIN, &x_vidwin) == -1) {
     fprintf (stderr, "vloopback output: cannot set dimensions for %s\n",vdevname);
     return FALSE;
   }
@@ -306,7 +306,7 @@ boolean render_frame (int hsize, int vsi
 
 void exit_screen (int16_t mouse_x, int16_t mouse_y) {
   int xval=0;
-  if (vdevfd!=-1) xval=close(vdevfd);
+  if (vdevfd!=-1) xval=v4l1_close(vdevfd);
   if (vdevname!=NULL) free(vdevname);
 }
 
