summaryrefslogtreecommitdiffstats
path: root/libcamera
diff options
context:
space:
mode:
authorJeong-Seok Yang <jseok.yang@samsung.com>2010-10-28 05:57:09 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-28 05:57:09 -0700
commit7639b4de08763301673a32870b563b21f8873786 (patch)
tree593f2409b739fd1fca38494f7bace828cba14d50 /libcamera
parent58943579b69ea1916124e434cc11a233065c467b (diff)
parent096a5ced3e3d3868cb6b575d8fd209f9e8c7772e (diff)
downloaddevice_samsung_crespo-7639b4de08763301673a32870b563b21f8873786.zip
device_samsung_crespo-7639b4de08763301673a32870b563b21f8873786.tar.gz
device_samsung_crespo-7639b4de08763301673a32870b563b21f8873786.tar.bz2
am 096a5ced: am 0f5a5274: libcamera: Fix EXIF informations
* commit '096a5ced3e3d3868cb6b575d8fd209f9e8c7772e': libcamera: Fix EXIF informations
Diffstat (limited to 'libcamera')
-rw-r--r--libcamera/SecCamera.cpp41
-rw-r--r--libcamera/SecCamera.h9
2 files changed, 36 insertions, 14 deletions
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
index 78a760d..1519be8 100644
--- a/libcamera/SecCamera.cpp
+++ b/libcamera/SecCamera.cpp
@@ -827,9 +827,10 @@ int SecCamera::initCamera(int index)
ret = fimc_v4l2_s_input(m_cam_fd2, index);
CHECK(ret);
#endif
+ m_camera_id = index;
+
setExifFixedAttribute();
- m_camera_id = index;
m_flag_init = 1;
}
return 0;
@@ -3271,13 +3272,19 @@ int SecCamera::getJpegThumbnailSize(int *width, int *height)
void SecCamera::setExifFixedAttribute()
{
+ char property[PROPERTY_VALUE_MAX];
+
//2 0th IFD TIFF Tags
//3 Maker
strcpy((char *)mExifInfo.maker, EXIF_DEF_MAKER);
//3 Model
strcpy((char *)mExifInfo.model, EXIF_DEF_MODEL);
//3 Software
- property_get("ro.build.PDA", (char *)mExifInfo.software, EXIF_DEF_SOFTWARE);
+ property_get("ro.build.id", property, EXIF_DEF_SOFTWARE);
+ strncpy((char *)mExifInfo.software, property,
+ sizeof(mExifInfo.software) - 1);
+ mExifInfo.software[sizeof(mExifInfo.software) - 1] = '\0';
+
//3 YCbCr Positioning
mExifInfo.ycbcr_positioning = EXIF_DEF_YCBCR_POSITIONING;
@@ -3296,10 +3303,12 @@ void SecCamera::setExifFixedAttribute()
//3 Maximum lens aperture
mExifInfo.max_aperture.num = mExifInfo.aperture.num;
mExifInfo.max_aperture.den = mExifInfo.aperture.den;
- //3 Flash
- mExifInfo.flash = EXIF_DEF_FLASH;
//3 Lens Focal Length
- mExifInfo.focal_length.num = 343; /* focal length of 3.43mm */
+ if (m_camera_id == CAMERA_ID_BACK)
+ mExifInfo.focal_length.num = BACK_CAMERA_FOCAL_LENGTH;
+ else
+ mExifInfo.focal_length.num = FRONT_CAMERA_FOCAL_LENGTH;
+
mExifInfo.focal_length.den = EXIF_DEF_FOCAL_LEN_DEN;
//3 User Comments
strcpy((char *)mExifInfo.user_comment, EXIF_DEF_USERCOMMENTS);
@@ -3376,12 +3385,9 @@ void SecCamera::setExifChangedAttribute()
if (iso < 0) {
LOGE("%s: error %d getting iso, camera_id = %d, using 100",
__func__, iso, m_camera_id);
- iso = 100;
+ iso = ISO_100;
}
- if (m_params->iso == ISO_AUTO) {
- mExifInfo.iso_speed_rating = iso;
- } else {
- switch(m_params->iso) {
+ switch(iso) {
case ISO_50:
mExifInfo.iso_speed_rating = 50;
break;
@@ -3401,18 +3407,17 @@ void SecCamera::setExifChangedAttribute()
mExifInfo.iso_speed_rating = 1600;
break;
default:
- mExifInfo.iso_speed_rating = iso;
+ mExifInfo.iso_speed_rating = 100;
break;
- }
}
uint32_t av, tv, bv, sv, ev;
av = APEX_FNUM_TO_APERTURE((double)mExifInfo.fnumber.num / mExifInfo.fnumber.den);
tv = APEX_EXPOSURE_TO_SHUTTER((double)mExifInfo.exposure_time.num / mExifInfo.exposure_time.den);
- sv = APEX_ISO_TO_FILMSENSITIVITY(iso);
+ sv = APEX_ISO_TO_FILMSENSITIVITY(mExifInfo.iso_speed_rating);
bv = av + tv - sv;
ev = av + tv;
- LOGD("Shutter speed=%d us, iso=%d\n", shutterSpeed, iso);
+ LOGD("Shutter speed=%d us, iso=%d\n", shutterSpeed, mExifInfo.iso_speed_rating);
LOGD("AV=%d, TV=%d, SV=%d\n", av, tv, sv);
//3 Shutter Speed
@@ -3444,6 +3449,14 @@ void SecCamera::setExifChangedAttribute()
mExifInfo.metering_mode = EXIF_METERING_AVERAGE;
break;
}
+
+ //3 Flash
+ int flash = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAMERA_GET_FLASH_ONOFF);
+ if (flash < 0)
+ mExifInfo.flash = EXIF_DEF_FLASH;
+ else
+ mExifInfo.flash = flash;
+
//3 White Balance
if (m_params->white_balance == WHITE_BALANCE_AUTO)
mExifInfo.white_balance = EXIF_WB_AUTO;
diff --git a/libcamera/SecCamera.h b/libcamera/SecCamera.h
index f1efcb9..71b643f 100644
--- a/libcamera/SecCamera.h
+++ b/libcamera/SecCamera.h
@@ -115,6 +115,9 @@ namespace android {
#define S5K4ECGX_THUMBNAIL_HEIGHT 240
#define S5K4ECGX_THUMBNAIL_BPP 16
+/* focal length of 3.43mm */
+#define S5K4ECGX_FOCAL_LENGTH 343
+
#define VGA_PREVIEW_WIDTH 640
#define VGA_PREVIEW_HEIGHT 480
#define VGA_SNAPSHOT_WIDTH 640
@@ -124,6 +127,9 @@ namespace android {
#define VGA_THUMBNAIL_HEIGHT 120
#define VGA_THUMBNAIL_BPP 16
+/* focal length of 0.9mm */
+#define VGA_FOCAL_LENGTH 90
+
#define MAX_BACK_CAMERA_PREVIEW_WIDTH JOIN(BACK_CAM,_PREVIEW_WIDTH)
#define MAX_BACK_CAMERA_PREVIEW_HEIGHT JOIN(BACK_CAM,_PREVIEW_HEIGHT)
#define MAX_BACK_CAMERA_SNAPSHOT_WIDTH JOIN(BACK_CAM,_SNAPSHOT_WIDTH)
@@ -136,6 +142,8 @@ namespace android {
#define BACK_CAMERA_THUMBNAIL_HEIGHT JOIN(BACK_CAM,_THUMBNAIL_HEIGHT)
#define BACK_CAMERA_THUMBNAIL_BPP JOIN(BACK_CAM,_THUMBNAIL_BPP)
+#define BACK_CAMERA_FOCAL_LENGTH JOIN(BACK_CAM,_FOCAL_LENGTH)
+
#define MAX_FRONT_CAMERA_PREVIEW_WIDTH JOIN(FRONT_CAM,_PREVIEW_WIDTH)
#define MAX_FRONT_CAMERA_PREVIEW_HEIGHT JOIN(FRONT_CAM,_PREVIEW_HEIGHT)
#define MAX_FRONT_CAMERA_SNAPSHOT_WIDTH JOIN(FRONT_CAM,_SNAPSHOT_WIDTH)
@@ -144,6 +152,7 @@ namespace android {
#define FRONT_CAMERA_THUMBNAIL_WIDTH JOIN(FRONT_CAM,_THUMBNAIL_WIDTH)
#define FRONT_CAMERA_THUMBNAIL_HEIGHT JOIN(FRONT_CAM,_THUMBNAIL_HEIGHT)
#define FRONT_CAMERA_THUMBNAIL_BPP JOIN(FRONT_CAM,_THUMBNAIL_BPP)
+#define FRONT_CAMERA_FOCAL_LENGTH JOIN(FRONT_CAM,_FOCAL_LENGTH)
#define DEFAULT_JPEG_THUMBNAIL_WIDTH 256
#define DEFAULT_JPEG_THUMBNAIL_HEIGHT 192