diff options
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r-- | src/com/android/camera/VideoModule.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index dd9c9bbc5..e4f5bc225 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -194,6 +194,7 @@ public class VideoModule extends BaseModule<VideoUI> implements // true. private int mDisplayRotation; private int mCameraDisplayOrientation; + private int mOrientationOffset; private int mDesiredPreviewWidth; private int mDesiredPreviewHeight; @@ -543,6 +544,7 @@ public class VideoModule extends BaseModule<VideoUI> implements @Override public void init(CameraActivity activity, View root) { mActivity = activity; + mOrientationOffset = CameraUtil.isDefaultToPortrait(mActivity) ? 0 : 90; mPreferences = ComboPreferences.get(mActivity); if (mPreferences == null) { @@ -690,7 +692,8 @@ public class VideoModule extends BaseModule<VideoUI> implements } // 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); @@ -766,6 +769,7 @@ public class VideoModule extends BaseModule<VideoUI> implements // 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) { @@ -1870,9 +1874,9 @@ public class VideoModule extends BaseModule<VideoUI> implements 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); |