summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2011-09-14 11:36:00 -0700
committerEino-Ville Talvala <etalvala@google.com>2011-09-14 11:47:34 -0700
commit3ac6ed3a95322fa9e29f81377e92669ebaeb77fb (patch)
tree93eb4a33519c335a017a2c3f0db35c5ca8dd39db
parent65e43e98f03cd260ce316df6ce22885abc8cc3b1 (diff)
downloadLegacyCamera-3ac6ed3a95322fa9e29f81377e92669ebaeb77fb.zip
LegacyCamera-3ac6ed3a95322fa9e29f81377e92669ebaeb77fb.tar.gz
LegacyCamera-3ac6ed3a95322fa9e29f81377e92669ebaeb77fb.tar.bz2
Fix orientation handling for Effects mode.
- Did not correctly set mDisplayRotation for effects mode This caused very slow startups for effects - EffectsRecorder does not need camera facing adjustment - onOrientationChange did not properly calculate orientation for effects Bug: 5309932 Bug: 5311545 Bug: 5280905 Change-Id: I2c5b240f42cebfaad974176f72864c61e1861042
-rw-r--r--src/com/android/camera/EffectsRecorder.java1
-rw-r--r--src/com/android/camera/VideoCamera.java23
2 files changed, 11 insertions, 13 deletions
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index be33d31..f78f5dc 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -232,6 +232,7 @@ public class EffectsRecorder {
default:
break;
}
+ if (mLogVerbose) Log.v(TAG, "Setting orientation hint to: " + degrees);
mOrientationHint = degrees;
setFaceDetectOrientation(degrees);
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 73ba11f..acdc11e 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -521,7 +521,9 @@ public class VideoCamera extends ActivityBase
if (mOrientationCompensation != orientationCompensation) {
mOrientationCompensation = orientationCompensation;
if (effectsActive()) {
- mEffectsRecorder.setOrientationHint(orientationCompensation);
+ CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
+ int rotation = (info.orientation + mOrientation) % 360;;
+ mEffectsRecorder.setOrientationHint(rotation);
}
// Do not rotate the icons during recording because the video
// orientation is fixed after recording.
@@ -884,13 +886,14 @@ public class VideoCamera extends ActivityBase
}
mPreviewing = false;
}
+
+ mDisplayRotation = Util.getDisplayRotation(this);
+ int orientation = Util.getDisplayOrientation(mDisplayRotation, mCameraId);
+ mCameraDevice.setDisplayOrientation(orientation);
+ setCameraParameters();
+
if (!effectsActive()) {
setPreviewDisplay(mSurfaceHolder);
- mDisplayRotation = Util.getDisplayRotation(this);
- int orientation = Util.getDisplayOrientation(mDisplayRotation, mCameraId);
- mCameraDevice.setDisplayOrientation(orientation);
- setCameraParameters();
-
try {
mCameraDevice.startPreview();
} catch (Throwable ex) {
@@ -898,8 +901,6 @@ public class VideoCamera extends ActivityBase
throw new RuntimeException("startPreview failed", ex);
}
} else {
- setCameraParameters();
-
initializeEffectsPreview();
Log.v(TAG, "effectsStartPreview");
mEffectsRecorder.startPreview();
@@ -1242,11 +1243,7 @@ public class VideoCamera extends ActivityBase
int rotation = 0;
if (mOrientation != OrientationEventListener.ORIENTATION_UNKNOWN) {
CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
- if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
- rotation = (info.orientation - mOrientation + 360) % 360;
- } else { // back-facing camera
- rotation = (info.orientation + mOrientation) % 360;
- }
+ rotation = (info.orientation + mOrientation) % 360;
}
mEffectsRecorder.setOrientationHint(rotation);
mOrientationHint = rotation;