diff options
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r-- | src/com/android/camera/VideoModule.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index af72a2981..b02b92fe6 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -176,6 +176,7 @@ public class VideoModule implements CameraModule, // true. private int mDisplayRotation; private int mCameraDisplayOrientation; + private int mOrientationOffset; private int mDesiredPreviewWidth; private int mDesiredPreviewHeight; @@ -449,6 +450,8 @@ public class VideoModule implements CameraModule, @Override public void init(CameraActivity activity, View root) { mActivity = activity; + mOrientationOffset = CameraUtil.isDefaultToPortrait(mActivity) ? 0 : 90; + mUI = new VideoUI(activity, this, root); mPreferences = new ComboPreferences(mActivity); CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), activity); @@ -613,7 +616,8 @@ public class VideoModule implements CameraModule, } // Set rotation and gps data. - int rotation = CameraUtil.getJpegRotation(mCameraId, mOrientation); + int orientation = (mOrientation + mOrientationOffset) % 360; + int rotation = CameraUtil.getJpegRotation(mCameraId, orientation); mParameters.setRotation(rotation); Location loc = mLocationManager.getCurrentLocation(); CameraUtil.setGpsParameters(mParameters, loc); @@ -684,6 +688,7 @@ public class VideoModule implements CameraModule, // the camera then point the camera to floor or sky, we still have // the correct orientation. if (orientation == OrientationEventListener.ORIENTATION_UNKNOWN) return; + orientation = (orientation - mOrientationOffset + 360) % 360; int newOrientation = CameraUtil.roundOrientation(orientation, mOrientation); if (mOrientation != newOrientation) { @@ -1692,9 +1697,9 @@ public class VideoModule implements CameraModule, if (mOrientation != OrientationEventListener.ORIENTATION_UNKNOWN) { CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId]; if (info.facing == CameraInfo.CAMERA_FACING_FRONT) { - rotation = (info.orientation - mOrientation + 360) % 360; + rotation = (info.orientation - mOrientation - mOrientationOffset + 360) % 360; } else { // back-facing camera - rotation = (info.orientation + mOrientation) % 360; + rotation = (info.orientation + mOrientation + mOrientationOffset) % 360; } } mMediaRecorder.setOrientationHint(rotation); |