packages: python-pygame/python-pygame-remove-v4l.patch (NEW)=?UTF-8?Q?=20?=- new, based o...

adamg adamg at pld-linux.org
Mon Feb 13 23:13:59 CET 2012


Author: adamg                        Date: Mon Feb 13 22:13:59 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- new, based on https://bitbucket.org/pygame/pygame/changeset/8296cad31717/raw/

---- Files affected:
packages/python-pygame:
   python-pygame-remove-v4l.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/python-pygame/python-pygame-remove-v4l.patch
diff -u /dev/null packages/python-pygame/python-pygame-remove-v4l.patch:1.1
--- /dev/null	Mon Feb 13 23:13:59 2012
+++ packages/python-pygame/python-pygame-remove-v4l.patch	Mon Feb 13 23:13:53 2012
@@ -0,0 +1,170 @@
+based on https://bitbucket.org/pygame/pygame/changeset/8296cad31717/raw/
+
+# HG changeset patch
+# User Nirav Patel <nrp at eclecti.cc>
+# Date 1303583959 0
+# Node ID 8296cad317177b84fa52e6757c198391804e1b1b
+# Parent  15eeb4b2082188e15502286ad439d30cb9195504
+Patch from Martijn Schmidt. Remove V4L support.
+
+With modifications by Nirav Patel.  V4L has effectively
+been deprecated from the Linux kernel as of 2.6.38. Support
+in pygame was just a placeholder, and removing it
+will not change any functionality.
+
+diff -r 15eeb4b2082188e15502286ad439d30cb9195504 -r 8296cad317177b84fa52e6757c198391804e1b1b Setup_Unix.in
+--- a/Setup.in	Fri Apr 15 20:47:04 2011 +0000
++++ b/Setup.in	Sat Apr 23 18:39:19 2011 +0000
+@@ -1,2 +1,2 @@
+ #This file defines platform specific modules for linux
+-_camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
++_camera src/_camera.c src/camera_v4l2.c $(SDL) $(DEBUG)
+diff -r 15eeb4b2082188e15502286ad439d30cb9195504 -r 8296cad317177b84fa52e6757c198391804e1b1b src/_camera.c
+--- a/src/_camera.c	Fri Apr 15 20:47:04 2011 +0000
++++ b/src/_camera.c	Sat Apr 23 18:39:19 2011 +0000
+@@ -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.
+@@ -165,20 +165,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 -r 15eeb4b2082188e15502286ad439d30cb9195504 -r 8296cad317177b84fa52e6757c198391804e1b1b src/camera.h
+--- a/src/camera.h	Fri Apr 15 20:47:04 2011 +0000
++++ b/src/camera.h	Sat Apr 23 18:39:19 2011 +0000
+@@ -38,7 +38,6 @@
+ 
+     #include <asm/types.h>          /* for videodev2.h */
+ 
+-    #include <linux/videodev.h>
+     #include <linux/videodev2.h>
+ #elif defined(__APPLE__)
+     #include <QuickTime/QuickTime.h>
+@@ -64,7 +63,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 {
+@@ -165,8 +164,4 @@
+ 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 -r 15eeb4b2082188e15502286ad439d30cb9195504 -r 8296cad317177b84fa52e6757c198391804e1b1b src/camera_v4l.c
+--- a/src/camera_v4l.c	Fri Apr 15 20:47:04 2011 +0000
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -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
================================================================


More information about the pld-cvs-commit mailing list