diff options
author | Nipun Kwatra <nkwatra@google.com> | 2010-08-04 14:04:07 -0700 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-08-19 09:59:18 -0700 |
commit | 6c008b86409202b00fcfc2ca9db3a026c20ccaf7 (patch) | |
tree | 8cab8ec20dcb12f3a6bd4c81d2a5e368ef53d595 /libs/camera | |
parent | 0de0c4960da1ec2f6aeada9718755c37cfee45e0 (diff) | |
download | frameworks_base-6c008b86409202b00fcfc2ca9db3a026c20ccaf7.zip frameworks_base-6c008b86409202b00fcfc2ca9db3a026c20ccaf7.tar.gz frameworks_base-6c008b86409202b00fcfc2ca9db3a026c20ccaf7.tar.bz2 |
Adding getSupportedPreviewSizes to CameraParameters.DO NOT MERGE
Moved functionality to parse string of sizes from getSupportedPictureSizes
to parseSizesList.
Added getSupportedPreviewSizes which returns a list of supported preview sizes.
Change-Id: I41d4f62f9f1641e9e9258aa2ebaeda13ba846c02
Diffstat (limited to 'libs/camera')
-rw-r--r-- | libs/camera/CameraParameters.cpp | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp index 1cf19a0..abd418a 100644 --- a/libs/camera/CameraParameters.cpp +++ b/libs/camera/CameraParameters.cpp @@ -291,6 +291,30 @@ static int parse_size(const char *str, int &width, int &height, char **endptr = return 0; } +static void parseSizesList(const char *sizesStr, Vector<Size> &sizes) +{ + if (sizesStr == 0) { + return; + } + + char *sizeStartPtr = (char *)sizesStr; + + while (true) { + int width, height; + int success = parse_size(sizeStartPtr, width, height, &sizeStartPtr); + if (success == -1 || (*sizeStartPtr != ',' && *sizeStartPtr != '\0')) { + LOGE("Picture sizes string \"%s\" contains invalid character.", sizesStr); + return; + } + sizes.push(Size(width, height)); + + if (*sizeStartPtr == '\0') { + return; + } + sizeStartPtr++; + } +} + void CameraParameters::setPreviewSize(int width, int height) { char str[32]; @@ -315,6 +339,12 @@ void CameraParameters::getPreviewSize(int *width, int *height) const } } +void CameraParameters::getSupportedPreviewSizes(Vector<Size> &sizes) const +{ + const char *previewSizesStr = get(KEY_SUPPORTED_PREVIEW_SIZES); + parseSizesList(previewSizesStr, sizes); +} + void CameraParameters::setPreviewFrameRate(int fps) { set(KEY_PREVIEW_FRAME_RATE, fps); @@ -342,31 +372,6 @@ void CameraParameters::setPictureSize(int width, int height) set(KEY_PICTURE_SIZE, str); } -void CameraParameters::getSupportedPictureSizes(Vector<Size> &sizes) const -{ - const char *pictureSizesStr = get(KEY_SUPPORTED_PICTURE_SIZES); - if (pictureSizesStr == 0) { - return; - } - - char *sizeStartPtr = (char *)pictureSizesStr; - - while (true) { - int width, height; - int success = parse_size(sizeStartPtr, width, height, &sizeStartPtr); - if (success == -1 || (*sizeStartPtr != ',' && *sizeStartPtr != '\0')) { - LOGE("Picture sizes string \"%s\" contains invalid character.", pictureSizesStr); - return; - } - sizes.push(Size(width, height)); - - if (*sizeStartPtr == '\0') { - return; - } - sizeStartPtr++; - } -} - void CameraParameters::getPictureSize(int *width, int *height) const { *width = -1; @@ -384,6 +389,12 @@ void CameraParameters::getPictureSize(int *width, int *height) const } } +void CameraParameters::getSupportedPictureSizes(Vector<Size> &sizes) const +{ + const char *pictureSizesStr = get(KEY_SUPPORTED_PICTURE_SIZES); + parseSizesList(pictureSizesStr, sizes); +} + void CameraParameters::setPictureFormat(const char *format) { set(KEY_PICTURE_FORMAT, format); |