summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2011-10-12 14:05:52 -0700
committerEino-Ville Talvala <etalvala@google.com>2011-10-12 19:28:09 -0700
commit07d5f8c27d144f7e72820b48fe5cb08f691435ad (patch)
tree063972e7a8f59c4f7b99edf2192ffbf5b7b8d557 /src/com
parent6b3bf91285a2916f939724629aa054a2bf7149c0 (diff)
downloadLegacyCamera-07d5f8c27d144f7e72820b48fe5cb08f691435ad.zip
LegacyCamera-07d5f8c27d144f7e72820b48fe5cb08f691435ad.tar.gz
LegacyCamera-07d5f8c27d144f7e72820b48fe5cb08f691435ad.tar.bz2
Add video stabilization management to the application.
- Still image mode: Disable vstab if it is supported - Camcorder mode: Enable vstab if it is supported - Camcorder with effects: Disable vstab when using background replacement, enable otherwise Bug: 5440224 Change-Id: Ibb9744b601d9bb122618e5eeaec00f50ee54cbee
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/Camera.java7
-rw-r--r--src/com/android/camera/EffectsRecorder.java22
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java7
3 files changed, 34 insertions, 2 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index cd8a0b3..3aa0b82 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -1765,6 +1765,13 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
mParameters.setRecordingHint(false);
+
+ // Disable video stabilization. Convenience methods not available in API
+ // level <= 14
+ String vstabSupported = mParameters.get("video-stabilization-supported");
+ if ("true".equals(vstabSupported)) {
+ mParameters.set("video-stabilization", "false");
+ }
}
private void updateCameraParametersZoom() {
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index 94a3740..2483173 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -384,11 +384,13 @@ public class EffectsRecorder {
switch (mCurrentEffect) {
case EFFECT_GOOFY_FACE:
+ tryEnableVideoStabilization(true);
Filter goofyFilter = mRunner.getGraph().getFilter("goofyrenderer");
goofyFilter.setInputValue("currentEffect",
((Integer)mEffectParameter).intValue());
break;
case EFFECT_BACKDROPPER:
+ tryEnableVideoStabilization(false);
Filter backgroundSrc = mRunner.getGraph().getFilter("background");
backgroundSrc.setInputValue("sourceUrl",
(String)mEffectParameter);
@@ -459,6 +461,9 @@ public class EffectsRecorder {
if (mState == STATE_RELEASED) return;
+ // Lock AE/AWB to reduce transition flicker
+ tryEnable3ALocks(true);
+
mCameraDevice.stopPreview();
if (mLogVerbose) Log.v(TAG, "Runner active, connecting effects preview");
try {
@@ -467,8 +472,6 @@ public class EffectsRecorder {
throw new RuntimeException("Unable to connect camera to effect input", e);
}
- // Lock AE/AWB to reduce transition flicker
- tryEnable3ALocks(true);
mCameraDevice.startPreview();
// Unlock AE/AWB after preview started
@@ -576,6 +579,21 @@ public class EffectsRecorder {
// Rest of stop and release handled in mRunnerDoneCallback
}
+ // Try to enable/disable video stabilization if supported; otherwise return false
+ boolean tryEnableVideoStabilization(boolean toggle) {
+ Camera.Parameters params = mCameraDevice.getParameters();
+
+ String vstabSupported = params.get("video-stabilization-supported");
+ if ("true".equals(vstabSupported)) {
+ if (mLogVerbose) Log.v(TAG, "Setting video stabilization to " + toggle);
+ params.set("video-stabilization", toggle ? "true" : "false");
+ mCameraDevice.setParameters(params);
+ return true;
+ }
+ if (mLogVerbose) Log.v(TAG, "Video stabilization not supported");
+ return false;
+ }
+
// Try to enable/disable 3A locks if supported; otherwise return false
boolean tryEnable3ALocks(boolean toggle) {
Camera.Parameters params = mCameraDevice.getParameters();
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 77e163e..3bc5bfa 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -1857,6 +1857,13 @@ public class VideoCamera extends ActivityBase
mParameters.setRecordingHint(true);
+ // Enable video stabilization. Convenience methods not available in API
+ // level <= 14
+ String vstabSupported = mParameters.get("video-stabilization-supported");
+ if ("true".equals(vstabSupported)) {
+ mParameters.set("video-stabilization", "true");
+ }
+
// Set picture size.
String pictureSize = mPreferences.getString(
CameraSettings.KEY_PICTURE_SIZE, null);