universal7580: camera: add empty camera wrapper
authorcodeworkx <codeworkx@cyanogenmod.org>
Sat, 28 Nov 2015 19:33:54 +0000 (20:33 +0100)
committerJan Altensen <info@stricted.net>
Fri, 16 Aug 2019 21:18:43 +0000 (23:18 +0200)
Changes:
* Removed references to "Camera3"
* Made it build correctly on universal7580

Change-Id: Ifa7a77ff5a9eb903cf2146d8ce8c7d6a64a6da4c
Signed-off-by: Jesse Chan <jc@lineageos.org>
camera/Android.mk [new file with mode: 0644]
camera/Camera2Wrapper.cpp [new file with mode: 0644]
camera/Camera2Wrapper.h [new file with mode: 0644]
camera/CameraWrapper.cpp [new file with mode: 0644]
camera/CameraWrapper.h [new file with mode: 0644]
include/camera/CameraParametersExtra.h [new file with mode: 0644]

diff --git a/camera/Android.mk b/camera/Android.mk
new file mode 100644 (file)
index 0000000..b094bd6
--- /dev/null
@@ -0,0 +1,20 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+    CameraWrapper.cpp \
+    Camera2Wrapper.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+    libhardware liblog libcamera_client libutils libcutils
+
+LOCAL_C_INCLUDES += \
+    system/core/include \
+    system/media/camera/include
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+LOCAL_MODULE := camera.$(TARGET_BOOTLOADER_BOARD_NAME)
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/camera/Camera2Wrapper.cpp b/camera/Camera2Wrapper.cpp
new file mode 100644 (file)
index 0000000..0079c87
--- /dev/null
@@ -0,0 +1,497 @@
+/*
+ * Copyright (C) 2017, The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_PARAMETERS
+
+#define LOG_TAG "Camera2Wrapper"
+#include <cutils/log.h>
+
+#include "CameraWrapper.h"
+#include "Camera2Wrapper.h"
+
+typedef struct wrapper_camera2_device {
+    camera_device_t base;
+    int id;
+    camera_device_t *vendor;
+} wrapper_camera2_device_t;
+
+#define VENDOR_CALL(device, func, ...) ({ \
+    wrapper_camera2_device_t *__wrapper_dev = (wrapper_camera2_device_t*) device; \
+    __wrapper_dev->vendor->ops->func(__wrapper_dev->vendor, ##__VA_ARGS__); \
+})
+
+#define CAMERA_ID(device) (((wrapper_camera2_device_t *)(device))->id)
+
+static camera_module_t *gVendorModule = 0;
+
+static int check_vendor_module()
+{
+    int rv = 0;
+    ALOGV("%s", __FUNCTION__);
+
+    if(gVendorModule)
+        return 0;
+
+    rv = hw_get_module_by_class("camera", "vendor", (const hw_module_t **)&gVendorModule);
+    if (rv)
+        ALOGE("failed to open vendor camera module");
+    return rv;
+}
+
+/*******************************************************************
+ * Camera2 wrapper fixup functions
+ *******************************************************************/
+
+static char * camera2_fixup_getparams(int id __unused, const char * settings)
+{
+    bool videoMode = false;
+    const char* isoMode;
+    char *manipBuf;
+
+    android::CameraParameters params;
+    params.unflatten(android::String8(settings));
+
+#ifdef LOG_PARAMETERS
+    ALOGV("%s: Original parameters:", __FUNCTION__);
+    params.dump();
+#endif
+
+#ifdef LOG_PARAMETERS
+    ALOGV("%s: Fixed parameters:", __FUNCTION__);
+    params.dump();
+#endif
+
+    android::String8 strParams = params.flatten();
+    char *ret = strdup(strParams.string());
+
+    return ret;
+}
+
+static char * camera2_fixup_setparams(int id __unused, const char * settings)
+{
+    bool videoMode = false;
+    const char* isoMode;
+
+    android::CameraParameters params;
+    params.unflatten(android::String8(settings));
+
+#ifdef LOG_PARAMETERS
+    ALOGV("%s: Original parameters:", __FUNCTION__);
+    params.dump();
+#endif
+
+#ifdef LOG_PARAMETERS
+    ALOGV("%s: Fixed parameters:", __FUNCTION__);
+    params.dump();
+#endif
+
+    android::String8 strParams = params.flatten();
+    char *ret = strdup(strParams.string());
+
+    return ret;
+}
+
+/*******************************************************************
+ * implementation of camera_device_ops functions
+ *******************************************************************/
+
+static int camera2_set_preview_window(struct camera_device * device,
+        struct preview_stream_ops *window)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device || !window)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, set_preview_window, window);
+}
+
+static void camera2_set_callbacks(struct camera_device * device,
+        camera_notify_callback notify_cb,
+        camera_data_callback data_cb,
+        camera_data_timestamp_callback data_cb_timestamp,
+        camera_request_memory get_memory,
+        void *user)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return;
+
+    VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user);
+}
+
+static void camera2_enable_msg_type(struct camera_device * device, int32_t msg_type)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return;
+
+    VENDOR_CALL(device, enable_msg_type, msg_type);
+}
+
+static void camera2_disable_msg_type(struct camera_device * device, int32_t msg_type)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return;
+
+    VENDOR_CALL(device, disable_msg_type, msg_type);
+}
+
+static int camera2_msg_type_enabled(struct camera_device * device, int32_t msg_type)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return 0;
+
+    return VENDOR_CALL(device, msg_type_enabled, msg_type);
+}
+
+static int camera2_start_preview(struct camera_device * device)
+{
+    int rc = 0;
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    rc = VENDOR_CALL(device, start_preview);
+    return rc;
+}
+
+static void camera2_stop_preview(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return;
+
+    VENDOR_CALL(device, stop_preview);
+}
+
+static int camera2_preview_enabled(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, preview_enabled);
+}
+
+static int camera2_store_meta_data_in_buffers(struct camera_device * device, int enable)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, store_meta_data_in_buffers, enable);
+}
+
+static int camera2_start_recording(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return EINVAL;
+
+    return VENDOR_CALL(device, start_recording);
+}
+
+static void camera2_stop_recording(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return;
+
+
+    VENDOR_CALL(device, stop_recording);
+}
+
+static int camera2_recording_enabled(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, recording_enabled);
+}
+
+static void camera2_release_recording_frame(struct camera_device * device,
+                const void *opaque)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return;
+
+    VENDOR_CALL(device, release_recording_frame, opaque);
+}
+
+static int camera2_auto_focus(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+
+    return VENDOR_CALL(device, auto_focus);
+}
+
+static int camera2_cancel_auto_focus(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, cancel_auto_focus);
+}
+
+static int camera2_take_picture(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, take_picture);
+}
+
+static int camera2_cancel_picture(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, cancel_picture);
+}
+
+static int camera2_set_parameters(struct camera_device * device, const char *params)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    char *tmp = NULL;
+    tmp = camera2_fixup_setparams(CAMERA_ID(device), params);
+
+    int ret = VENDOR_CALL(device, set_parameters, tmp);
+
+    return ret;
+}
+
+static char* camera2_get_parameters(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return NULL;
+
+    char* params = VENDOR_CALL(device, get_parameters);
+
+    char * tmp = camera2_fixup_getparams(CAMERA_ID(device), params);
+    VENDOR_CALL(device, put_parameters, params);
+    params = tmp;
+
+    return params;
+}
+
+static void camera2_put_parameters(struct camera_device *device, char *params)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(params)
+        free(params);
+}
+
+static int camera2_send_command(struct camera_device * device,
+            int32_t cmd, int32_t arg1, int32_t arg2)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, send_command, cmd, arg1, arg2);
+}
+
+static void camera2_release(struct camera_device * device)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return;
+
+    VENDOR_CALL(device, release);
+}
+
+static int camera2_dump(struct camera_device * device, int fd)
+{
+    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera2_device_t*)device)->vendor));
+
+    if(!device)
+        return -EINVAL;
+
+    return VENDOR_CALL(device, dump, fd);
+}
+
+static int camera2_device_close(hw_device_t* device)
+{
+    int ret = 0;
+    wrapper_camera2_device_t *wrapper_dev = NULL;
+
+    ALOGV("%s", __FUNCTION__);
+
+    android::Mutex::Autolock lock(gCameraWrapperLock);
+
+    if (!device) {
+        ret = -EINVAL;
+        goto done;
+    }
+
+    wrapper_dev = (wrapper_camera2_device_t*) device;
+
+    wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor);
+    if (wrapper_dev->base.ops)
+        free(wrapper_dev->base.ops);
+    free(wrapper_dev);
+done:
+    return ret;
+}
+
+/*******************************************************************
+ * implementation of camera_module functions
+ *******************************************************************/
+
+/* open device handle to one of the cameras
+ *
+ * assume camera service will keep singleton of each camera
+ * so this function will always only be called once per camera instance
+ */
+
+int camera2_device_open(const hw_module_t* module, const char* name,
+                hw_device_t** device)
+{
+    int rv = 0;
+    int num_cameras = 0;
+    int cameraid;
+    wrapper_camera2_device_t* camera2_device = NULL;
+    camera_device_ops_t* camera2_ops = NULL;
+
+    android::Mutex::Autolock lock(gCameraWrapperLock);
+
+    ALOGV("%s", __FUNCTION__);
+
+    if (name != NULL) {
+        if (check_vendor_module())
+            return -EINVAL;
+
+        cameraid = atoi(name);
+        num_cameras = gVendorModule->get_number_of_cameras();
+
+        if (cameraid > num_cameras) {
+            ALOGE("camera service provided cameraid out of bounds, "
+                    "cameraid = %d, num supported = %d",
+                    cameraid, num_cameras);
+            rv = -EINVAL;
+            goto fail;
+        }
+
+        camera2_device = (wrapper_camera2_device_t*)malloc(sizeof(*camera2_device));
+        if (!camera2_device) {
+            ALOGE("camera2_device allocation fail");
+            rv = -ENOMEM;
+            goto fail;
+        }
+        memset(camera2_device, 0, sizeof(*camera2_device));
+        camera2_device->id = cameraid;
+
+        rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name,(hw_device_t**)&(camera2_device->vendor));
+        if (rv)
+        {
+            ALOGE("vendor camera open fail");
+            goto fail;
+        }
+        ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera2_device->vendor));
+
+        camera2_ops = (camera_device_ops_t*)malloc(sizeof(*camera2_ops));
+        if (!camera2_ops) {
+            ALOGE("camera_ops allocation fail");
+            rv = -ENOMEM;
+            goto fail;
+        }
+
+        memset(camera2_ops, 0, sizeof(*camera2_ops));
+
+        camera2_device->base.common.tag = HARDWARE_DEVICE_TAG;
+        camera2_device->base.common.version = CAMERA_DEVICE_API_VERSION_1_0;
+        camera2_device->base.common.module = (hw_module_t *)(module);
+        camera2_device->base.common.close = camera2_device_close;
+        camera2_device->base.ops = camera2_ops;
+
+        camera2_ops->set_preview_window = camera2_set_preview_window;
+        camera2_ops->set_callbacks = camera2_set_callbacks;
+        camera2_ops->enable_msg_type = camera2_enable_msg_type;
+        camera2_ops->disable_msg_type = camera2_disable_msg_type;
+        camera2_ops->msg_type_enabled = camera2_msg_type_enabled;
+        camera2_ops->start_preview = camera2_start_preview;
+        camera2_ops->stop_preview = camera2_stop_preview;
+        camera2_ops->preview_enabled = camera2_preview_enabled;
+        camera2_ops->store_meta_data_in_buffers = camera2_store_meta_data_in_buffers;
+        camera2_ops->start_recording = camera2_start_recording;
+        camera2_ops->stop_recording = camera2_stop_recording;
+        camera2_ops->recording_enabled = camera2_recording_enabled;
+        camera2_ops->release_recording_frame = camera2_release_recording_frame;
+        camera2_ops->auto_focus = camera2_auto_focus;
+        camera2_ops->cancel_auto_focus = camera2_cancel_auto_focus;
+        camera2_ops->take_picture = camera2_take_picture;
+        camera2_ops->cancel_picture = camera2_cancel_picture;
+        camera2_ops->set_parameters = camera2_set_parameters;
+        camera2_ops->get_parameters = camera2_get_parameters;
+        camera2_ops->put_parameters = camera2_put_parameters;
+        camera2_ops->send_command = camera2_send_command;
+        camera2_ops->release = camera2_release;
+        camera2_ops->dump = camera2_dump;
+
+        *device = &camera2_device->base.common;
+    }
+
+    return rv;
+
+fail:
+    if(camera2_device) {
+        free(camera2_device);
+        camera2_device = NULL;
+    }
+    if(camera2_ops) {
+        free(camera2_ops);
+        camera2_ops = NULL;
+    }
+    *device = NULL;
+    return rv;
+}
diff --git a/camera/Camera2Wrapper.h b/camera/Camera2Wrapper.h
new file mode 100644 (file)
index 0000000..20121a5
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2017, The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dlfcn.h>
+#include <hardware/camera2.h>
+
+int camera2_device_open(const hw_module_t* module, const char* name, hw_device_t** device);
diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp
new file mode 100644 (file)
index 0000000..ed48529
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2017, The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_PARAMETERS
+
+#define LOG_TAG "CameraWrapper"
+#include <cutils/log.h>
+
+#include "CameraWrapper.h"
+#include "Camera2Wrapper.h"
+
+static camera_module_t *gVendorModule = 0;
+
+static int check_vendor_module()
+{
+    int rv = 0;
+    ALOGV("%s", __FUNCTION__);
+
+    if(gVendorModule)
+        return 0;
+
+    rv = hw_get_module_by_class("camera", "vendor", (const hw_module_t **)&gVendorModule);
+    if (rv)
+        ALOGE("failed to open vendor camera module");
+    return rv;
+}
+
+static struct hw_module_methods_t camera_module_methods = {
+    .open = camera_device_open
+};
+
+camera_module_t HAL_MODULE_INFO_SYM = {
+    .common = {
+         .tag = HARDWARE_MODULE_TAG,
+         .module_api_version = CAMERA_MODULE_API_VERSION_2_4,
+         .hal_api_version = HARDWARE_HAL_API_VERSION,
+         .id = CAMERA_HARDWARE_MODULE_ID,
+         .name = "universal7580 Camera Wrapper",
+         .author = "The LineageOS Project",
+         .methods = &camera_module_methods,
+         .dso = NULL,
+         .reserved = {0},
+    },
+    .get_number_of_cameras = camera_get_number_of_cameras,
+    .get_camera_info = camera_get_camera_info,
+    .set_callbacks = camera_set_callbacks,
+    .get_vendor_tag_ops = camera_get_vendor_tag_ops,
+    .open_legacy = camera_open_legacy,
+    .set_torch_mode = NULL,
+    .init = NULL,
+    .reserved = {0},
+};
+
+static int camera_device_open(const hw_module_t* module, const char* name,
+                hw_device_t** device)
+{
+    int rv = -EINVAL;
+
+    if (name != NULL) {
+        if (check_vendor_module())
+            return -EINVAL;
+        rv = camera2_device_open(module, name, device);
+    }
+
+    return rv;
+}
+
+static int camera_get_number_of_cameras(void)
+{
+    ALOGV("%s", __FUNCTION__);
+    if (check_vendor_module())
+        return 0;
+    return gVendorModule->get_number_of_cameras();
+}
+
+static int camera_get_camera_info(int camera_id, struct camera_info *info)
+{
+    ALOGV("%s", __FUNCTION__);
+    if (check_vendor_module())
+        return 0;
+    return gVendorModule->get_camera_info(camera_id, info);
+}
+
+static int camera_set_callbacks(const camera_module_callbacks_t *callbacks)
+{
+    ALOGV("%s", __FUNCTION__);
+    if (check_vendor_module())
+        return 0;
+    return gVendorModule->set_callbacks(callbacks);
+}
+
+static void camera_get_vendor_tag_ops(vendor_tag_ops_t* ops)
+{
+    ALOGV("%s", __FUNCTION__);
+    if (check_vendor_module())
+        return;
+    return gVendorModule->get_vendor_tag_ops(ops);
+}
+
+static int camera_open_legacy(const struct hw_module_t* module, const char* id, uint32_t halVersion, struct hw_device_t** device)
+{
+    ALOGV("%s", __FUNCTION__);
+    if (check_vendor_module())
+        return 0;
+    return camera2_device_open(module, id, device);
+}
diff --git a/camera/CameraWrapper.h b/camera/CameraWrapper.h
new file mode 100644 (file)
index 0000000..c8183d5
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017, The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <utils/String8.h>
+#include <hardware/hardware.h>
+#include <hardware/camera.h>
+#include <camera/Camera.h>
+#include <camera/CameraParameters.h>
+#include <camera/CameraParametersExtra.h>
+
+static android::Mutex gCameraWrapperLock;
+
+static int camera_device_open(const hw_module_t* module, const char* name,
+                hw_device_t** device);
+static int camera_device_close(hw_device_t* device);
+static int camera_get_number_of_cameras(void);
+static int camera_get_camera_info(int camera_id, struct camera_info *info);
+static int camera_set_callbacks(const camera_module_callbacks_t *callbacks);
+static void camera_get_vendor_tag_ops(vendor_tag_ops_t* ops);
+static int camera_open_legacy(const struct hw_module_t* module, const char* id, uint32_t halVersion, struct hw_device_t** device);
diff --git a/include/camera/CameraParametersExtra.h b/include/camera/CameraParametersExtra.h
new file mode 100644 (file)
index 0000000..f781db9
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2014 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define CAMERA_PARAMETERS_EXTRA_C \
+    const char CameraParameters::PIXEL_FORMAT_YUV420SP_NV21[] = "nv21"; \
+    const char CameraParameters::EFFECT_CARTOONIZE[] = "cartoonize"; \
+    const char CameraParameters::EFFECT_POINT_RED_YELLOW[] = "point-red-yellow"; \
+    const char CameraParameters::EFFECT_POINT_GREEN[] = "point-green"; \
+    const char CameraParameters::EFFECT_POINT_BLUE[] = "point-blue"; \
+    const char CameraParameters::EFFECT_VINTAGE_COLD[] = "vintage-cold"; \
+    const char CameraParameters::EFFECT_VINTAGE_WARM[] = "vintage-warm"; \
+    const char CameraParameters::EFFECT_WASHED[] = "washed"; \
+    const char CameraParameters::ISO_AUTO[] = "auto"; \
+    const char CameraParameters::ISO_NIGHT[] = "night"; \
+    const char CameraParameters::ISO_SPORTS[] = "sports"; \
+    const char CameraParameters::ISO_6400[] = "6400"; \
+    const char CameraParameters::ISO_3200[] = "3200"; \
+    const char CameraParameters::ISO_1600[] = "1600"; \
+    const char CameraParameters::ISO_800[] = "800"; \
+    const char CameraParameters::ISO_400[] = "400"; \
+    const char CameraParameters::ISO_200[] = "200"; \
+    const char CameraParameters::ISO_100[] = "100"; \
+    const char CameraParameters::ISO_80[] = "80"; \
+    const char CameraParameters::ISO_50[] = "50"; \
+    const char CameraParameters::KEY_SUPPORTED_METERING_MODE[] = "metering-values"; \
+    const char CameraParameters::METERING_CENTER[] = "center"; \
+    const char CameraParameters::METERING_MATRIX[] = "matrix"; \
+    const char CameraParameters::METERING_SPOT[] = "spot"; \
+    const char CameraParameters::METERING_OFF[] = "off"; \
+    const char CameraParameters::KEY_DYNAMIC_RANGE_CONTROL[] = "dynamic-range-control"; \
+    const char CameraParameters::KEY_SUPPORTED_PHASE_AF[] = "phase-af-values"; \
+    const char CameraParameters::KEY_PHASE_AF[] = "phase-af"; \
+    const char CameraParameters::KEY_SUPPORTED_RT_HDR[] = "rt-hdr-values"; \
+    const char CameraParameters::KEY_RT_HDR[] = "rt-hdr";
+
+#define CAMERA_PARAMETERS_EXTRA_H \
+    static const char PIXEL_FORMAT_YUV420SP_NV21[]; \
+    static const char EFFECT_CARTOONIZE[]; \
+    static const char EFFECT_POINT_RED_YELLOW[]; \
+    static const char EFFECT_POINT_GREEN[]; \
+    static const char EFFECT_POINT_BLUE[]; \
+    static const char EFFECT_VINTAGE_COLD[]; \
+    static const char EFFECT_VINTAGE_WARM[]; \
+    static const char EFFECT_WASHED[]; \
+    static const char ISO_AUTO[]; \
+    static const char ISO_NIGHT[]; \
+    static const char ISO_SPORTS[]; \
+    static const char ISO_6400[]; \
+    static const char ISO_3200[]; \
+    static const char ISO_1600[]; \
+    static const char ISO_800[]; \
+    static const char ISO_400[]; \
+    static const char ISO_200[]; \
+    static const char ISO_100[]; \
+    static const char ISO_80[]; \
+    static const char ISO_50[]; \
+    static const char KEY_SUPPORTED_METERING_MODE[]; \
+    static const char METERING_CENTER[]; \
+    static const char METERING_MATRIX[]; \
+    static const char METERING_SPOT[]; \
+    static const char METERING_OFF[]; \
+    static const char KEY_DYNAMIC_RANGE_CONTROL[]; \
+    static const char KEY_SUPPORTED_PHASE_AF[]; \
+    static const char KEY_PHASE_AF[]; \
+    static const char KEY_SUPPORTED_RT_HDR[]; \
+    static const char KEY_RT_HDR[];
+