pygame-remove-v4l.patch 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. diff --git a/Setup.in b/Setup.in
  2. index c90174f..2ad0252 100644
  3. --- a/Setup.in
  4. +++ b/Setup.in
  5. @@ -34,7 +34,7 @@ _numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG)
  6. _numericsndarray src/_numericsndarray.c $(SDL) $(MIXER) $(DEBUG)
  7. movie src/movie.c $(SDL) $(SMPEG) $(DEBUG)
  8. scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
  9. -_camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
  10. +_camera src/_camera.c src/camera_v4l2.c $(SDL) $(DEBUG)
  11. pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
  12. GFX = src/SDL_gfx/SDL_gfxPrimitives.c
  13. diff --git a/src/_camera.c b/src/_camera.c
  14. index d25cf63..f354fab 100644
  15. --- a/src/_camera.c
  16. +++ b/src/_camera.c
  17. @@ -22,7 +22,7 @@
  18. * Author: Nirav Patel
  19. *
  20. * This module allows for use of v4l2 webcams in pygame. The code is written
  21. - * such that adding support for v4l or vfw cameras should be possible without
  22. + * such that adding support for vfw cameras should be possible without
  23. * much modification of existing functions. v4l2 functions are kept seperate
  24. * from functions available to pygame users and generic functions like
  25. * colorspace conversion.
  26. @@ -160,20 +160,8 @@ PyObject* camera_start (PyCameraObject* self)
  27. {
  28. #if defined(__unix__)
  29. if (v4l2_open_device(self) == 0) {
  30. - if (v4l_open_device(self) == 0) {
  31. - v4l2_close_device(self);
  32. - return NULL;
  33. - } else {
  34. - self->camera_type = CAM_V4L;
  35. - if (v4l_init_device(self) == 0) {
  36. - v4l2_close_device(self);
  37. - return NULL;
  38. - }
  39. - if (v4l_start_capturing(self) == 0) {
  40. - v4l2_close_device(self);
  41. - return NULL;
  42. - }
  43. - }
  44. + v4l2_close_device(self);
  45. + return NULL;
  46. } else {
  47. self->camera_type = CAM_V4L2;
  48. if (v4l2_init_device(self) == 0) {
  49. diff --git a/src/camera.h b/src/camera.h
  50. index 921ad96..f528ad8 100644
  51. --- a/src/camera.h
  52. +++ b/src/camera.h
  53. @@ -39,7 +39,6 @@
  54. #include <asm/types.h> /* for videodev2.h */
  55. - #include <linux/videodev.h>
  56. #include <linux/videodev2.h>
  57. #endif
  58. @@ -51,7 +50,7 @@
  59. #define RGB_OUT 1
  60. #define YUV_OUT 2
  61. #define HSV_OUT 4
  62. -#define CAM_V4L 1
  63. +#define CAM_V4L 1 /* deprecated. the incomplete support in pygame was removed */
  64. #define CAM_V4L2 2
  65. struct buffer
  66. @@ -111,8 +110,4 @@ int v4l2_init_device (PyCameraObject* self);
  67. int v4l2_close_device (PyCameraObject* self);
  68. int v4l2_open_device (PyCameraObject* self);
  69. -/* internal functions specific to v4l */
  70. -int v4l_open_device (PyCameraObject* self);
  71. -int v4l_init_device(PyCameraObject* self);
  72. -int v4l_start_capturing(PyCameraObject* self);
  73. #endif
  74. diff --git a/src/camera_v4l.c b/src/camera_v4l.c
  75. index 674bfc6..e69de29 100644
  76. --- a/src/camera_v4l.c
  77. +++ b/src/camera_v4l.c
  78. @@ -1,81 +0,0 @@
  79. -/*
  80. - pygame - Python Game Library
  81. -
  82. - This library is free software; you can redistribute it and/or
  83. - modify it under the terms of the GNU Library General Public
  84. - License as published by the Free Software Foundation; either
  85. - version 2 of the License, or (at your option) any later version.
  86. -
  87. - This library is distributed in the hope that it will be useful,
  88. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  89. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  90. - Library General Public License for more details.
  91. -
  92. - You should have received a copy of the GNU Library General Public
  93. - License along with this library; if not, write to the Free
  94. - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  95. -
  96. -*/
  97. -#if defined(__unix__)
  98. -#include "camera.h"
  99. -
  100. -/*
  101. - * V4L functions
  102. - */
  103. -
  104. -int v4l_open_device (PyCameraObject* self)
  105. -{
  106. - struct stat st;
  107. - struct video_capability cap;
  108. - struct video_mbuf buf;
  109. -
  110. - if (-1 == stat (self->device_name, &st)) {
  111. - PyErr_Format(PyExc_SystemError, "Cannot identify '%s': %d, %s",
  112. - self->device_name, errno, strerror (errno));
  113. - return 0;
  114. - }
  115. -
  116. - if (!S_ISCHR (st.st_mode)) {
  117. - PyErr_Format(PyExc_SystemError, "%s is no device",self->device_name);
  118. - return 0;
  119. - }
  120. -
  121. - self->fd = open (self->device_name, O_RDWR /* required | O_NONBLOCK */, 0);
  122. -
  123. - if (-1 == self->fd) {
  124. - PyErr_Format(PyExc_SystemError, "Cannot open '%s': %d, %s",
  125. - self->device_name, errno, strerror (errno));
  126. - return 0;
  127. - }
  128. -
  129. - if(ioctl(self->fd, VIDIOCGCAP, cap) == -1) {
  130. - PyErr_Format(PyExc_SystemError, "%s is not a V4L device",
  131. - self->device_name);
  132. - return 0;
  133. - }
  134. -
  135. - if(!(cap.type & VID_TYPE_CAPTURE)) {
  136. - PyErr_Format(PyExc_SystemError, "%s is not a video capture device",
  137. - self->device_name);
  138. - return 0;
  139. - }
  140. -
  141. - if( ioctl(self->fd , VIDIOCGMBUF , buf ) == -1 ) {
  142. - PyErr_Format(PyExc_SystemError, "%s does not support streaming i/o",
  143. - self->device_name);
  144. - return 0;
  145. - }
  146. -
  147. - return 1;
  148. -}
  149. -
  150. -int v4l_init_device(PyCameraObject* self)
  151. -{
  152. - return 0;
  153. -}
  154. -
  155. -int v4l_start_capturing(PyCameraObject* self)
  156. -{
  157. - return 0;
  158. -}
  159. -#endif