diff options
author | James Dong <jdong@google.com> | 2011-01-04 16:09:07 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-01-04 16:09:07 -0800 |
commit | a1d2d8f7a5fd956ab82acc641415e09ff6c00a7e (patch) | |
tree | 4272cd1b8be49b9f34af0b4e178d72d22f87a62c /media | |
parent | cd7f598122c30b155bd8e18f8e36eff5424e20ef (diff) | |
download | frameworks_base-a1d2d8f7a5fd956ab82acc641415e09ff6c00a7e.zip frameworks_base-a1d2d8f7a5fd956ab82acc641415e09ff6c00a7e.tar.gz frameworks_base-a1d2d8f7a5fd956ab82acc641415e09ff6c00a7e.tar.bz2 |
Use video output if necessary for timelapse video recording
Change-Id: I88d0cc824f0fbf8b2f392fbc23c69b5bfefda1b8
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/CameraSourceTimeLapse.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp index 0b158be..9677838 100644 --- a/media/libstagefright/CameraSourceTimeLapse.cpp +++ b/media/libstagefright/CameraSourceTimeLapse.cpp @@ -76,7 +76,7 @@ CameraSourceTimeLapse::CameraSourceTimeLapse( mVideoWidth = videoSize.width; mVideoHeight = videoSize.height; - if (trySettingPreviewSize(videoSize.width, videoSize.height)) { + if (trySettingVideoSize(videoSize.width, videoSize.height)) { mUseStillCameraForTimeLapse = false; } else { // TODO: Add a check to see that mTimeBetweenTimeLapseFrameCaptureUs is greater @@ -115,29 +115,39 @@ void CameraSourceTimeLapse::startQuickReadReturns() { } } -bool CameraSourceTimeLapse::trySettingPreviewSize(int32_t width, int32_t height) { - LOGV("trySettingPreviewSize: %dx%d", width, height); +bool CameraSourceTimeLapse::trySettingVideoSize(int32_t width, int32_t height) { + LOGV("trySettingVideoSize: %dx%d", width, height); int64_t token = IPCThreadState::self()->clearCallingIdentity(); String8 s = mCamera->getParameters(); CameraParameters params(s); Vector<Size> supportedSizes; - params.getSupportedPreviewSizes(supportedSizes); + params.getSupportedVideoSizes(supportedSizes); + bool videoOutputSupported = false; + if (supportedSizes.size() == 0) { + params.getSupportedPreviewSizes(supportedSizes); + } else { + videoOutputSupported = true; + } - bool previewSizeSupported = false; + bool videoSizeSupported = false; for (uint32_t i = 0; i < supportedSizes.size(); ++i) { int32_t pictureWidth = supportedSizes[i].width; int32_t pictureHeight = supportedSizes[i].height; if ((pictureWidth == width) && (pictureHeight == height)) { - previewSizeSupported = true; + videoSizeSupported = true; } } bool isSuccessful = false; - if (previewSizeSupported) { - LOGV("Video size (%d, %d) is a supported preview size", width, height); - params.setPreviewSize(width, height); + if (videoSizeSupported) { + LOGV("Video size (%d, %d) is supported", width, height); + if (videoOutputSupported) { + params.setVideoSize(width, height); + } else { + params.setPreviewSize(width, height); + } if (mCamera->setParameters(params.flatten()) == OK) { isSuccessful = true; } else { |