camera: Rewrote Android support.
This does something a little weird, in that it doesn't care what `__ANDROID_API__` is set to, but will attempt to dlopen the system libraries, like we do for many other platform-specific pieces of SDL. This allows us to a) not bump the minimum required Android version, which is extremely ancient but otherwise still working, doing the right thing on old and new hardware in the field, and b) not require the app to link against more libraries than it previously did before the feature was available. The downside is that it's a little messy, but it's okay for now, I think.main
parent
848dcf8a5f
commit
2613e3da24
|
@ -24,6 +24,9 @@ LOCAL_SRC_FILES := \
|
|||
$(wildcard $(LOCAL_PATH)/src/audio/openslES/*.c) \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
|
||||
$(wildcard $(LOCAL_PATH)/src/camera/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/camera/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/camera/dummy/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/core/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
android:name="android.hardware.microphone"
|
||||
android:required="false" /> -->
|
||||
|
||||
<!-- Camera support -->
|
||||
<!-- if you want to record video, uncomment this. -->
|
||||
<!--
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
-->
|
||||
|
||||
<!-- Allow downloading to the external storage on Android 5.1 and older -->
|
||||
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="22" /> -->
|
||||
|
||||
|
|
|
@ -192,5 +192,6 @@
|
|||
|
||||
/* Enable the camera driver */
|
||||
#define SDL_CAMERA_DRIVER_ANDROID 1
|
||||
#define SDL_CAMERA_DRIVER_DUMMY 1
|
||||
|
||||
#endif /* SDL_build_config_android_h_ */
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
|
||||
#define DEBUG_CAMERA 0
|
||||
|
||||
|
||||
// !!! FIXME: update this driver!
|
||||
#ifdef SDL_CAMERA_DRIVER_ANDROID
|
||||
#undef SDL_CAMERA_DRIVER_ANDROID
|
||||
#endif
|
||||
|
||||
typedef struct SDL_CameraDevice SDL_CameraDevice;
|
||||
|
||||
/* Backends should call this as devices are added to the system (such as
|
||||
|
@ -53,6 +47,10 @@ extern void SDL_CameraDevicePermissionOutcome(SDL_CameraDevice *device, SDL_bool
|
|||
// Backends can call this to get a standardized name for a thread to power a specific camera device.
|
||||
extern char *SDL_GetCameraThreadName(SDL_CameraDevice *device, char *buf, size_t buflen);
|
||||
|
||||
// Backends can call these to change a device's refcount.
|
||||
extern void RefPhysicalCameraDevice(SDL_CameraDevice *device);
|
||||
extern void UnrefPhysicalCameraDevice(SDL_CameraDevice *device);
|
||||
|
||||
// These functions are the heart of the camera threads. Backends can call them directly if they aren't using the SDL-provided thread.
|
||||
extern void SDL_CameraThreadSetup(SDL_CameraDevice *device);
|
||||
extern SDL_bool SDL_CameraThreadIterate(SDL_CameraDevice *device);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue