diff options
author | James Dong <jdong@google.com> | 2011-01-05 10:27:55 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-05 10:27:55 -0800 |
commit | 019e96a6c6228c2565d8bc172f6278b31384aca5 (patch) | |
tree | d849a9df7eefab1a0e960e8e0fab86b943361e94 /media | |
parent | 627baacc748c5e2ed68bdb256aea4d70fcfe9ce4 (diff) | |
parent | 28934a90e168291f6c77c56e8a05f272e5151bbd (diff) | |
download | frameworks_av-019e96a6c6228c2565d8bc172f6278b31384aca5.zip frameworks_av-019e96a6c6228c2565d8bc172f6278b31384aca5.tar.gz frameworks_av-019e96a6c6228c2565d8bc172f6278b31384aca5.tar.bz2 |
Merge "Use video output if necessary for timelapse video recording"
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 { |