diff options
author | James Dong <jdong@google.com> | 2010-11-29 16:51:55 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-11-30 22:28:27 -0800 |
commit | 0f5a6f9231e04b5c04af5dc2ad020755e2616f31 (patch) | |
tree | 7c5952114c65c535ad68c362e6e13865e5f77b4d | |
parent | 7a1e1bdde7a28d9573367d6f95b736fd793ace0c (diff) | |
download | frameworks_av-0f5a6f9231e04b5c04af5dc2ad020755e2616f31.zip frameworks_av-0f5a6f9231e04b5c04af5dc2ad020755e2616f31.tar.gz frameworks_av-0f5a6f9231e04b5c04af5dc2ad020755e2616f31.tar.bz2 |
Add preferred preview size support in the camera framework
bug - 3237021
Change-Id: Ica8a3ae5cfbee462b74de98770e33277186c9a2b
-rw-r--r-- | camera/CameraParameters.cpp | 9 | ||||
-rw-r--r-- | include/camera/CameraParameters.h | 23 |
2 files changed, 32 insertions, 0 deletions
diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp index 45b1b9a..e9a5f8c 100644 --- a/camera/CameraParameters.cpp +++ b/camera/CameraParameters.cpp @@ -75,6 +75,7 @@ const char CameraParameters::KEY_FOCUS_DISTANCES[] = "focus-distances"; const char CameraParameters::KEY_VIDEO_FRAME_FORMAT[] = "video-frame-format"; 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"; const char CameraParameters::TRUE[] = "true"; const char CameraParameters::FOCUS_DISTANCE_INFINITY[] = "Infinity"; @@ -333,6 +334,14 @@ void CameraParameters::getPreviewSize(int *width, int *height) const parse_pair(p, width, height, 'x'); } +void CameraParameters::getPreferredPreviewSizeForVideo(int *width, int *height) const +{ + *width = *height = -1; + const char *p = get(KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO); + if (p == 0) return; + parse_pair(p, width, height, 'x'); +} + void CameraParameters::getSupportedPreviewSizes(Vector<Size> &sizes) const { const char *previewSizesStr = get(KEY_SUPPORTED_PREVIEW_SIZES); diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h index 6364d58..431aaa4 100644 --- a/include/camera/CameraParameters.h +++ b/include/camera/CameraParameters.h @@ -79,6 +79,14 @@ public: // the camera only has a single output, and does not have // separate output for video frames and preview frame. void getSupportedVideoSizes(Vector<Size> &sizes) const; + // Retrieve the preferred preview size (width and height) in pixels + // for video recording. The given width and height must be one of + // supported preview sizes returned from getSupportedPreviewSizes(). + // Must not be called if getSupportedVideoSizes() returns an empty + // Vector of Size. If getSupportedVideoSizes() returns an empty + // Vector of Size, the width and height returned from this method + // is invalid, and is "-1x-1". + void getPreferredPreviewSizeForVideo(int *width, int *height) const; void setPreviewFrameRate(int fps); int getPreviewFrameRate() const; @@ -319,6 +327,21 @@ public: // frameworks/base/include/camera/Camera.h. // Example: "176x144,1280x720". Read only. static const char KEY_SUPPORTED_VIDEO_SIZES[]; + + // Preferred preview frame size in pixels for video recording. + // The width and height must be one of the supported sizes retrieved + // via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when + // getSupportedVideoSizes() does not return an empty Vector of Size. + // Camcorder applications are recommended to set the preview size + // to a value that is not larger than the preferred preview size. + // In other words, the product of the width and height of the + // preview size should not be larger than that of the preferred + // preview size. In addition, we recommend to choos a preview size + // that has the same aspect ratio as the resolution of video to be + // recorded. + // Example value: "800x600". Read only. + static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[]; + // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in // frameworks/base/include/camera/Camera.h. // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only. |