Skip to content
Browse files

Camera: QCOM legacy definitions,HTC cam switch,NO_UPDATE_PREVIEW

Updating Camera parameters, and service with several
compatibility patches:

1., QCOM legacy CameraParameters and functions:
Adding these will make ICS qcomm camera blobs work on JB 4.2.
Use BOARD_USES_QCOM_LEGACY_CAM_PARAMS := true in BoardConfig
to use this.

Also fixes the problem of legacy qcom
camera blobs with recent libcameraservice QCOM_HARDWARE changes,
where the orientation is messed up on first
preview: the fix is leaving out setPreviewWindow(window) for
legacy qcomm cam blobs.

2., Also adding NO_UPDATE_PREVIEW flag for legacy purposes.

3., Adding adding the set orientation patch:
Always set buffers orientation when setting the qcom camera preview window
Fixes the rotated preview on TouchPad
CyanogenMod/android_frameworks_base@1a8e41a

4., camera: Full support for HTC camera switch

5., Adding more parameters for HTC Explorer

Change-Id: I2bfc72b8ef027665356788f1db7f96b31d037dbe
  • Loading branch information...
1 parent 618aba9 commit 09f92d9ac901fffda9dd769758a18bc3bd377880 @tbalden tbalden committed with mnm9994u Mar 23, 2013
View
3 camera/Android.mk
@@ -25,6 +25,9 @@ endif
ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
LOCAL_CFLAGS += -DQCOM_HARDWARE
endif
+ifeq ($(BOARD_USES_QCOM_LEGACY_CAM_PARAMS),true)
+ LOCAL_CFLAGS += -DQCOM_LEGACY_CAM_PARAMS
+endif
LOCAL_MODULE:= libcamera_client
View
47 camera/CameraParameters.cpp
@@ -40,6 +40,28 @@ const char CameraParameters::KEY_PREVIEW_FRAME_RATE_MODE[] = "preview-frame-rate
const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[] = "preview-frame-rate-modes";
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_AUTO_MODE[] = "frame-rate-auto";
const char CameraParameters::KEY_PREVIEW_FRAME_RATE_FIXED_MODE[] = "frame-rate-fixed";
+#ifdef QCOM_LEGACY_CAM_PARAMS
+//Values for Continuous AF
+const char CameraParameters::CAF_OFF[] = "caf-off";
+const char CameraParameters::CAF_ON[] = "caf-on";
+//Same, for CodeAurora-based blobs
+const char CameraParameters::CAPTURE_MODE_NORMAL[] = "normal";
+const char CameraParameters::CAPTURE_MODE_BURST[] = "burst";
+const char CameraParameters::CAPTURE_MODE_CONTI_BURST[] = "contiburst";
+const char CameraParameters::CAPTURE_MODE_HDR[] = "hdr";
+const char CameraParameters::CAPTURE_MODE_HJR[] = "hjr";
+const char CameraParameters::CAPTURE_MODE_PANORAMA[] = "panorama";
+const char CameraParameters::CONTINUOUS_AF_OFF[] = "caf-off";
+const char CameraParameters::CONTINUOUS_AF_ON[] = "caf-on";
+const char CameraParameters::KEY_CONTINUOUS_AF[] = "continuous-af";
+const char CameraParameters::KEY_CAF[] = "continuous-af";
+const char CameraParameters::KEY_CAPTURE_MODE[] = "capture-mode";
+const char CameraParameters::KEY_PICTURE_COUNT[] = "picture-count";
+const char CameraParameters::KEY_MAX_BURST_PICTURE_COUNT[] = "max-burst-picture-count";
+const char CameraParameters::KEY_SUPPORTED_CONTINUOUS_AF[] = "continuous-af-mode";
+const char CameraParameters::KEY_SUPPORTED_CAF[] = "continuous-af-values";
+const char CameraParameters::KEY_SUPPORTED_CAPTURE_MODES[] = "capture-mode-values";
+#endif
#endif
const char CameraParameters::KEY_PICTURE_SIZE[] = "picture-size";
const char CameraParameters::KEY_SUPPORTED_PICTURE_SIZES[] = "picture-size-values";
@@ -266,6 +288,9 @@ const char CameraParameters::FOCUS_MODE_EDOF[] = "edof";
const char CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO[] = "continuous-video";
const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-picture";
#if defined(QCOM_HARDWARE)
+#ifdef QCOM_LEGACY_CAM_PARAMS
+const char CameraParameters::FOCUS_MODE_CONTINUOUS_CAMERA[] = "continuous-camera";
+#endif
const char CameraParameters::FOCUS_MODE_NORMAL[] = "normal";
@@ -309,11 +334,26 @@ const char CameraParameters::SKIN_TONE_ENHANCEMENT_ENABLE[] = "enable";
const char CameraParameters::SKIN_TONE_ENHANCEMENT_DISABLE[] = "disable";
const char CameraParameters::KEY_SHARPNESS[] = "sharpness";
+#ifdef QCOM_LEGACY_CAM_PARAMS
+const char CameraParameters::KEY_MAX_SHARPNESS[] = "sharpness-max";
+const char CameraParameters::KEY_MIN_SHARPNESS[] = "sharpness-min";
+#else
const char CameraParameters::KEY_MAX_SHARPNESS[] = "max-sharpness";
+#endif
const char CameraParameters::KEY_CONTRAST[] = "contrast";
+#ifdef QCOM_LEGACY_CAM_PARAMS
+const char CameraParameters::KEY_MAX_CONTRAST[] = "contrast-max";
+const char CameraParameters::KEY_MIN_CONTRAST[] = "contrast-min";
+#else
const char CameraParameters::KEY_MAX_CONTRAST[] = "max-contrast";
+#endif
const char CameraParameters::KEY_SATURATION[] = "saturation";
+#ifdef QCOM_LEGACY_CAM_PARAMS
+const char CameraParameters::KEY_MAX_SATURATION[] = "saturation-max";
+const char CameraParameters::KEY_MIN_SATURATION[] = "saturation-min";
+#else
const char CameraParameters::KEY_MAX_SATURATION[] = "max-saturation";
+#endif
//Values for DENOISE
const char CameraParameters::DENOISE_OFF[] = "denoise-off";
@@ -613,6 +653,13 @@ void CameraParameters::getSupportedPreviewSizes(Vector<Size> &sizes) const
}
#ifdef QCOM_HARDWARE
+#ifdef QCOM_LEGACY_CAM_PARAMS
+void CameraParameters::setPostviewSize(int width, int height)
+{
+ // dummy
+}
+#endif
+
void CameraParameters::getSupportedHfrSizes(Vector<Size> &sizes) const
{
const char *hfrSizesStr = get(KEY_SUPPORTED_HFR_SIZES);
View
42 include/camera/CameraParameters.h
@@ -182,6 +182,20 @@ class CameraParameters
static const char KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[];
static const char KEY_PREVIEW_FRAME_RATE_AUTO_MODE[];
static const char KEY_PREVIEW_FRAME_RATE_FIXED_MODE[];
+#ifdef QCOM_LEGACY_CAM_PARAMS
+ static const char KEY_CAPTURE_MODE[];
+ static const char KEY_SUPPORTED_CAPTURE_MODES[];
+ static const char KEY_PICTURE_COUNT[];
+ static const char KEY_MAX_BURST_PICTURE_COUNT[];
+ static const char KEY_SUPPORTED_CONTINUOUS_AF[];
+ static const char KEY_SUPPORTED_CAF[];
+ static const char CAPTURE_MODE_NORMAL[];
+ static const char CAPTURE_MODE_BURST[];
+ static const char CAPTURE_MODE_CONTI_BURST[];
+ static const char CAPTURE_MODE_HDR[];
+ static const char CAPTURE_MODE_HJR[];
+ static const char CAPTURE_MODE_PANORAMA[];
+#endif
#endif
// The dimensions for captured pictures in pixels (width x height).
// Example value: "1024x768". Read/write.
@@ -825,6 +839,22 @@ class CameraParameters
static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
#ifdef QCOM_HARDWARE
+#ifdef QCOM_LEGACY_CAM_PARAMS
+ static const char FOCUS_MODE_CONTINUOUS_CAMERA[];
+
+ // Values for Continuous AF
+ static const char CAF_OFF[] ;
+ static const char CAF_ON[] ;
+ // Proprietaries from CodeAurora use these...
+ static const char CONTINUOUS_AF_OFF[] ;
+ static const char CONTINUOUS_AF_ON[] ;
+ static const char KEY_CONTINUOUS_AF[] ;
+ static const char KEY_CAF[] ;
+ static const char KEY_TAKING_PICTURE_ZOOM[];
+ static const char KEY_PANORAMA_MODE[];
+ static const char PANORAMA_MODE_NOT_INPROGRESS[];
+ static const char PANORAMA_MODE_INPROGRESS[];
+#endif
// Normal focus mode. Applications should call
// CameraHardwareInterface.autoFocus to start the focus in this mode.
static const char FOCUS_MODE_NORMAL[];
@@ -848,10 +878,19 @@ class CameraParameters
static const char KEY_SHARPNESS[];
static const char KEY_MAX_SHARPNESS[];
+#ifdef QCOM_LEGACY_CAM_PARAMS
+ static const char KEY_MIN_SHARPNESS[];
+#endif
static const char KEY_CONTRAST[];
static const char KEY_MAX_CONTRAST[];
+#ifdef QCOM_LEGACY_CAM_PARAMS
+ static const char KEY_MIN_CONTRAST[];
+#endif
static const char KEY_SATURATION[];
static const char KEY_MAX_SATURATION[];
+#ifdef QCOM_LEGACY_CAM_PARAMS
+ static const char KEY_MIN_SATURATION[];
+#endif
static const char KEY_HISTOGRAM[] ;
static const char KEY_SUPPORTED_HISTOGRAM_MODES[] ;
@@ -922,6 +961,9 @@ class CameraParameters
int getOrientation() const;
void setOrientation(int orientation);
void setPreviewFpsRange(int minFPS,int maxFPS);
+#ifdef QCOM_LEGACY_CAM_PARAMS
+ void setPostviewSize(int x, int y);
+#endif
void getSupportedHfrSizes(Vector<Size> &sizes) const;
#endif
View
4 services/camera/libcameraservice/Android.mk
@@ -40,6 +40,10 @@ LOCAL_C_INCLUDES += \
system/media/camera/include \
external/jpeg
+ifeq ($(BOARD_USES_QCOM_LEGACY_CAM_PARAMS),true)
+ LOCAL_CFLAGS += -DQCOM_LEGACY_CAM_PARAMS
+endif
+
ifeq ($(BOARD_HAVE_HTC_FFC), true)
LOCAL_CFLAGS += -DBOARD_HAVE_HTC_FFC
endif
View
7 services/camera/libcameraservice/CameraClient.cpp
@@ -251,8 +251,10 @@ void CameraClient::disconnect() {
// Release the held ANativeWindow resources.
if (mPreviewWindow != 0) {
#ifdef QCOM_HARDWARE
+#ifndef NO_UPDATE_PREVIEW
mHardware->setPreviewWindow(0);
#endif
+#endif
disconnectWindow(mPreviewWindow);
mPreviewWindow = 0;
#ifndef QCOM_HARDWARE
@@ -297,9 +299,14 @@ status_t CameraClient::setPreviewWindow(const sp<IBinder>& binder,
result = mHardware->setPreviewWindow(window);
}
#ifdef QCOM_HARDWARE
+#ifndef NO_UPDATE_PREVIEW
} else {
+ if (window != 0) {
+ native_window_set_buffers_transform(window.get(), mOrientation);
+ }
result = mHardware->setPreviewWindow(window);
#endif
+#endif
}
if (result == NO_ERROR) {
View
18 services/camera/libcameraservice/CameraService.cpp
@@ -87,6 +87,24 @@ static void htcCameraSwitch(int cameraId)
// ----------------------------------------------------------------------------
+#if defined(BOARD_HAVE_HTC_FFC)
@johnnyslt
johnnyslt added a note May 17, 2013

duplicate function, see above this line

@mnm9994u
mnm9994u added a note May 17, 2013

thanks for noting it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+#define HTC_SWITCH_CAMERA_FILE_PATH "/sys/android_camera2/htcwc"
+static void htcCameraSwitch(int cameraId)
+{
+ char buffer[16];
+ int fd;
+
+ if (access(HTC_SWITCH_CAMERA_FILE_PATH, W_OK) == 0) {
+ snprintf(buffer, sizeof(buffer), "%d", cameraId);
+
+ fd = open(HTC_SWITCH_CAMERA_FILE_PATH, O_WRONLY);
+ write(fd, buffer, strlen(buffer));
+ close(fd);
+ }
+}
+#endif
+
+
// This is ugly and only safe if we never re-create the CameraService, but
// should be ok for now.
static CameraService *gCameraService;

0 comments on commit 09f92d9

Please sign in to comment.
Something went wrong with that request. Please try again.