diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-03-07 15:44:37 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-03-07 17:27:17 +0800 |
commit | 7ac60f8c902354ba14013054f92013a9616a3221 (patch) | |
tree | ef3226c8f43415bb56db9a5fb6c627cfcd70225f | |
parent | 33688c562822f57efbaee655d07ff88fb94bc16b (diff) | |
download | device_samsung_crespo-7ac60f8c902354ba14013054f92013a9616a3221.zip device_samsung_crespo-7ac60f8c902354ba14013054f92013a9616a3221.tar.gz device_samsung_crespo-7ac60f8c902354ba14013054f92013a9616a3221.tar.bz2 |
libcamera: Fix setParameters crash when opening front camera.
bug fix: Duplicated setting of cameraid is caused that
setParameters fail. So, operations about setting of camera
id are moved for setting once.
bug:3512875
Change-Id: I48d0847644525a658b4415fffcf2910a83a65e43
Signed-off-by: Jeong-Seok Yang <jseok.yang@samsung.com>
-rwxr-xr-x | libcamera/SecCamera.cpp | 50 | ||||
-rw-r--r-- | libcamera/SecCamera.h | 1 | ||||
-rw-r--r-- | libcamera/SecCameraHWInterface.cpp | 2 |
3 files changed, 16 insertions, 37 deletions
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp index e17c878..4d0705a 100755 --- a/libcamera/SecCamera.cpp +++ b/libcamera/SecCamera.cpp @@ -736,6 +736,22 @@ int SecCamera::initCamera(int index) m_camera_id = index; + switch (m_camera_id) { + case CAMERA_ID_FRONT: + m_preview_max_width = MAX_FRONT_CAMERA_PREVIEW_WIDTH; + m_preview_max_height = MAX_FRONT_CAMERA_PREVIEW_HEIGHT; + m_snapshot_max_width = MAX_FRONT_CAMERA_SNAPSHOT_WIDTH; + m_snapshot_max_height = MAX_FRONT_CAMERA_SNAPSHOT_HEIGHT; + break; + + case CAMERA_ID_BACK: + m_preview_max_width = MAX_BACK_CAMERA_PREVIEW_WIDTH; + m_preview_max_height = MAX_BACK_CAMERA_PREVIEW_HEIGHT; + m_snapshot_max_width = MAX_BACK_CAMERA_SNAPSHOT_WIDTH; + m_snapshot_max_height = MAX_BACK_CAMERA_SNAPSHOT_HEIGHT; + break; + } + setExifFixedAttribute(); m_flag_init = 1; @@ -1615,40 +1631,6 @@ int SecCamera::getSnapshotPixelFormat(void) // ====================================================================== // Settings -int SecCamera::setCameraId(int camera_id) -{ - if ((camera_id != CAMERA_ID_FRONT) && (camera_id != CAMERA_ID_BACK)) { - LOGE("ERR(%s)::Invalid camera id(%d)\n", __func__, camera_id); - return -1; - } - if (m_camera_id == camera_id) - return 0; - - LOGV("%s(camera_id(%d))", __func__, camera_id); - - switch (camera_id) { - case CAMERA_ID_FRONT: - m_preview_max_width = MAX_FRONT_CAMERA_PREVIEW_WIDTH; - m_preview_max_height = MAX_FRONT_CAMERA_PREVIEW_HEIGHT; - m_snapshot_max_width = MAX_FRONT_CAMERA_SNAPSHOT_WIDTH; - m_snapshot_max_height = MAX_FRONT_CAMERA_SNAPSHOT_HEIGHT; - break; - - case CAMERA_ID_BACK: - m_preview_max_width = MAX_BACK_CAMERA_PREVIEW_WIDTH; - m_preview_max_height = MAX_BACK_CAMERA_PREVIEW_HEIGHT; - m_snapshot_max_width = MAX_BACK_CAMERA_SNAPSHOT_WIDTH; - m_snapshot_max_height = MAX_BACK_CAMERA_SNAPSHOT_HEIGHT; - break; - } - - m_camera_id = camera_id; - - resetCamera(); - - return 0; -} - int SecCamera::getCameraId(void) { return m_camera_id; diff --git a/libcamera/SecCamera.h b/libcamera/SecCamera.h index f3a2166..c87a0f4 100644 --- a/libcamera/SecCamera.h +++ b/libcamera/SecCamera.h @@ -284,7 +284,6 @@ public: int flagCreate(void) const; - int setCameraId(int camera_id); int getCameraId(void); int startPreview(void); diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp index 137653a..4a5b012 100644 --- a/libcamera/SecCameraHWInterface.cpp +++ b/libcamera/SecCameraHWInterface.cpp @@ -156,8 +156,6 @@ void CameraHardwareSec::initDefaultParameters(int cameraId) int snapshot_max_width = 0; int snapshot_max_height = 0; - /* set camera ID & reset camera */ - mSecCamera->setCameraId(cameraId); if (cameraId == SecCamera::CAMERA_ID_BACK) { p.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "720x480,640x480,352x288,176x144"); |