summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/api1/client2
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2014-09-13 21:16:11 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-13 21:16:12 +0000
commitf0b31e6333839972afb2e374f6d8824180d29fc2 (patch)
tree0960a076a947a63898f617fddc4392fe264e0196 /services/camera/libcameraservice/api1/client2
parent0e40a83936d42a34788bbce1c113c404d727fe47 (diff)
parenta4c95a6bc3b801bf41ca841440e9124f947e53fe (diff)
downloadframeworks_av-f0b31e6333839972afb2e374f6d8824180d29fc2.zip
frameworks_av-f0b31e6333839972afb2e374f6d8824180d29fc2.tar.gz
frameworks_av-f0b31e6333839972afb2e374f6d8824180d29fc2.tar.bz2
Merge "Camera: Allow larger preview resolutions in API1 for >= HALv2 devices" into lmp-dev
Diffstat (limited to 'services/camera/libcameraservice/api1/client2')
-rw-r--r--services/camera/libcameraservice/api1/client2/Parameters.cpp26
-rw-r--r--services/camera/libcameraservice/api1/client2/Parameters.h7
2 files changed, 29 insertions, 4 deletions
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
index 8d00590..ed9137f 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -76,9 +76,29 @@ status_t Parameters::initialize(const CameraMetadata *info, int deviceVersion) {
res = getFilteredSizes(MAX_VIDEO_SIZE, &availableVideoSizes);
if (res != OK) return res;
- // TODO: Pick more intelligently
- previewWidth = availablePreviewSizes[0].width;
- previewHeight = availablePreviewSizes[0].height;
+ // Select initial preview and video size that's under the initial bound and
+ // on the list of both preview and recording sizes
+ previewWidth = 0;
+ previewHeight = 0;
+ for (size_t i = 0 ; i < availablePreviewSizes.size(); i++) {
+ int newWidth = availablePreviewSizes[i].width;
+ int newHeight = availablePreviewSizes[i].height;
+ if (newWidth >= previewWidth && newHeight >= previewHeight &&
+ newWidth <= MAX_INITIAL_PREVIEW_WIDTH &&
+ newHeight <= MAX_INITIAL_PREVIEW_HEIGHT) {
+ for (size_t j = 0; j < availableVideoSizes.size(); j++) {
+ if (availableVideoSizes[j].width == newWidth &&
+ availableVideoSizes[j].height == newHeight) {
+ previewWidth = newWidth;
+ previewHeight = newHeight;
+ }
+ }
+ }
+ }
+ if (previewWidth == 0) {
+ ALOGE("%s: No initial preview size can be found!", __FUNCTION__);
+ return BAD_VALUE;
+ }
videoWidth = previewWidth;
videoHeight = previewHeight;
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.h b/services/camera/libcameraservice/api1/client2/Parameters.h
index 5e6e6ab..815cc55 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.h
+++ b/services/camera/libcameraservice/api1/client2/Parameters.h
@@ -179,8 +179,13 @@ struct Parameters {
// Number of zoom steps to simulate
static const unsigned int NUM_ZOOM_STEPS = 100;
// Max preview size allowed
+ // This is set to a 1:1 value to allow for any aspect ratio that has
+ // a max long side of 1920 pixels
static const unsigned int MAX_PREVIEW_WIDTH = 1920;
- static const unsigned int MAX_PREVIEW_HEIGHT = 1080;
+ static const unsigned int MAX_PREVIEW_HEIGHT = 1920;
+ // Initial max preview/recording size bound
+ static const int MAX_INITIAL_PREVIEW_WIDTH = 1920;
+ static const int MAX_INITIAL_PREVIEW_HEIGHT = 1080;
// Aspect ratio tolerance
static const float ASPECT_RATIO_TOLERANCE = 0.001;