diff options
author | Ankit Premrajka <ankitp@codeaurora.org> | 2011-11-21 19:25:02 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-12-05 23:39:35 -0800 |
commit | bfd1c91937c47898a146ba769793978c6a611468 (patch) | |
tree | 085eb52b7bf2d2ff9cf1e9044ee37f73eec13883 | |
parent | 4e5350799c058af24649f3f790ac990b9314711e (diff) | |
download | frameworks_av-bfd1c91937c47898a146ba769793978c6a611468.zip frameworks_av-bfd1c91937c47898a146ba769793978c6a611468.tar.gz frameworks_av-bfd1c91937c47898a146ba769793978c6a611468.tar.bz2 |
Camera: Qcom parameters partial rebase
Add customized parameters for qcom camera features.
Squashed commit of the following submissions to CAF:
camera: add custom camera parameters to hardware java file.
Change-Id: Ic2b363df6d25a0c3a49aed30e717d10874f533ae
Camera: Add support for wavelet denoise
Change-Id: I97be72615fe5909987ac430034bbdc16f2d20509
Camera : Add support for histogram in frameworks
Change-Id: Ibf751c3b2d488f4be0afaaa3e994372bafeffbe7
Camera: Add ZSL support in framework.
Change-Id: I4e863020d7d407d9c3936beb83dc7abf385c4654
Camera: Add touch AF/AEC support in ICS framework
In, ICS the old touch AF/AEC functions getTouchIndexAf(),
setTouchIndexAf() etc are no longer valid. Added new functions to get
the center of touched area.
Change-Id: I37d00040f895cd8a4de2e2a438971aa2d9c1a045
Camera: Add support for Red eye reduction
Change-Id: Iada280ac33aee8b1114dc40d8d79e0e47ad5c2fd
Conflicts:
api/current.txt
Camera: Enable streaming texture and YV12 feature
Change-Id: I814c92b469e0f25baef0ce80338761d1e6443085
Camera: Add frameworks support for high frame rate
Change-Id: I9722e9b7e61433651ab5f76f76208853eb1fd849
Camera: Simplify ASD menu and best mode menu.
Change-Id: Ia7a1eca9268eec021a6e2c3f7ce2a932e8819d50
Camera : Macro definition change. PIXEL_FORMAT_YV12 to "yuv420p"
Why: CTS testcase is expecting "yuv420p" as the format string for YV12 mode.
CRs-Fixed: 328252
(cherry picked from commit 0a263f67b75497e4b95b9de8c370ed9496ab59ef)
Change-Id: I66f418a52775a969d81bcb332bbe500370e3ab7c
Camera: Changes for face detection
Change-Id: I7b2172e8690d6e23762e42f5888fecbfda15ba61
Camera: Add support for burst count
Change-Id: I4488a5eac1eebb0b5c8e2cc7cbbe7be0c7301be7
Camera: enable HDR feature
(cherry picked from commit e40770bbdadd925fc1e07a08249a15981b961570)
Change-Id: Ie9ca3066e8e53710bf292d047a3724aefc029854
Camera : Add API to find fullsize liveshot support
Change-Id: I3c2fc3578decbe5cf87fded5362f317df0b40b5e
(cherry picked from commit 65d80f04892776eec1c19c844eacb8c454b4bd1a)
Camera: Set default camera area string
The default invalid value for KEY_FOCUS_AREA and
KEY_METERING_AREA is changed to "(0,0,0,0,0)"
CRs-fixed: 334934
Change-Id: I354802c8611ee5c00a591b96b1a1ca04926969cb
Camera: Change the scenemode names in framework
To comply with ICS API Specification,
SCENE_MODE_AUTO changed to SCENE_MODE_ASD
SCENE_MODE_OFF changed to SCENE_MODE_AUTO
Change-Id: I8e744f10c728f469923b09f69d6d64bc5c7c6850
Camera : Framework changes for camcorder UI menu
Change-Id: Iff9e9021da44b67f81a24c828b960113ee249248
Camera : Remove unwanted video resolution in Framework
- FWVGA, WQVGA resolution UI options are removed for camcorder.
Change-Id: If621140966b01dbc8c30a4d161e6771528b8adda
Camera : Enable FWVGA and WQVGA resolutions in camcorder media profiles
Change-Id: Iad9cc33f7b6d8eb7de21df372c016edeef0b99ba
Unlock camera AWB lock only when white-balance is changed.
bug:5633546
Change-Id: I90bb4b5b445daedf38a64e2f8fb980fc0f0aaa81
Change-Id: Ie3cc15132489502e64321776d49d96846b5705d6
Conflicts:
camera/Android.mk
camera/CameraParameters.cpp
include/camera/CameraParameters.h
services/camera/libcameraservice/CameraService.cpp
services/camera/libcameraservice/CameraService.h
-rw-r--r-- | camera/Android.mk | 4 | ||||
-rw-r--r-- | camera/CameraParameters.cpp | 314 | ||||
-rw-r--r-- | include/camera/CameraParameters.h | 238 | ||||
-rw-r--r-- | include/media/MediaProfiles.h | 9 | ||||
-rw-r--r-- | include/media/mediarecorder.h | 3 | ||||
-rw-r--r-- | media/libmedia/MediaProfiles.cpp | 4 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraHardwareInterface.h | 10 |
7 files changed, 573 insertions, 9 deletions
diff --git a/camera/Android.mk b/camera/Android.mk index cad2a53..9f60da2 100644 --- a/camera/Android.mk +++ b/camera/Android.mk @@ -22,6 +22,10 @@ ifeq ($(BOARD_CAMERA_HAVE_ISO),true) LOCAL_CFLAGS += -DHAVE_ISO endif +ifeq ($(BOARD_USES_QCOM_HARDWARE),true) + LOCAL_CFLAGS += -DQCOM_HARDWARE +endif + LOCAL_MODULE:= libcamera_client include $(BUILD_SHARED_LIBRARY) diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp index 45b5196..1bedd89 100644 --- a/camera/CameraParameters.cpp +++ b/camera/CameraParameters.cpp @@ -26,12 +26,21 @@ namespace android { // Parameter keys to communicate between camera application and driver. const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size"; const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values"; +#ifdef QCOM_HARDWARE +const char CameraParameters::KEY_SUPPORTED_HFR_SIZES[] = "hfr-size-values"; +#endif const char CameraParameters::KEY_PREVIEW_FORMAT[] = "preview-format"; const char CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS[] = "preview-format-values"; const char CameraParameters::KEY_PREVIEW_FRAME_RATE[] = "preview-frame-rate"; const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES[] = "preview-frame-rate-values"; const char CameraParameters::KEY_PREVIEW_FPS_RANGE[] = "preview-fps-range"; const char CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE[] = "preview-fps-range-values"; +#ifdef QCOM_HARDWARE +const char CameraParameters::KEY_PREVIEW_FRAME_RATE_MODE[] = "preview-frame-rate-mode"; +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"; +#endif const char CameraParameters::KEY_PICTURE_SIZE[] = "picture-size"; const char CameraParameters::KEY_SUPPORTED_PICTURE_SIZES[] = "picture-size-values"; const char CameraParameters::KEY_PICTURE_FORMAT[] = "picture-format"; @@ -51,10 +60,20 @@ const char CameraParameters::KEY_WHITE_BALANCE[] = "whitebalance"; const char CameraParameters::KEY_SUPPORTED_WHITE_BALANCE[] = "whitebalance-values"; const char CameraParameters::KEY_EFFECT[] = "effect"; const char CameraParameters::KEY_SUPPORTED_EFFECTS[] = "effect-values"; +#ifdef QCOM_HARDWARE +const char CameraParameters::KEY_TOUCH_AF_AEC[] = "touch-af-aec"; +const char CameraParameters::KEY_SUPPORTED_TOUCH_AF_AEC[] = "touch-af-aec-values"; +const char CameraParameters::KEY_TOUCH_INDEX_AEC[] = "touch-index-aec"; +const char CameraParameters::KEY_TOUCH_INDEX_AF[] = "touch-index-af"; +#endif const char CameraParameters::KEY_ANTIBANDING[] = "antibanding"; const char CameraParameters::KEY_SUPPORTED_ANTIBANDING[] = "antibanding-values"; const char CameraParameters::KEY_SCENE_MODE[] = "scene-mode"; const char CameraParameters::KEY_SUPPORTED_SCENE_MODES[] = "scene-mode-values"; +#ifdef QCOM_HARDWARE +const char CameraParameters::KEY_SCENE_DETECT[] = "scene-detect"; +const char CameraParameters::KEY_SUPPORTED_SCENE_DETECT[] = "scene-detect-values"; +#endif QCOM_HARDWARE const char CameraParameters::KEY_FLASH_MODE[] = "flash-mode"; const char CameraParameters::KEY_SUPPORTED_FLASH_MODES[] = "flash-mode-values"; const char CameraParameters::KEY_FOCUS_MODE[] = "focus-mode"; @@ -81,6 +100,28 @@ const char CameraParameters::KEY_ZOOM_SUPPORTED[] = "zoom-supported"; const char CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED[] = "smooth-zoom-supported"; const char CameraParameters::KEY_FOCUS_DISTANCES[] = "focus-distances"; const char CameraParameters::KEY_VIDEO_FRAME_FORMAT[] = "video-frame-format"; +#ifdef QCOM_HARDWARE +const char CameraParameters::KEY_ISO_MODE[] = "iso"; +const char CameraParameters::KEY_SUPPORTED_ISO_MODES[] = "iso-values"; +const char CameraParameters::KEY_LENSSHADE[] = "lensshade"; +const char CameraParameters::KEY_SUPPORTED_LENSSHADE_MODES[] = "lensshade-values"; +const char CameraParameters::KEY_AUTO_EXPOSURE[] = "auto-exposure"; +const char CameraParameters::KEY_SUPPORTED_AUTO_EXPOSURE[] = "auto-exposure-values"; +const char CameraParameters::KEY_DENOISE[] = "denoise"; +const char CameraParameters::KEY_SUPPORTED_DENOISE[] = "denoise-values"; +const char CameraParameters::KEY_SELECTABLE_ZONE_AF[] = "selectable-zone-af"; +const char CameraParameters::KEY_SUPPORTED_SELECTABLE_ZONE_AF[] = "selectable-zone-af-values"; +const char CameraParameters::KEY_FACE_DETECTION[] = "face-detection"; +const char CameraParameters::KEY_SUPPORTED_FACE_DETECTION[] = "face-detection-values"; +const char CameraParameters::KEY_MEMORY_COLOR_ENHANCEMENT[] = "mce"; +const char CameraParameters::KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[] = "mce-values"; +const char CameraParameters::KEY_VIDEO_HIGH_FRAME_RATE[] = "video-hfr"; +const char CameraParameters::KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[] = "video-hfr-values"; +const char CameraParameters::KEY_REDEYE_REDUCTION[] = "redeye-reduction"; +const char CameraParameters::KEY_SUPPORTED_REDEYE_REDUCTION[] = "redeye-reduction-values"; +const char CameraParameters::KEY_HIGH_DYNAMIC_RANGE_IMAGING[] = "hdr"; +const char CameraParameters::KEY_SUPPORTED_HDR_IMAGING_MODES[] = "hdr-values"; +#endif const char CameraParameters::KEY_VIDEO_SIZE[] = "video-size"; const char CameraParameters::KEY_SUPPORTED_VIDEO_SIZES[] = "video-size-values"; const char CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = "preferred-preview-size-for-video"; @@ -88,8 +129,17 @@ const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW[] = "max-num-detected const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW[] = "max-num-detected-faces-sw"; const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint"; const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported"; +const char CameraParameters::KEY_FULL_VIDEO_SNAP_SUPPORTED[] = "full-video-snap-supported"; const char CameraParameters::KEY_VIDEO_STABILIZATION[] = "video-stabilization"; const char CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED[] = "video-stabilization-supported"; +#ifdef QCOM_HARDWARE +const char CameraParameters::KEY_ZSL[] = "zsl"; +const char CameraParameters::KEY_SUPPORTED_ZSL_MODES[] = "zsl-values"; +const char CameraParameters::KEY_CAMERA_MODE[] = "camera-mode"; +#endif +const char CameraParameters::KEY_AE_BRACKET_HDR[] = "ae-bracket-hdr"; +/*only effective when KEY_AE_BRACKET_HDR set to ae_bracketing*/ +//const char CameraParameters::KEY_AE_BRACKET_SETTING_KEY[] = "ae-bracket-setting"; #ifdef HAVE_ISO const char CameraParameters::KEY_SUPPORTED_ISO_MODES[] = "iso-values"; @@ -127,6 +177,15 @@ const char CameraParameters::EFFECT_POSTERIZE[] = "posterize"; const char CameraParameters::EFFECT_WHITEBOARD[] = "whiteboard"; const char CameraParameters::EFFECT_BLACKBOARD[] = "blackboard"; const char CameraParameters::EFFECT_AQUA[] = "aqua"; +#ifdef QCOM_HARDWARE +const char CameraParameters::EFFECT_EMBOSS[] = "emboss"; +const char CameraParameters::EFFECT_SKETCH[] = "sketch"; +const char CameraParameters::EFFECT_NEON[] = "neon"; + +// Values for auto exposure settings. +const char CameraParameters::TOUCH_AF_AEC_OFF[] = "touch-off"; +const char CameraParameters::TOUCH_AF_AEC_ON[] = "touch-on"; +#endif // Values for antibanding settings. const char CameraParameters::ANTIBANDING_AUTO[] = "auto"; @@ -142,7 +201,8 @@ const char CameraParameters::FLASH_MODE_RED_EYE[] = "red-eye"; const char CameraParameters::FLASH_MODE_TORCH[] = "torch"; // Values for scene mode settings. -const char CameraParameters::SCENE_MODE_AUTO[] = "auto"; +const char CameraParameters::SCENE_MODE_AUTO[] = "auto"; // corresponds to CAMERA_BESTSHOT_OFF in HAL +const char CameraParameters::SCENE_MODE_ASD[] = "asd"; // corresponds to CAMERA_BESTSHOT_AUTO in HAL const char CameraParameters::SCENE_MODE_ACTION[] = "action"; const char CameraParameters::SCENE_MODE_PORTRAIT[] = "portrait"; const char CameraParameters::SCENE_MODE_LANDSCAPE[] = "landscape"; @@ -157,11 +217,28 @@ const char CameraParameters::SCENE_MODE_FIREWORKS[] = "fireworks"; const char CameraParameters::SCENE_MODE_SPORTS[] = "sports"; const char CameraParameters::SCENE_MODE_PARTY[] = "party"; const char CameraParameters::SCENE_MODE_CANDLELIGHT[] = "candlelight"; +#ifdef QCOM_HARDWARE +const char CameraParameters::SCENE_MODE_BACKLIGHT[] = "backlight"; +const char CameraParameters::SCENE_MODE_FLOWERS[] = "flowers"; +#endif const char CameraParameters::SCENE_MODE_BARCODE[] = "barcode"; + const char CameraParameters::SCENE_MODE_HDR[] = "hdr"; +#ifdef QCOM_HARDWARE +const char CameraParameters::SCENE_MODE_AR[] = "AR"; +// Values for auto scene detection settings. +const char CameraParameters::SCENE_DETECT_OFF[] = "off"; +const char CameraParameters::SCENE_DETECT_ON[] = "on"; +#endif + + +// Formats for setPreviewFormat and setPictureFormat. const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp"; const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp"; +#ifdef QCOM_HARDWARE +const char CameraParameters::PIXEL_FORMAT_YUV420SP_ADRENO[] = "yuv420sp-adreno"; +#endif const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv"; const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p"; const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565"; @@ -170,6 +247,12 @@ const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg"; const char CameraParameters::PIXEL_FORMAT_BAYER_RGGB[] = "bayer-rggb"; const char CameraParameters::PIXEL_FORMAT_ANDROID_OPAQUE[] = "android-opaque"; +#ifdef QCOM_HARDWARE +const char CameraParameters::PIXEL_FORMAT_RAW[] = "raw"; +const char CameraParameters::PIXEL_FORMAT_YV12[] = "yuv420p"; +const char CameraParameters::PIXEL_FORMAT_NV12[] = "nv12"; +#endif + // Values for focus mode settings. const char CameraParameters::FOCUS_MODE_AUTO[] = "auto"; const char CameraParameters::FOCUS_MODE_INFINITY[] = "infinity"; @@ -178,6 +261,113 @@ const char CameraParameters::FOCUS_MODE_FIXED[] = "fixed"; 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) +const char CameraParameters::FOCUS_MODE_NORMAL[] = "normal"; + + +const char CameraParameters::KEY_SKIN_TONE_ENHANCEMENT[] = "skinToneEnhancement"; +const char CameraParameters::KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] = "skinToneEnhancement-values"; + +// Values for ISO Settings +const char CameraParameters::ISO_AUTO[] = "auto"; +const char CameraParameters::ISO_HJR[] = "ISO_HJR"; +const char CameraParameters::ISO_100[] = "ISO100"; +const char CameraParameters::ISO_200[] = "ISO200"; +const char CameraParameters::ISO_400[] = "ISO400"; +const char CameraParameters::ISO_800[] = "ISO800"; +const char CameraParameters::ISO_1600[] = "ISO1600"; + + //Values for Lens Shading +const char CameraParameters::LENSSHADE_ENABLE[] = "enable"; +const char CameraParameters::LENSSHADE_DISABLE[] = "disable"; + +// Values for auto exposure settings. +const char CameraParameters::AUTO_EXPOSURE_FRAME_AVG[] = "frame-average"; +const char CameraParameters::AUTO_EXPOSURE_CENTER_WEIGHTED[] = "center-weighted"; +const char CameraParameters::AUTO_EXPOSURE_SPOT_METERING[] = "spot-metering"; + +const char CameraParameters::KEY_GPS_LATITUDE_REF[] = "gps-latitude-ref"; +const char CameraParameters::KEY_GPS_LONGITUDE_REF[] = "gps-longitude-ref"; +const char CameraParameters::KEY_GPS_ALTITUDE_REF[] = "gps-altitude-ref"; +const char CameraParameters::KEY_GPS_STATUS[] = "gps-status"; +const char CameraParameters::KEY_EXIF_DATETIME[] = "exif-datetime"; + +const char CameraParameters::KEY_HISTOGRAM[] = "histogram"; +const char CameraParameters::KEY_SUPPORTED_HISTOGRAM_MODES[] = "histogram-values"; +//Values for Histogram Shading +const char CameraParameters::HISTOGRAM_ENABLE[] = "enable"; +const char CameraParameters::HISTOGRAM_DISABLE[] = "disable"; + +//Values for Skin Tone Enhancement Modes +const char CameraParameters::SKIN_TONE_ENHANCEMENT_ENABLE[] = "enable"; +const char CameraParameters::SKIN_TONE_ENHANCEMENT_DISABLE[] = "disable"; + +const char CameraParameters::KEY_SHARPNESS[] = "sharpness"; +const char CameraParameters::KEY_MAX_SHARPNESS[] = "max-sharpness"; +const char CameraParameters::KEY_CONTRAST[] = "contrast"; +const char CameraParameters::KEY_MAX_CONTRAST[] = "max-contrast"; +const char CameraParameters::KEY_SATURATION[] = "saturation"; +const char CameraParameters::KEY_MAX_SATURATION[] = "max-saturation"; + +//Values for DENOISE +const char CameraParameters::DENOISE_OFF[] = "denoise-off"; +const char CameraParameters::DENOISE_ON[] = "denoise-on"; +// Values for selectable zone af Settings +const char CameraParameters::SELECTABLE_ZONE_AF_AUTO[] = "auto"; +const char CameraParameters::SELECTABLE_ZONE_AF_SPOT_METERING[] = "spot-metering"; +const char CameraParameters::SELECTABLE_ZONE_AF_CENTER_WEIGHTED[] = "center-weighted"; +const char CameraParameters::SELECTABLE_ZONE_AF_FRAME_AVERAGE[] = "frame-average"; + +// Values for Face Detection settings. +const char CameraParameters::FACE_DETECTION_OFF[] = "off"; +const char CameraParameters::FACE_DETECTION_ON[] = "on"; + +// Values for MCE settings. +const char CameraParameters::MCE_ENABLE[] = "enable"; +const char CameraParameters::MCE_DISABLE[] = "disable"; + +// Values for HFR settings. +const char CameraParameters::VIDEO_HFR_OFF[] = "off"; +const char CameraParameters::VIDEO_HFR_2X[] = "60"; +const char CameraParameters::VIDEO_HFR_3X[] = "90"; +const char CameraParameters::VIDEO_HFR_4X[] = "120"; + +// Values for Redeye Reduction settings. +const char CameraParameters::REDEYE_REDUCTION_ENABLE[] = "enable"; +const char CameraParameters::REDEYE_REDUCTION_DISABLE[] = "disable"; +// Values for HDR settings. +const char CameraParameters::HDR_ENABLE[] = "enable"; +const char CameraParameters::HDR_DISABLE[] = "disable"; + +// Values for ZSL settings. +const char CameraParameters::ZSL_OFF[] = "off"; +const char CameraParameters::ZSL_ON[] = "on"; + +// Values for HDR Bracketing settings. +const char CameraParameters::AE_BRACKET_HDR_OFF[] = "Off"; +const char CameraParameters::AE_BRACKET_HDR[] = "HDR"; +const char CameraParameters::AE_BRACKET[] = "AE-Bracket"; + +static const char* portrait = "portrait"; +static const char* landscape = "landscape"; + +int CameraParameters::getOrientation() const +{ + const char* orientation = get("orientation"); + if (orientation && !strcmp(orientation, portrait)) + return CAMERA_ORIENTATION_PORTRAIT; + return CAMERA_ORIENTATION_LANDSCAPE; +} +void CameraParameters::setOrientation(int orientation) +{ + if (orientation == CAMERA_ORIENTATION_PORTRAIT) { + set("orientation", portrait); + } else { + set("orientation", landscape); + } +} +#endif + CameraParameters::CameraParameters() : mMap() @@ -260,7 +450,7 @@ void CameraParameters::set(const char *key, const char *value) void CameraParameters::set(const char *key, int value) { char str[16]; - sprintf(str, "%d", value); + snprintf(str, sizeof(str), "%d", value); set(key, str); } @@ -325,6 +515,32 @@ static int parse_pair(const char *str, int *first, int *second, char delim, return 0; } +// Parse string like "(1, 2, 3, 4, ..., N)" +// num is pointer to an allocated array of size N +static int parseNDimVector(const char *str, int *num, int N, char delim = ',') +{ + char *start, *end; + if(num == NULL) { + ALOGE("Invalid output array (num == NULL)"); + return -1; + } + //check if string starts and ends with parantheses + if(str[0] != '(' || str[strlen(str)-1] != ')') { + ALOGE("Invalid format of string %s, valid format is (n1, n2, n3, n4 ...)", str); + return -1; + } + start = (char*) str; + start++; + for(int i=0; i<N; i++) { + *(num+i) = (int) strtol(start, &end, 10); + if(*end != delim && i < N-1) { + ALOGE("Cannot find delimeter '%c' in string \"%s\". end = %c", delim, str, *end); + return -1; + } + start = end+1; + } + return 0; +} static void parseSizesList(const char *sizesStr, Vector<Size> &sizes) { if (sizesStr == 0) { @@ -353,7 +569,7 @@ static void parseSizesList(const char *sizesStr, Vector<Size> &sizes) void CameraParameters::setPreviewSize(int width, int height) { char str[32]; - sprintf(str, "%dx%d", width, height); + snprintf(str, sizeof(str), "%dx%d", width, height); set(KEY_PREVIEW_SIZE, str); } @@ -380,6 +596,21 @@ void CameraParameters::getSupportedPreviewSizes(Vector<Size> &sizes) const parseSizesList(previewSizesStr, sizes); } +#ifdef QCOM_HARDWARE +void CameraParameters::getSupportedHfrSizes(Vector<Size> &sizes) const +{ + const char *hfrSizesStr = get(KEY_SUPPORTED_HFR_SIZES); + parseSizesList(hfrSizesStr, sizes); +} + +void CameraParameters::setPreviewFpsRange(int minFPS, int maxFPS) +{ + char str[32]; + snprintf(str, sizeof(str), "%d,%d",minFPS,maxFPS); + set(KEY_PREVIEW_FPS_RANGE,str); +} +#endif + void CameraParameters::setVideoSize(int width, int height) { char str[32]; @@ -419,6 +650,18 @@ void CameraParameters::getPreviewFpsRange(int *min_fps, int *max_fps) const parse_pair(p, min_fps, max_fps, ','); } +#ifdef QCOM_HARDWARE +void CameraParameters::setPreviewFrameRateMode(const char *mode) +{ + set(KEY_PREVIEW_FRAME_RATE_MODE, mode); +} + +const char *CameraParameters::getPreviewFrameRateMode() const +{ + return get(KEY_PREVIEW_FRAME_RATE_MODE); +} +#endif + void CameraParameters::setPreviewFormat(const char *format) { set(KEY_PREVIEW_FORMAT, format); @@ -472,6 +715,71 @@ void CameraParameters::dump() const } } +#ifdef QCOM_HARDWARE +void CameraParameters::setTouchIndexAec(int x, int y) +{ + char str[32]; + snprintf(str, sizeof(str), "%dx%d", x, y); + set(KEY_TOUCH_INDEX_AEC, str); +} + +void CameraParameters::getTouchIndexAec(int *x, int *y) const +{ + *x = -1; + *y = -1; + + // Get the current string, if it doesn't exist, leave the -1x-1 + const char *p = get(KEY_TOUCH_INDEX_AEC); + if (p == 0) + return; + + int tempX, tempY; + if (parse_pair(p, &tempX, &tempY, 'x') == 0) { + *x = tempX; + *y = tempY; + } +} + +void CameraParameters::setTouchIndexAf(int x, int y) +{ + char str[32]; + snprintf(str, sizeof(str), "%dx%d", x, y); + set(KEY_TOUCH_INDEX_AF, str); +} + +void CameraParameters::getMeteringAreaCenter(int *x, int *y) const +{ + //Default invalid values + *x = -2000; + *y = -2000; + + const char *p = get(KEY_METERING_AREAS); + if(p != NULL) { + int arr[5] = {-2000, -2000, -2000, -2000, 0}; + parseNDimVector(p, arr, 5); //p = "(x1, y1, x2, y2, weight)" + *x = (arr[0] + arr[2])/2; //center_x = (x1+x2)/2 + *y = (arr[1] + arr[3])/2; //center_y = (y1+y2)/2 + } +} + +void CameraParameters::getTouchIndexAf(int *x, int *y) const +{ + *x = -1; + *y = -1; + + // Get the current string, if it doesn't exist, leave the -1x-1 + const char *p = get(KEY_TOUCH_INDEX_AF); + if (p == 0) + return; + + int tempX, tempY; + if (parse_pair(p, &tempX, &tempY, 'x') == 0) { + *x = tempX; + *y = tempY; + } +} +#endif + status_t CameraParameters::dump(int fd, const Vector<String16>& args) const { const size_t SIZE = 256; diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h index c4c2f09..b6d1582 100644 --- a/include/camera/CameraParameters.h +++ b/include/camera/CameraParameters.h @@ -36,7 +36,21 @@ struct Size { height = h; } }; - +#ifdef QCOM_HARDWARE +struct FPSRange{ + int minFPS; + int maxFPS; + + FPSRange(){ + minFPS=0; + maxFPS=0; + }; + FPSRange(int min,int max){ + minFPS=min; + maxFPS=max; + }; +}; +#endif class CameraParameters { public: @@ -91,6 +105,10 @@ public: void setPreviewFrameRate(int fps); int getPreviewFrameRate() const; void getPreviewFpsRange(int *min_fps, int *max_fps) const; +#ifdef QCOM_HARDWARE + void setPreviewFrameRateMode(const char *mode); + const char *getPreviewFrameRateMode() const; +#endif void setPreviewFormat(const char *format); const char *getPreviewFormat() const; void setPictureSize(int width, int height); @@ -98,6 +116,14 @@ public: void getSupportedPictureSizes(Vector<Size> &sizes) const; void setPictureFormat(const char *format); const char *getPictureFormat() const; +#ifdef QCOM_HARDWARE + void setTouchIndexAec(int x, int y); + void getTouchIndexAec(int *x, int *y) const; + void setTouchIndexAf(int x, int y); + void getTouchIndexAf(int *x, int *y) const; +#endif + + void getMeteringAreaCenter(int * x, int *y) const; void dump() const; status_t dump(int fd, const Vector<String16>& args) const; @@ -112,6 +138,11 @@ public: // Supported preview frame sizes in pixels. // Example value: "800x600,480x320". Read only. static const char KEY_SUPPORTED_PREVIEW_SIZES[]; +#ifdef QCOM_HARDWARE + // Supported PREVIEW/RECORDING SIZES IN HIGH FRAME RATE recording, sizes in pixels. + // Example value: "800x480,432x320". Read only. + static const char KEY_SUPPORTED_HFR_SIZES[]; +#endif // The current minimum and maximum preview fps. This controls the rate of // preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and // maximum fps must be one of the elements from @@ -141,6 +172,14 @@ public: // Supported number of preview frames per second. // Example value: "24,15,10". Read. static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[]; +#ifdef QCOM_HARDWARE + // The mode of preview frame rate. + // Example value: "frame-rate-auto, frame-rate-fixed". + static const char KEY_PREVIEW_FRAME_RATE_MODE[]; + 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[]; +#endif // The dimensions for captured pictures in pixels (width x height). // Example value: "1024x768". Read/write. static const char KEY_PICTURE_SIZE[]; @@ -203,6 +242,12 @@ public: // header. // Example value: "21.0" or "-5". Write only. static const char KEY_GPS_ALTITUDE[]; + +#ifdef QCOM_HARDWARE + static const char KEY_SKIN_TONE_ENHANCEMENT[] ; + static const char KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] ; +#endif + // GPS timestamp (UTC in seconds since January 1, 1970). This should be // stored in JPEG EXIF header. // Example value: "1251192757". Write only. @@ -222,6 +267,15 @@ public: // Supported color effect settings. // Example value: "none,mono,sepia". Read only. static const char KEY_SUPPORTED_EFFECTS[]; +#ifdef QCOM_HARDWARE + //Touch Af/AEC settings. + static const char KEY_TOUCH_AF_AEC[]; + static const char KEY_SUPPORTED_TOUCH_AF_AEC[]; + //Touch Index for AEC. + static const char KEY_TOUCH_INDEX_AEC[]; + //Touch Index for AF. + static const char KEY_TOUCH_INDEX_AF[]; +#endif // Current antibanding setting. // Example value: "auto" or ANTIBANDING_XXX constants. Read/write. static const char KEY_ANTIBANDING[]; @@ -234,6 +288,14 @@ public: // Supported scene mode settings. // Example value: "auto,night,fireworks". Read only. static const char KEY_SUPPORTED_SCENE_MODES[]; +#ifdef QCOM_HARDWARE + // Current auto scene detection mode. + // Example value: "off" or SCENE_DETECT_XXX constants. Read/write. + static const char KEY_SCENE_DETECT[]; + // Supported auto scene detection settings. + // Example value: "off,backlight,snow/cloudy". Read only. + static const char KEY_SUPPORTED_SCENE_DETECT[]; +#endif // Current flash mode. // Example value: "auto" or FLASH_MODE_XXX constants. Read/write. static const char KEY_FLASH_MODE[]; @@ -505,6 +567,23 @@ public: // captured pictures. // Example value: "true" or "false". Read only. static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[]; + static const char KEY_FULL_VIDEO_SNAP_SUPPORTED[]; + +#ifdef QCOM_HARDWARE + static const char KEY_ISO_MODE[]; + static const char KEY_SUPPORTED_ISO_MODES[]; + static const char KEY_LENSSHADE[] ; + static const char KEY_SUPPORTED_LENSSHADE_MODES[] ; + + static const char KEY_AUTO_EXPOSURE[]; + static const char KEY_SUPPORTED_AUTO_EXPOSURE[]; + + static const char KEY_GPS_LATITUDE_REF[]; + static const char KEY_GPS_LONGITUDE_REF[]; + static const char KEY_GPS_ALTITUDE_REF[]; + static const char KEY_GPS_STATUS[]; + static const char KEY_EXIF_DATETIME[]; +#endif // The state of the video stabilization. If set to true, both the // preview stream and the recorded video stream are stabilized by @@ -520,6 +599,20 @@ public: // has no effect on still image capture. static const char KEY_VIDEO_STABILIZATION[]; +#ifdef QCOM_HARDWARE + static const char KEY_MEMORY_COLOR_ENHANCEMENT[]; + static const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[]; + + static const char KEY_ZSL[]; + static const char KEY_SUPPORTED_ZSL_MODES[]; + + static const char KEY_CAMERA_MODE[]; + + static const char KEY_VIDEO_HIGH_FRAME_RATE[]; + static const char KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[]; + static const char KEY_HIGH_DYNAMIC_RANGE_IMAGING[]; + static const char KEY_SUPPORTED_HDR_IMAGING_MODES[]; +#endif // Returns true if video stabilization is supported. That is, applications // can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview // stream and record stabilized videos. @@ -536,6 +629,7 @@ public: static const char KEY_WDR[]; static const char KEY_WEATHER[]; #endif + static const char KEY_AE_BRACKET_HDR[]; // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED. static const char TRUE[]; @@ -544,6 +638,24 @@ public: // Value for KEY_FOCUS_DISTANCES. static const char FOCUS_DISTANCE_INFINITY[]; +#ifdef QCOM_HARDWARE + // DENOISE + static const char KEY_DENOISE[]; + static const char KEY_SUPPORTED_DENOISE[]; + + //Selectable zone AF. + static const char KEY_SELECTABLE_ZONE_AF[]; + static const char KEY_SUPPORTED_SELECTABLE_ZONE_AF[]; + + //Face Detection + static const char KEY_FACE_DETECTION[]; + static const char KEY_SUPPORTED_FACE_DETECTION[]; + + //Redeye Reduction + static const char KEY_REDEYE_REDUCTION[]; + static const char KEY_SUPPORTED_REDEYE_REDUCTION[]; +#endif + // Values for white balance settings. static const char WHITE_BALANCE_AUTO[]; static const char WHITE_BALANCE_INCANDESCENT[]; @@ -564,6 +676,15 @@ public: static const char EFFECT_WHITEBOARD[]; static const char EFFECT_BLACKBOARD[]; static const char EFFECT_AQUA[]; +#ifdef QCOM_HARDWARE + static const char EFFECT_EMBOSS[]; + static const char EFFECT_SKETCH[]; + static const char EFFECT_NEON[]; + + // Values for Touch AF/AEC + static const char TOUCH_AF_AEC_OFF[] ; + static const char TOUCH_AF_AEC_ON[] ; +#endif // Values for antibanding settings. static const char ANTIBANDING_AUTO[]; @@ -588,6 +709,7 @@ public: // Values for scene mode settings. static const char SCENE_MODE_AUTO[]; + static const char SCENE_MODE_ASD[]; static const char SCENE_MODE_ACTION[]; static const char SCENE_MODE_PORTRAIT[]; static const char SCENE_MODE_LANDSCAPE[]; @@ -602,6 +724,11 @@ public: static const char SCENE_MODE_SPORTS[]; static const char SCENE_MODE_PARTY[]; static const char SCENE_MODE_CANDLELIGHT[]; +#ifdef QCOM_HARDWARE + static const char SCENE_MODE_BACKLIGHT[]; + static const char SCENE_MODE_FLOWERS[]; + static const char SCENE_MODE_AR[]; +#endif // Applications are looking for a barcode. Camera driver will be optimized // for barcode reading. static const char SCENE_MODE_BARCODE[]; @@ -612,8 +739,15 @@ public: // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT, // and KEY_VIDEO_FRAME_FORMAT +#ifdef QCOM_HARDWARE + static const char SCENE_DETECT_OFF[]; + static const char SCENE_DETECT_ON[]; +#endif static const char PIXEL_FORMAT_YUV422SP[]; static const char PIXEL_FORMAT_YUV420SP[]; // NV21 +#ifdef QCOM_HARDWARE + static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; // ADRENO +#endif static const char PIXEL_FORMAT_YUV422I[]; // YUY2 static const char PIXEL_FORMAT_YUV420P[]; // YV12 static const char PIXEL_FORMAT_RGB565[]; @@ -622,9 +756,16 @@ public: // Raw bayer format used for images, which is 10 bit precision samples // stored in 16 bit words. The filter pattern is RGGB. static const char PIXEL_FORMAT_BAYER_RGGB[]; + // Pixel format is not known to the framework static const char PIXEL_FORMAT_ANDROID_OPAQUE[]; +#ifdef QCOM_HARDWARE + static const char PIXEL_FORMAT_RAW[]; + static const char PIXEL_FORMAT_YV12[]; // NV21 + static const char PIXEL_FORMAT_NV12[]; //NV12 +#endif + // Values for focus mode settings. // Auto-focus mode. Applications should call // CameraHardwareInterface.autoFocus to start the focus in this mode. @@ -676,6 +817,101 @@ public: // other modes. static const char FOCUS_MODE_CONTINUOUS_PICTURE[]; +#ifdef QCOM_HARDWARE + // Normal focus mode. Applications should call + // CameraHardwareInterface.autoFocus to start the focus in this mode. + static const char FOCUS_MODE_NORMAL[]; + static const char ISO_AUTO[]; + static const char ISO_HJR[] ; + static const char ISO_100[]; + static const char ISO_200[] ; + static const char ISO_400[]; + static const char ISO_800[]; + static const char ISO_1600[]; + // Values for Lens Shading + static const char LENSSHADE_ENABLE[] ; + static const char LENSSHADE_DISABLE[] ; + + // Values for auto exposure settings. + static const char AUTO_EXPOSURE_FRAME_AVG[]; + static const char AUTO_EXPOSURE_CENTER_WEIGHTED[]; + static const char AUTO_EXPOSURE_SPOT_METERING[]; + + static const char KEY_SHARPNESS[]; + static const char KEY_MAX_SHARPNESS[]; + static const char KEY_CONTRAST[]; + static const char KEY_MAX_CONTRAST[]; + static const char KEY_SATURATION[]; + static const char KEY_MAX_SATURATION[]; + + static const char KEY_HISTOGRAM[] ; + static const char KEY_SUPPORTED_HISTOGRAM_MODES[] ; + // Values for HISTOGRAM + static const char HISTOGRAM_ENABLE[] ; + static const char HISTOGRAM_DISABLE[] ; + + // Values for SKIN TONE ENHANCEMENT + static const char SKIN_TONE_ENHANCEMENT_ENABLE[] ; + static const char SKIN_TONE_ENHANCEMENT_DISABLE[] ; + + // Values for Denoise + static const char DENOISE_OFF[] ; + static const char DENOISE_ON[] ; + + // Values for auto exposure settings. + static const char SELECTABLE_ZONE_AF_AUTO[]; + static const char SELECTABLE_ZONE_AF_SPOT_METERING[]; + static const char SELECTABLE_ZONE_AF_CENTER_WEIGHTED[]; + static const char SELECTABLE_ZONE_AF_FRAME_AVERAGE[]; + + // Values for Face Detection settings. + static const char FACE_DETECTION_OFF[]; + static const char FACE_DETECTION_ON[]; + + // Values for MCE settings. + static const char MCE_ENABLE[]; + static const char MCE_DISABLE[]; + + // Values for ZSL settings. + static const char ZSL_OFF[]; + static const char ZSL_ON[]; + + // Values for HDR Bracketing settings. + static const char AE_BRACKET_HDR_OFF[]; + static const char AE_BRACKET_HDR[]; + static const char AE_BRACKET[]; + + // Values for HFR settings. + static const char VIDEO_HFR_OFF[]; + static const char VIDEO_HFR_2X[]; + static const char VIDEO_HFR_3X[]; + static const char VIDEO_HFR_4X[]; + + // Values for Redeye Reduction settings. + static const char REDEYE_REDUCTION_ENABLE[]; + static const char REDEYE_REDUCTION_DISABLE[]; + // Values for HDR settings. + static const char HDR_ENABLE[]; + static const char HDR_DISABLE[]; + + // Values for Redeye Reduction settings. + // static const char REDEYE_REDUCTION_ENABLE[]; + // static const char REDEYE_REDUCTION_DISABLE[]; + // Values for HDR settings. + // static const char HDR_ENABLE[]; + // static const char HDR_DISABLE[]; + + enum { + CAMERA_ORIENTATION_UNKNOWN = 0, + CAMERA_ORIENTATION_PORTRAIT = 1, + CAMERA_ORIENTATION_LANDSCAPE = 2, + }; + int getOrientation() const; + void setOrientation(int orientation); + void setPreviewFpsRange(int minFPS,int maxFPS); + void getSupportedHfrSizes(Vector<Size> &sizes) const; +#endif + private: DefaultKeyedVector<String8,String8> mMap; }; diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h index 9fc962c..60d6bef 100644 --- a/include/media/MediaProfiles.h +++ b/include/media/MediaProfiles.h @@ -32,8 +32,13 @@ enum camcorder_quality { CAMCORDER_QUALITY_480P = 4, CAMCORDER_QUALITY_720P = 5, CAMCORDER_QUALITY_1080P = 6, - CAMCORDER_QUALITY_QVGA = 7, - CAMCORDER_QUALITY_LIST_END = 7, + CAMCORDER_QUALITY_QVGA = 11, + CAMCORDER_QUALITY_FWVGA = 7, + CAMCORDER_QUALITY_WVGA = 8, + CAMCORDER_QUALITY_VGA = 9, + CAMCORDER_QUALITY_WQVGA = 10, + + CAMCORDER_QUALITY_LIST_END = 11, CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000, CAMCORDER_QUALITY_TIME_LAPSE_LOW = 1000, diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index 6d304e0..3c2e700 100644 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -118,6 +118,9 @@ enum media_recorder_event_type { MEDIA_RECORDER_EVENT_LIST_START = 1, MEDIA_RECORDER_EVENT_ERROR = 1, MEDIA_RECORDER_EVENT_INFO = 2, +#ifdef QCOM_HARDWARE + MEDIA_RECORDER_MSG_COMPRESSED_IMAGE = 8, // mzhu: TODO, where to put this? +#endif MEDIA_RECORDER_EVENT_LIST_END = 99, // Track related event types diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp index 8319cd7..f69dbea 100644 --- a/media/libmedia/MediaProfiles.cpp +++ b/media/libmedia/MediaProfiles.cpp @@ -70,6 +70,10 @@ const MediaProfiles::NameToTagMap MediaProfiles::sCamcorderQualityNameMap[] = { {"720p", CAMCORDER_QUALITY_720P}, {"1080p", CAMCORDER_QUALITY_1080P}, {"qvga", CAMCORDER_QUALITY_QVGA}, + {"fwvga", CAMCORDER_QUALITY_FWVGA}, + {"wvga", CAMCORDER_QUALITY_WVGA}, + {"vga", CAMCORDER_QUALITY_VGA}, + {"wqvga", CAMCORDER_QUALITY_WQVGA}, {"timelapselow", CAMCORDER_QUALITY_TIME_LAPSE_LOW}, {"timelapsehigh", CAMCORDER_QUALITY_TIME_LAPSE_HIGH}, diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h index 05ac9fa..9f529a0 100644 --- a/services/camera/libcameraservice/CameraHardwareInterface.h +++ b/services/camera/libcameraservice/CameraHardwareInterface.h @@ -456,13 +456,17 @@ private: ALOGV("%s", __FUNCTION__); CameraHardwareInterface *__this = static_cast<CameraHardwareInterface *>(user); - sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(data->handle)); - if (index >= mem->mNumBufs) { + if (data != NULL) { + sp<CameraHeapMemory> mem(static_cast<CameraHeapMemory *>(data->handle)); + if (index >= mem->mNumBufs) { ALOGE("%s: invalid buffer index %d, max allowed is %d", __FUNCTION__, index, mem->mNumBufs); return; + } + __this->mDataCb(msg_type, mem->mBuffers[index], metadata, __this->mCbUser); + } else { + __this->mDataCb(msg_type, NULL, metadata, __this->mCbUser); } - __this->mDataCb(msg_type, mem->mBuffers[index], metadata, __this->mCbUser); } static void __data_cb_timestamp(nsecs_t timestamp, int32_t msg_type, |