diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index b860a46..59cd665 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -41,6 +41,12 @@ using namespace android; static Mutex gCameraWrapperLock; static camera_module_t *gVendorModule = 0; +static camera_notify_callback gUserNotifyCb = NULL; +static camera_data_callback gUserDataCb = NULL; +static camera_data_timestamp_callback gUserDataCbTimestamp = NULL; +static camera_request_memory gUserGetMemory = NULL; +static void *gUserCameraDevice = NULL; + static char **fixed_set_params = NULL; static int camera_device_open(const hw_module_t *module, const char *name, @@ -167,6 +173,25 @@ static int camera_set_preview_window(struct camera_device *device, return VENDOR_CALL(device, set_preview_window, window); } +void camera_notify_cb(int32_t msg_type, int32_t ext1, int32_t ext2, void *user) { + gUserNotifyCb(msg_type, ext1, ext2, gUserCameraDevice); +} + +void camera_data_cb(int32_t msg_type, const camera_memory_t *data, unsigned int index, + camera_frame_metadata_t *metadata, void *user) { + gUserDataCb(msg_type, data, index, metadata, gUserCameraDevice); +} + +void camera_data_cb_timestamp(nsecs_t timestamp, int32_t msg_type, + const camera_memory_t *data, unsigned index, void *user) { + gUserDataCbTimestamp(timestamp, msg_type, data, index, gUserCameraDevice); +} + +camera_memory_t* camera_get_memory(int fd, size_t buf_size, + uint_t num_bufs, void *user) { + return gUserGetMemory(fd, buf_size, num_bufs, gUserCameraDevice); +} + static void camera_set_callbacks(struct camera_device *device, camera_notify_callback notify_cb, camera_data_callback data_cb, @@ -180,8 +205,14 @@ static void camera_set_callbacks(struct camera_device *device, ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); - VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, - get_memory, user); + gUserNotifyCb = notify_cb; + gUserDataCb = data_cb; + gUserDataCbTimestamp = data_cb_timestamp; + gUserGetMemory = get_memory; + gUserCameraDevice = user; + + VENDOR_CALL(device, set_callbacks, camera_notify_cb, camera_data_cb, + camera_data_cb_timestamp, camera_get_memory, user); } static void camera_enable_msg_type(struct camera_device *device,