[pygame] Removed V4L support because V4L has been deprecated from the Linux kernel as of 2.6.38

Jan Kaluža jkaluza at fedoraproject.org
Thu Jun 23 06:44:06 UTC 2011


commit b9500b42325ae3e8b8f323fd571162aa686e1870
Author: Jan Kaluza <hanzz.k at gmail.com>
Date:   Thu Jun 23 08:43:32 2011 +0200

    Removed V4L support because V4L has been deprecated from the Linux
    kernel as of 2.6.38

 pygame-remove-v4l.patch |  165 +++++++++++++++++++++++++++++++++++++++++++++++
 pygame.spec             |   10 +++-
 2 files changed, 174 insertions(+), 1 deletions(-)
---
diff --git a/pygame-remove-v4l.patch b/pygame-remove-v4l.patch
new file mode 100644
index 0000000..4870dd5
--- /dev/null
+++ b/pygame-remove-v4l.patch
@@ -0,0 +1,165 @@
+diff --git a/Setup.in b/Setup.in
+index c90174f..2ad0252 100644
+--- a/Setup.in
++++ b/Setup.in
+@@ -34,7 +34,7 @@ _numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG)
+ _numericsndarray src/_numericsndarray.c $(SDL) $(MIXER) $(DEBUG)
+ movie src/movie.c $(SDL) $(SMPEG) $(DEBUG)
+ scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
+-_camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
++_camera src/_camera.c src/camera_v4l2.c $(SDL) $(DEBUG)
+ pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
+ 
+ GFX = src/SDL_gfx/SDL_gfxPrimitives.c 
+diff --git a/src/_camera.c b/src/_camera.c
+index d25cf63..f354fab 100644
+--- a/src/_camera.c
++++ b/src/_camera.c
+@@ -22,7 +22,7 @@
+  * Author: Nirav Patel
+  *
+  * This module allows for use of v4l2 webcams in pygame.  The code is written
+- * such that adding support for v4l or vfw cameras should be possible without
++ * such that adding support for vfw cameras should be possible without
+  * much modification of existing functions.  v4l2 functions are kept seperate
+  * from functions available to pygame users and generic functions like
+  * colorspace conversion.
+@@ -160,20 +160,8 @@ PyObject* camera_start (PyCameraObject* self)
+ {
+ #if defined(__unix__)
+     if (v4l2_open_device(self) == 0) {
+-        if (v4l_open_device(self) == 0) {
+-            v4l2_close_device(self);
+-            return NULL;
+-        } else {
+-            self->camera_type = CAM_V4L;
+-            if (v4l_init_device(self) == 0) {
+-                v4l2_close_device(self);
+-                return NULL;
+-            }
+-            if (v4l_start_capturing(self) == 0) {
+-                v4l2_close_device(self);
+-                return NULL;
+-            }
+-        }
++        v4l2_close_device(self);
++        return NULL;
+     } else {
+         self->camera_type = CAM_V4L2;
+         if (v4l2_init_device(self) == 0) {
+diff --git a/src/camera.h b/src/camera.h
+index 921ad96..f528ad8 100644
+--- a/src/camera.h
++++ b/src/camera.h
+@@ -39,7 +39,6 @@
+ 
+     #include <asm/types.h>          /* for videodev2.h */
+ 
+-    #include <linux/videodev.h>
+     #include <linux/videodev2.h>
+ #endif
+ 
+@@ -51,7 +50,7 @@
+ #define RGB_OUT 1
+ #define YUV_OUT 2
+ #define HSV_OUT 4
+-#define CAM_V4L 1
++#define CAM_V4L 1 /* deprecated. the incomplete support in pygame was removed */
+ #define CAM_V4L2 2
+ 
+ struct buffer 
+@@ -111,8 +110,4 @@ int v4l2_init_device (PyCameraObject* self);
+ int v4l2_close_device (PyCameraObject* self);
+ int v4l2_open_device (PyCameraObject* self);
+ 
+-/* internal functions specific to v4l */
+-int v4l_open_device (PyCameraObject* self);
+-int v4l_init_device(PyCameraObject* self);
+-int v4l_start_capturing(PyCameraObject* self);
+ #endif
+diff --git a/src/camera_v4l.c b/src/camera_v4l.c
+index 674bfc6..e69de29 100644
+--- a/src/camera_v4l.c
++++ b/src/camera_v4l.c
+@@ -1,81 +0,0 @@
+-/*
+-  pygame - Python Game Library
+-
+-  This library is free software; you can redistribute it and/or
+-  modify it under the terms of the GNU Library General Public
+-  License as published by the Free Software Foundation; either
+-  version 2 of the License, or (at your option) any later version.
+-
+-  This library is distributed in the hope that it will be useful,
+-  but WITHOUT ANY WARRANTY; without even the implied warranty of
+-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-  Library General Public License for more details.
+-
+-  You should have received a copy of the GNU Library General Public
+-  License along with this library; if not, write to the Free
+-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+-  
+-*/
+-#if defined(__unix__)
+-#include "camera.h"
+-
+-/*
+- * V4L functions
+- */
+- 
+-int v4l_open_device (PyCameraObject* self)
+-{
+-    struct stat st;
+-    struct video_capability cap;
+-    struct video_mbuf buf;
+-    
+-    if (-1 == stat (self->device_name, &st)) {
+-        PyErr_Format(PyExc_SystemError, "Cannot identify '%s': %d, %s",
+-            self->device_name, errno, strerror (errno));
+-        return 0;
+-    }
+-
+-    if (!S_ISCHR (st.st_mode)) {
+-        PyErr_Format(PyExc_SystemError, "%s is no device",self->device_name);
+-        return 0;
+-    }
+-
+-    self->fd = open (self->device_name, O_RDWR /* required | O_NONBLOCK */, 0);
+-
+-    if (-1 == self->fd) {
+-        PyErr_Format(PyExc_SystemError, "Cannot open '%s': %d, %s",
+-            self->device_name, errno, strerror (errno));
+-        return 0;
+-    }
+-    
+-    if(ioctl(self->fd, VIDIOCGCAP, cap) == -1) {
+-        PyErr_Format(PyExc_SystemError, "%s is not a V4L device",
+-            self->device_name);        
+-	return 0;
+-    }
+-    
+-    if(!(cap.type & VID_TYPE_CAPTURE)) {
+-        PyErr_Format(PyExc_SystemError, "%s is not a video capture device",
+-            self->device_name);
+-        return 0;
+-    }
+-    
+-    if( ioctl(self->fd , VIDIOCGMBUF , buf ) == -1 ) {
+-        PyErr_Format(PyExc_SystemError, "%s does not support streaming i/o",
+-            self->device_name);
+-	return 0;
+-    }
+-    
+-    return 1;
+-}
+-
+-int v4l_init_device(PyCameraObject* self)
+-{
+-    return 0;
+-}
+-
+-int v4l_start_capturing(PyCameraObject* self)
+-{
+-    return 0;
+-}
+-#endif
diff --git a/pygame.spec b/pygame.spec
index 0fc5193..beb1c94 100644
--- a/pygame.spec
+++ b/pygame.spec
@@ -2,7 +2,7 @@
 
 Name:           pygame
 Version:        1.9.1
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Python modules for writing games
 
 Group:          Development/Languages
@@ -13,6 +13,9 @@ Patch0:         %{name}-1.9.1-config.patch
 # porttime is part of libportmidi.so, there's no libporttime in Fedora
 Patch1:         pygame-1.9.1-porttime.patch
 Patch2:         pygame-1.9.1-no-test-install.patch
+# patch backported from upstream repository, V4L has been remove in linux-2.6.38
+# http://svn.seul.org/viewcvs/viewvc.cgi?view=rev&root=PyGame&revision=3077
+Patch3:         pygame-remove-v4l.patch
 Source0:        http://pygame.org/ftp/%{name}-%{version}release.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -48,6 +51,7 @@ pygame.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 # rpmlint fixes
 find examples/ -type f -print0 | xargs -0 chmod -x 
@@ -101,6 +105,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Thu Jun 23 2011 Jan Kaluza <jkaluza at redhat.com> - 1.9.1-6
+- Removed V4L support because V4L has been deprecated from the Linux
+  kernel as of 2.6.38
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.9.1-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list