summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/EffectsRecorder.java
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/android/camera/EffectsRecorder.java
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/android/camera/EffectsRecorder.java')
-rw-r--r--src/com/android/camera/EffectsRecorder.java22
1 files changed, 20 insertions, 2 deletions
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();