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 | 28934a90e168291f6c77c56e8a05f272e5151bbd (patch) | |
tree | da8b10f020741f7dc28161496cbe7e0d59e19622 /media/libstagefright/CameraSourceTimeLapse.cpp | |
parent | c2f95fba3ab2a4e512fd1152a12e64691f2ea73d (diff) | |
download | frameworks_av-28934a90e168291f6c77c56e8a05f272e5151bbd.zip frameworks_av-28934a90e168291f6c77c56e8a05f272e5151bbd.tar.gz frameworks_av-28934a90e168291f6c77c56e8a05f272e5151bbd.tar.bz2 |
Use video output if necessary for timelapse video recording
Change-Id: I88d0cc824f0fbf8b2f392fbc23c69b5bfefda1b8
Diffstat (limited to 'media/libstagefright/CameraSourceTimeLapse.cpp')
-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 { |