rpms/gyachi/devel gyachi-1.1.46-libv4l.patch, NONE, 1.1 gyachi.spec, 1.18, 1.19

Hans de Goede jwrdegoede at fedoraproject.org
Sun Sep 7 11:17:50 UTC 2008


Author: jwrdegoede

Update of /cvs/pkgs/rpms/gyachi/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15710

Modified Files:
	gyachi.spec 
Added Files:
	gyachi-1.1.46-libv4l.patch 
Log Message:
* Sun Sep  7 2008 Hans de Goede <hdegoede at redhat.com> - 1.1.46-10
- Patch to use libv4l for support for more webcams


gyachi-1.1.46-libv4l.patch:

--- NEW FILE gyachi-1.1.46-libv4l.patch ---
diff -up gyachi-1.1.46/webcam/Makefile.am.foo gyachi-1.1.46/webcam/Makefile.am
--- gyachi-1.1.46/webcam/Makefile.am.foo	2008-05-18 15:36:30.000000000 +0200
+++ gyachi-1.1.46/webcam/Makefile.am	2008-09-07 09:59:03.000000000 +0200
@@ -16,7 +16,7 @@ gyachi_upload_SOURCES = gyacheupload-mai
                         gyacheupload.h
 
 gyachi_webcam_LDADD = @GYACHI_LIB@ @GTK_LIBS@ @JASPER_LIBS@ $(INTLLIBS)
-gyachi_upload_LDADD = @GYACHI_LIB@ @GTK_LIBS@ @GTHREAD_LIBS@ @JASPER_LIBS@ $(INTLLIBS)
+gyachi_upload_LDADD = @GYACHI_LIB@ @GTK_LIBS@ @GTHREAD_LIBS@ @JASPER_LIBS@ $(INTLLIBS) -lv4l1
 
 # Required for localization
 localedir = $(datadir)/locale
diff -up gyachi-1.1.46/webcam/gyacheupload-v4l.c.foo gyachi-1.1.46/webcam/gyacheupload-v4l.c
--- gyachi-1.1.46/webcam/gyacheupload-v4l.c.foo	2008-07-20 14:47:31.000000000 +0200
+++ gyachi-1.1.46/webcam/gyacheupload-v4l.c	2008-09-07 09:57:39.000000000 +0200
@@ -73,8 +73,10 @@
 
 #ifdef V4L2
 #	include <linux/videodev2.h>
+#	include <libv4l2.h>
 #else
 #	include <linux/videodev.h>
+#	include <libv4l1.h>
 #endif
 
 #include "gyacheupload.h"
