Commits

illume committed 1c26599

Disable camera_mac if OS X is above version 10.6.

Comments (0)

Files changed (3)

 
 /* list_cameras() - lists cameras available on the computer */
 PyObject* list_cameras (PyObject* self, PyObject* arg) {
-#if defined(__unix__) || defined (__APPLE__)
+#if defined(__unix__) || defined (PYGAME_MAC_CAMERA_OLD)
     PyObject* ret_list;
     PyObject* string;
     char** devices;
     
     #if defined(__unix__)
     devices = v4l2_list_cameras(&num_devices);
-    # elif defined(__APPLE__)
+    # elif defined(PYGAME_MAC_CAMERA_OLD)
     devices = mac_list_cameras(&num_devices);
     # endif
     
             return NULL;
         }
     }
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
     if (! (mac_open_device(self) == 1 && mac_init_device(self) == 1 && mac_start_capturing(self) == 1)) {
         mac_close_device(self);
         return NULL;
         return NULL;
     if (v4l2_close_device(self) == 0)
         return NULL;
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
     if (mac_stop_capturing(self) == 0)
         return NULL;
     if (mac_close_device(self) == 0)
         self->brightness = value;
     
     return Py_BuildValue ("(NNN)", PyBool_FromLong(self->hflip), PyBool_FromLong(self->vflip), PyInt_FromLong(self->brightness));
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
     return Py_BuildValue ("(NNN)", PyBool_FromLong(self->hflip), PyBool_FromLong(self->vflip), PyInt_FromLong(-1));
 #endif
     Py_RETURN_NONE;
            
     return Py_BuildValue ("(NNN)", PyBool_FromLong(self->hflip), PyBool_FromLong(self->vflip), PyInt_FromLong(self->brightness));
 
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
     int hflip = 0, vflip = 0, brightness = 0;
     char *kwids[] = {"hflip", "vflip", "brightness", NULL};
 
 PyObject* camera_get_size (PyCameraObject* self) {
 #if defined(__unix__)
     return Py_BuildValue ("(ii)", self->width, self->height);
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
     return Py_BuildValue ("(ii)", self->boundsRect.right, self->boundsRect.bottom);
 #endif
     Py_RETURN_NONE;
     } else {
         return PySurface_New (surf);
     }
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
         SDL_Surface* surf = NULL;
         PyObject *surfobj = NULL;
 
 PyObject* camera_get_raw(PyCameraObject* self) {
 #if defined(__unix__)
     return v4l2_read_raw(self);
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
     return mac_read_raw(self);
 #endif
     Py_RETURN_NONE;
     
     return (PyObject*)cameraobj;
     
-# elif defined(__APPLE__)
+# elif defined(PYGAME_MAC_CAMERA_OLD)
     int w, h;
     char* dev_name = NULL;
     char* color = NULL;
 
     #include <linux/videodev2.h>
 #elif defined(__APPLE__)
-    #include <QuickTime/QuickTime.h>
-    #include <QuickTime/Movies.h>
-    #include <QuickTime/ImageCompression.h>
-    
+    #include <AvailabilityMacros.h>
+    /* We support OSX 10.6 and below. */
+    #if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
+        #define #PYGAME_MAC_CAMERA_OLD 1
+    #endif
+#endif
+
+#if defined(PYGAME_MAC_CAMERA_OLD)
+        #include <QuickTime/QuickTime.h>
+        #include <QuickTime/Movies.h>
+        #include <QuickTime/ImageCompression.h>
 #endif
 
 /* some constants used which are not defined on non-v4l machines. */
     int brightness;
     int fd;
 } PyCameraObject;
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
 typedef struct PyCameraObject {
     PyObject_HEAD
     char* device_name;              /* unieke name of the device */
 int v4l2_close_device (PyCameraObject* self);
 int v4l2_open_device (PyCameraObject* self);
 
-#elif defined(__APPLE__)
+#elif defined(PYGAME_MAC_CAMERA_OLD)
 /* internal functions specific to mac */
 char** mac_list_cameras(int* num_devices);
 int mac_open_device (PyCameraObject* self);
 #import "camera.h"
 #import "pgcompat.h"
 
+#if defined(PYGAME_MAC_CAMERA_OLD)
+
 
 
 /* Flips the image array horizontally and/or vertically by reverse copying
     
     return 1;
 }
+
+
+#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.