(Apple) Ifdef code with HAVE_LOCATION and HAVE_CAMERA

This commit is contained in:
twinaphex 2014-01-06 16:27:30 +01:00
parent 61218b4a66
commit de703eee52
1 changed files with 17 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include "gfx/gfx_common.h" #include "gfx/gfx_common.h"
#include "gfx/gfx_context.h" #include "gfx/gfx_context.h"
#ifdef HAVE_LOCATION
#include <CoreLocation/CoreLocation.h> #include <CoreLocation/CoreLocation.h>
static CLLocationManager *locationManager; static CLLocationManager *locationManager;
@ -29,15 +30,20 @@ static CLLocationDegrees currentLatitude;
static CLLocationDegrees currentLongitude; static CLLocationDegrees currentLongitude;
static CLLocationAccuracy currentHorizontalAccuracy; static CLLocationAccuracy currentHorizontalAccuracy;
static CLLocationAccuracy currentVerticalAccuracy; static CLLocationAccuracy currentVerticalAccuracy;
#endif
// Define compatibility symbols and categories // Define compatibility symbols and categories
#ifdef IOS #ifdef IOS
#ifdef HAVE_CAMERA
#include <AVFoundation/AVCaptureSession.h> #include <AVFoundation/AVCaptureSession.h>
#include <AVFoundation/AVCaptureDevice.h> #include <AVFoundation/AVCaptureDevice.h>
#include <AVFoundation/AVCaptureOutput.h> #include <AVFoundation/AVCaptureOutput.h>
#include <AVFoundation/AVCaptureInput.h> #include <AVFoundation/AVCaptureInput.h>
#include <AVFoundation/AVMediaFormat.h> #include <AVFoundation/AVMediaFormat.h>
#include <CoreVideo/CVOpenGLESTextureCache.h> #include <CoreVideo/CVOpenGLESTextureCache.h>
#endif
#define APP_HAS_FOCUS ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive) #define APP_HAS_FOCUS ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
#define GLContextClass EAGLContext #define GLContextClass EAGLContext
@ -81,12 +87,13 @@ static const float ALMOST_INVISIBLE = .021f;
static GLKView* g_view; static GLKView* g_view;
static UIView* g_pause_indicator_view; static UIView* g_pause_indicator_view;
// Camera #ifdef HAVE_CAMERA
static AVCaptureSession *_session; static AVCaptureSession *_session;
static NSString *_sessionPreset; static NSString *_sessionPreset;
CVOpenGLESTextureCacheRef textureCache; CVOpenGLESTextureCacheRef textureCache;
GLuint outputTexture; GLuint outputTexture;
static bool newFrame = false; static bool newFrame = false;
#endif
#elif defined(OSX) #elif defined(OSX)
@ -231,6 +238,7 @@ static bool g_is_syncing = true;
return YES; return YES;
} }
#ifdef HAVE_CAMERA
void event_process_camera_frame(void* pixelBufferPtr) void event_process_camera_frame(void* pixelBufferPtr)
{ {
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)pixelBufferPtr; CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)pixelBufferPtr;
@ -357,6 +365,9 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
} }
#endif #endif
#endif
#ifdef HAVE_LOCATION
- (bool)onLocationHasChanged - (bool)onLocationHasChanged
{ {
bool hasChanged = locationChanged; bool hasChanged = locationChanged;
@ -415,10 +426,11 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation]; [locationManager startUpdatingLocation];
} }
#endif
@end @end
static RAScreen* get_chosen_screen() static RAScreen* get_chosen_screen(void)
{ {
if (g_settings.video.monitor_index >= RAScreen.screens.count) if (g_settings.video.monitor_index >= RAScreen.screens.count)
{ {
@ -600,6 +612,7 @@ void apple_bind_game_view_fbo(void)
[g_view bindDrawable]; [g_view bindDrawable];
} }
#ifdef HAVE_CAMERA
typedef struct ios_camera typedef struct ios_camera
{ {
void *empty; void *empty;
@ -680,6 +693,8 @@ const camera_driver_t camera_ios = {
}; };
#endif #endif
#endif
#ifdef HAVE_LOCATION #ifdef HAVE_LOCATION
typedef struct apple_location typedef struct apple_location
{ {