Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update camerahal, fixes panorama mode in camera

based on p500 jelly bean camera hal

Change-Id: I4c01eaa7d836217d1bcc03601e909af555c92e1f
  • Loading branch information...
commit 58b25fc3650237fa76b0cf3883dc7ee446117dc7 1 parent 4788449
@KonstaT authored
Showing with 36 additions and 43 deletions.
  1. +36 −43 libcamera/cameraHal.cpp
View
79 libcamera/cameraHal.cpp
@@ -37,38 +37,9 @@
#include "libhardware/modules/gralloc/gralloc_priv.h"
#endif
-//#define LOGV LOGI
-
-struct qcom_mdp_rect {
- uint32_t x;
- uint32_t y;
- uint32_t w;
- uint32_t h;
-};
-
-struct qcom_mdp_img {
- uint32_t width;
- int32_t height;
- int32_t format;
- int32_t offset;
- int memory_id; /* The file descriptor */
- uint32_t priv; // CONFIG_ANDROID_PMEM
-};
-
-struct qcom_mdp_blit_req {
- struct qcom_mdp_img src;
- struct qcom_mdp_img dst;
- struct qcom_mdp_rect src_rect;
- struct qcom_mdp_rect dst_rect;
- uint32_t alpha;
- uint32_t transp_mask;
- uint32_t flags;
- int sharpening_strength; /* -127 <--> 127, default 64 */
-};
-
struct blitreq {
unsigned int count;
- struct qcom_mdp_blit_req req;
+ struct mdp_blit_req req;
};
/* Prototypes and extern functions. */
@@ -360,7 +331,7 @@ CameraHAL_DataCb(int32_t msg_type, const android::sp<android::IMemory>& dataPtr,
hwParameters.getPreviewSize(&previewWidth, &previewHeight);
CameraHAL_HandlePreviewData(dataPtr, mWindow, origCamReqMemory,
previewWidth, previewHeight);
- }
+ }
if (origData_cb != NULL && origCamReqMemory != NULL) {
camera_memory_t *clientData = CameraHAL_GenClientData(dataPtr,
@@ -447,13 +418,15 @@ void
CameraHAL_FixupParams(android::CameraParameters &settings)
{
const char *preview_sizes =
- "1280x720,800x480,768x432,720x480,640x480,576x432,480x320,384x288,352x288,320x240,240x160,176x144";
+ "640x480,576x432,480x320,384x288,352x288,320x240,240x160,176x144";
const char *video_sizes =
- "1280x720,800x480,720x480,640x480,352x288,320x240,176x144";
- const char *preferred_size = "640x480";
- const char *preview_frame_rates = "30,27,24,15";
+ "640x480,352x288,320x240,176x144";
+ const char *preferred_size = "480x320";
+ const char *preview_frame_rates = "10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25";
const char *preferred_frame_rate = "15";
- const char *frame_rate_range = "(15,30)";
+ const char *frame_rate_range = "(10,25)";
+ const char *preferred_horizontal_viewing_angle = "51.2";
+ const char *preferred_vertical_viewing_angle = "39.4";
settings.set(android::CameraParameters::KEY_VIDEO_FRAME_FORMAT,
android::CameraParameters::PIXEL_FORMAT_YUV420SP);
@@ -463,10 +436,12 @@ CameraHAL_FixupParams(android::CameraParameters &settings)
preview_sizes);
}
+#if 0
if (!settings.get(android::CameraParameters::KEY_SUPPORTED_VIDEO_SIZES)) {
settings.set(android::CameraParameters::KEY_SUPPORTED_VIDEO_SIZES,
video_sizes);
}
+#endif
if (!settings.get(android::CameraParameters::KEY_VIDEO_SIZE)) {
settings.set(android::CameraParameters::KEY_VIDEO_SIZE, preferred_size);
@@ -492,6 +467,16 @@ CameraHAL_FixupParams(android::CameraParameters &settings)
settings.set(android::CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE,
frame_rate_range);
}
+
+ if (!settings.get(android::CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE)) {
+ settings.set(android::CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE,
+ preferred_horizontal_viewing_angle);
+ }
+
+ if (!settings.get(android::CameraParameters::KEY_VERTICAL_VIEW_ANGLE)) {
+ settings.set(android::CameraParameters::KEY_VERTICAL_VIEW_ANGLE,
+ preferred_vertical_viewing_angle);
+ }
}
/* Hardware Camera interface handlers. */
@@ -563,12 +548,11 @@ qcamera_start_preview(struct camera_device * device)
{
LOGV("qcamera_start_preview: Enabling CAMERA_MSG_PREVIEW_FRAME\n");
- /* TODO: Remove hack. */
LOGV("qcamera_start_preview: Preview enabled:%d msg enabled:%d\n",
qCamera->previewEnabled(),
qCamera->msgTypeEnabled(CAMERA_MSG_PREVIEW_FRAME));
if (!qCamera->msgTypeEnabled(CAMERA_MSG_PREVIEW_FRAME)) {
- qCamera->enableMsgType(CAMERA_MSG_PREVIEW_FRAME);
+ qCamera->enableMsgType(CAMERA_MSG_PREVIEW_FRAME);
}
return qCamera->startPreview();
}
@@ -579,7 +563,6 @@ qcamera_stop_preview(struct camera_device * device)
LOGV("qcamera_stop_preview: msgenabled:%d\n",
qCamera->msgTypeEnabled(CAMERA_MSG_PREVIEW_FRAME));
- /* TODO: Remove hack. */
if (qCamera->msgTypeEnabled(CAMERA_MSG_PREVIEW_FRAME)) {
qCamera->disableMsgType(CAMERA_MSG_PREVIEW_FRAME);
}
@@ -604,10 +587,15 @@ int
qcamera_start_recording(struct camera_device * device)
{
LOGV("qcamera_start_recording\n");
-
- /* TODO: Remove hack. */
+/*
+ if (qcamera_preview_enabled(device)){
+ LOGD("Preview was enabled");
+ qcamera_stop_preview(device);
+ }
+*/
qCamera->enableMsgType(CAMERA_MSG_VIDEO_FRAME);
qCamera->startRecording();
+
return NO_ERROR;
}
@@ -616,9 +604,11 @@ qcamera_stop_recording(struct camera_device * device)
{
LOGV("qcamera_stop_recording:\n");
- /* TODO: Remove hack. */
qCamera->disableMsgType(CAMERA_MSG_VIDEO_FRAME);
qCamera->stopRecording();
+/*
+ qcamera_start_preview(device);
+*/
}
int
@@ -660,7 +650,6 @@ qcamera_take_picture(struct camera_device * device)
{
LOGV("qcamera_take_picture:\n");
- /* TODO: Remove hack. */
qCamera->enableMsgType(CAMERA_MSG_SHUTTER |
CAMERA_MSG_POSTVIEW_FRAME |
CAMERA_MSG_RAW_IMAGE |
@@ -755,6 +744,9 @@ camera_device_close(hw_device_t* device)
return rc;
}
+void sighandle(int s){
+ //abort();
+}
int
qcamera_device_open(const hw_module_t* module, const char* name,
@@ -763,6 +755,7 @@ qcamera_device_open(const hw_module_t* module, const char* name,
void *libcameraHandle;
int cameraId = atoi(name);
+ signal(SIGFPE,(*sighandle)); //@nAa: Bad boy doing hacks
LOGD("qcamera_device_open: name:%s device:%p cameraId:%d\n",
name, device, cameraId);
Please sign in to comment.
Something went wrong with that request. Please try again.