Revert "Updated Camera Wrapper (from fortunave3g repo)"
This reverts commit 5117d9177750651d53dbf33fdff79b95c35cedca.
diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp
index 117311c..4f60007 100644
--- a/camera/CameraWrapper.cpp
+++ b/camera/CameraWrapper.cpp
@@ -21,7 +21,7 @@
*
*/
-#define LOG_NDEBUG 0
+//#define LOG_NDEBUG 0
#define LOG_TAG "CameraWrapper"
#include <cutils/log.h>
@@ -46,7 +46,7 @@
int32_t arg1, int32_t arg2);
static struct hw_module_methods_t camera_module_methods = {
- .open = camera_device_open
+ .open = camera_device_open,
};
camera_module_t HAL_MODULE_INFO_SYM = {
@@ -61,6 +61,7 @@
.dso = NULL, /* remove compilation warnings */
.reserved = {0}, /* remove compilation warnings */
},
+
.get_number_of_cameras = camera_get_number_of_cameras,
.get_camera_info = camera_get_camera_info,
.set_callbacks = NULL, /* remove compilation warnings */
@@ -97,9 +98,16 @@
return rv;
}
+static bool needYUV420preview(android::CameraParameters ¶ms) {
+ int video_width, video_height;
+ params.getPreviewSize(&video_width, &video_height);
+ ALOGV("%s : PreviewSize is %x", __FUNCTION__, video_width*video_height);
+ return video_width*video_height <= 720*720;
+}
+
#define KEY_VIDEO_HFR_VALUES "video-hfr-values"
-const static char * iso_values[] = {"auto,ISO_HJR,ISO100,ISO200,ISO400,ISO800"};
+const static char * iso_values[] = {"auto,ISO_HJR,ISO100,ISO200,ISO400,ISO800,ISO1600,auto"};
static char *camera_fixup_getparams(int id, const char *settings)
{
@@ -112,11 +120,11 @@
#endif
// fix params here
- params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]);
+// params.set(android::CameraParameters::KEY_SUPPORTED_ISO_MODES, iso_values[id]);
params.set(android::CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5");
- params.set(android::CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-2");
- params.set(android::CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "2");
-
+ params.set(android::CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-4");
+ params.set(android::CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "4");
+
/* If the vendor has HFR values but doesn't also expose that
* this can be turned off, fixup the params to tell the Camera
* that it really is okay to turn it off.
@@ -127,9 +135,9 @@
sprintf(tmp, "%s,off", hfrValues);
params.set(KEY_VIDEO_HFR_VALUES, tmp);
}
-
- params.set("whitebalance-values", "auto,incandescent,fluorescent,daylight,cloudy-daylight");
- params.set("effect-values", "none,mono,negative,sepia");
+
+ /* Enforce video-snapshot-supported to true */
+ params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true");
android::String8 strParams = params.flatten();
char *ret = strdup(strParams.string());
@@ -153,47 +161,36 @@
params.dump();
#endif
- // No need to fix-up ISO_HJR, it is the same for userspace and the camera lib
- if (params.get("iso")) {
- const char *isoMode = params.get(android::CameraParameters::KEY_ISO_MODE);
- if (strcmp(isoMode, "ISO100") == 0)
- params.set(android::CameraParameters::KEY_ISO_MODE, "100");
- else if (strcmp(isoMode, "ISO200") == 0)
- params.set(android::CameraParameters::KEY_ISO_MODE, "200");
- else if (strcmp(isoMode, "ISO400") == 0)
- params.set(android::CameraParameters::KEY_ISO_MODE, "400");
- else if (strcmp(isoMode, "ISO800") == 0)
- params.set(android::CameraParameters::KEY_ISO_MODE, "800");
- }
-
- // fix params here
- int video_width, video_height;
- params.getPreviewSize(&video_width, &video_height);
- if(video_width*video_height <= 960*540){
+ const char *recordingHint = params.get(android::CameraParameters::KEY_RECORDING_HINT);
+ bool isVideo = recordingHint && !strcmp(recordingHint, "true");
+
+ //if (isVideo) {
+ //params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_OFF);
+ //} else {
+ //params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_ON);
+ //}
+
+ if (needYUV420preview(params)) {
+ ALOGV("%s: switching preview format to yuv420p", __FUNCTION__);
params.set("preview-format", "yuv420p");
}
-
- params.set("scene-detect", "off");
-
- bool isVideo = false;
- if (params.get(android::CameraParameters::KEY_RECORDING_HINT))
- isVideo = !strcmp(params.get(android::CameraParameters::KEY_RECORDING_HINT), "true");
- if (id == 0) {
- int camMode;
- if (params.get(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE)) {
- camMode = params.getInt(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE);
- } else {
- camMode = -1;
- }
+ // fix params here
+ // No need to fix-up ISO_HJR, it is the same for userspace and the camera lib
+ //if (params.get("iso")) {
+ //const char *isoMode = params.get(android::CameraParameters::KEY_ISO_MODE);
+ //if (strcmp(isoMode, "ISO100") == 0)
+ //params.set(android::CameraParameters::KEY_ISO_MODE, "100");
+ //else if (strcmp(isoMode, "ISO200") == 0)
+ //params.set(android::CameraParameters::KEY_ISO_MODE, "200");
+ //else if (strcmp(isoMode, "ISO400") == 0)
+ //params.set(android::CameraParameters::KEY_ISO_MODE, "400");
+ //else if (strcmp(isoMode, "ISO800") == 0)
+ //params.set(android::CameraParameters::KEY_ISO_MODE, "800");
+ //else if (strcmp(isoMode, "ISO1600") == 0)
+ //params.set(android::CameraParameters::KEY_ISO_MODE, "1600");
+ //}
- if (camMode == -1) {
- params.set(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE, "1");
- } else {
- params.set(android::CameraParameters::KEY_SAMSUNG_CAMERA_MODE, isVideo ? "1" : "0");
- }
- }
-
android::String8 strParams = params.flatten();
if (fixed_set_params[id])
@@ -659,3 +656,4 @@
return 0;
return gVendorModule->get_camera_info(camera_id, info);
}
+