@@ -410,12 +410,12 @@ int grab_init() {
 	unsigned int min;
 	unsigned int i;
 	
-        if ((grab_fd = open(v_device,O_RDWR | O_NONBLOCK, 0)) == -1 ) {
+        if ((grab_fd = v4l2_open(v_device,O_RDWR | O_NONBLOCK, 0)) == -1 ) {
 		show_error_dialog("Could not open Video4Linux device.\nThe device may already be in use.");
 		return 0; 
 	}
 	
-	if (ioctl(grab_fd,VIDIOC_QUERYCAP,&grab_cap) == -1) {
+	if (v4l2_ioctl(grab_fd,VIDIOC_QUERYCAP,&grab_cap) == -1) {
 		show_error_dialog("An error occurred at 'ioctl VIDIOC_QUERYCAP'.\nNot a V4L2 device.");
 		return 0; 
 	}
@@ -445,7 +445,7 @@ int grab_init() {
         grab_fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB24;
         grab_fmt.fmt.pix.field       = V4L2_FIELD_INTERLACED;
 
-        if (ioctl (grab_fd, VIDIOC_S_FMT, &grab_fmt) == -1) {
+        if (v4l2_ioctl (grab_fd, VIDIOC_S_FMT, &grab_fmt) == -1) {
 			show_error_dialog("Fatal: video format not supported by grab device\n");
 			return 0;
 		}
@@ -454,7 +454,7 @@ int grab_init() {
 
 //		CLEAR(grab_fmt);
 //        grab_fmt.type                = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-//        if (ioctl (grab_fd, VIDIOC_G_FMT, &grab_fmt) == -1) {
+//        if (v4l2_ioctl (grab_fd, VIDIOC_G_FMT, &grab_fmt) == -1) {
 //			show_error_dialog("Could not get format information of grab device\n");
 //			return 0;
 //		}
@@ -482,7 +482,7 @@ int grab_init() {
         req.type                = V4L2_BUF_TYPE_VIDEO_CAPTURE;
         req.memory              = V4L2_MEMORY_MMAP;
 
-	if (ioctl (grab_fd, VIDIOC_REQBUFS, &req) == -1) {
+	if (v4l2_ioctl (grab_fd, VIDIOC_REQBUFS, &req) == -1) {
 			show_error_dialog("Fatal: memory mapping not supported by grab device\n");
 			return 0;
 		}
@@ -506,14 +506,14 @@ int grab_init() {
                 buf.memory      = V4L2_MEMORY_MMAP;
                 buf.index       = n_buffers;
 
-                if (ioctl (grab_fd, VIDIOC_QUERYBUF, &buf) == -1) {
+                if (v4l2_ioctl (grab_fd, VIDIOC_QUERYBUF, &buf) == -1) {
 					show_error_dialog("VIDIOC_QUERYBUF\n");
 					return 0;
 				}
 				
                 buffers[n_buffers].length = buf.length;
                 buffers[n_buffers].start =
-                        mmap (NULL /* start anywhere */,
+                        v4l2_mmap (NULL /* start anywhere */,
                               buf.length,
                               PROT_READ | PROT_WRITE /* required */,
                               MAP_SHARED /* recommended */,
@@ -537,7 +537,7 @@ int grab_init() {
         		buf.memory      = V4L2_MEMORY_MMAP;
         		buf.index       = i;
 
-        		if (ioctl (grab_fd, VIDIOC_QBUF, &buf) == -1) {
+        		if (v4l2_ioctl (grab_fd, VIDIOC_QBUF, &buf) == -1) {
 					show_error_dialog("VIDIOC_QBUF\n");
 					return(0);
 				}
@@ -546,7 +546,7 @@ int grab_init() {
 		
 		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
-		if (ioctl (grab_fd, VIDIOC_STREAMON, &type) == -1) {
+		if (v4l2_ioctl (grab_fd, VIDIOC_STREAMON, &type) == -1) {
 			show_error_dialog("VIDIOC_STREAMON\n");
 			return(0);
 		}
@@ -559,18 +559,18 @@ void cleanup_v4l() {
 
 	cam_is_open=0;
 	type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	if (ioctl (grab_fd, VIDIOC_STREAMOFF, &type)) {
+	if (v4l2_ioctl (grab_fd, VIDIOC_STREAMOFF, &type)) {
 		show_error_dialog("VIDIOC_STREAMOFF\n");
 		return;
 	}
 
-	for (i = 0; i < n_buffers; ++i) munmap (buffers[i].start, buffers[i].length);
+	for (i = 0; i < n_buffers; ++i) v4l1_munmap (buffers[i].start, buffers[i].length);
 	free (buffers);
 
 	if (v_device) {free (v_device); v_device=NULL;}
 	if (pnm_buf) {free(pnm_buf); pnm_buf=NULL;}
 	if (grab_fd>-1) {
-		close (grab_fd);
+		v4l2_close (grab_fd);
 		grab_fd=-1;
 	}
 }
@@ -579,7 +579,7 @@ int get_control_v4l2(unsigned int id) {
 	struct v4l2_queryctrl grab_ctrl;
 
 	grab_ctrl.id = id;
-	if (ioctl(grab_fd,VIDIOC_QUERYCTRL,&grab_ctrl) != -1) {
+	if (v4l2_ioctl(grab_fd,VIDIOC_QUERYCTRL,&grab_ctrl) != -1) {
 		fprintf(stderr, "ctrl %i:%s min:%i max:%i def:%i\n", id, grab_ctrl.name, grab_ctrl.minimum, grab_ctrl.maximum,
 		grab_ctrl.default_value);
 		return(0);
@@ -593,7 +593,7 @@ void set_v4l2control(unsigned int id, in
     if(!get_control_v4l2(id)) {
 	propcontrol.id = id;
     	propcontrol.value= value;
-    	ioctl (grab_fd, VIDIOC_S_CTRL, &propcontrol);
+    	v4l2_ioctl (grab_fd, VIDIOC_S_CTRL, &propcontrol);
     }
 }
 
@@ -613,7 +613,7 @@ unsigned char* grab_one(int *width, int 
     buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
     buf.memory = V4L2_MEMORY_MMAP;
 
-    if (ioctl (grab_fd, VIDIOC_DQBUF, &buf) == -1) {
+    if (v4l2_ioctl (grab_fd, VIDIOC_DQBUF, &buf) == -1) {
     	switch (errno) {
         	case EAGAIN:
 				return rgb_buf;
@@ -627,7 +627,7 @@ unsigned char* grab_one(int *width, int 
 			
 	grab_data=buffers[buf.index].start;
 
-	if (ioctl (grab_fd, VIDIOC_QBUF, &buf) == -1) {
+	if (v4l2_ioctl (grab_fd, VIDIOC_QBUF, &buf) == -1) {
 		show_error_dialog("VIDIOC_QBUF\n");
 		return;
 	}
@@ -675,12 +675,12 @@ unsigned char* grab_one(int *width, int 
 
 // Here begin functions for the Video4Linux Api 1
 int grab_init() {
-	if ((grab_fd = open(v_device,O_RDWR)) == -1 ) {
+	if ((grab_fd = v4l1_open(v_device,O_RDWR)) == -1 ) {
 	show_error_dialog("Could not open Video4Linux device.\nThe device may already be in use.");
 	return 0; 
 	}
 
-	if (ioctl(grab_fd,VIDIOCGCAP,&grab_cap) == -1) {
+	if (v4l1_ioctl(grab_fd,VIDIOCGCAP,&grab_cap) == -1) {
 	show_error_dialog("An error occurred at 'ioctl VIDIOCGCAP'.\nWrong device.");
 	return 0; 
 	}
@@ -706,7 +706,7 @@ int grab_init() {
 	strncpy(webcam_description, grab_cap.name ,28);
 	strcat(webcam_description, " V4L1");
 
-	if (ioctl (grab_fd, VIDIOCGPICT, &grab_pic) == -1) {
+	if (v4l1_ioctl (grab_fd, VIDIOCGPICT, &grab_pic) == -1) {
 		show_error_dialog("Error getting picture information.");
 		return 0; 
 	}
@@ -714,13 +714,13 @@ int grab_init() {
 	set_picture();
 
 	// Find out how many buffers are available
-	if(ioctl(grab_fd, VIDIOCGMBUF, &grab_mbuf) < 0)	{
+	if(v4l1_ioctl(grab_fd, VIDIOCGMBUF, &grab_mbuf) < 0)	{
 		show_error_dialog("Error while querying mmap-buffers.");
         return 0;
 	}
 	
 	/* mmap all available buffers. */
-	grab_data = mmap(0, grab_mbuf.size, PROT_READ | PROT_WRITE, MAP_SHARED, grab_fd, 0);
+	grab_data = v4l1_mmap(0, grab_mbuf.size, PROT_READ | PROT_WRITE, MAP_SHARED, grab_fd, 0);
 	if(grab_data == MAP_FAILED) {
 		show_error_dialog("Error mmap'ing all available buffers.");
 		return 0;
@@ -734,7 +734,7 @@ int grab_init() {
 	grab_size = x * y * w;
 	
 	/* Request the maximum number of frames the device can handle. */
-	if(ioctl(grab_fd, VIDIOCMCAPTURE, &grab_buf) < 0) {
+	if(v4l1_ioctl(grab_fd, VIDIOCMCAPTURE, &grab_buf) < 0) {
 		show_error_dialog("Error while capturing initial image.");
 		return 0;
 	}
@@ -748,9 +748,9 @@ void cleanup_v4l() {
 	if (v_device) {free (v_device); v_device=NULL;}
 	if (pnm_buf) {free(pnm_buf); pnm_buf=NULL;}
 	if (grab_fd>-1) {
-		close (grab_fd);
+		v4l1_munmap(grab_data, grab_mbuf.size);
+		v4l1_close (grab_fd);
 		grab_fd=-1;
-		munmap(grab_data, grab_mbuf.size);
 	}
 }
 
@@ -770,7 +770,7 @@ void set_picture() {
 		grab_pic.palette = wpalette[grab_palette].palette;
 		grab_pic.depth   = wpalette[grab_palette].depth;
 
-		if(!ioctl(grab_fd, VIDIOCSPICT, &grab_pic))
+		if(!v4l1_ioctl(grab_fd, VIDIOCSPICT, &grab_pic))
 		{
 			return;
 		}
@@ -785,12 +785,12 @@ unsigned char* grab_one(int *width, int 
 	set_picture();
 	
 	/* Wait for the frame to be captured. */
-	if(ioctl(grab_fd, VIDIOCSYNC, &grab_buf) < 0) {
+	if(v4l1_ioctl(grab_fd, VIDIOCSYNC, &grab_buf) < 0) {
 		show_error_dialog("An error occurred at 'ioctl VIDIOCSYNC'.");
 		return NULL;
 	}
 	
-	if(ioctl(grab_fd, VIDIOCMCAPTURE, &grab_buf) < 0) {
+	if(v4l1_ioctl(grab_fd, VIDIOCMCAPTURE, &grab_buf) < 0) {
 		show_error_dialog("Error while capturing an image.");
 		return NULL;
 	}


Index: gyachi.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gyachi/devel/gyachi.spec,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- gyachi.spec	29 Aug 2008 18:06:50 -0000	1.18
+++ gyachi.spec	7 Sep 2008 11:17:19 -0000	1.19
@@ -17,7 +17,7 @@
 
 Name:		gyachi
 Version:	1.1.46
-Release:	9%{?dist}
+Release:	10%{?dist}
 Summary:	A Yahoo! chat client with Webcam and voice support
 
 Group:		Applications/Internet
@@ -25,6 +25,7 @@
 URL:		http://gyachi.sourceforge.net
 Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
 #Patch0:	configure.patch
+Patch1:         gyachi-1.1.46-libv4l.patch
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -179,6 +180,7 @@
 %prep
 %setup -q
 #%patch0 -p1
+%patch1 -p1
 
 
 %build
@@ -285,6 +287,9 @@
 
 
 %changelog
+* Sun Sep  7 2008 Hans de Goede <hdegoede at redhat.com> - 1.1.46-10
+- Patch to use libv4l for support for more webcams
+
 * Thu Aug 28 2008 Michael Schwendt <mschwendt at fedoraproject.org> - 1.1.46-9
 - include %%_libdir/gyachi directory
 - include recre8 theme directory




More information about the fedora-extras-commits mailing list